Package org.wso2.carbon.rulecep.service

Examples of org.wso2.carbon.rulecep.service.ServiceEngineFactory


        return group1;
    }

    protected Element getArrows(SVGDocument doc) {
        if (subActivities != null) {
            ActivityInterface prevActivity = null;
            ActivityInterface prevElseActivity = null;
            ActivityInterface activity = null;
            String id = null;
            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates myStartCoords = getStartIconExitArrowCoords();
            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates myExitCoords = getEndIconEntryArrowCoords();
            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates myStartElseCoords = getStartIconElseArrowCoords();
            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates exitCoords = null;
            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates activityEntryCoords = null;
            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates activityExitCoords = null;
            Iterator<ActivityInterface> itr = subActivities.iterator();
            Element subGroup = doc.createElementNS("http://www.w3.org/2000/svg", "g");
            while (itr.hasNext()) {
                activity = itr.next();
                activityEntryCoords = activity.getEntryArrowCoords();
                activityExitCoords = activity.getExitArrowCoords();

                if (activity instanceof ElseIfImpl || activity instanceof ElseImpl) {
                    if (prevActivity != null && prevActivity instanceof ElseIfImpl) {
                        exitCoords = ((ElseIfInterface) prevActivity).getNextElseExitArrowCoords();
//                        activityEntryCoords = activity.getEntryArrowCoords();
                        id = prevActivity.getId() + "-" + activity.getId();

                        subGroup.appendChild(getArrowDefinition(doc, exitCoords.getXLeft(),
                            exitCoords.getYTop(), activityEntryCoords.getXLeft(),
                            activityEntryCoords.getYTop(), id, prevActivity, activity));
                        subGroup.appendChild(getArrowDefinition(doc, activityExitCoords.getXLeft(),
                            activityExitCoords.getYTop(), myExitCoords.getXLeft(),
                            myExitCoords.getYTop(), id, prevActivity, activity));

                    } else {
//                        activityEntryCoords = activity.getEntryArrowCoords();
                        subGroup.appendChild(getArrowDefinition(doc, myStartElseCoords.getXLeft(),
                            myStartElseCoords.getYTop(), activityEntryCoords.getXLeft(),
                            activityEntryCoords.getYTop(), id, prevActivity, activity));
                        subGroup.appendChild(getArrowDefinition(doc, activityExitCoords.getXLeft(),
                            activityExitCoords.getYTop(), myExitCoords.getXLeft(),
                            myExitCoords.getYTop(), id, prevActivity, activity));

                    }
                } else {
                    if (prevActivity != null) {
                        exitCoords = prevActivity.getExitArrowCoords();
//                        activityEntryCoords = activity.getEntryArrowCoords();
//                        activityExitCoords = activity.getExitArrowCoords();
                        id = prevActivity.getId() + "-" + activity.getId();
                        subGroup.appendChild(getArrowDefinition(doc, exitCoords.getXLeft(),
                            exitCoords.getYTop(), activityEntryCoords.getXLeft(),
                            activityEntryCoords.getYTop(), id, prevActivity, activity));
                    } else {
//                        activityEntryCoords = activity.getEntryArrowCoords();


    public void setRootActivity(org.wso2.carbon.bpel.ui.bpel2svg.ProcessInterface rootActivity) {
        this.rootActivity = rootActivity;
    }
   
    public ActivityInterface getActivityAtLineNumber(int lineNumber) {
      ActivityInterface ret=null;
     
      if (this.rootActivity != null) {
        ret = this.rootActivity.getActivityAtLineNumber(lineNumber);
       
      }

        int xLeft = startXLeft + (getYSpacing() / 2);
        int yTop = centreOfMyLayout - (getStartIconHeight() / 2);
        int endXLeft = startXLeft + dimensions.getWidth() - getEndIconWidth() - (getYSpacing() / 2);
        int endYTop = centreOfMyLayout - (getEndIconHeight() / 2);

        ActivityInterface activity = null;
        Iterator<ActivityInterface> itr = getSubActivities().iterator();
        int childXLeft = startXLeft + (getYSpacing() / 2);
        int childYTop = startYTop + (getXSpacing() / 2);
        while (itr.hasNext()) {
            activity = itr.next();
//            childXLeft = centreOfMyLayout - activity.getDimensions().getWidth() / 2;
            activity.layout(childXLeft, childYTop);
            childYTop += activity.getDimensions().getHeight();
        }

        // Set the values
        setStartIconXLeft(xLeft);
        setStartIconYTop(yTop);

            int width = 0;
            int height = 0;
            dimensions = new SVGDimension(width, height);

            SVGDimension subActivityDim = null;
            ActivityInterface activity = null;
            Iterator<ActivityInterface> itr = getSubActivities().iterator();
            while (itr.hasNext()) {
                activity = itr.next();
                subActivityDim = activity.getDimensions();
                if (subActivityDim.getWidth() > width) {
                    width += subActivityDim.getWidth();
                }
                height += subActivityDim.getHeight();
            }

    public void layoutVertical(int startXLeft, int startYTop) {
        int centreOfMyLayout = startXLeft + (dimensions.getWidth() / 2);
        int xLeft = centreOfMyLayout - (getStartIconWidth() / 2);
        int yTop = startYTop + (getYSpacing() / 2);

        ActivityInterface activity = null;
        Iterator<ActivityInterface> itr = getSubActivities().iterator();
        int childYTop = yTop + getStartIconHeight() + (getYSpacing() / 2);
        int childXLeft = startXLeft;
        while (itr.hasNext()) {
            activity = itr.next();
            childXLeft = centreOfMyLayout - activity.getDimensions().getWidth() / 2;
            activity.layout(childXLeft, childYTop);
            childYTop += activity.getDimensions().getHeight();
        }

        setStartIconXLeft(xLeft);
        setStartIconYTop(yTop);
        setStartIconTextXLeft(startXLeft + BOX_MARGIN);

    public void layoutHorizontal(int startXLeft, int startYTop) {
        int centreOfMyLayout = startYTop + (dimensions.getHeight() / 2);
        int xLeft = startXLeft + (getYSpacing() / 2);
        int yTop = centreOfMyLayout - (getStartIconHeight() / 2);

        ActivityInterface activity = null;
        Iterator<ActivityInterface> itr = getSubActivities().iterator();
        int childYTop = yTop;
        int childXLeft = xLeft + getStartIconWidth() + (getYSpacing() / 2);
        while (itr.hasNext()) {
            activity = itr.next();
            childYTop = centreOfMyLayout - (activity.getDimensions().getHeight() / 2);
            activity.layout(childXLeft, childYTop);
            childXLeft += activity.getDimensions().getWidth();
        }

        setStartIconXLeft(xLeft);
        setStartIconYTop(yTop);
        setStartIconTextXLeft(startXLeft + BOX_MARGIN);

    @Override
    public org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates getExitArrowCoords() {
        SVGCoordinates coords = getStartIconExitArrowCoords();

        if (subActivities != null && subActivities.size() > 0) {
            ActivityInterface activity = subActivities.get(subActivities.size() - 1);
            coords = activity.getExitArrowCoords();
        }
        return coords;
    }

        return group1;
    }

    protected Element getArrows(SVGDocument doc) {
        if (subActivities != null) {
            ActivityInterface prevActivity = null;
            ActivityInterface activity = null;
            String id = null;
            SVGCoordinates myStartCoords = getStartIconExitArrowCoords();
            SVGCoordinates exitCoords = null;
            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates entryCoords = null;
            Iterator<ActivityInterface> itr = subActivities.iterator();
            while (itr.hasNext()) {
                activity = itr.next();
                if (prevActivity != null) {
                    exitCoords = prevActivity.getExitArrowCoords();
                    entryCoords = activity.getEntryArrowCoords();
                    id = prevActivity.getId() + "-" + activity.getId();
                    return getArrowDefinition(doc, exitCoords.getXLeft(), exitCoords.getYTop(),
                        entryCoords.getXLeft(), entryCoords.getYTop(), id,
                        prevActivity, activity);
                } else {
                    entryCoords = activity.getExitArrowCoords();
                    return getArrowDefinition(doc, myStartCoords.getXLeft(), myStartCoords.getYTop(),
                        entryCoords.getXLeft(), entryCoords.getYTop(), id,
                        this, activity);
                }
            }

            yTop = getCoreDimensions().getYTop() + (getYSpacing() / 2);
            endXLeft = centerNHLayout - (getEndIconWidth() / 2) + (getXSpacing() / 2);
            endYTop = getCoreDimensions().getYTop() + getCoreDimensions().getHeight() - getEndIconHeight() - (getYSpacing() / 2);
        }

        ActivityInterface activity = null;
        Iterator<org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface> itr = getSubActivities().iterator();

        int childYTop = 0;
        int childXLeft = 0;

        if (isSimpleLayout()) {
            childYTop = yTop + getStartIconHeight() + (getYSpacing() / 2);
            childXLeft = startXLeft + (getXSpacing() / 2);
        } else {
            childYTop = getCoreDimensions().getYTop() + getStartIconHeight() + (getYSpacing() / 2);
            childXLeft = getCoreDimensions().getXLeft() + (getXSpacing() / 2);
        }

        // Process None Handlers First
        while (itr.hasNext()) {
            activity = itr.next();
            if (activity instanceof FaultHandlerImpl || activity instanceof TerminationHandlerImpl || activity instanceof CompensationHandlerImpl || activity instanceof EventHandlerImpl) {
                // Ignore
            } else {
                activity.layout(childXLeft, childYTop);
                childXLeft += activity.getDimensions().getWidth();
            }
        }
        // Process Handlers
        itr = getSubActivities().iterator();
        childXLeft = startXLeft + getCoreDimensions().getWidth();
        childYTop = yTop + getHandlerAdjustment();

        while (itr.hasNext()) {
            activity = itr.next();
            if (activity instanceof FaultHandlerImpl || activity instanceof TerminationHandlerImpl || activity instanceof CompensationHandlerImpl || activity instanceof EventHandlerImpl) {
                activity.layout(childXLeft, childYTop);
                childXLeft += activity.getDimensions().getWidth();
            }
        }

        // Set the values
        setStartIconXLeft(xLeft);

      }
    } catch(Exception e) {
      fail("Failed: "+e);
    }

    ActivityInterface act=svg.getActivityAtLineNumber(lineNo);
   
    if (act == null) {
      fail("Failed to get '"+type.getName()+"' at line "+lineNo);
    }
   
    if (type.isAssignableFrom(act.getClass()) == false) {
      fail("Returned activity is not a '"+type.getName()+"'");
    }
  }

TOP

Related Classes of org.wso2.carbon.rulecep.service.ServiceEngineFactory

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.