src/org/ohmage/service/UserDocumentServices.java
public void userCanReadDocument(final String username, 
			final String documentId) throws ServiceException {
		
		try {
			List<Document.Role> roles = userDocumentQueries.getDocumentRolesForDocumentForUser(username, documentId);
			
			// To read a document, it simply has to be visible to the user in
			// some capacity.
			if(roles.size() == 0) {
				throw new ServiceException(
						ErrorCode.DOCUMENT_INSUFFICIENT_PERMISSIONS, 
						"The user does not have sufficient permissions to read the document.");
			}
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
/**
	 * Ensures that a user can read a document.
	 * 
	 * @param username The username of the user that is being checked that they
	 * 				   can read this document.
	 * 
	 * @param documentId The unique identifier for the document.
	 * 
	 * @throws ServiceException Thrown if the user cannot read this document or
	 * 							if there is an error.
	 */
Ensures that a user can read a document.

@param username The username of the user that is being checked that they
can read this document.

@param documentId The unique identifier for the document.

@throws ServiceException Thrown if the user cannot read this document or
if there is an error.
Ensures that a user can read a document . @param username The username of the user that is being checked that they can read this document . @param documentId The unique identifier for the document . @throws ServiceException Thrown if the user cannot read this document or if there is an error .
public void userCanReadDocument(final String username, 
			final String documentId) throws ServiceException {
		try {
			List<Document.Role> roles = userDocumentQueries.getDocumentRolesForDocumentForUser(username, documentId);
			if(roles.size() == 0) {
				throw new ServiceException(
						ErrorCode.DOCUMENT_INSUFFICIENT_PERMISSIONS, 
						"The user does not have sufficient permissions to read the document.");
			}
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
public void userCanReadDocument ( final String username , final String documentId ) throws ServiceException { try { List < Document . Role > roles = userDocumentQueries . getDocumentRolesForDocumentForUser ( username , documentId ) ; if ( roles . size ( ) == 0 ) { throw new ServiceException ( ErrorCode . DOCUMENT_INSUFFICIENT_PERMISSIONS , "The user does not have sufficient permissions to read the document." ) ; } } catch ( DataAccessException e ) { throw new ServiceException ( e ) ; } }
Ensures that a user can read a document.
Ensures that a user can read a document .
// To read a document, it simply has to be visible to the user in // some capacity.