/** * this method search in the data base a specific location by name * * @param location receive the entity that is searched * @return */ public static String obtainIdOfLocation(Location location) { DataBaseDriver.getInstance().createConnectionToDB(); String locationId = DataBaseDriver.getInstance() .getKeyValue( DomainAppConstants.LOCATIONS, DomainAppConstants.KEY_NAME, location.getName(), DomainAppConstants.KEY_ID); DataBaseDriver.getInstance().closeConnectionToDB(); return locationId; }
private static JSONObject buildLocation(Location location) { JSONObject jsonLocation = new JSONObject(); jsonLocation.put(DomainAppConstants.KEY_CUSTOM_NAME, location.getDisplayName()); jsonLocation.put(DomainAppConstants.KEY_NAME, location.getName()); return jsonLocation; }
/** * This method search a specific location by ID * * @param location is a entity that contains information of location * @return */ public static JSONObject getLocationByID(Location location) { String endPoint = buildEndPoint(location.getId()); JSONObject response = APILibrary.getInstance().getById(endPoint); return response; }