Search in sources :

Example 16 with ActivityImplementorVO

use of com.centurylink.mdw.model.value.activity.ActivityImplementorVO in project mdw-designer by CenturyLinkCloud.

the class FlowchartPage method drop.

public void drop(DropTargetDropEvent e) {
    if (process.isReadonly()) {
        return;
    }
    try {
        if (e.isDataFlavorSupported(DataFlavor.stringFlavor)) {
            Transferable tr = e.getTransferable();
            e.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
            String s = (String) tr.getTransferData(DataFlavor.stringFlavor);
            int i = Integer.parseInt(s.substring(3));
            ActivityImplementorVO nmi = model.getNodeMetaInfo().get(i);
            Selectable object;
            int x = e.getLocation().x;
            int y = e.getLocation().y;
            if (process.zoom != 100) {
                x = x * 100 / process.zoom;
                y = y * 100 / process.zoom;
            }
            if (nmi.getImplementorClassName().equals(NodeMetaInfo.PSEUDO_PROCESS_ACTIVITY)) {
                String type = promptEmbeddedProcessType(process);
                if (type != null)
                    object = process.addSubGraph(x, y, type, recordchange);
                else
                    object = null;
            } else {
                object = process.addNode(nmi, x, y, recordchange);
            }
            e.dropComplete(true);
            if (object != null) {
                canvas.setSelectedObject(object);
                canvas.requestFocus();
                canvas.repaint();
            }
        } else {
            e.rejectDrop();
        }
    } catch (IOException io) {
        // io.printStackTrace();
        e.rejectDrop();
    } catch (UnsupportedFlavorException ufe) {
        // ufe.printStackTrace();
        e.rejectDrop();
    }
}
Also used : ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) Selectable(com.centurylink.mdw.designer.display.Selectable) Transferable(java.awt.datatransfer.Transferable) IOException(java.io.IOException) UnsupportedFlavorException(java.awt.datatransfer.UnsupportedFlavorException) Point(java.awt.Point)

Example 17 with ActivityImplementorVO

use of com.centurylink.mdw.model.value.activity.ActivityImplementorVO in project mdw-designer by CenturyLinkCloud.

the class FlowchartPage method dragDropEnd.

public void dragDropEnd(DragSourceDropEvent e) {
    if (Constants.isMacOsX()) {
        ActivityImplementorVO nmi = model.getNodeMetaInfo().get(nodepane.getSelectedNode());
        Selectable object;
        Point p = canvas.getMousePosition();
        int x = p.x;
        int y = p.y;
        if (process.zoom != 100) {
            x = x * 100 / process.zoom;
            y = y * 100 / process.zoom;
        }
        if (nmi.getImplementorClassName().equals(NodeMetaInfo.PSEUDO_PROCESS_ACTIVITY)) {
            String type = promptEmbeddedProcessType(process);
            if (type != null)
                object = process.addSubGraph(x, y, type, recordchange);
            else
                object = null;
        } else {
            object = process.addNode(nmi, x, y, recordchange);
        }
        if (object != null) {
            canvas.setSelectedObject(object);
            canvas.requestFocus();
            canvas.repaint();
        }
    }
}
Also used : ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) Selectable(com.centurylink.mdw.designer.display.Selectable) Point(java.awt.Point) Point(java.awt.Point)

Example 18 with ActivityImplementorVO

use of com.centurylink.mdw.model.value.activity.ActivityImplementorVO in project mdw-designer by CenturyLinkCloud.

the class DesignerDataModel method replaceAliasesInPackage.

private void replaceAliasesInPackage(PackageVO pkg) {
    List<ProcessVO> newProcs = new ArrayList<ProcessVO>(pkg.getProcesses().size());
    for (ProcessVO proc : pkg.getProcesses()) {
        ProcessVO proc1 = this.findProcessDefinition(processes, proc.getProcessId(), null);
        if (proc1 != null)
            newProcs.add(proc1);
        else
            newProcs.add(proc);
    }
    pkg.setProcesses(newProcs);
    List<ActivityImplementorVO> newImpls = new ArrayList<ActivityImplementorVO>(pkg.getImplementors().size());
    for (ActivityImplementorVO impl : pkg.getImplementors()) {
        ActivityImplementorVO impl1 = findActivityImplementorVO(impl.getImplementorClassName());
        if (impl1 != null)
            newImpls.add(impl1);
        else
            newImpls.add(impl);
    }
    pkg.setImplementors(newImpls);
    List<ExternalEventVO> newHandlers = new ArrayList<ExternalEventVO>(pkg.getExternalEvents().size());
    for (ExternalEventVO hdl : pkg.getExternalEvents()) {
        ExternalEventVO hdl1 = findExternalEvent(hdl.getEventName());
        if (hdl1 != null)
            newHandlers.add(hdl1);
        else
            newHandlers.add(hdl);
    }
    pkg.setExternalEvents(newHandlers);
    if (pkg.getRuleSets() != null) {
        List<RuleSetVO> newRuleSets = new ArrayList<RuleSetVO>(pkg.getRuleSets().size());
        for (RuleSetVO hdl : pkg.getRuleSets()) {
            RuleSetVO hdl1 = findRuleSet(hdl.getId());
            if (hdl1 != null)
                newRuleSets.add(hdl1);
            else
                newRuleSets.add(hdl);
        }
        pkg.setRuleSets(newRuleSets);
    }
}
Also used : ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) ExternalEventVO(com.centurylink.mdw.model.value.event.ExternalEventVO) ArrayList(java.util.ArrayList) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) RuleSetVO(com.centurylink.mdw.model.value.attribute.RuleSetVO)

