Search in sources :

Example 16 with ServiceOperation

use of org.talend.repository.services.model.services.ServiceOperation in project tesb-studio-se by Talend.

the class ESBRepositoryContentHandler method addContents.

@Override
public void addContents(Collection<EObject> collection, Resource resource) {
    if (collection != null && collection.size() > 0) {
        for (EObject object : collection) {
            if (object instanceof ServiceConnection) {
                ServiceConnection serviceConnection = (ServiceConnection) object;
                List<ServicePort> listPort = serviceConnection.getServicePort();
                for (ServicePort port : listPort) {
                    resource.getContents().add(port);
                    List<ServiceOperation> listOperation = port.getServiceOperation();
                    for (ServiceOperation operation : listOperation) {
                        resource.getContents().add(operation);
                    }
                }
            }
        }
    }
}
Also used : ServicePort(org.talend.repository.services.model.services.ServicePort) ServiceConnection(org.talend.repository.services.model.services.ServiceConnection) EObject(org.eclipse.emf.ecore.EObject) ServiceOperation(org.talend.repository.services.model.services.ServiceOperation)

Example 17 with ServiceOperation

use of org.talend.repository.services.model.services.ServiceOperation in project tesb-studio-se by Talend.

the class ESBRepositoryContentHandler method save.

private Resource save(ServiceItem item) {
    Resource itemResource = xmiResourceManager.getItemResource(item);
    itemResource.getContents().clear();
    itemResource.getContents().add(item.getConnection());
    for (ServicePort port : ((ServiceConnection) item.getConnection()).getServicePort()) {
        itemResource.getContents().add(port);
        for (ServiceOperation operation : port.getServiceOperation()) {
            itemResource.getContents().add(operation);
        }
    }
    return itemResource;
}
Also used : ServicePort(org.talend.repository.services.model.services.ServicePort) ServiceConnection(org.talend.repository.services.model.services.ServiceConnection) Resource(org.eclipse.emf.ecore.resource.Resource) ServiceOperation(org.talend.repository.services.model.services.ServiceOperation)

Example 18 with ServiceOperation

use of org.talend.repository.services.model.services.ServiceOperation 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);
    }
}
Also used : ServicePort(org.talend.repository.services.model.services.ServicePort) Collection(java.util.Collection) Operation(javax.wsdl.Operation) ServiceOperation(org.talend.repository.services.model.services.ServiceOperation) ServiceOperation(org.talend.repository.services.model.services.ServiceOperation) RepositoryNode(org.talend.repository.model.RepositoryNode) PortType(javax.wsdl.PortType) RepositoryViewObject(org.talend.core.model.repository.RepositoryViewObject)

Example 19 with ServiceOperation

use of org.talend.repository.services.model.services.ServiceOperation 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;
}
Also used : ServicePort(org.talend.repository.services.model.services.ServicePort) ServiceConnection(org.talend.repository.services.model.services.ServiceConnection) ServiceItem(org.talend.repository.services.model.services.ServiceItem) ServiceOperation(org.talend.repository.services.model.services.ServiceOperation)

Example 20 with ServiceOperation

use of org.talend.repository.services.model.services.ServiceOperation 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;
}
Also used : ServicePort(org.talend.repository.services.model.services.ServicePort) ServiceConnection(org.talend.repository.services.model.services.ServiceConnection) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ServiceOperation(org.talend.repository.services.model.services.ServiceOperation)

Aggregations

ServiceOperation (org.talend.repository.services.model.services.ServiceOperation)26 ServicePort (org.talend.repository.services.model.services.ServicePort)26 ServiceConnection (org.talend.repository.services.model.services.ServiceConnection)25 ServiceItem (org.talend.repository.services.model.services.ServiceItem)17 PersistenceException (org.talend.commons.exception.PersistenceException)15 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)12 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)10 IRepositoryNode (org.talend.repository.model.IRepositoryNode)6 ProcessItem (org.talend.core.model.properties.ProcessItem)5 IFile (org.eclipse.core.resources.IFile)4 ConnectionItem (org.talend.core.model.properties.ConnectionItem)4 Item (org.talend.core.model.properties.Item)4 RepositoryNode (org.talend.repository.model.RepositoryNode)4 ArrayList (java.util.ArrayList)3 CoreException (org.eclipse.core.runtime.CoreException)3 INode (org.talend.core.model.process.INode)3 IProcess2 (org.talend.core.model.process.IProcess2)3 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 Operation (javax.wsdl.Operation)2