src/org/ohmage/service/AccessRequestServices.java
public void deleteAccessRequests(final Collection<String> requestIds, final String username) 
			throws ServiceException {
		
		try {
			
			// Check whether the request with the requestId exist
			if (! userSetupRequestQueries.getRequestsExist(requestIds))
				throw new ServiceException(ErrorCode.USER_ACCESS_REQUEST_EXECUTION_ERROR, "Some request ids do not exist!");

			// check whether user can delete them all
			if (! userSetupRequestQueries.getUserCanAccessRequests(requestIds, username))
				throw new ServiceException(ErrorCode.USER_ACCESS_REQUEST_EXECUTION_ERROR, "User doesn't have access to all requests!");
						
			
			userSetupRequestQueries.deleteAccessRequests(requestIds);
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
// only an admin can do this
only an admin can do this
only an admin can do this
public void deleteAccessRequests(final Collection<String> requestIds, final String username) 
			throws ServiceException {
		try {
			if (! userSetupRequestQueries.getRequestsExist(requestIds))
				throw new ServiceException(ErrorCode.USER_ACCESS_REQUEST_EXECUTION_ERROR, "Some request ids do not exist!");
			if (! userSetupRequestQueries.getUserCanAccessRequests(requestIds, username))
				throw new ServiceException(ErrorCode.USER_ACCESS_REQUEST_EXECUTION_ERROR, "User doesn't have access to all requests!");
			userSetupRequestQueries.deleteAccessRequests(requestIds);
		}
		catch(DataAccessException e) {
			throw new ServiceException(e);
		}
	}
public void deleteAccessRequests ( final Collection < String > requestIds , final String username ) throws ServiceException { try { if ( ! userSetupRequestQueries . getRequestsExist ( requestIds ) ) throw new ServiceException ( ErrorCode . USER_ACCESS_REQUEST_EXECUTION_ERROR , "Some request ids do not exist!" ) ; if ( ! userSetupRequestQueries . getUserCanAccessRequests ( requestIds , username ) ) throw new ServiceException ( ErrorCode . USER_ACCESS_REQUEST_EXECUTION_ERROR , "User doesn't have access to all requests!" ) ; userSetupRequestQueries . deleteAccessRequests ( requestIds ) ; } catch ( DataAccessException e ) { throw new ServiceException ( e ) ; } }
only an admin can do this
only an admin can do this
// Check whether the request with the requestId exist // check whether user can delete them all