src/org/ohmage/service/ObserverServices.java
public void verifyUserOwnsObserver(
		final String username,
		final String observerId)
		throws ServiceException {
		
		try {
			// Get the owner.
			String owner = observerQueries.getOwner(observerId);
			
			// If the owner doesn't exist, throw an exception.
			if(owner == null) {
				throw
					new ServiceException(
						ErrorCode.OBSERVER_INVALID_ID,
						"An observer with this ID does not exist: " +
							observerId);
			}
			
			if(! owner.equals(username)) {
				throw
					new ServiceException(
						ErrorCode.OBSERVER_INSUFFICIENT_PERMISSIONS,
						"The requesting user does not have sufficient " +
							"permission to modify the observer: " +
							observerId);
			}
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
/**
	 * Verifies that the user is the owner of an observer.
	 * 
	 * @param username
	 *        The user's username.
	 * 
	 * @param observerId
	 *        The observer's unique identifier.
	 * 
	 * @param observerVersion
	 *        The observer's version.
	 * 
	 * @throws ServiceException
	 *         The user is not the owner of the observer or there was an issue
	 *         querying the database.
	 */
Verifies that the user is the owner of an observer.

@param username
The user's username.

@param observerId
The observer's unique identifier.

@param observerVersion
The observer's version.

@throws ServiceException
The user is not the owner of the observer or there was an issue
querying the database.
Verifies that the user is the owner of an observer . @param username The user ' s username . @param observerId The observer ' s unique identifier . @param observerVersion The observer ' s version . @throws ServiceException The user is not the owner of the observer or there was an issue querying the database .
public void verifyUserOwnsObserver(
		final String username,
		final String observerId)
		throws ServiceException {
		try {
			String owner = observerQueries.getOwner(observerId);
			if(owner == null) {
				throw
					new ServiceException(
						ErrorCode.OBSERVER_INVALID_ID,
						"An observer with this ID does not exist: " +
							observerId);
			}
			if(! owner.equals(username)) {
				throw
					new ServiceException(
						ErrorCode.OBSERVER_INSUFFICIENT_PERMISSIONS,
						"The requesting user does not have sufficient " +
							"permission to modify the observer: " +
							observerId);
			}
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
public void verifyUserOwnsObserver ( final String username , final String observerId ) throws ServiceException { try { String owner = observerQueries . getOwner ( observerId ) ; if ( owner == null ) { throw new ServiceException ( ErrorCode . OBSERVER_INVALID_ID , "An observer with this ID does not exist: " + observerId ) ; } if ( ! owner . equals ( username ) ) { throw new ServiceException ( ErrorCode . OBSERVER_INSUFFICIENT_PERMISSIONS , "The requesting user does not have sufficient " + "permission to modify the observer: " + observerId ) ; } } catch ( DataAccessException e ) { throw new ServiceException ( e ) ; } }
Verifies that the user is the owner of an observer.
Verifies that the user is the owner of an observer .
// Get the owner. // If the owner doesn't exist, throw an exception.