Search in sources :

Example 1 with ServiceExportManager

use of org.talend.repository.services.ui.scriptmanager.ServiceExportManager in project tesb-studio-se by Talend.

the class ExportServiceAction method init.

private void init(String targetPath) throws InvocationTargetException {
    serviceName = serviceItem.getProperty().getLabel();
    serviceVersion = serviceItem.getProperty().getVersion();
    serviceWsdl = WSDLUtils.getWsdlFile(serviceItem);
    ServiceConnection serviceConnection = (ServiceConnection) serviceItem.getConnection();
    additionalInfo = serviceConnection.getAdditionalInfo().map();
    EList<ServicePort> listPort = serviceConnection.getServicePort();
    List<IRepositoryViewObject> jobs;
    try {
        jobs = ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.PROCESS);
    } catch (PersistenceException e) {
        throw new InvocationTargetException(e);
    }
    for (ServicePort port : listPort) {
        List<ServiceOperation> listOperation = port.getServiceOperation();
        Map<String, String> operations = new HashMap<String, String>(listOperation.size());
        for (ServiceOperation operation : listOperation) {
            String jobId = operation.getReferenceJobId();
            if (jobId != null && !jobId.equals("")) {
                String operationName = operation.getName();
                IRepositoryViewObject jobNode = null;
                for (IRepositoryViewObject job : jobs) {
                    if (job.getId().equals(jobId)) {
                        jobNode = job;
                        break;
                    }
                }
                if (jobNode == null) {
                    continue;
                }
                String jobName = jobNode.getLabel();
                operations.put(operationName, jobName);
                nodes.add(jobNode);
                contextValues.putAll(JobContextUtils.getContextsMap((ProcessItem) jobNode.getProperty().getItem()));
            }
        }
        ports.put(port, operations);
    }
    if (this.serviceManager == null) {
        this.serviceManager = new ServiceExportManager(exportChoiceMap);
    }
    serviceManager.setDestinationPath(targetPath);
    tempFolder = getTmpFolderPath();
}
Also used : ServicePort(org.talend.repository.services.model.services.ServicePort) ServiceConnection(org.talend.repository.services.model.services.ServiceConnection) HashMap(java.util.HashMap) ServiceExportManager(org.talend.repository.services.ui.scriptmanager.ServiceExportManager) ServiceOperation(org.talend.repository.services.model.services.ServiceOperation) InvocationTargetException(java.lang.reflect.InvocationTargetException) ProcessItem(org.talend.core.model.properties.ProcessItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 HashMap (java.util.HashMap)1 PersistenceException (org.talend.commons.exception.PersistenceException)1 ProcessItem (org.talend.core.model.properties.ProcessItem)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 ServiceConnection (org.talend.repository.services.model.services.ServiceConnection)1 ServiceOperation (org.talend.repository.services.model.services.ServiceOperation)1 ServicePort (org.talend.repository.services.model.services.ServicePort)1 ServiceExportManager (org.talend.repository.services.ui.scriptmanager.ServiceExportManager)1