src/org/ohmage/service/MediaServices.java
public void verifyMediaExistance(final UUID mediaId, final boolean shouldExist) throws ServiceException {
		
		try {
			Boolean mediaExists = mediaQueries.getMediaExists(mediaId);
			
			if(mediaExists && (! shouldExist)) {
				throw new ServiceException(
						ErrorCode.MEDIA_INVALID_ID, 
						"The media already exists: " + mediaId);
			}
			else if((! mediaExists) && shouldExist) {
				throw new ServiceException(
						ErrorCode.MEDIA_INVALID_ID, 
						"The image does not exist: " + mediaId);
			}
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
/**
	 * Checks if a media exists or not and compares that to whether or not it
	 * should exist.
	 * 
	 * @param mediaId The unique identifier for the image.
	 * 
	 * @param shouldExist Whether or not the image should exist.
	 * 
	 * @throws ServiceException Thrown if the image does not exist and it 
	 * 							should or does exist and it should not, or if
	 * 							there is an error.
	 */
Checks if a media exists or not and compares that to whether or not it
should exist.

@param mediaId The unique identifier for the image.

@param shouldExist Whether or not the image should exist.

@throws ServiceException Thrown if the image does not exist and it
should or does exist and it should not, or if
there is an error.
Checks if a media exists or not and compares that to whether or not it should exist . @param mediaId The unique identifier for the image . @param shouldExist Whether or not the image should exist . @throws ServiceException Thrown if the image does not exist and it should or does exist and it should not or if there is an error .
public void verifyMediaExistance(final UUID mediaId, final boolean shouldExist) throws ServiceException {
		try {
			Boolean mediaExists = mediaQueries.getMediaExists(mediaId);
			if(mediaExists && (! shouldExist)) {
				throw new ServiceException(
						ErrorCode.MEDIA_INVALID_ID, 
						"The media already exists: " + mediaId);
			}
			else if((! mediaExists) && shouldExist) {
				throw new ServiceException(
						ErrorCode.MEDIA_INVALID_ID, 
						"The image does not exist: " + mediaId);
			}
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
public void verifyMediaExistance ( final UUID mediaId , final boolean shouldExist ) throws ServiceException { try { Boolean mediaExists = mediaQueries . getMediaExists ( mediaId ) ; if ( mediaExists && ( ! shouldExist ) ) { throw new ServiceException ( ErrorCode . MEDIA_INVALID_ID , "The media already exists: " + mediaId ) ; } else if ( ( ! mediaExists ) && shouldExist ) { throw new ServiceException ( ErrorCode . MEDIA_INVALID_ID , "The image does not exist: " + mediaId ) ; } } catch ( DataAccessException e ) { throw new ServiceException ( e ) ; } }
Checks if a media exists or not and compares that to whether or not it
 should exist.
Checks if a media exists or not and compares that to whether or not it should exist .