Package org.enhydra.shark.xpdl.elements

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


            boolean addToCollection) {
        if (type == null || type.equals("")) {
            type = JaWEConstants.TRANSITION_TYPE_UNCONDITIONAL;
        }

        Transition tra = createXPDLTransition(tras, type);
        if (type.equals(JaWEConstants.TRANSITION_TYPE_CONDITIONAL)) {
            tra.getCondition().setTypeCONDITION();
        } else if (type.equals(JaWEConstants.TRANSITION_TYPE_OTHERWISE)) {
            tra.getCondition().setTypeOTHERWISE();
        } else if (type.equals(JaWEConstants.TRANSITION_TYPE_EXCEPTION)) {
            tra.getCondition().setTypeEXCEPTION();
        } else if (type.equals(JaWEConstants.TRANSITION_TYPE_DEFAULTEXCEPTION)) {
            tra.getCondition().setTypeDEFAULTEXCEPTION();
        }

        adjustXPDLObject(tra, type);

        if (addToCollection) {
View Full Code Here


        }
        return tra;
    }

    protected Transition createXPDLTransition(Transitions tras, String type) {
        Transition tra = (Transition) tras.generateNewElement();
        JaWETypes jts = JaWEManager.getInstance().getJaWEController().getJaWETypes();
        boolean hasTemplate = jts.hasTemplateId(type);
        if (hasTemplate) {
            jts.fillFromTemplate(tra, type);
        }
        String id = tra.getId();
        if (!hasTemplate || id.equals("") || tras.getTransition(id) != null) {
            if (id.equals("")) {
                id = JaWEManager.getInstance().getIdFactory().generateUniqueId(tras);
            } else {
                id = JaWEManager.getInstance().getIdFactory().generateSimilarOrIdenticalUniqueId(tras, new HashSet(), id);
            }
            int i = 0;
            while (tras.getTransition(id) != null) {
                id = id + String.valueOf(++i);
            }
            tra.setId(id);
        }

        return tra;
    }
