Examples of WfAssignment


Examples of org.ofbiz.workflow.WfAssignment

     * @param start True to attempt to start the activity.
     * @return GenericResultWaiter of the start job.
     * @throws WfException
     */
    public void delegateAndAccept(String workEffortId, String fromPartyId, String fromRoleTypeId, Timestamp fromFromDate, String toPartyId, String toRoleTypeId, Timestamp toFromDate, boolean start) throws WfException {
        WfAssignment assign = delegate(workEffortId, fromPartyId, fromRoleTypeId, fromFromDate, toPartyId, toRoleTypeId, toFromDate);
        assign.accept();
        Debug.logVerbose("Delegated assignment.", module);

        if (start) {
            Debug.logVerbose("Starting activity.", module);
            if (!activityRunning(assign.activity())) {
                start(assign.activity().runtimeKey());
            } else {
                Debug.logWarning("Activity already running; not starting.", module);
            }
        } else {
            Debug.logVerbose("Not starting assignment.", module);
View Full Code Here

Examples of org.ofbiz.workflow.WfAssignment

     * @param fromDate The assignment's from date.
     * @return GenericResultWaiter for the complete job.
     * @throws WfException
     */
    public void complete(String workEffortId, String partyId, String roleTypeId, Timestamp fromDate, Map<String, Object> result) throws WfException {
        WfAssignment assign = WfFactory.getWfAssignment(delegator, workEffortId, partyId, roleTypeId, fromDate);
        if (UtilValidate.isNotEmpty(result))
            assign.setResult(result);
        assign.complete();
    }
View Full Code Here

Examples of org.ofbiz.workflow.WfAssignment

    // create a new assignment
    private WfAssignment assign(WfResource resource, boolean append) throws WfException {
        if (!append) {
            Iterator ai = getIteratorAssignment();
            while (ai.hasNext()) {
                WfAssignment a = (WfAssignment) ai.next();
                a.remove();
            }
        }

        WfAssignment assign = WfFactory.getWfAssignment(this, resource, null, true);
        return assign;
    }
View Full Code Here

Examples of org.ofbiz.workflow.WfAssignment

        super.abort();
       
        // cancel the active assignments
        Iterator assignments = this.getAssignments().iterator();
        while (assignments.hasNext()) {
            WfAssignment assignment = (WfAssignment) assignments.next();           
            assignment.changeStatus("CAL_CANCELLED");
        }               
    }   
View Full Code Here

Examples of org.ofbiz.workflow.WfAssignment

        while (i.hasNext()) {           
            GenericValue value = (GenericValue) i.next();
            String party = value.getString("partyId");
            String role = value.getString("roleTypeId");
            java.sql.Timestamp from = value.getTimestamp("fromDate");           
            WfAssignment a = WfFactory.getWfAssignment(getDelegator(), runtimeKey(), party, role, from);                                  

            if (validStatus.contains(a.status())) {
                // if we find one set this to true
                foundOne = true;
            } else {
                // if we must completeAll / assignAll and this one fails return false
                if ((type == CHECK_COMPLETE && completeAll) || (type == CHECK_ASSIGN && acceptAll))
View Full Code Here

Examples of org.ofbiz.workflow.WfAssignment

        context.put("userLogin", userLogin);
        context.put("workEffortId", runtimeKey());
        if (howManyAssignment() == 1) {
            Debug.logVerbose("Single assignment; getting assignment info.", module);
            List assignments = getAssignments();
            WfAssignment assign = (WfAssignment) assignments.iterator().next();
            WfResource res = assign.assignee();
            context.put("assignedPartyId", res.resourcePartyId());
            context.put("assignedRoleTypeId", res.resourceRoleId());
        }  
                       
        // first we will pull out the values from the context for the actual parameters  
View Full Code Here

Examples of org.ofbiz.workflow.WfAssignment

        if (!append) {
            Iterator i = activity.getIteratorAssignment();

            while (i.hasNext()) {
                WfAssignment a = (WfAssignment) i.next();
                a.remove();
            }
        }
        return WfFactory.getWfAssignment(activity, resource, fromDate, true);
    }
View Full Code Here

Examples of org.ofbiz.workflow.WfAssignment

     * @param roleTypeId The assigned / to be assigned role type ID.
     * @param fromDate The assignment's from date.
     * @throws WfException
     */
    public void accept(String workEffortId, String partyId, String roleTypeId, Timestamp fromDate) throws WfException {
        WfAssignment assign = WfFactory.getWfAssignment(delegator, workEffortId, partyId, roleTypeId, fromDate);          
        assign.accept();
    }
View Full Code Here

Examples of org.ofbiz.workflow.WfAssignment

     * @return The new assignment object.
     * @throws WfException
     */
    public WfAssignment delegate(String workEffortId, String fromPartyId, String fromRoleTypeId, Timestamp fromFromDate, String toPartyId, String toRoleTypeId, Timestamp toFromDate) throws WfException {                   
        WfActivity activity = WfFactory.getWfActivity(delegator, workEffortId);
        WfAssignment fromAssign = null;
       
        // check status and delegateAfterStart attribute
        if (activity.state().equals("open.running") && !activity.getDefinitionObject().getBoolean("delegateAfterStart").booleanValue())                
            throw new WfException("This activity cannot be delegated once it has been started");
                     
        if (fromPartyId == null && fromRoleTypeId == null && fromFromDate == null) {           
            Iterator i = activity.getIteratorAssignment();
            fromAssign = (WfAssignment) i.next();
            if (i.hasNext()) {
                throw new WfException("Cannot locate the assignment to delegate from, there is more then one " +
                        "assignment for this activity.");
            }
        }

        if (fromAssign == null) {
            fromAssign = WfFactory.getWfAssignment(delegator, workEffortId, fromPartyId, fromRoleTypeId, fromFromDate);
        }                   
        fromAssign.delegate();  
       
        // check for a restartOnDelegate
        WfActivity newActivity = null;
        if (activity.getDefinitionObject().getBoolean("restartOnDelegate").booleanValue()) { 
            // this only applies to running single assignment activities
            if (activity.state().equals("open.running") && activity.howManyAssignment() == 0) {
                try {
                    activity.abort();
                } catch (CannotStop cs) {
                    throw new WfException("Cannot stop the current activity");
                } catch (NotRunning nr) {
                    throw new WfException("Current activity is not running; cannot abort");
                }
                String parentProcessId = activity.container().runtimeKey();
                newActivity = WfFactory.getWfActivity(activity.getDefinitionObject(), parentProcessId);
            }        
        }   
       
        WfAssignment assign = null;
        if (newActivity != null) {
            assign = assign(newActivity.runtimeKey(), toPartyId, toRoleTypeId, toFromDate, true);
        } else {
            assign = assign(workEffortId, toPartyId, toRoleTypeId, toFromDate, true);
        }
View Full Code Here

Examples of org.ofbiz.workflow.WfAssignment

     * @param start True to attempt to start the activity.
     * @return GenericResultWaiter of the start job.
     * @throws WfException
     */
    public void delegateAndAccept(String workEffortId, String fromPartyId, String fromRoleTypeId, Timestamp fromFromDate, String toPartyId, String toRoleTypeId, Timestamp toFromDate, boolean start) throws WfException {                                
        WfAssignment assign = delegate(workEffortId, fromPartyId, fromRoleTypeId, fromFromDate, toPartyId, toRoleTypeId, toFromDate);                     
        assign.accept();
        Debug.logVerbose("Delegated assignment.", module);
       
        if (start) {
            Debug.logVerbose("Starting activity.", module);
            if (!activityRunning(assign.activity())) {
                start(assign.activity().runtimeKey());
            } else {           
                Debug.logWarning("Activity already running; not starting.", module);
            }
        } else {
            Debug.logVerbose("Not starting assignment.", module);
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.