Package org.enhydra.shark.xpdl.elements

Examples of org.enhydra.shark.xpdl.elements.Activity


        }
        return as;
    }

    public Activity createXPDLObject(Activities acts, String type, boolean addToCollection) {
        Activity act = null;
        if (type == null || type.equals("")) {
            type = JaWEConstants.ACTIVITY_TYPE_TOOL;
        }
        if (type.equals(JaWEConstants.ACTIVITY_TYPE_BLOCK) || type.equals(JaWEConstants.ACTIVITY_TYPE_NO) || type.equals(JaWEConstants.ACTIVITY_TYPE_ROUTE) || type.equals(JaWEConstants.ACTIVITY_TYPE_SUBFLOW) || type.equals(JaWEConstants.ACTIVITY_TYPE_TOOL)) {
            act = createStandardActivity(acts, type);
View Full Code Here


        }
        return act;
    }

    protected Activity createStandardActivity(Activities acts, String type) {
        Activity act = createXPDLActivity(acts, type);
        //CUSTOM
        String num = act.getId().substring("activity".length());
        act.setName("Activity " + num);
        //END CUSTOM
        if (type.equals(JaWEConstants.ACTIVITY_TYPE_BLOCK)) {
            act.getActivityTypes().setBlockActivity();
        } else if (type.equals(JaWEConstants.ACTIVITY_TYPE_ROUTE)) {
            int i = 1;
            String baseId = "route";
            String id = baseId + i;
            while (acts.getActivity(id) != null) {
                id = baseId + String.valueOf(++i);
            }
            act.setId(id);
            act.setName("Route " + i);
            act.getActivityTypes().setRoute();
        } else if (type.equals(JaWEConstants.ACTIVITY_TYPE_SUBFLOW)) {
            int i = 1;
            String baseId = "subflow";
            String id = baseId + i;
            while (acts.getActivity(id) != null) {
                id = baseId + String.valueOf(++i);
            }
            act.setId(id);
            act.setName("Subflow " + i);
            act.getActivityTypes().setImplementation();
            act.getActivityTypes().getImplementation().getImplementationTypes().setSubFlow();
        } else if (type.equals(JaWEConstants.ACTIVITY_TYPE_TOOL)) {
            //CUSTOM
            int i = 1;
            String baseId = "tool";
            String id = baseId + i;
            while (acts.getActivity(id) != null) {
                id = baseId + String.valueOf(++i);
            }
            act.setId(id);
            act.setName("Tool " + i);
            //END CUSTOM
            act.getActivityTypes().setImplementation();
            act.getActivityTypes().getImplementation().getImplementationTypes().setTools();

            // CUSTOM
            String defaultAppId = "default_application";
            // look for default tool
            XMLElement el = act.getParent();
            while (el.getParent() != null) {
                el = el.getParent();
            }
            Package pkg = (Package) el;
            Applications apps = pkg.getApplications();
            Application defaultApp = apps.getApplication(defaultAppId);
            if (defaultApp == null) {
                // create default app
                defaultApp = createXPDLObject(apps, null, true);
                defaultApp.setId(defaultAppId);
            }

            // create tool mapping
            Tools tools = act.getActivityTypes().getImplementation().getImplementationTypes().getTools();
            Tool tool = createXPDLObject(tools, null, true);
            tool.setId(defaultAppId);
            // END CUSTOM
        } else if (type.equals(JaWEConstants.ACTIVITY_TYPE_NO)) {
            act.getActivityTypes().setImplementation();
            act.getActivityTypes().getImplementation().getImplementationTypes().setNo();

            // CUSTOM: grab every available workflow variable from the workflow process that it belongs to and add as extended attribute (view only)
            WorkflowProcess process = (WorkflowProcess) act.getParent().getParent();
            Map m = XMLUtil.getPossibleVariables(process);
            XMLCollectionElement dataFields[] = (XMLCollectionElement[]) m.values().toArray(new XMLCollectionElement[0]);
            for (int i = 0; i < dataFields.length; i++) {
                ExtendedAttribute attribute = this.createXPDLObject(act.getExtendedAttributes(), null, true);
                attribute.setName("VariableToProcess_UPDATE");
                attribute.setVValue(dataFields[i].getId());
            }
            // END CUSTOM
        }
View Full Code Here

        }
        return act;
    }

    protected Activity createSpecialActivity(Activities acts, String type) {
        Activity act = createXPDLActivity(acts, type);
        JaWETypes jts = JaWEManager.getInstance().getJaWEController().getJaWETypes();
        boolean hasTemplate = jts.hasTemplateId(type);

        if (!hasTemplate) {
            act.getActivityTypes().getImplementation().getImplementationTypes().setTools();
            act.getActivityTypes().setImplementation();
        }
        return act;
    }
