Search in sources :

Example 51 with ProcessItem

use of org.talend.core.model.properties.ProcessItem in project tesb-studio-se by Talend.

the class RouteInputProcessTypeController method refresh.

@Override
public void refresh(IElementParameter param, boolean check) {
    IElementParameter processTypeParameter = param.getChildParameters().get(EParameterName.PROCESS_TYPE_PROCESS.getName());
    if (processTypeParameter == null) {
        super.refresh(processTypeParameter, check);
        return;
    }
    Object processId = processTypeParameter.getValue();
    if (processId == null) {
        super.refresh(processTypeParameter, check);
        return;
    }
    ProcessItem pi = ItemCacheManager.getProcessItem(processId.toString());
    if (!CamelDesignerUtil.checkRouteInputExistInJob(pi)) {
        clearAll(param, processTypeParameter);
    } else {
        super.refresh(param, check);
    }
}
Also used : ProcessItem(org.talend.core.model.properties.ProcessItem) IElementParameter(org.talend.core.model.process.IElementParameter)

Example 52 with ProcessItem

use of org.talend.core.model.properties.ProcessItem in project tesb-studio-se by Talend.

the class ConsumerFaultResponseMigrationTask method addMoreFaultResponseMessage.

private void addMoreFaultResponseMessage(Item item) throws PersistenceException {
    if (item instanceof ProcessItem) {
        ProcessType processType = ((ProcessItem) item).getProcess();
        for (Object o : processType.getNode()) {
            if (o instanceof NodeType) {
                NodeType currentNode = (NodeType) o;
                if ("tESBConsumer".equals(currentNode.getComponentName())) {
                    Iterator<?> iterator = currentNode.getMetadata().iterator();
                    while (iterator.hasNext()) {
                        MetadataType metadataType = (MetadataType) iterator.next();
                        if ("FAULT".equals(metadataType.getConnector())) {
                            EList<?> column = metadataType.getColumn();
                            addColumn(column, faultActor);
                            addColumn(column, faultCode);
                            addColumn(column, faultNode);
                            addColumn(column, faultRole);
                        }
                    }
                }
            }
        }
        FACTORY.save(item, true);
    }
}
Also used : ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) ProcessItem(org.talend.core.model.properties.ProcessItem) NodeType(org.talend.designer.core.model.utils.emf.talendfile.NodeType) MetadataType(org.talend.designer.core.model.utils.emf.talendfile.MetadataType)

Example 53 with ProcessItem

use of org.talend.core.model.properties.ProcessItem in project tesb-studio-se by Talend.

the class ExportServiceAction method addRequiredFeatures.

private void addRequiredFeatures(FeaturesModel features) {
    // add correlation feature
    ServiceConnection connection = (ServiceConnection) serviceItem.getConnection();
    String useRegistry = connection.getAdditionalInfo().get(ServiceMetadataDialog.USE_SERVICE_REGISTRY);
    if (!"true".equals(useRegistry)) {
        String useCorrelation = connection.getAdditionalInfo().get(ServiceMetadataDialog.USE_BUSINESS_CORRELATION);
        if ("true".equals(useCorrelation)) {
            features.addFeature(new FeatureModel(FeaturesModel.CORRELATION_FEATURE_NAME));
        }
    }
    // add talend-data-mapper feature
    for (IRepositoryViewObject node : nodes) {
        ProcessItem processItem = (ProcessItem) node.getProperty().getItem();
        if (null != EmfModelUtils.getComponentByName(processItem, THMAP_COMPONENT_NAME)) {
            features.addFeature(new FeatureModel(FeaturesModel.TALEND_DATA_MAPPER_FEATURE_NAME));
            break;
        }
    }
}
Also used : ServiceConnection(org.talend.repository.services.model.services.ServiceConnection) ProcessItem(org.talend.core.model.properties.ProcessItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) FeatureModel(org.talend.designer.publish.core.models.FeatureModel)

Example 54 with ProcessItem

use of org.talend.core.model.properties.ProcessItem 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)

Example 55 with ProcessItem

use of org.talend.core.model.properties.ProcessItem in project tdi-studio-se by Talend.

the class JobJavaScriptsWSManager method getExportResources.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.repository.ui.wizards.exportjob.scriptsmanager.JobJavaScriptsManager#getExportResources
     * (org.talend.repository.ui.wizards.exportjob.ExportFileResource[], java.util.Map, java.lang.String,
     * java.lang.String, int, int, java.lang.String[])
     */
