use of org.talend.repository.model.RepositoryNode in project tesb-studio-se by Talend.
the class ESBService method updateOperation.
@Override
public void updateOperation(INode node, String linkedRepository, RepositoryNode selectNode) {
String[] ids = linkedRepository.split(" - ");
if (ids.length == 3) {
try {
IRepositoryViewObject reViewObject = ProxyRepositoryFactory.getInstance().getLastVersion(ids[0]);
ServiceItem servicesItem = (ServiceItem) reViewObject.getProperty().getItem();
ServiceConnection serConn = (ServiceConnection) servicesItem.getConnection();
String portName = "";
EList<ServicePort> portList = serConn.getServicePort();
ServiceOperation operation = null;
for (ServicePort port : portList) {
if (port.getId().equals(ids[1])) {
portName = port.getName();
EList<ServiceOperation> opeList = port.getServiceOperation();
for (ServiceOperation ope : opeList) {
if (ope.getId().equals(ids[2])) {
operation = ope;
break;
}
}
break;
}
}
if (operation == null) {
return;
}
RepositoryNode topParent = getServicesTopNode(selectNode);
changeOldOperationLabel(topParent, node, operation);
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
IProcess2 process = (IProcess2) RepositoryPlugin.getDefault().getDesignerCoreService().getCurrentProcess();
Item jobItem = process.getProperty().getItem();
String jobID = jobItem.getProperty().getId();
String jobName = jobItem.getProperty().getLabel();
if (operation.getReferenceJobId() != null && !operation.getReferenceJobId().equals(jobID)) {
changeOtherJobSchemaValue(factory, operation, /* serConn, */
selectNode);
MessageDialog.openWarning(new Shell(), Messages.ESBService_DisconnectWarningTitle, Messages.ESBService_DisconnectWarningMsg);
}
operation.setReferenceJobId(jobID);
operation.setLabel(operation.getName() + '-' + jobName);
IFile wsdlPath = WSDLUtils.getWsdlFile(selectNode);
Map<String, String> serviceParameters = WSDLUtils.getServiceOperationParameters(wsdlPath, operation.getName(), portName);
CreateNewJobAction.setProviderRequestComponentConfiguration(node, serviceParameters);
factory.save(servicesItem);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
} catch (CoreException e) {
ExceptionHandler.process(e);
}
}
}
use of org.talend.repository.model.RepositoryNode in project tesb-studio-se by Talend.
the class CreateESBAction method doRun.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
protected void doRun() {
RepositoryNode beanNode = getCurrentRepositoryNode();
if (isToolbar()) {
if (beanNode != null && beanNode.getContentType() != ESBRepositoryNodeType.SERVICES) {
beanNode = null;
}
if (beanNode == null) {
beanNode = getRepositoryNodeForDefault(ESBRepositoryNodeType.SERVICES);
}
}
ISelection selection;
IWorkbenchPage activePage = getActivePage();
if (activePage == null) {
selection = getSelection();
} else {
selection = getRepositorySelection();
}
if (selection.isEmpty()) {
return;
}
ESBWizard beanWizard = new ESBWizard(PlatformUI.getWorkbench(), true, selection);
WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), beanWizard);
dlg.open();
}
use of org.talend.repository.model.RepositoryNode in project tesb-studio-se by Talend.
the class CreateNewJobAction method doRun.
@Override
protected void doRun() {
RepositoryNode node = getSelectedRepositoryNode();
if (node == null) {
return;
}
NewProcessWizard processWizard = getNewProcessWizard(node);
WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), processWizard);
if (dlg.open() == Window.OK) {
createNewProcess(node, processWizard.getProcess());
}
}
use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.
the class ImportTreeFromRepository method run.
@Override
public void run() {
targetAbsolutePath = null;
loopNode = null;
xpathAndOrder.clear();
RepositoryXmlSelectionDialog reviewDialog = new RepositoryXmlSelectionDialog(shell, new String[] { "XML", "MDM" });
if (reviewDialog.open() == Window.OK) {
TreeNode treeNodeRoot = XmlMapUtil.getTreeNodeRoot(schemaNode);
XmlMapUtil.detachNodeConnections(treeNodeRoot, mapperManager.getExternalData(), true);
RepositoryNode repositoryNode = reviewDialog.getResult();
Item item = repositoryNode.getObject().getProperty().getItem();
String detailedMessage = "";
try {
if (item instanceof XmlFileConnectionItem) {
XmlFileConnectionItem xmlitem = (XmlFileConnectionItem) item;
XmlFileConnection connection = (XmlFileConnection) xmlitem.getConnection();
prepareEmfTreeFromXml(connection);
} else if (item instanceof MDMConnectionItem) {
String selectedSchema = (String) repositoryNode.getProperties(EProperties.LABEL);
MDMConnection connection = (MDMConnection) ((MDMConnectionItem) item).getConnection();
prepareEmfTreeFromMdm(connection, selectedSchema);
}
} catch (Exception e) {
ExceptionHandler.process(e);
StringBuffer sb = new StringBuffer();
sb.append(e.toString());
sb.append("\n");
if (e.getStackTrace() != null) {
for (StackTraceElement trace : e.getStackTrace()) {
sb.append(trace.toString());
sb.append("\n");
}
}
detailedMessage = sb.toString();
}
boolean childrenEmpty = false;
if (schemaNode.getChildren().isEmpty()) {
childrenEmpty = true;
TreeNode rootNode = createModel();
rootNode.setName("root");
rootNode.setNodeType(NodeType.ELEMENT);
rootNode.setType(XmlMapUtil.DEFAULT_DATA_TYPE);
rootNode.setXpath(XmlMapUtil.getXPath(schemaNode.getXpath(), "root", NodeType.ELEMENT));
schemaNode.getChildren().add(rootNode);
if (loopNode == null) {
schemaNode.getChildren().get(0).setLoop(true);
schemaNode.getChildren().get(0).setMain(true);
}
}
if (childrenEmpty || (detailedMessage != null && !"".equals(detailedMessage))) {
showError(detailedMessage);
}
AbstractInOutTree tree = null;
if (schemaNode.eContainer() instanceof InputXmlTree) {
XmlMapConnectionBuilder connectionBuilder = new XmlMapConnectionBuilder();
connectionBuilder.setCheckRootNodePrefix(true);
connectionBuilder.rebuildLinks(schemaNode, mapperManager.getExternalData());
mapperManager.refreshTreeSchemaEditor((InputXmlTree) schemaNode.eContainer());
// mapperManager.inputTreeSchemaBeanListModified();
tree = (InputXmlTree) schemaNode.eContainer();
} else if (schemaNode.eContainer() instanceof OutputXmlTree) {
// mapperManager.outputTreeSchemaBeanListModified();
mapperManager.refreshTreeSchemaEditor((OutputXmlTree) schemaNode.eContainer());
tree = (OutputXmlTree) schemaNode.eContainer();
}
if (tree != null) {
mapperManager.getProblemsAnalyser().checkProblems(tree);
mapperManager.getMapperUI().updateStatusBar();
}
}
}
use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.
the class StatLogsAndImplicitcontextTreeViewPage method createStatTree.
private void createStatTree(Composite composite) {
//$NON-NLS-1$
Group g = widgetFactory.createGroup(composite, Messages.getString("StatsAndLogsComposite.StatsLogsSettings"));
GridData gd = new GridData(GridData.FILL_BOTH);
g.setLayoutData(gd);
g.setLayout(new FillLayout());
statViewer = new CheckboxRepositoryTreeViewer(g, SWT.MULTI | SWT.V_SCROLL);
statContentProvider = new AllJobContentProvider(repositoryView);
statViewer.setContentProvider(statContentProvider);
statViewer.setLabelProvider(new RepositoryLabelProvider(repositoryView));
statViewer.setSorter(repositoryView.getViewer().getSorter());
IViewSite viewSite = repositoryView.getViewSite();
statViewer.setInput(viewSite);
// This only tree listener aim is to change open/close icons on folders :
statViewer.addTreeListener(new ITreeViewerListener() {
@Override
public void treeCollapsed(TreeExpansionEvent event) {
RepositoryNode node = (RepositoryNode) event.getElement();
if (node.getType().equals(ENodeType.SIMPLE_FOLDER)) {
TreeItem item = getObject(statViewer.getTree(), event.getElement());
if (item != null) {
item.setImage(ImageProvider.getImage(ECoreImage.FOLDER_CLOSE_ICON));
}
}
}
@Override
public void treeExpanded(TreeExpansionEvent event) {
RepositoryNode node = (RepositoryNode) event.getElement();
if (node.getType().equals(ENodeType.SIMPLE_FOLDER)) {
TreeItem item = getObject(statViewer.getTree(), event.getElement());
if (item != null) {
item.setImage(ImageProvider.getImage(ECoreImage.FOLDER_OPEN_ICON));
}
}
}
});
statViewer.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
RepositoryNode node = (RepositoryNode) event.getElement();
List<RepositoryNode> objects = new ArrayList<RepositoryNode>();
processItems(objects, node);
if (event.getChecked()) {
statAddedObjects.addAll(objects);
statRemovedObjects.removeAll(objects);
statCheckedObjects.addAll(objects);
} else {
statAddedObjects.removeAll(objects);
statRemovedObjects.addAll(objects);
statCheckedObjects.removeAll(objects);
}
// set checked
statViewer.setCheckedElements(statCheckedObjects.toArray());
// viewer.refresh();
}
});
RepositoryNode[] nodes = statContentProvider.getContents();
List<RepositoryNode> objects = new ArrayList<RepositoryNode>();
if (nodes != null) {
for (RepositoryNode n : nodes) {
processItems(objects, n);
for (RepositoryNode node : objects) {
if (isStatUseProjectSetting(node)) {
if (!statCheckedObjects.contains(node)) {
statCheckedObjects.add(node);
}
}
}
}
}
statViewer.setCheckedElements(statCheckedObjects.toArray());
if (nodes != null) {
statViewer.setExpandedElements(nodes);
}
}
Aggregations