View Full Code Here

        } else
        {
            String en = el.toValue();
            for(Iterator it = ets.iterator(); it.hasNext();)
            {
                Transition t = (Transition)it.next();
                String cond = t.getCondition().toValue();
                String ctype = t.getCondition().getType();
                if(ctype.equals("DEFAULTEXCEPTION") || cond.equals(en) || cond.length() == 0)
                    return;
            }

            isValid = false;
View Full Code Here

        {
            Map actConns = new HashMap();
            Set multipleConnections = new HashSet();
            for(int i = 0; i < el.size(); i++)
            {
                Transition t = (Transition)el.get(i);
                String actConn = "[" + t.getFrom() + "-" + t.getTo() + "]";
                if(actConns.containsKey(actConn))
                {
                    multipleConnections.add(actConns.get(actConn));
                    multipleConnections.add(t);
                    if(!fullCheck)
                        break;
                }
                actConns.put(actConn, t);
            }

            if(multipleConnections.size() > 0)
            {
                XMLValidationError verr;
                for(Iterator it = multipleConnections.iterator(); it.hasNext(); existingErrors.add(verr))
                {
                    Transition t = (Transition)it.next();
                    String actConn = "[" + t.getFrom() + "-" + t.getTo() + "]";
                    verr = new XMLValidationError("ERROR", "LOGIC", "ERROR_MULTIPLE_ACTIVITY_CONNECTIONS", actConn, t);
                }

            }
        }
View Full Code Here

    protected boolean containsTransitionWithId(Set trans, String id)
    {
        for(Iterator it = trans.iterator(); it.hasNext();)
        {
            Transition t = (Transition)it.next();
            if(t.getId().equals(id))
                return true;
        }

        return false;
    }
View Full Code Here

        Iterator ts = outTrans.iterator();
        do
        {
            if(!ts.hasNext())
                break;
            Transition t = (Transition)ts.next();
            String ct = t.getCondition().getType();
            if(ct.equals("OTHERWISE"))
            {
                if(foundOtherwise)
                {
                    foundMultipleOtherwise = true;
View Full Code Here

        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

        if(hasAnyPostcondition(act))
        {
            Set ots = XMLUtil.getOutgoingTransitions(act);
            for(Iterator trs = ots.iterator(); trs.hasNext();)
            {
                Transition t = (Transition)trs.next();
                if(t.getCondition().getType().equals("OTHERWISE"))
                    return true;
            }

            return false;
        } else
View Full Code Here

                    XMLElement txpdl = t.getPropertyObject();
                    if (sxpdl instanceof Activity && txpdl instanceof Activity) {
                        Transitions tras = (Transitions) getGraph().getXPDLObject().get("Transitions");
                        String fromId = ((Activity) sxpdl).getId();
                        String toId = ((Activity) txpdl).getId();
                        Transition tra = JaWEManager.getInstance().getXPDLObjectFactory().createXPDLObject(tras, subType, false);
                        tra.setFrom(fromId);
                        tra.setTo(toId);
                        if (fromId.equals(toId)) {
                            GraphUtilities.setStyle(tra, GraphEAConstants.EA_JAWE_GRAPH_TRANSITION_STYLE_VALUE_NO_ROUTING_BEZIER);
                        } else {
                            GraphUtilities.setStyle(tra, getGraphController().getGraphSettings().getDefaultTransitionStyle());
                        }
                        GraphUtilities.setBreakpoints(tra, points);
                        points.clear();
                        graphController.setUpdateInProgress(true);
                        JaWEManager.getInstance().getJaWEController().startUndouableChange();
                        tras.add(tra);
                        getGraphManager().insertTransition(tra);
                        List toSelect = new ArrayList();
                        toSelect.add(tra);
                        JaWEManager.getInstance().getJaWEController().endUndouableChange(toSelect);
                        getGraph().selectTransition(tra, false);
                        graphController.setUpdateInProgress(false);
                    } else if (sxpdl instanceof ExtendedAttribute && txpdl instanceof Activity) {
                        connectStartOrEndBubble((ExtendedAttribute) sxpdl, ((Activity) txpdl).getId());
                    } else if (txpdl instanceof ExtendedAttribute && sxpdl instanceof Activity) {
                        connectStartOrEndBubble((ExtendedAttribute) txpdl, ((Activity) sxpdl).getId());
                    }
                    return true;
                }
                // circular
            } else {
                if (validateConnection(pPort, pPort, null) && points.size() > 0) { // CUSTOM: only allow circular if there is another point

                    Point realP = (Point) getGraph().fromScreen(new Point(start));
                    List breakpoints = new ArrayList();
                    if (points.size() == 0) {
                        int rp50x1 = realP.x - 50;
                        int rp50x2 = realP.x + 50;
                        if (rp50x1 < 0) {
                            rp50x2 = rp50x2 - rp50x1;
                            rp50x1 = 0;
                        }
                        int rp50y = realP.y - 50;
                        if (rp50y < 0) {
                            rp50y = realP.y + 50;
                        }

                        breakpoints.add(new Point(Math.abs(rp50x1), Math.abs(rp50y)));
                        breakpoints.add(new Point(Math.abs(rp50x2), Math.abs(rp50y)));
                    } else {
                        breakpoints.addAll(points);
                        points.clear();
                    }

                    Activity act = (Activity) ((GraphPortInterface) firstPort.getCell()).getActivity().getPropertyObject();

                    Transitions tras = (Transitions) getGraph().getXPDLObject().get("Transitions");
                    Transition tra = JaWEManager.getInstance().getXPDLObjectFactory().createXPDLObject(tras, subType, false);
                    tra.setFrom(act.getId());
                    tra.setTo(act.getId());
                    GraphUtilities.setStyle(tra, GraphEAConstants.EA_JAWE_GRAPH_TRANSITION_STYLE_VALUE_NO_ROUTING_BEZIER);
                    GraphUtilities.setBreakpoints(tra, breakpoints);
                    getGraphController().setUpdateInProgress(true);
                    JaWEManager.getInstance().getJaWEController().startUndouableChange();
                    tras.add(tra);
View Full Code Here

    /**
     * Suggest to automatically add a Condition if a name is specified
     */
    protected void suggestCondition() {
        Transition transition = (Transition)getOwner();
        String name = transition.getName();
        Condition condition = transition.getCondition();
        String conditionType = (condition != null) ? condition.getType() : "";
        String expression = (condition != null) ? condition.toValue() : "";

        // check when transition name is specified and no existing condition
        if (name != null && name.trim().length() > 0
View Full Code Here

TOP

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

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.