agave-jobs/jobs-core/src/main/java/org/iplantc/service/jobs/managers/JobRequestInputProcessor.java
/**
     * Validates the {@link SoftwareInput} values passed into a job request.
     *
     * @param jobRequestMap the map of software inputs given in the job request
     * @throws JobProcessingException if one or more inputs is invalid
     */
Validates the  SoftwareInput values passed into a job request.
@param jobRequestMap the map of software inputs given in the job request
@throws JobProcessingException if one or more inputs is invalid
Validates the SoftwareInput values passed into a job request . @param jobRequestMap the map of software inputs given in the job request @throws JobProcessingException if one or more inputs is invalid
public void process(Map<String, Object> jobRequestMap) throws JobProcessingException {
        setJobInputs(getMapper().createObjectNode());
        for (SoftwareInput softwareInput : getSoftware().getInputs()) {
            ArrayNode jobRequestInputValue = null;
            try {
                if (!softwareInput.isVisible()) {
                    if (jobRequestMap.containsKey(softwareInput.getKey())) {
                        throw new JobProcessingException(400,
                                "Invalid value for " + softwareInput.getKey()
                                        + ". " + softwareInput.getKey()
                                        + " is a fixed value that "
                                        + "cannot be set manually. ");
                    }
                    else {
                        jobRequestInputValue = doProcessSoftwareInputValue(softwareInput, softwareInput.getDefaultValueAsJsonArray());
                    }
                }
                else if (!jobRequestMap.containsKey(softwareInput.getKey())) {
                    if (softwareInput.isRequired()) {
                        throw new JobProcessingException(400,
                                "No input specified for " + softwareInput.getKey());
                    }
                    else {
                        continue;
                    }
                }
                else {
                    jobRequestInputValue = doProcessSoftwareInputValue(softwareInput, jobRequestMap.get(softwareInput.getKey()));
                }
                if (jobRequestInputValue.size() > 0) {
                    getJobInputs().set(softwareInput.getKey(), jobRequestInputValue);
                }
            } catch (PermissionException e) {
                throw new JobProcessingException(403, e.getMessage(), e);
            } catch (JobProcessingException e) {
                throw e;
            } catch (Exception e) {
                throw new JobProcessingException(400,
                        "Failed to parse input for " + softwareInput.getKey(), e);
            }
        }
    }
public void process ( Map < String , Object > jobRequestMap ) throws JobProcessingException { setJobInputs ( getMapper ( ) . createObjectNode ( ) ) ; for ( SoftwareInput softwareInput : getSoftware ( ) . getInputs ( ) ) { ArrayNode jobRequestInputValue = null ; try { if ( ! softwareInput . isVisible ( ) ) { if ( jobRequestMap . containsKey ( softwareInput . getKey ( ) ) ) { throw new JobProcessingException ( 400 , "Invalid value for " + softwareInput . getKey ( ) + ". " + softwareInput . getKey ( ) + " is a fixed value that " + "cannot be set manually. " ) ; } else { jobRequestInputValue = doProcessSoftwareInputValue ( softwareInput , softwareInput . getDefaultValueAsJsonArray ( ) ) ; } } else if ( ! jobRequestMap . containsKey ( softwareInput . getKey ( ) ) ) { if ( softwareInput . isRequired ( ) ) { throw new JobProcessingException ( 400 , "No input specified for " + softwareInput . getKey ( ) ) ; } else { continue ; } } else { jobRequestInputValue = doProcessSoftwareInputValue ( softwareInput , jobRequestMap . get ( softwareInput . getKey ( ) ) ) ; } if ( jobRequestInputValue . size ( ) > 0 ) { getJobInputs ( ) . set ( softwareInput . getKey ( ) , jobRequestInputValue ) ; } } catch ( PermissionException e ) { throw new JobProcessingException ( 403 , e . getMessage ( ) , e ) ; } catch ( JobProcessingException e ) { throw e ; } catch ( Exception e ) { throw new JobProcessingException ( 400 , "Failed to parse input for " + softwareInput . getKey ( ) , e ) ; } } }
Validates the {@link SoftwareInput} values passed into a job request.
Validates the { @link SoftwareInput } values passed into a job request .
// add hidden inputs into the input array so we have a full // record of all inputs for this job in the history. // hidden fields are required // validate the default value to ensure it's still valid // missing fields could be completely optional // if it's requried, that's a problem // if not, carry on // the field is present and availble to receive input. validate it // empty result set should exclude the input from being included in the processed job requet