Search in sources :

Example 21 with AttributeVO

use of com.centurylink.mdw.model.value.attribute.AttributeVO in project mdw-designer by CenturyLinkCloud.

the class DesignerDataModel method copyPackage.

public PackageVO copyPackage(PackageVO curPkg, String newname, int newversion) {
    PackageVO newPkg = new PackageVO();
    newPkg.setPackageName(newname != null ? newname : curPkg.getPackageName());
    newPkg.setPackageDescription(curPkg.getPackageDescription());
    newPkg.setExported(false);
    // newPkg.setPools(pools)
    // newPkg.setVariables(variables)
    newPkg.setSchemaVersion(DataAccess.currentSchemaVersion);
    newPkg.setPackageId(getNewId());
    newPkg.setVersion(newversion);
    newPkg.setMetaContent(curPkg.getMetaContent());
    List<ProcessVO> processes = new ArrayList<ProcessVO>();
    newPkg.setProcesses(processes);
    if (curPkg.getProcesses() != null) {
        for (ProcessVO p : curPkg.getProcesses()) {
            processes.add(p);
        }
    }
    if (curPkg.getImplementors() != null) {
        List<ActivityImplementorVO> impls = new ArrayList<ActivityImplementorVO>();
        newPkg.setImplementors(impls);
        for (ActivityImplementorVO a : curPkg.getImplementors()) {
            impls.add(a);
        }
    }
    if (curPkg.getExternalEvents() != null) {
        List<ExternalEventVO> handlers = new ArrayList<ExternalEventVO>();
        newPkg.setExternalEvents(handlers);
        for (ExternalEventVO a : curPkg.getExternalEvents()) {
            handlers.add(a);
        }
    }
    if (curPkg.getParticipants() != null) {
        List<LaneVO> participants = new ArrayList<LaneVO>();
        newPkg.setParticipants(participants);
        for (LaneVO a : curPkg.getParticipants()) {
            participants.add(a);
        }
    }
    if (curPkg.getRuleSets() != null) {
        List<RuleSetVO> rulesets = new ArrayList<RuleSetVO>();
        newPkg.setRuleSets(rulesets);
        for (RuleSetVO a : curPkg.getRuleSets()) {
            rulesets.add(a);
        }
    }
    if (curPkg.getAttributes() != null) {
        List<AttributeVO> attrs = new ArrayList<AttributeVO>();
        newPkg.setAttributes(attrs);
        for (AttributeVO a : curPkg.getAttributes()) {
            attrs.add(a);
        }
    }
    addPackage(newPkg);
    return newPkg;
}
Also used : PackageVO(com.centurylink.mdw.model.value.process.PackageVO) AttributeVO(com.centurylink.mdw.model.value.attribute.AttributeVO) CustomAttributeVO(com.centurylink.mdw.model.value.attribute.CustomAttributeVO) ExternalEventVO(com.centurylink.mdw.model.value.event.ExternalEventVO) ArrayList(java.util.ArrayList) RuleSetVO(com.centurylink.mdw.model.value.attribute.RuleSetVO) ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) LaneVO(com.centurylink.mdw.model.value.process.LaneVO)

Example 22 with AttributeVO

use of com.centurylink.mdw.model.value.attribute.AttributeVO in project mdw-designer by CenturyLinkCloud.

the class Graph method addLink.

/**
 * this is for pasting
 * @param trans
 * @param fromId
 * @param toId
 * @return
 */
public Link addLink(GraphCommon owner, WorkTransitionVO trans, Long fromId, Long toId, int xoff, int yoff, boolean recordchange, boolean newLogicalId) {
    WorkTransitionVO conn = new WorkTransitionVO();
    conn.setFromWorkId(fromId);
    conn.setToWorkId(toId);
    conn.setEventType(trans.getEventType());
    conn.setWorkTransitionId(new Long(0));
    conn.setCompletionCode(trans.getCompletionCode());
    ArrayList<AttributeVO> attributes = new ArrayList<AttributeVO>();
    for (AttributeVO attr : trans.getAttributes()) {
        AttributeVO nattr = new AttributeVO(attr.getAttributeName(), attr.getAttributeValue());
        attributes.add(nattr);
    }
    conn.setAttributes(attributes);
    owner.getProcessVO().getTransitions().add(conn);
    if (newLogicalId) {
        String lid;
        if (owner instanceof SubGraph) {
            lid = ((SubGraph) owner).getGraph().generateLogicalId("T");
        } else {
            lid = ((Graph) owner).generateLogicalId("T");
        }
        conn.setAttribute(WorkAttributeConstant.LOGICAL_ID, lid);
    }
    Link link = new Link(owner.findNode(fromId), owner.findNode(toId), conn, arrowstyle);
    if (xoff != 0 || yoff != 0)
        link.shift(xoff, yoff, arrowstyle);
    owner.links.add(link);
    setDirtyLevel(DIRTY);
    if (recordchange)
        link.getChanges().setChangeType(Changes.NEW);
    return link;
}
Also used : WorkTransitionVO(com.centurylink.mdw.model.value.work.WorkTransitionVO) AttributeVO(com.centurylink.mdw.model.value.attribute.AttributeVO) ArrayList(java.util.ArrayList)

