src/org/ohmage/request/accessrequest/AccessRequestCreationRequest.java
@Override
	public void service() {
		LOGGER.info("Servicing the AccessRequestCreationRequest.");
		
		if(! authenticate(AllowNewAccount.NEW_ACCOUNT_DISALLOWED)) {
			return;
		}
		
		try {
			
			LOGGER.info("Creating the AccessRequest.");
			String requester = this.getUser().getUsername();
			AccessRequestServices.instance().createAccessRequest(
					uuid, requester, emailAddress, requestType, requestContent);
			
			// if successful, send an email notification
			Boolean notifyAdmin = null;
			try {
				// check default setting 
				notifyAdmin = StringUtils.decodeBoolean(
							PreferenceCache.instance().lookup(
									PreferenceCache.KEY_MAIL_ACCESS_REQUEST_NOTIFY_ADMIN));
			}
			catch(CacheMissException e) {
				LOGGER.info(PreferenceCache.KEY_MAIL_ACCESS_REQUEST_NOTIFY_ADMIN + "is not set. Will not send notification");
				notifyAdmin = false;
			}
			
			if (notifyAdmin) {
				LOGGER.info("Sending notificaton to admin");				
				AccessRequestServices.instance().sendNotification(requester, uuid, true); 
			}
		}
		catch(ServiceException e) {
			e.failRequest(this);
			e.logException(LOGGER);
		}
	}
/**
	 * Services this request if an existing user is making the request.
	 */
Services this request if an existing user is making the request.
Services this request if an existing user is making the request .
@Override
	public void service() {
		LOGGER.info("Servicing the AccessRequestCreationRequest.");
		if(! authenticate(AllowNewAccount.NEW_ACCOUNT_DISALLOWED)) {
			return;
		}
		try {
			LOGGER.info("Creating the AccessRequest.");
			String requester = this.getUser().getUsername();
			AccessRequestServices.instance().createAccessRequest(
					uuid, requester, emailAddress, requestType, requestContent);
			Boolean notifyAdmin = null;
			try {
				notifyAdmin = StringUtils.decodeBoolean(
							PreferenceCache.instance().lookup(
									PreferenceCache.KEY_MAIL_ACCESS_REQUEST_NOTIFY_ADMIN));
			}
			catch(CacheMissException e) {
				LOGGER.info(PreferenceCache.KEY_MAIL_ACCESS_REQUEST_NOTIFY_ADMIN + "is not set. Will not send notification");
				notifyAdmin = false;
			}
			if (notifyAdmin) {
				LOGGER.info("Sending notificaton to admin");				
				AccessRequestServices.instance().sendNotification(requester, uuid, true); 
			}
		}
		catch(ServiceException e) {
			e.failRequest(this);
			e.logException(LOGGER);
		}
	}
@ Override public void service ( ) { LOGGER . info ( "Servicing the AccessRequestCreationRequest." ) ; if ( ! authenticate ( AllowNewAccount . NEW_ACCOUNT_DISALLOWED ) ) { return ; } try { LOGGER . info ( "Creating the AccessRequest." ) ; String requester = this . getUser ( ) . getUsername ( ) ; AccessRequestServices . instance ( ) . createAccessRequest ( uuid , requester , emailAddress , requestType , requestContent ) ; Boolean notifyAdmin = null ; try { notifyAdmin = StringUtils . decodeBoolean ( PreferenceCache . instance ( ) . lookup ( PreferenceCache . KEY_MAIL_ACCESS_REQUEST_NOTIFY_ADMIN ) ) ; } catch ( CacheMissException e ) { LOGGER . info ( PreferenceCache . KEY_MAIL_ACCESS_REQUEST_NOTIFY_ADMIN + "is not set. Will not send notification" ) ; notifyAdmin = false ; } if ( notifyAdmin ) { LOGGER . info ( "Sending notificaton to admin" ) ; AccessRequestServices . instance ( ) . sendNotification ( requester , uuid , true ) ; } } catch ( ServiceException e ) { e . failRequest ( this ) ; e . logException ( LOGGER ) ; } }
Services this request if an existing user is making the request.
Services this request if an existing user is making the request .
// if successful, send an email notification // check default setting 