agave-jobs/jobs-core/src/main/java/org/iplantc/service/jobs/managers/JobRequestProcessor.java
/**
	 * Validates the sofware name was valid and the user has permission to use it.
	 * @param jobRequestMap the job request form
	 * @return the software requested by the job request
	 * @throws JobProcessingException if the software choice is invalid or unavailable
	 */
Validates the sofware name was valid and the user has permission to use it.
@param jobRequestMap the job request form
@return the software requested by the job request
@throws JobProcessingException if the software choice is invalid or unavailable
Validates the sofware name was valid and the user has permission to use it . @param jobRequestMap the job request form @return the software requested by the job request @throws JobProcessingException if the software choice is invalid or unavailable
public Software processSoftwareName(Map<String, Object> jobRequestMap) 
	throws JobProcessingException 
	{
		String softwareName = null;
		if (jobRequestMap.containsKey("appId")) {
			softwareName = (String)jobRequestMap.get("appId");
		} else {
			softwareName = (String)jobRequestMap.get("softwareName");
		}
		if (StringUtils.isEmpty(softwareName)) {
			throw new JobProcessingException(400,
					"appId cannot be empty");
		}
		else if (StringUtils.length(softwareName) > 80) {
			throw new JobProcessingException(400,
					"appId must be less than 80 characters");
		}
		else if (!softwareName.contains("-") || softwareName.endsWith("-"))
		{
			throw new JobProcessingException(400,
					"Invalid appId. " +
					"Please specify an app using its unique id. " +
					"The unique id is defined by the app name " +
					"and version separated by a hyphen. eg. example-1.0");
		}
		Software software = SoftwareDao.getSoftwareByUniqueName(softwareName.trim());
		if (software == null) {
			throw new JobProcessingException(400, "No app found matching " + softwareName + " for " + getUsername());
		}
		else if (!isSoftwareInvokableByUser(software, getUsername())) {
			throw new JobProcessingException(403,
					"Permission denied. You do not have permission to use the requeste app, " + softwareName);
		}
		return software;
	}
public Software processSoftwareName ( Map < String , Object > jobRequestMap ) throws JobProcessingException { String softwareName = null ; if ( jobRequestMap . containsKey ( "appId" ) ) { softwareName = ( String ) jobRequestMap . get ( "appId" ) ; } else { softwareName = ( String ) jobRequestMap . get ( "softwareName" ) ; } if ( StringUtils . isEmpty ( softwareName ) ) { throw new JobProcessingException ( 400 , "appId cannot be empty" ) ; } else if ( StringUtils . length ( softwareName ) > 80 ) { throw new JobProcessingException ( 400 , "appId must be less than 80 characters" ) ; } else if ( ! softwareName . contains ( "-" ) || softwareName . endsWith ( "-" ) ) { throw new JobProcessingException ( 400 , "Invalid appId. " + "Please specify an app using its unique id. " + "The unique id is defined by the app name " + "and version separated by a hyphen. eg. example-1.0" ) ; } Software software = SoftwareDao . getSoftwareByUniqueName ( softwareName . trim ( ) ) ; if ( software == null ) { throw new JobProcessingException ( 400 , "No app found matching " + softwareName + " for " + getUsername ( ) ) ; } else if ( ! isSoftwareInvokableByUser ( software , getUsername ( ) ) ) { throw new JobProcessingException ( 403 , "Permission denied. You do not have permission to use the requeste app, " + softwareName ) ; } return software ; }
Validates the sofware name was valid and the user has permission to use it.
Validates the sofware name was valid and the user has permission to use it .