agave-jobs/jobs-api/src/main/java/org/iplantc/service/jobs/resources/JobsResource.java
/**
	 * This method represents the HTTP POST action. Posting a job submission
	 * form to this service will submit a contrast job on behalf of the
	 * authenticated user. While this method does not return a value internally,
	 * a {@link org.json.JSONObject JSONObject} representation of the
	 * successfully submitted job is written to the output stream. If the job
	 * fails due to an internal error, a
	 * {@link org.restlet.data.Status#SERVER_ERROR_INTERNAL 500} HTTP code will
	 * be sent. If the job fails due to a user error, a link
	 * {@link org.restlet.data.Status#CLIENT_ERROR_BAD_REQUEST 400} HTTP code
	 * will be sent.
	 */
This method represents the HTTP POST action. Posting a job submission
form to this service will submit a contrast job on behalf of the
authenticated user. While this method does not return a value internally,
a  org.json.JSONObject JSONObject representation of the
successfully submitted job is written to the output stream. If the job
fails due to an internal error, a
org.restlet.data.Status#SERVER_ERROR_INTERNAL 500 HTTP code will
be sent. If the job fails due to a user error, a link
org.restlet.data.Status#CLIENT_ERROR_BAD_REQUEST 400 HTTP code
will be sent.
This method represents the HTTP POST action . Posting a job submission form to this service will submit a contrast job on behalf of the authenticated user . While this method does not return a value internally a org . json . JSONObject JSONObject representation of the successfully submitted job is written to the output stream . If the job fails due to an internal error a org . restlet . data . Status#SERVER_ERROR_INTERNAL 500 HTTP code will be sent . If the job fails due to a user error a link org . restlet . data . Status#CLIENT_ERROR_BAD_REQUEST 400 HTTP code will be sent .
@Override
	public void acceptRepresentation(Representation entity)
	{
		AgaveLogServiceClient.log(AgaveLogServiceClient.ServiceKeys.JOBS02.name(),
				AgaveLogServiceClient.ActivityKeys.JobsSubmit.name(),
				getAuthenticatedUsername(), "", getRequest().getClientInfo().getUpstreamAddress());
		try
		{
			JsonNode json = super.getPostedEntityAsObjectNode(true);
			JobRequestProcessor processor = new JobRequestProcessor(getAuthenticatedUsername(), internalUsername);
			Job job = processor.processJob(json);
			getResponse().setStatus(Status.SUCCESS_CREATED);
			getResponse().setEntity(new IplantSuccessRepresentation(
					job.toJsonWithNotifications(
							processor.getNotificationProcessor().getNotifications())));
		}
		catch (JobProcessingException e) {
			getResponse().setEntity(
					new IplantErrorRepresentation(e.getMessage()));
			getResponse().setStatus(Status.valueOf(e.getStatus()));
		}
    	catch (ResourceException e)
		{
			getResponse().setEntity(
					new IplantErrorRepresentation(e.getMessage()));
			getResponse().setStatus(e.getStatus());
			log.error("Job submission failed for user " + getAuthenticatedUsername(), e);
		}
		catch (Exception e) {
			getResponse().setEntity(
					new IplantErrorRepresentation("Failed to submit job: " + e.getMessage()));
			getResponse().setStatus(Status.SERVER_ERROR_INTERNAL);
			log.error("Job submission failed for user " + getAuthenticatedUsername(), e);
		}
		finally {
			try { HibernateUtil.closeSession(); } catch (Throwable ignored) {}
		}
	}
@ Override public void acceptRepresentation ( Representation entity ) { AgaveLogServiceClient . log ( AgaveLogServiceClient . ServiceKeys . JOBS02 . name ( ) , AgaveLogServiceClient . ActivityKeys . JobsSubmit . name ( ) , getAuthenticatedUsername ( ) , "" , getRequest ( ) . getClientInfo ( ) . getUpstreamAddress ( ) ) ; try { JsonNode json = super . getPostedEntityAsObjectNode ( true ) ; JobRequestProcessor processor = new JobRequestProcessor ( getAuthenticatedUsername ( ) , internalUsername ) ; Job job = processor . processJob ( json ) ; getResponse ( ) . setStatus ( Status . SUCCESS_CREATED ) ; getResponse ( ) . setEntity ( new IplantSuccessRepresentation ( job . toJsonWithNotifications ( processor . getNotificationProcessor ( ) . getNotifications ( ) ) ) ) ; } catch ( JobProcessingException e ) { getResponse ( ) . setEntity ( new IplantErrorRepresentation ( e . getMessage ( ) ) ) ; getResponse ( ) . setStatus ( Status . valueOf ( e . getStatus ( ) ) ) ; } catch ( ResourceException e ) { getResponse ( ) . setEntity ( new IplantErrorRepresentation ( e . getMessage ( ) ) ) ; getResponse ( ) . setStatus ( e . getStatus ( ) ) ; log . error ( "Job submission failed for user " + getAuthenticatedUsername ( ) , e ) ; } catch ( Exception e ) { getResponse ( ) . setEntity ( new IplantErrorRepresentation ( "Failed to submit job: " + e . getMessage ( ) ) ) ; getResponse ( ) . setStatus ( Status . SERVER_ERROR_INTERNAL ) ; log . error ( "Job submission failed for user " + getAuthenticatedUsername ( ) , e ) ; } finally { try { HibernateUtil . closeSession ( ) ; } catch ( Throwable ignored ) { } } }
This method represents the HTTP POST action.
This method represents the HTTP POST action .
//			Job job = JobManager.processJob(json, username, internalUsername); // append any bundled notifications to the hypermedia response 