use of org.talend.repository.model.IRepositoryNode in project tesb-studio-se by Talend.
the class OpenCamelExistVersionProcessAction method init.
// http://jira.talendforge.org/browse/TESB-5930
@Override
public void init(TreeViewer viewer, IStructuredSelection selection) {
boolean canWork = selection.size() == 1;
if (canWork) {
Object o = selection.getFirstElement();
if (o instanceof IRepositoryNode) {
IRepositoryNode node = (IRepositoryNode) o;
switch(node.getType()) {
case REPOSITORY_ELEMENT:
if (node.getObjectType() == CamelRepositoryNodeType.repositoryRoutesType) {
canWork = true;
} else {
canWork = false;
}
break;
default:
canWork = false;
break;
}
if (canWork) {
canWork = node.getObject().getRepositoryStatus() != ERepositoryStatus.DELETED;
}
if (canWork) {
canWork = isLastVersion(node);
}
}
}
setEnabled(canWork);
}
use of org.talend.repository.model.IRepositoryNode in project tesb-studio-se by Talend.
the class ReadCamelProcess method init.
@Override
public void init(TreeViewer viewer, IStructuredSelection selection) {
boolean canWork = !selection.isEmpty() && selection.size() == 1;
if (canWork) {
final IRepositoryNode node = (IRepositoryNode) selection.getFirstElement();
canWork = node.getType() == ENodeType.REPOSITORY_ELEMENT && //&& ProxyRepositoryFactory.getInstance().getStatus(node.getObject()) != ERepositoryStatus.LOCK_BY_USER
node.getObjectType() == CamelRepositoryNodeType.repositoryRoutesType && !RepositoryManager.isOpenedItemInEditor(node.getObject());
}
setEnabled(canWork);
}
use of org.talend.repository.model.IRepositoryNode in project tesb-studio-se by Talend.
the class CreateCamelProcess method init.
@Override
public void init(TreeViewer viewer, IStructuredSelection selection) {
boolean canWork = !selection.isEmpty() && selection.size() == 1;
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
if (factory.isUserReadOnlyOnCurrentProject()) {
canWork = false;
}
if (canWork) {
IRepositoryNode node = (IRepositoryNode) selection.getFirstElement();
switch(node.getType()) {
case SIMPLE_FOLDER:
case SYSTEM_FOLDER:
ERepositoryObjectType nodeType = (ERepositoryObjectType) node.getProperties(EProperties.CONTENT_TYPE);
if (nodeType != null && !nodeType.equals(getProcessType()) && !nodeType.equals(CamelRepositoryNodeType.repositoryRouteDesinsType)) {
canWork = false;
}
if (node.getObject() != null && node.getObject().isDeleted()) {
canWork = false;
}
break;
default:
canWork = false;
}
if (canWork && !ProjectManager.getInstance().isInCurrentMainProject(node)) {
canWork = false;
}
}
setEnabled(canWork);
}
use of org.talend.repository.model.IRepositoryNode in project tesb-studio-se by Talend.
the class ESBService method changeOldOperationLabel.
// public AbstractMetadataObject getServicesOperation(Connection connection, String operationName) {
// List<ServiceOperation> list = new ArrayList<ServiceOperation>();
// if (connection instanceof ServiceConnection) {
// ServiceConnection serConnection = (ServiceConnection) connection;
// EList<ServicePort> serPort = serConnection.getServicePort();
// for (ServicePort port : serPort) {
// list.addAll(port.getServiceOperation());
// }
// }
// for (ServiceOperation ope : list) {
// if (ope.getLabel().equals(operationName)) {
// return ope;
// }
// }
// return null;
// }
// public void changeOperationLabel(RepositoryNode newNode, INode node, Connection connection) {
// if (!(connection instanceof ServiceConnection)) {
// return;
// }
// ServiceConnection serConn = (ServiceConnection) connection;
// changeOldOperationLabel(serConn, node);
// changenewOperationLabel(newNode, node, serConn);
// }
private void changeOldOperationLabel(RepositoryNode topParent, INode node, ServiceOperation newOperation) {
// here should be all the ports, not just ports of one connection
List<IRepositoryNode> nodeList = topParent.getChildren();
IElementParameter elePara = node.getElementParameter("PROPERTY:" + EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
if (elePara == null) {
return;
}
ServiceConnection serConn = null;
ServiceItem servicesItem = null;
String paraValue = (String) elePara.getValue();
if (paraValue == null || "".equals(paraValue)) {
return;
}
String connID = null;
if (paraValue.contains(" - ")) {
connID = paraValue.split(" - ")[0];
} else {
connID = paraValue;
}
for (IRepositoryNode repNode : nodeList) {
String id = repNode.getObject().getProperty().getId();
if (id.equals(connID)) {
servicesItem = (ServiceItem) repNode.getObject().getProperty().getItem();
serConn = (ServiceConnection) servicesItem.getConnection();
break;
}
}
if (serConn == null) {
return;
}
EList<ServicePort> portList = serConn.getServicePort();
IElementParameter portPara = node.getElementParameter(WSDLUtils.PORT_NAME);
IElementParameter opePara = node.getElementParameter(WSDLUtils.OPERATION_NAME);
if (portPara != null && opePara != null) {
String portValue = (String) portPara.getValue();
String opeValue = (String) opePara.getValue();
if (portValue != null && !"".equals(portValue) && opeValue != null && !"".equals(opeValue)) {
out: for (ServicePort port : portList) {
if (port.getName().equals(portValue)) {
for (ServiceOperation ope : port.getServiceOperation()) {
if (ope.getName().equals(opeValue) && newOperation != null && !ope.getId().equals(newOperation.getId())) {
ope.setLabel(opeValue);
ope.setReferenceJobId(null);
if (servicesItem != null) {
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
try {
factory.save(servicesItem);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
break out;
}
}
}
}
}
}
}
use of org.talend.repository.model.IRepositoryNode in project tesb-studio-se by Talend.
the class ESBService method getAllTheJObNames.
@Override
public StringBuffer getAllTheJObNames(IRepositoryNode jobObject) {
StringBuffer jobNames = null;
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
List<IRepositoryNode> jobList = new ArrayList<IRepositoryNode>();
if (jobObject.getObjectType() == ERepositoryObjectType.PROCESS) {
jobList.add(jobObject);
} else if (jobObject.getObjectType() == ERepositoryObjectType.FOLDER) {
jobList = getJobObject(jobObject);
}
try {
List<IRepositoryViewObject> repList = factory.getAll(getServicesType());
for (IRepositoryNode node : jobList) {
ERepositoryObjectType repositoryObjectType = node.getObjectType();
if (repositoryObjectType != ERepositoryObjectType.PROCESS) {
continue;
}
String jobID = node.getObject().getProperty().getId();
for (IRepositoryViewObject obj : repList) {
ServiceItem item = (ServiceItem) obj.getProperty().getItem();
ServiceConnection conn = (ServiceConnection) item.getConnection();
middle: for (ServicePort port : conn.getServicePort()) {
for (ServiceOperation operation : port.getServiceOperation()) {
if (operation.getReferenceJobId() != null && operation.getReferenceJobId().endsWith(jobID)) {
if (jobNames == null) {
jobNames = new StringBuffer(node.getObject().getProperty().getLabel());
} else {
jobNames.append(",");
jobNames.append(node.getObject().getProperty().getLabel());
}
break middle;
}
}
}
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
return jobNames;
}
Aggregations