Package org.ofbiz.workflow

Examples of org.ofbiz.workflow.WfException


        try {
            value = getDelegator().findByPrimaryKey("WorkEffort",
                        UtilMisc.toMap("workEffortId", workEffortId));
        } catch (GenericEntityException e) {
            throw new WfException(e.getMessage(), e);
        }
        return value;
    }
View Full Code Here


            // System.out.println(serialized);

            runtimeData.set("runtimeInfo", XmlSerializer.serialize(value));
            runtimeData.store();
        } catch (GenericEntityException e) {
            throw new WfException(e.getMessage(), e);
        } catch (SerializeException e) {
            throw new InvalidData(e.getMessage(), e);
        } catch (FileNotFoundException e) {
            throw new InvalidData(e.getMessage(), e);
        } catch (IOException e) {
View Full Code Here

        try {
            GenericValue runtimeData = dataObject.getRelatedOne("RuntimeData");

            contextXML = runtimeData.getString("runtimeInfo");
        } catch (GenericEntityException e) {
            throw new WfException(e.getMessage(), e);
        }
        // De-serialize the context
        if (contextXML != null) {
            try {
                context = (Map) XmlSerializer.deserialize(contextXML, getDelegator());
            } catch (SerializeException e) {
                throw new WfException(e.getMessage(), e);
            } catch (IOException e) {
                throw new WfException(e.getMessage(), e);
            } catch (Exception e) {
                throw new WfException(e.getMessage(), e);
            }
        }
        return context;
    }
View Full Code Here

    private GenericValue getWorkEffort(String workEffortId) throws WfException {
        GenericValue we = null;
        try {
            we = getDelegator().findByPrimaryKey("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId));
        } catch (GenericEntityException e) {
            throw new WfException("Problem getting WorkEffort entity (" + workEffortId + ")", e);
        }
        return we;
    }
View Full Code Here

        // evaluate the condition
        Boolean evaluation = null;
        try {
            evaluation = cond.evaluateCondition(context, attrs, expression, dctx);
        } catch (EvaluationException e) {
            throw new WfException("Problems evaluating condition", e);
        }

        return evaluation.booleanValue();
    }
View Full Code Here

        Object o = null;
        try {
            o = BshUtil.eval(expression.trim(), context);
        } catch (bsh.EvalError e) {
            throw new WfException("Bsh evaluation error.", e);
        }

        if (o == null)
            return false;
        else if (o instanceof Number)
View Full Code Here

    /**
     * @see org.ofbiz.workflow.WfRequester#registerProcess(org.ofbiz.workflow.WfProcess, java.util.Map, org.ofbiz.service.GenericRequester)
     */
    public void registerProcess(WfProcess process, Map context, GenericRequester requester) throws WfException {
        if (process == null)
            throw new WfException("Process cannot be null");
        if (context == null)
            throw new WfException("Context should not be null");

        performers.put(process, requester);
        WfProcessMgr mgr = process.manager();

        // Validate the process context w/ what was passed.
        try {
            if (Debug.verboseOn()) Debug.logVerbose("Validating w/ signature: " + mgr.contextSignature(), module);
            ModelService.validate(mgr.contextSignature(), context, true, null, ModelService.IN_PARAM, Locale.getDefault());
        } catch (GenericServiceException e) {
            throw new WfException("Context passed does not validate against defined signature: ", e);
        }

        // Set the context w/ the process
        Map localContext = new HashMap(context);
        localContext.putAll(mgr.getInitialContext());
        process.setProcessContext(localContext);

        // Set the source reference id if one was passed
        GenericValue processDefinition = process.getDefinitionObject();
        String sourceReferenceField = processDefinition.getString("sourceReferenceField");
        if (context.containsKey(sourceReferenceField)) {
            GenericValue processObj = process.getRuntimeObject();
            if (processObj != null) {
                try {
                    processObj.set("sourceReferenceId", localContext.get(sourceReferenceField));
                    processObj.store();
                } catch (GenericEntityException e) {
                    throw new WfException("Cannot set sourceReferenceId on the process runtime object", e);
                }
            }
        }

    }
View Full Code Here

    }

    public WfActivityImpl(GenericDelegator delegator, String workEffortId) throws WfException {
        super(delegator, workEffortId);
        if (activityId == null || activityId.length() == 0)
            throw new WfException("Execution object is not of type WfActivity");
        this.processId = getRuntimeObject().getString("workEffortParentId");
    }
View Full Code Here

                if (pAct != null) {
                    try {
                        runTime.set("priority", new Long(pAct.priority()));
                        runTime.store();
                    } catch (GenericEntityException e) {
                        throw new WfException(e.getMessage(), e);
                    }
                }
            }
        }

        GenericValue performer = null;
        if (valueObject.get("performerParticipantId") != null) {
            try {
                performer = valueObject.getRelatedOne("PerformerWorkflowParticipant");
                if (performer == null) {
                    Map performerFields = UtilMisc.toMap("packageId", valueObject.getString("packageId"),
                            "packageVersion", valueObject.getString("packageVersion"), "processId", "_NA_",
                            "processVersion", "_NA_", "participantId", valueObject.getString("performerParticipantId"));
                    performer = delegator.findByPrimaryKey("WorkflowParticipant", performerFields);
                }
            } catch (GenericEntityException e) {
                throw new WfException(e.getMessage(), e);
            }
        }
        if (performer != null)
            createAssignments(performer);
View Full Code Here

                partyType = v1.getRelatedOne("PartyType");
                Map fields2 = UtilMisc.toMap("partyTypeId", "PARTY_GROUP");
                groupType = getDelegator().findByPrimaryKeyCache("PartyType", fields2);
            } catch (GenericEntityException e) {
                throw new WfException(e.getMessage(), e);
            }
            if (EntityTypeUtil.isType(partyType, groupType)) {
                // party is a group
                Collection partyRelations = null;
                try {
                    Map fields = UtilMisc.toMap("partyIdFrom", performer.getString("partyId"),
                            "partyRelationshipTypeId", "GROUP_ROLLUP");
                    partyRelations = getDelegator().findByAnd("PartyRelationship", fields);
                } catch (GenericEntityException e) {
                    throw new WfException(e.getMessage(), e);
                }

                // make assignments for these parties
                Debug.logVerbose("[WfActivity.createAssignments] : Group assignment", module);
                Iterator i = partyRelations.iterator();

                while (i.hasNext()) {
                    GenericValue value = (GenericValue) i.next();
                    assign(
                        WfFactory.getWfResource(getDelegator(), null, null, value.getString("partyIdTo"), null),
                        true);
                }
            } else {
                // not a group
                Debug.logVerbose("[WfActivity.createAssignments] : (G) Single assignment", module);
                assign(WfFactory.getWfResource(performer), false);
            }
        }

        // check for role types
        else if (performer.get("roleTypeId") != null && !performer.getString("roleTypeId").equals("_NA_")) {
            Collection partyRoles = null;

            try {
                Map fields = UtilMisc.toMap("roleTypeId", performer.getString("roleTypeId"));
                partyRoles = getDelegator().findByAnd("PartyRole", fields);
            } catch (GenericEntityException e) {
                throw new WfException(e.getMessage(), e);
            }

            // loop through the roles and create assignments
            Debug.logVerbose("[WfActivity.createAssignments] : Role assignment", module);
            Iterator i = partyRoles.iterator();
View Full Code Here

TOP

Related Classes of org.ofbiz.workflow.WfException

Copyright © 2018 www.massapicom. 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.