Example 23 with AttributeVO

use of com.centurylink.mdw.model.value.attribute.AttributeVO in project mdw-designer by CenturyLinkCloud.

the class Graph method addNode.

/**
 * This is for pasting
 * @param actvo
 * @return
 */
public Node addNode(GraphCommon owner, ActivityVO sourceact, int xoff, int yoff, boolean recordchange, boolean newLogicalId) {
    Long pActId = genNodeId();
    ArrayList<AttributeVO> attributes = new ArrayList<AttributeVO>();
    for (AttributeVO attr : sourceact.getAttributes()) {
        AttributeVO nattr = new AttributeVO(attr.getAttributeName(), attr.getAttributeValue());
        attributes.add(nattr);
    }
    ActivityVO nodet = new ActivityVO(pActId, sourceact.getActivityName(), sourceact.getActivityDescription(), sourceact.getImplementorClassName(), attributes);
    owner.getProcessVO().getActivities().add(nodet);
    if (newLogicalId) {
        String lid;
        if (owner instanceof SubGraph) {
            lid = ((SubGraph) owner).getGraph().generateLogicalId("A");
        } else {
            lid = ((Graph) owner).generateLogicalId("A");
        }
        nodet.setAttribute(WorkAttributeConstant.LOGICAL_ID, lid);
    }
    Node node = new Node(nodet, owner, metainfo);
    if (newLogicalId && node.isTaskActivity()) {
        node.setAttribute(TaskActivity.ATTRIBUTE_TASK_LOGICAL_ID, null);
    }
    node.x += xoff;
    node.y += yoff;
    owner.nodes.add(node);
    if (recordchange)
        node.getChanges().setChangeType(Changes.NEW);
    setDirtyLevel(DIRTY);
    return node;
}
Also used : AttributeVO(com.centurylink.mdw.model.value.attribute.AttributeVO) ActivityVO(com.centurylink.mdw.model.value.activity.ActivityVO) MbengNode(com.qwest.mbeng.MbengNode) ArrayList(java.util.ArrayList)

Example 24 with AttributeVO

use of com.centurylink.mdw.model.value.attribute.AttributeVO in project mdw-designer by CenturyLinkCloud.

the class PluginDataAccess method setAttributes.

public void setAttributes(String owner, Long ownerId, List<AttributeVO> attrs) {
    try {
        Map<String, String> attributes = null;
        if (attrs != null) {
            attributes = new HashMap<>();
            for (AttributeVO attr : attrs) attributes.put(attr.getAttributeName(), attr.getAttributeValue());
        }
        getDesignerDataAccess().setAttributes(owner, ownerId, attributes);
    } catch (Exception ex) {
        PluginMessages.uiError(ex, "Set Attributes", workflowProject);
    }
}
Also used : AttributeVO(com.centurylink.mdw.model.value.attribute.AttributeVO) CustomAttributeVO(com.centurylink.mdw.model.value.attribute.CustomAttributeVO) SQLException(java.sql.SQLException) DataAccessOfflineException(com.centurylink.mdw.dataaccess.DataAccessOfflineException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) RemoteException(java.rmi.RemoteException)

Aggregations

AttributeVO (com.centurylink.mdw.model.value.attribute.AttributeVO)24 ArrayList (java.util.ArrayList)15 PackageVO (com.centurylink.mdw.model.value.process.PackageVO)5 ActivityVO (com.centurylink.mdw.model.value.activity.ActivityVO)4 WorkTransitionVO (com.centurylink.mdw.model.value.work.WorkTransitionVO)4 MbengNode (com.qwest.mbeng.MbengNode)4 List (java.util.List)4 PackageDocument (com.centurylink.mdw.bpm.PackageDocument)3 ActivityImplementorVO (com.centurylink.mdw.model.value.activity.ActivityImplementorVO)3 CustomAttributeVO (com.centurylink.mdw.model.value.attribute.CustomAttributeVO)3 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)3 ProcessDefinitionDocument (com.centurylink.mdw.bpm.ProcessDefinitionDocument)2 Property (com.centurylink.mdw.bpm.PropertyDocument.Property)2 PropertyGroup (com.centurylink.mdw.bpm.PropertyGroupDocument.PropertyGroup)2 ExternalEventVO (com.centurylink.mdw.model.value.event.ExternalEventVO)2 VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)2 AttributeDialog (com.centurylink.mdw.plugin.designer.dialogs.AttributeDialog)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 XmlOptions (org.apache.xmlbeans.XmlOptions)2