/** * Loads a {@link BatchScript}. * @param properties source properties * @return the loaded script * @throws IllegalArgumentException if script is invalid, or some parameters were {@code null} */ public static BatchScript load(Properties properties) { if (properties == null) { throw new IllegalArgumentException("properties must not be null"); //$NON-NLS-1$ } String version = properties.getProperty(KEY_VERSION); if (VERSION.equals(version) == false) { throw new IllegalArgumentException(MessageFormat.format( "Unsupported script version: {0}", version)); } String batchId = properties.getProperty(KEY_ID); String verificationCode = properties.getProperty(KEY_VERIFICATION_CODE); Set<String> flowIds = FlowScript.extractFlowIds(properties); List<FlowScript> flowScripts = new ArrayList<>(); for (String flowId : flowIds) { FlowScript flowScript = FlowScript.load(properties, flowId); flowScripts.add(flowScript); } return new BatchScript(batchId, verificationCode, flowScripts); } }
Set<String> availableFlowIds = extractFlowIds(properties); if (availableFlowIds.contains(flowId) == false) { throw new IllegalArgumentException(MessageFormat.format(