Search in sources :

Example 26 with ServicePort

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);
    }
}
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 27 with ServicePort

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;
}
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 28 with ServicePort

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;
}
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

ServicePort (org.talend.repository.services.model.services.ServicePort)28 ServiceOperation (org.talend.repository.services.model.services.ServiceOperation)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)14 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)10 IRepositoryNode (org.talend.repository.model.IRepositoryNode)6 ProcessItem (org.talend.core.model.properties.ProcessItem)5 HashMap (java.util.HashMap)4 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 Definition (javax.wsdl.Definition)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