Example 19 with ActivityImplementorVO

use of com.centurylink.mdw.model.value.activity.ActivityImplementorVO in project mdw-designer by CenturyLinkCloud.

the class DesignerDataModel method collectImportItems.

public List<ImportItem> collectImportItems(PackageVO pkg) {
    List<ImportItem> importItems = new ArrayList<ImportItem>();
    // check for package
    ImportItem item;
    int status;
    if (pkg.getVersion() != 0 && getDatabaseSchemaVersion() >= DataAccess.schemaVersion4) {
        status = ImportItem.STATUS_NEW_VERSION;
        for (PackageVO one : packages) {
            if (one.getPackageName().equals(pkg.getPackageName())) {
                if (pkg.getVersion() < one.getVersion()) {
                    status = ImportItem.STATUS_OLD_VERSION;
                } else if (pkg.getVersion() == one.getVersion()) {
                    if (status == ImportItem.STATUS_NEW_VERSION)
                        status = ImportItem.STATUS_SAME_VERSION;
                }
            }
        }
    } else
        status = ImportItem.STATUS_NOT_PACKAGE;
    item = new ImportItem(pkg.getPackageName(), ImportItem.TYPE_PACKAGE, status);
    importItems.add(item);
    // check for implementors
    for (ActivityImplementorVO a : pkg.getImplementors()) {
        ActivityImplementorVO a1 = findActivityImplementorVO(a.getImplementorClassName());
        if (a1 == null)
            status = ImportItem.STATUS_NEW;
        else if (same_implementor(a, a1))
            status = ImportItem.STATUS_SAME;
        else
            status = ImportItem.STATUS_DIFFERENT;
        item = new ImportItem(a.getImplementorClassName(), ImportItem.TYPE_IMPLEMENTOR, status);
        importItems.add(item);
    }
    for (ExternalEventVO e : pkg.getExternalEvents()) {
        ExternalEventVO e1 = findExternalEvent(e.getEventName());
        if (e1 == null)
            status = ImportItem.STATUS_NEW;
        else if (same_handler(e, e1))
            status = ImportItem.STATUS_SAME;
        else
            status = ImportItem.STATUS_DIFFERENT;
        item = new ImportItem(e.getEventName(), ImportItem.TYPE_HANDLER, status);
        importItems.add(item);
    }
    for (RuleSetVO e : pkg.getRuleSets()) {
        RuleSetVO e1 = findRuleSet(e.getName(), null);
        if (e1 == null || e.getVersion() > e1.getVersion())
            status = ImportItem.STATUS_NEW_VERSION;
        else if (e.getVersion() == 0) {
            status = ImportItem.STATUS_NEW_VERSION;
            e.setVersion(e1.getVersion() + 1);
        } else if (e.getVersion() == e1.getVersion())
            status = ImportItem.STATUS_SAME_VERSION;
        else
            status = ImportItem.STATUS_OLD_VERSION;
        item = new ImportItem(e.getName(), ImportItem.TYPE_RULESET, status);
        importItems.add(item);
    }
    for (ProcessVO p : pkg.getProcesses()) {
        ProcessVO p1 = findProcessDefinition(p.getProcessName(), 0);
        if (p1 == null || p.getVersion() > p1.getVersion() || p.getVersion() == 0)
            status = ImportItem.STATUS_NEW_VERSION;
        else if (p.getVersion() == p1.getVersion())
            status = ImportItem.STATUS_SAME_VERSION;
        else
            status = ImportItem.STATUS_OLD_VERSION;
        item = new ImportItem(p.getProcessName(), ImportItem.TYPE_PROCESS, status);
        importItems.add(item);
    }
    return importItems;
}
Also used : ImportItem(com.centurylink.mdw.designer.utils.ImportItem) ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) PackageVO(com.centurylink.mdw.model.value.process.PackageVO) ExternalEventVO(com.centurylink.mdw.model.value.event.ExternalEventVO) ArrayList(java.util.ArrayList) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) RuleSetVO(com.centurylink.mdw.model.value.attribute.RuleSetVO)

Example 20 with ActivityImplementorVO

use of com.centurylink.mdw.model.value.activity.ActivityImplementorVO 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)

Aggregations

ActivityImplementorVO (com.centurylink.mdw.model.value.activity.ActivityImplementorVO)24 ArrayList (java.util.ArrayList)12 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)9 RuleSetVO (com.centurylink.mdw.model.value.attribute.RuleSetVO)6 ExternalEventVO (com.centurylink.mdw.model.value.event.ExternalEventVO)6 PackageVO (com.centurylink.mdw.model.value.process.PackageVO)5 Point (java.awt.Point)5 ActivityVO (com.centurylink.mdw.model.value.activity.ActivityVO)4 ActivityImpl (com.centurylink.mdw.plugin.designer.model.ActivityImpl)4 AttributeVO (com.centurylink.mdw.model.value.attribute.AttributeVO)3 ActionCancelledException (com.centurylink.mdw.common.utilities.timer.ActionCancelledException)2 Selectable (com.centurylink.mdw.designer.display.Selectable)2 ImportItem (com.centurylink.mdw.designer.utils.ImportItem)2 VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)2 CodeTimer (com.centurylink.mdw.plugin.CodeTimer)2 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)2 Combo (org.eclipse.swt.widgets.Combo)2 ProcessExporter (com.centurylink.mdw.dataaccess.ProcessExporter)1 ProcessPersister (com.centurylink.mdw.dataaccess.ProcessPersister)1 IconFactory (com.centurylink.mdw.designer.icons.IconFactory)1