src/org/ohmage/service/ImageServices.java
public void verifyImageExistance(final UUID imageId, final boolean shouldExist) throws ServiceException {
		
		try {
			Boolean imageExists = imageQueries.getImageExists(imageId);
			
			if(imageExists && (! shouldExist)) {
				throw new ServiceException(
						ErrorCode.IMAGE_INVALID_ID, 
						"The image already exists.");
			}
			else if((! imageExists) && shouldExist) {
				throw new ServiceException(
						ErrorCode.IMAGE_INVALID_ID, 
						"The image does not exist.");
			}
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
/**
	 * Checks if an image exists or not and compares that to whether or not it
	 * should exist.
	 * 
	 * @param imageId 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 an image exists or not and compares that to whether or not it
should exist.

@param imageId 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 an image exists or not and compares that to whether or not it should exist . @param imageId 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 verifyImageExistance(final UUID imageId, final boolean shouldExist) throws ServiceException {
		try {
			Boolean imageExists = imageQueries.getImageExists(imageId);
			if(imageExists && (! shouldExist)) {
				throw new ServiceException(
						ErrorCode.IMAGE_INVALID_ID, 
						"The image already exists.");
			}
			else if((! imageExists) && shouldExist) {
				throw new ServiceException(
						ErrorCode.IMAGE_INVALID_ID, 
						"The image does not exist.");
			}
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
public void verifyImageExistance ( final UUID imageId , final boolean shouldExist ) throws ServiceException { try { Boolean imageExists = imageQueries . getImageExists ( imageId ) ; if ( imageExists && ( ! shouldExist ) ) { throw new ServiceException ( ErrorCode . IMAGE_INVALID_ID , "The image already exists." ) ; } else if ( ( ! imageExists ) && shouldExist ) { throw new ServiceException ( ErrorCode . IMAGE_INVALID_ID , "The image does not exist." ) ; } } catch ( DataAccessException e ) { throw new ServiceException ( e ) ; } }
Checks if an image exists or not and compares that to whether or not it
 should exist.
Checks if an image exists or not and compares that to whether or not it should exist .