Search in sources :

Example 16 with ExternalEvent

use of com.centurylink.mdw.plugin.designer.model.ExternalEvent in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerDragSource method dragSetData.

@Override
public void dragSetData(DragSourceEvent event) {
    if (TextTransfer.getInstance().isSupportedType(event.dataType)) {
        IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
        List<?> elements = selection.toList();
        StringBuilder data = new StringBuilder();
        for (int i = 0; i < elements.size(); i++) {
            Object element = elements.get(i);
            if (element instanceof WorkflowProcess || element instanceof ExternalEvent || element instanceof ActivityImpl || element instanceof WorkflowAsset) {
                data.append(element.toString());
                if (i < elements.size() - 1)
                    data.append("#");
            }
        }
        event.data = data.toString();
    }
}
Also used : ActivityImpl(com.centurylink.mdw.plugin.designer.model.ActivityImpl) WorkflowAsset(com.centurylink.mdw.plugin.designer.model.WorkflowAsset) ExternalEvent(com.centurylink.mdw.plugin.designer.model.ExternalEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Example 17 with ExternalEvent

use of com.centurylink.mdw.plugin.designer.model.ExternalEvent in project mdw-designer by CenturyLinkCloud.

the class EventHandler method createExternalEvent.

public ExternalEvent createExternalEvent(String handlerString) {
    ExternalEventVO externalEventVO = new ExternalEventVO();
    if (eventName != null && eventName.length() > 0)
        externalEventVO.setEventName(eventName);
    else
        externalEventVO.setEventName(messagePattern);
    externalEventVO.setMessagePattern(messagePattern);
    externalEventVO.setEventHandler(handlerString);
    WorkflowPackage workflowPackage = getPackage() == null ? getProject().getDefaultPackage() : getPackage();
    return new ExternalEvent(externalEventVO, workflowPackage);
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) ExternalEventVO(com.centurylink.mdw.model.value.event.ExternalEventVO) ExternalEvent(com.centurylink.mdw.plugin.designer.model.ExternalEvent)

Example 18 with ExternalEvent

use of com.centurylink.mdw.plugin.designer.model.ExternalEvent in project mdw-designer by CenturyLinkCloud.

the class AssetSearchQuery method run.

public IStatus run(IProgressMonitor monitor) throws OperationCanceledException {
    if (getScopedProjects().isEmpty() && getSelectedPackage() != null)
        getScopedProjects().add(getSelectedPackage().getProject());
    if (getScopedProjects().isEmpty()) {
        String msg = "No MDW projects in search scope.";
        showError(msg, "MDW Search", null);
        return new Status(IStatus.WARNING, MdwPlugin.getPluginId(), 0, msg, null);
    }
    for (WorkflowProject project : getScopedProjects()) {
        if (getSearchType().equals(SearchType.ENTITY_BY_NAME) || (getSearchType().equals(SearchType.ENTITY_BY_ID) && getPattern().equals("*"))) {
            if (getResourceType().equalsIgnoreCase("External Event Handler")) {
                for (ExternalEvent eventHandler : project.getAllExternalEvents()) {
                    String name = isCaseSensitive() ? eventHandler.getName() : eventHandler.getName().toLowerCase();
                    if ((getPattern().equals("*") || name.indexOf(getPattern()) >= 0) && (getSelectedPackage() == null || (eventHandler.getPackage() != null && eventHandler.getPackage().equals(getSelectedPackage()))))
                        getSearchResults().addMatchingElement(eventHandler);
                }
            } else {
                for (WorkflowAsset asset : project.getAllWorkflowAssets()) {
                    if (asset.getLanguage().equalsIgnoreCase(getResourceType())) {
                        String name = isCaseSensitive() ? asset.getName() : asset.getName().toLowerCase();
                        if ((getPattern().equals("*") || name.indexOf(getPattern()) >= 0) && (getSelectedPackage() == null || (asset.getPackage() != null && asset.getPackage().equals(getSelectedPackage()))))
                            getSearchResults().addMatchingElement(asset);
                    }
                }
            }
        } else if (getSearchType().equals(SearchType.CONTAINING_TEXT)) {
            if (getResourceType().equalsIgnoreCase("External Event Handler")) {
                for (ExternalEvent eventHandler : project.getAllExternalEvents()) {
                    String name = isCaseSensitive() ? eventHandler.getName() : eventHandler.getName().toLowerCase();
                    if ((getPattern().equals("*") || name.indexOf(getPattern()) >= 0) && (getSelectedPackage() == null || (eventHandler.getPackage() != null && eventHandler.getPackage().equals(getSelectedPackage())))) {
                        // resource name pattern is matched, check for
                        // contained text
                        String searchText = isCaseSensitive() ? getContainedText() : getContainedText().toLowerCase();
                        searchText = searchText.replaceAll("\\*", "");
                        if (eventHandler.getName().indexOf(searchText) >= 0)
                            getSearchResults().addMatchingElement(eventHandler);
                    }
                }
            } else {
                for (WorkflowAsset asset : project.getAllWorkflowAssets()) {
                    if (asset.getLanguage().equalsIgnoreCase(getResourceType())) {
                        String name = isCaseSensitive() ? asset.getName() : asset.getName().toLowerCase();
                        if ((getPattern().equals("*") || name.indexOf(getPattern()) >= 0) && (getSelectedPackage() == null || (asset.getPackage() != null && asset.getPackage().equals(getSelectedPackage())))) {
                            // resource name pattern is matched, check for
                            // contained text
                            asset = asset.getProject().getDesignerProxy().loadWorkflowAsset(asset);
                            if (!asset.isBinary()) {
                                String content = isCaseSensitive() ? asset.getContent() : asset.getContent().toLowerCase();
                                String searchText = isCaseSensitive() ? getContainedText() : getContainedText().toLowerCase();
                                searchText = searchText.replaceAll("\\*", "");
                                if (content.indexOf(searchText) >= 0)
                                    getSearchResults().addMatchingElement(asset);
                            }
                        }
                    }
                }
            }
        } else if (getSearchType().equals(SearchType.ENTITY_BY_ID)) {
            WorkflowAsset asset = project.getAsset(new Long(getPattern()));
            if (asset != null && asset.getLanguage().equalsIgnoreCase(getResourceType()))
                getSearchResults().addMatchingElement(asset);
        } else {
            showError("Unsupported search type: " + getSearchType(), "MDW Search", null);
        }
    }
    if (getSearchResults().getMatchingElements().size() == 0)
        return new Status(IStatus.WARNING, MdwPlugin.getPluginId(), 0, "No matching elements found", null);
    else
        return Status.OK_STATUS;
}
Also used : Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) WorkflowAsset(com.centurylink.mdw.plugin.designer.model.WorkflowAsset) ExternalEvent(com.centurylink.mdw.plugin.designer.model.ExternalEvent) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject)

Aggregations

ExternalEvent (com.centurylink.mdw.plugin.designer.model.ExternalEvent)18 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)11 WorkflowAsset (com.centurylink.mdw.plugin.designer.model.WorkflowAsset)8 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)8 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)7 PartInitException (org.eclipse.ui.PartInitException)6 WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)5 ActivityImpl (com.centurylink.mdw.plugin.designer.model.ActivityImpl)4 AutomatedTestCase (com.centurylink.mdw.plugin.designer.model.AutomatedTestCase)4 TaskTemplate (com.centurylink.mdw.plugin.designer.model.TaskTemplate)4 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 ExternalEventVO (com.centurylink.mdw.model.value.event.ExternalEventVO)3 ArrayList (java.util.ArrayList)3 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)3 IEditorPart (org.eclipse.ui.IEditorPart)3 DesignerProxy (com.centurylink.mdw.plugin.designer.DesignerProxy)2 Activity (com.centurylink.mdw.plugin.designer.model.Activity)2 AdapterActivity (com.centurylink.mdw.plugin.designer.model.Activity.AdapterActivity)2 EvaluatorActivity (com.centurylink.mdw.plugin.designer.model.Activity.EvaluatorActivity)2