Examples of WFVariable


Examples of com.tririga.pub.workflow.WFVariable

        }
       
        Set parametersEntries = parameters.entrySet();
        for (Iterator itr = parametersEntries.iterator(); itr.hasNext(); ) {
            Map.Entry entry = (Map.Entry)itr.next();
            WFVariable variable = (WFVariable)entry.getValue();
            String name = variable.getName();
            if (WFVariable.Type.WFSTEPINSTANCEVARIABLE.equals(variable.getType())) {
                WFStepInfo stepInfo = (WFStepInfo)variable.getValue();
                System.out.println("Parameter: '" + name + "' Value:" + stepInfo);
            }
            else {
                System.out.println("Parameter: '" + name + "' was not a WFStepInfo.  Variable: " + variable);
            }
        }
       
        /*
         * Using the set of target records create a WFVariable that contains
         * every other record.  This is to illustrate the process of creating
         * a return parameter that can then be assigned to a workflow variable
         * within the workflow (configured as part of the Custom Task step
         * definition).
         *
         * We will only return a single return parameter but it is possible
         * to return multiple parameters.
         */
       
        // We need a Collection that we can put the selected record IDs into.
        Collection resultRecordIds = new ArrayList();
        // Add every other record to the collection.
        for (int i = 0; i < records.length; i++) {
            if (i % 2 == 0) {
                Record record = records[i];
                resultRecordIds.add(record.getId());
            }
        }
       
        /*
         * A return parameter is a WFVariable. 
         * Currently WFStepInfo values are the only types supported.
         * This can then be assigned to a variable defined within the
         * workflow and referenced in all the same ways you would any
         * other task step within the workflow.
         */
       
        // Create the WFStepInfo value.
        //
        // We leave the BO ID and Module ID values not set.  If they
        // are not set the Workflow Engine will set them based on
        // the type of records contained in the record list as part
        // of the return value processing.
        WFStepInfoImpl wfStepInfo = new WFStepInfoImpl();
        wfStepInfo.setRecordList(resultRecordIds);
        wfStepInfo.setResultCount(new Long(resultRecordIds.size()));
        wfStepInfo.setSuccess(Boolean.TRUE);
        wfStepInfo.setStatus("Custom");
        // Create a WFVariable that contains it.
        WFVariable returnParam1 = new WFVariable(RETURN_VALUE_NAME, wfStepInfo);
        // Create the CustomParamTaskResult to return.
        CustomParamTaskResultImpl taskResult = new CustomParamTaskResultImpl();
        // Create the return parameters map.
        HashMap returnParams = new HashMap();
        // Add our value to the map.
        returnParams.put(returnParam1.getName(), returnParam1);
        // Set the map on the result.
        taskResult.setReturnParameters(returnParams);
        // Set our status.
        taskResult.setExecutionWasSuccessful(true);
        // Return it.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.