src/org/ohmage/service/UploadValidationServices.java
public static void validateUploadMetadata(final JSONObject uploadObject) 
			throws ServiceException {
		
		// FIXME this is actually a timestamp -- it should be renamed in the HTTP API calls that use it
		String metadataDate = JsonUtils.getStringFromJsonObject(uploadObject, JsonInputKeys.METADATA_DATE);
		Long epochTime = JsonUtils.getLongFromJsonObject(uploadObject, JsonInputKeys.METADATA_TIME);
		String timezone = JsonUtils.getStringFromJsonObject(uploadObject, JsonInputKeys.METADATA_TIMEZONE);
		String locationStatus = JsonUtils.getStringFromJsonObject(uploadObject, JsonInputKeys.METADATA_LOCATION_STATUS);
		JSONObject location = JsonUtils.getJsonObjectFromJsonObject(uploadObject, JsonInputKeys.METADATA_LOCATION);
		
		validateIso8601Timestamp(metadataDate, DATE_ERROR_MESSAGE_NULL, DATE_ERROR_MESSAGE_INVALID);
		validateEpochTime(epochTime);
		validateTimezone(timezone);
		validateLocationStatus(locationStatus);
		validateLocation(location, locationStatus);
	}
/**
	 * Validates the metadata in the provided JSON object:
	 * {@value org.ohmage.request.JsonInputKeys#METADATA_DATE},
	 * {@value org.ohmage.request.JsonInputKeys#JSON_METADATA_TIME},
	 * {@value org.ohmage.request.JsonInputKeys#METADATA_TIMEZONE},
	 * {@value org.ohmage.request.JsonInputKeys#METADATA_LOCATION_STATUS},
	 * {@value org.ohmage.request.JsonInputKeys#METADATA_DATE},
	 * 
	 *  
	 * @param location  A JSON object containing location properties to be
	 * validated.
	 * @throws ServiceException  If the location is null and the location 
	 * status is unavailable or if the location status is not unavailable
	 * and the location is invalid in structure.
	 */


@param location  A JSON object containing location properties to be
validated.
@throws ServiceException  If the location is null and the location
status is unavailable or if the location status is not unavailable
and the location is invalid in structure.
@param location A JSON object containing location properties to be validated . @throws ServiceException If the location is null and the location status is unavailable or if the location status is not unavailable and the location is invalid in structure .
public static void validateUploadMetadata(final JSONObject uploadObject) 
			throws ServiceException {
		String metadataDate = JsonUtils.getStringFromJsonObject(uploadObject, JsonInputKeys.METADATA_DATE);
		Long epochTime = JsonUtils.getLongFromJsonObject(uploadObject, JsonInputKeys.METADATA_TIME);
		String timezone = JsonUtils.getStringFromJsonObject(uploadObject, JsonInputKeys.METADATA_TIMEZONE);
		String locationStatus = JsonUtils.getStringFromJsonObject(uploadObject, JsonInputKeys.METADATA_LOCATION_STATUS);
		JSONObject location = JsonUtils.getJsonObjectFromJsonObject(uploadObject, JsonInputKeys.METADATA_LOCATION);
		validateIso8601Timestamp(metadataDate, DATE_ERROR_MESSAGE_NULL, DATE_ERROR_MESSAGE_INVALID);
		validateEpochTime(epochTime);
		validateTimezone(timezone);
		validateLocationStatus(locationStatus);
		validateLocation(location, locationStatus);
	}
public static void validateUploadMetadata ( final JSONObject uploadObject ) throws ServiceException { String metadataDate = JsonUtils . getStringFromJsonObject ( uploadObject , JsonInputKeys . METADATA_DATE ) ; Long epochTime = JsonUtils . getLongFromJsonObject ( uploadObject , JsonInputKeys . METADATA_TIME ) ; String timezone = JsonUtils . getStringFromJsonObject ( uploadObject , JsonInputKeys . METADATA_TIMEZONE ) ; String locationStatus = JsonUtils . getStringFromJsonObject ( uploadObject , JsonInputKeys . METADATA_LOCATION_STATUS ) ; JSONObject location = JsonUtils . getJsonObjectFromJsonObject ( uploadObject , JsonInputKeys . METADATA_LOCATION ) ; validateIso8601Timestamp ( metadataDate , DATE_ERROR_MESSAGE_NULL , DATE_ERROR_MESSAGE_INVALID ) ; validateEpochTime ( epochTime ) ; validateTimezone ( timezone ) ; validateLocationStatus ( locationStatus ) ; validateLocation ( location , locationStatus ) ; }
Validates the metadata in the provided JSON object:
 {@value org.ohmage.request.JsonInputKeys#METADATA_DATE},
 {@value org.ohmage.request.JsonInputKeys#JSON_METADATA_TIME},
 {@value org.ohmage.request.JsonInputKeys#METADATA_TIMEZONE},
 {@value org.ohmage.request.JsonInputKeys#METADATA_LOCATION_STATUS},
 {@value org.ohmage.request.JsonInputKeys#METADATA_DATE},
Validates the metadata in the provided JSON object : { @value org . ohmage . request . JsonInputKeys#METADATA_DATE } { @value org . ohmage . request . JsonInputKeys#JSON_METADATA_TIME } { @value org . ohmage . request . JsonInputKeys#METADATA_TIMEZONE } { @value org . ohmage . request . JsonInputKeys#METADATA_LOCATION_STATUS } { @value org . ohmage . request . JsonInputKeys#METADATA_DATE }
// FIXME this is actually a timestamp -- it should be renamed in the HTTP API calls that use it