@Override
public List<ExportFileResource> getExportResources(ExportFileResource[] process, String... codeOptions) throws ProcessorException {
    List<ExportFileResource> list = new ArrayList<ExportFileResource>();
    boolean needJob = true;
    boolean needSource = isOptionChoosed(ExportChoice.needSourceCode);
    boolean needContext = isOptionChoosed(ExportChoice.needContext);
    //$NON-NLS-1$
    ExportFileResource libResource = new ExportFileResource(null, "WEB-INF/lib");
    //$NON-NLS-1$
    ExportFileResource contextResource = new ExportFileResource(null, "WEB-INF/classes");
    //$NON-NLS-1$
    ExportFileResource srcResource = new ExportFileResource(null, "WEB-INF");
    if (needJob) {
        list.add(libResource);
    }
    if (needContext) {
        list.add(contextResource);
    }
    if (needSource) {
        list.add(srcResource);
    }
    copyServerConfigFileToTempDir();
    // set export config mode now only to be sure that the libraries will be setup for an export mode, and not
    // editor mode.
    //$NON-NLS-1$
    ProcessorUtilities.setExportConfig("java", "", "");
    for (ExportFileResource exportResource : process) {
        ProcessItem processItem = (ProcessItem) exportResource.getItem();
        String selectedJobVersion = processItem.getProperty().getVersion();
        if (!isMultiNodes() && this.getSelectedJobVersion() != null) {
            selectedJobVersion = this.getSelectedJobVersion();
        }
        if (!isOptionChoosed(ExportChoice.doNotCompileCode)) {
            generateJobFiles(processItem, contextName, selectedJobVersion, statisticPort != IProcessor.NO_STATISTICS, tracePort != IProcessor.NO_TRACES, isOptionChoosed(ExportChoice.applyToChildren), progressMonitor);
        }
    }
    // Gets talend libraries
    List<URL> talendLibraries = getExternalLibraries(true, process);
    libResource.addResources(talendLibraries);
    // Add log4j files if needed
    if (Log4jPrefsSettingManager.getInstance().isLog4jEnable()) {
        addLog4jXmlToRes(contextResource);
    }
    for (ExportFileResource proces : process) {
        ProcessItem processItem = (ProcessItem) proces.getItem();
        String selectedJobVersion = processItem.getProperty().getVersion();
        if (!isMultiNodes() && this.getSelectedJobVersion() != null) {
            selectedJobVersion = this.getSelectedJobVersion();
        }
        ProcessorUtilities.setExportConfig(proces.getDirectoryName(), true);
        // if (!isOptionChoosed(ExportChoice.doNotCompileCode)) {
        // generateJobFiles(processItem, contextName, selectedJobVersion, statisticPort != IProcessor.NO_STATISTICS,
        // tracePort != IProcessor.NO_TRACES, isOptionChoosed(ExportChoice.applyToChildren), progressMonitor);
        // }
        // generate the WSDL file
        ExportFileResource wsdlFile = getWSDLFile(processItem, isOptionChoosed(ExportChoice.needWSDL), talendLibraries);
        list.add(wsdlFile);
        // edit the WSDD file
        editWSDDFile(processItem);
        // add children jobs
        boolean needChildren = true;
        addSubJobResources(process, processItem, needChildren, exportChoice, libResource, contextResource, srcResource, selectedJobVersion);
        // generate the context file
        getContextScripts(processItem, needContext, contextResource, selectedJobVersion);
        // generate jar file for job
        libResource.addResources(getJobScripts(processItem, selectedJobVersion, needJob));
        // dynamic db xml mapping
        addXmlMapping(proces, isOptionChoosed(ExportChoice.needSourceCode));
    }
    // generate Server Config file
    ExportFileResource serverConfigFile = getServerConfigFile(isOptionChoosed(ExportChoice.needCONFIGFILE));
    list.add(serverConfigFile);
    // generate the WSDD file
    ExportFileResource wsddFile = getWSDDFile(isOptionChoosed(ExportChoice.needWSDD));
    list.add(wsddFile);
    // generate the WEB-INFO folder
    ExportFileResource webInfoFolder = getWebXMLFile(isOptionChoosed(ExportChoice.needWEBXML));
    list.add(webInfoFolder);
    // generate the META-INFO folder
    ExportFileResource metaInfoFolder = genMetaInfoFolder(isOptionChoosed(ExportChoice.needMetaInfo));
    list.add(metaInfoFolder);
    // Gets system routines
    List<URL> systemRoutineList = getSystemRoutine(process);
    libResource.addResources(systemRoutineList);
    // Gets user routines
    List<URL> userRoutineList = getUserRoutine(process);
    libResource.addResources(userRoutineList);
    // Gets axis libraries
    List<ModuleNeeded> newAxisLib = new ArrayList<ModuleNeeded>(axisLib);
    for (URL libUrl : talendLibraries) {
        if (libUrl.getFile() != null) {
            newAxisLib.remove(new File(libUrl.getFile()).getName());
        }
    }
    List<URL> axisLibList = getLib(newAxisLib, isOptionChoosed(ExportChoice.needAXISLIB));
    libResource.addResources(axisLibList);
    return list;
}
Also used : ProcessItem(org.talend.core.model.properties.ProcessItem) ExportFileResource(org.talend.repository.documentation.ExportFileResource) ArrayList(java.util.ArrayList) ModuleNeeded(org.talend.core.model.general.ModuleNeeded) File(java.io.File) URL(java.net.URL)

Aggregations

ProcessItem (org.talend.core.model.properties.ProcessItem)160 PersistenceException (org.talend.commons.exception.PersistenceException)49 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)49 ArrayList (java.util.ArrayList)44 Item (org.talend.core.model.properties.Item)40 JobletProcessItem (org.talend.core.model.properties.JobletProcessItem)37 Property (org.talend.core.model.properties.Property)30 IProcess2 (org.talend.core.model.process.IProcess2)24 ProcessType (org.talend.designer.core.model.utils.emf.talendfile.ProcessType)24 IProcess (org.talend.core.model.process.IProcess)23 File (java.io.File)22 IDesignerCoreService (org.talend.designer.core.IDesignerCoreService)21 NodeType (org.talend.designer.core.model.utils.emf.talendfile.NodeType)21 ExportFileResource (org.talend.repository.documentation.ExportFileResource)21 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)21 IOException (java.io.IOException)20 INode (org.talend.core.model.process.INode)20 List (java.util.List)19 EList (org.eclipse.emf.common.util.EList)19 ProcessorException (org.talend.designer.runprocess.ProcessorException)17