use of org.talend.repository.services.model.services.ServicePort in project tesb-studio-se by Talend.
the class OpenWSDLPage method populateModelFromWsdl.
@SuppressWarnings({ "unchecked" })
private static void populateModelFromWsdl(IProxyRepositoryFactory factory, Definition definition, ServiceItem serviceItem, RepositoryNode serviceRepositoryNode) throws CoreException {
serviceRepositoryNode.getChildren().clear();
((ServiceConnection) serviceItem.getConnection()).getServicePort().clear();
for (PortType portType : (Collection<PortType>) definition.getAllPortTypes().values()) {
ServicePort port = ServicesFactory.eINSTANCE.createServicePort();
port.setId(factory.getNextId());
port.setName(portType.getQName().getLocalPart());
for (Operation operation : (Collection<Operation>) portType.getOperations()) {
String operationName = operation.getName();
ServiceOperation serviceOperation = ServicesFactory.eINSTANCE.createServiceOperation();
serviceOperation.setId(factory.getNextId());
RepositoryNode operationNode = new RepositoryNode(new RepositoryViewObject(serviceItem.getProperty()), serviceRepositoryNode, ENodeType.REPOSITORY_ELEMENT);
operationNode.setProperties(EProperties.LABEL, serviceItem.getProperty().getLabel());
operationNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.SERVICESOPERATION);
serviceOperation.setName(operationName);
if (operation.getDocumentationElement() != null) {
serviceOperation.setDocumentation(operation.getDocumentationElement().getTextContent());
}
serviceOperation.setLabel(operationName);
serviceOperation.setInBinding(WSDLUtils.isOperationInBinding(definition, port.getName(), operationName));
port.getServiceOperation().add(serviceOperation);
}
((ServiceConnection) serviceItem.getConnection()).getServicePort().add(port);
}
}
use of org.talend.repository.services.model.services.ServicePort in project tesb-studio-se by Talend.
the class OpenJobAction method getReferenceJobId.
protected static String getReferenceJobId(IRepositoryNode node) {
String parentPortName = node.getParent().getObject().getLabel();
ServiceItem serviceItem = (ServiceItem) node.getParent().getParent().getObject().getProperty().getItem();
List<ServicePort> listPort = ((ServiceConnection) serviceItem.getConnection()).getServicePort();
for (ServicePort port : listPort) {
if (port.getName().equals(parentPortName)) {
List<ServiceOperation> listOperation = port.getServiceOperation();
for (ServiceOperation operation : listOperation) {
if (operation.getLabel().equals(node.getObject().getLabel())) {
return operation.getReferenceJobId();
}
}
break;
}
}
return null;
}
use of org.talend.repository.services.model.services.ServicePort in project tesb-studio-se by Talend.
the class ExportServiceAction method isAllOperationsAssignedJob.
private static boolean isAllOperationsAssignedJob(ServiceItem serviceItem) throws PersistenceException {
ServiceConnection connection = (ServiceConnection) serviceItem.getConnection();
List<IRepositoryViewObject> jobs = ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.PROCESS);
for (ServicePort port : connection.getServicePort()) {
for (ServiceOperation operation : port.getServiceOperation()) {
String referenceJobId = operation.getReferenceJobId();
if (referenceJobId == null || referenceJobId.equals("")) {
//$NON-NLS-1$
return false;
}
boolean found = false;
for (IRepositoryViewObject job : jobs) {
if (referenceJobId.equals(job.getId())) {
found = true;
break;
}
}
if (!found) {
return false;
}
}
}
return true;
}
Aggregations