View Full Code Here

        }
        return act;
    }

    protected Activity createXPDLActivity(Activities acts, String type) {
        Activity act = (Activity) acts.generateNewElement();
        JaWETypes jts = JaWEManager.getInstance().getJaWEController().getJaWETypes();
        boolean hasTemplate = jts.hasTemplateId(type);
        if (hasTemplate) {
            jts.fillFromTemplate(act, type);
        }
        String id = act.getId();
        if (!hasTemplate || id.equals("") || acts.getActivity(id) != null) {

            if (id.equals("")) {
                id = JaWEManager.getInstance().getIdFactory().generateUniqueId(acts);
            } else {
                id = JaWEManager.getInstance().getIdFactory().generateSimilarOrIdenticalUniqueId(acts, new HashSet(), id);
            }

            int i = 0;
            while (acts.getActivity(id) != null) {
                id = id + String.valueOf(++i);
            }
            act.setId(id);
        }

        return act;
    }
View Full Code Here

        validateStandard(el, existingErrors, fullCheck);
    }

    public void validateElement(ExceptionName el, List existingErrors, boolean fullCheck)
    {
        Activity act = XMLUtil.getActivity(el);
        Set ets = XMLUtil.getExceptionalOutgoingTransitions(act);
        boolean isValid = true;
        if(ets.size() == 0)
        {
            isValid = false;
View Full Code Here

    }

    public void validateElement(Performer el, List existingErrors, boolean fullCheck)
    {
        String performer = el.toValue();
        Activity act = XMLUtil.getActivity(el);
        int actType = act.getActivityType();
        boolean toolOrNoAct = true;
        if(actType != 1 && actType != 2){
            toolOrNoAct = false;
        }else{
            Participant p = XMLUtil.findParticipant(xmlInterface, XMLUtil.getWorkflowProcess(act), performer);
View Full Code Here

                {
                    isGraphConformant = false;
                    loopError = true;
                    for(int i = 0; i < loopNodes.length; i++)
                    {
                        Activity act = (Activity)activities.get(loopNodes[i]);
                        XMLValidationError verr = new XMLValidationError("ERROR", "CONFORMANCE", "ERROR_LOOP_CONTAINED_ACTIVITY_IN_LOOP_BLOCKED_MODE", "", act);
                        existingErrors.add(verr);
                    }

                }
            } else
            {
                loopError = gc.isGraphCyclic();
                if(loopError)
                {
                    isGraphConformant = false;
                    XMLValidationError verr = new XMLValidationError("ERROR", "CONFORMANCE", "ERROR_CYCLIC_GRAPH_IN_LOOP_BLOCKED_MODE", "", wpOrAs);
                    existingErrors.add(verr);
                }
            }
        }
        if(ct == 2 && (isGraphConformant || fullCheck))
        {
            if(XMLUtil.getStartingActivities(wpOrAs).size() != 1)
            {
                isGraphConformant = false;
                XMLValidationError verr = new XMLValidationError("ERROR", "CONFORMANCE", "ERROR_MULTIPLE_STARTING_ACTIVITIES_IN_FULL_BLOCKED_MODE", "", wpOrAs);
                existingErrors.add(verr);
            }
            if((isGraphConformant || fullCheck) && XMLUtil.getEndingActivities(wpOrAs).size() != 1)
            {
                isGraphConformant = false;
                XMLValidationError verr = new XMLValidationError("ERROR", "CONFORMANCE", "ERROR_MULTIPLE_ENDING_ACTIVITIES_IN_FULL_BLOCKED_MODE", "", wpOrAs);
                existingErrors.add(verr);
            }
            boolean smerr = false;
            if((isGraphConformant || fullCheck) && splitActs.size() != joinActs.size())
            {
                if(splitActs.size() > joinActs.size())
                {
                    XMLValidationError verr = new XMLValidationError("ERROR", "CONFORMANCE", "ERROR_SPLIT_JOIN_MISSMATCH_IN_FULL_BLOCKED_MODE_MORE_SPLITS", "", wpOrAs);
                    existingErrors.add(verr);
                } else
                {
                    XMLValidationError verr = new XMLValidationError("ERROR", "CONFORMANCE", "ERROR_SPLIT_JOIN_MISSMATCH_IN_FULL_BLOCKED_MODE_MORE_JOINS", "", wpOrAs);
                    existingErrors.add(verr);
                }
                isGraphConformant = false;
                smerr = true;
            }
            if((isGraphConformant || fullCheck) && !smerr && getNoOfANDSplitsOrJoins(splitActs, 0) != getNoOfANDSplitsOrJoins(joinActs, 1))
            {
                XMLValidationError verr = new XMLValidationError("ERROR", "CONFORMANCE", "ERROR_SPLIT_JOIN_MISSMATCH_IN_FULL_BLOCKED_MODE_DIFFERENT_TYPES", "", wpOrAs);
                existingErrors.add(verr);
                isGraphConformant = false;
            }
            if(isGraphConformant || fullCheck)
            {
                Iterator it = splitActs.iterator();
label0:
                do
                {
                    Activity act;
                    XMLValidationError verr;
label1:
                    do
                    {
label2:
                        do
                        {
                            do
                            {
                                if(!it.hasNext())
                                    break label2;
                                act = (Activity)it.next();
                                if(!XMLUtil.isANDTypeSplitOrJoin(act, 0))
                                    continue label1;
                            } while(checkANDSplit(act));
                            isGraphConformant = false;
                            verr = new XMLValidationError("ERROR", "CONFORMANCE", "ERROR_CONDITIONAL_TRANSITION_FOR_AND_SPLIT_IN_FULL_BLOCKED_MODE", "", act);
                            existingErrors.add(verr);
                        } while(fullCheck);
                        break label0;
                    } while(checkXORSplit(act));
                    isGraphConformant = false;
                    verr = new XMLValidationError("ERROR", "CONFORMANCE", "ERROR_NO_OTHERWISE_TRANSITION_FOR_XOR_SPLIT_IN_FULL_BLOCKED_MODE", "", act);
                    existingErrors.add(verr);
                } while(fullCheck);
                it = noSplitActs.iterator();
label3:
                do
                {
                    Activity act;
                    do
                    {
                        if(!it.hasNext())
                            break label3;
                        act = (Activity)it.next();
                    } while(checkXORSplit(act));
                    isGraphConformant = false;
                    XMLValidationError verr = new XMLValidationError("ERROR", "CONFORMANCE", "ERROR_NO_OTHERWISE_TRANSITION_FOR_XOR_SPLIT_IN_FULL_BLOCKED_MODE", "", act);
                    existingErrors.add(verr);
                } while(fullCheck);
            }
            if(isGraphConformant || fullCheck)
            {
                Iterator it = splitActs.iterator();
label4:
                do
                {
                    Activity act;
                    int ji;
label5:
                    do
                    {
label6:
View Full Code Here

    {
        int size = activities.size();
        boolean incidenceMatrix[][] = new boolean[size][size];
        for(int indAct = 0; indAct < size; indAct++)
        {
            Activity a = (Activity)activities.get(indAct);
            for(Iterator trs = XMLUtil.getOutgoingTransitions(a).iterator(); trs.hasNext();)
            {
                Transition t = (Transition)trs.next();
                String aOut = t.getTo();
                Activity toAct = activities.getActivity(aOut);
                if(toAct == null)
                    return (boolean[][])null;
                int indOut = activities.indexOf(toAct);
                incidenceMatrix[indAct][indOut] = true;
            }
View Full Code Here

        Iterator it = acts.iterator();
        do
        {
            if(!it.hasNext())
                break;
            Activity act = (Activity)it.next();
            if(sOrJ == 0 && XMLUtil.isANDTypeSplitOrJoin(act, 0))
                no++;
            else
            if(sOrJ == 1 && XMLUtil.isANDTypeSplitOrJoin(act, 0))
                no++;
View Full Code Here

                boolean wc;
                do
                {
                    if(!it.hasNext())
                        break label0;
                    Activity act = (Activity)it.next();
                    wc = checkActivityConnection(act, existingErrors, fullCheck);
                } while(wc);
                isWellConnected = false;
            } while(fullCheck);
        }
View Full Code Here

TOP

Related Classes of org.enhydra.shark.xpdl.elements.Activity

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.