src/org/ohmage/service/ClassServices.java
public void checkClassExistence(final String classId, 
			final boolean shouldExist) throws ServiceException {
		
		try {
			if((classId != null) && classQueries.getClassExists(classId)) {
				if(! shouldExist) {
					throw new ServiceException(
							ErrorCode.CLASS_INVALID_ID,
							"The class already exists: " + classId
						);
				}
			}
			else {
				if(shouldExist) {
					throw new ServiceException(
							ErrorCode.CLASS_INVALID_ID, 
							"The class does not exist: " + classId
						);
				}
			}
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
/**
	 * Checks if a class exists and compares that value to whether or not it
	 * should exist. If they don't match or there is an error, it will set the
	 * request as failed with an error message if the reason for failure is
	 * known and throw a ServiceException.<br />
	 * <br />
	 * Note: Passing in a value of null will always result in the class not
	 * existing.
	 * 
	 * @param classId The class identifier to use to check for existence.
	 * 
	 * @param shouldExist Whether or not the class should already exist.
	 * 
	 * @throws ServiceException Thrown if there is an error, the class doesn't
	 * 							exist and it should, or the class does exist
	 * 							and it shouldn't.
	 */
Checks if a class exists and compares that value to whether or not it
should exist. If they don't match or there is an error, it will set the
request as failed with an error message if the reason for failure is
known and throw a ServiceException.

Note: Passing in a value of null will always result in the class not
existing.

@param classId The class identifier to use to check for existence.

@param shouldExist Whether or not the class should already exist.

@throws ServiceException Thrown if there is an error, the class doesn't
exist and it should, or the class does exist
and it shouldn't.
Checks if a class exists and compares that value to whether or not it should exist . If they don ' t match or there is an error it will set the request as failed with an error message if the reason for failure is known and throw a ServiceException . Note : Passing in a value of null will always result in the class not existing . @param classId The class identifier to use to check for existence . @param shouldExist Whether or not the class should already exist . @throws ServiceException Thrown if there is an error the class doesn ' t exist and it should or the class does exist and it shouldn ' t .
public void checkClassExistence(final String classId, 
			final boolean shouldExist) throws ServiceException {
		try {
			if((classId != null) && classQueries.getClassExists(classId)) {
				if(! shouldExist) {
					throw new ServiceException(
							ErrorCode.CLASS_INVALID_ID,
							"The class already exists: " + classId
						);
				}
			}
			else {
				if(shouldExist) {
					throw new ServiceException(
							ErrorCode.CLASS_INVALID_ID, 
							"The class does not exist: " + classId
						);
				}
			}
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
public void checkClassExistence ( final String classId , final boolean shouldExist ) throws ServiceException { try { if ( ( classId != null ) && classQueries . getClassExists ( classId ) ) { if ( ! shouldExist ) { throw new ServiceException ( ErrorCode . CLASS_INVALID_ID , "The class already exists: " + classId ) ; } } else { if ( shouldExist ) { throw new ServiceException ( ErrorCode . CLASS_INVALID_ID , "The class does not exist: " + classId ) ; } } } catch ( DataAccessException e ) { throw new ServiceException ( e ) ; } }
Checks if a class exists and compares that value to whether or not it
 should exist.
Checks if a class exists and compares that value to whether or not it should exist .