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();
}
}
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);
}
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;
}
Aggregations