Search in sources :

Example 21 with ElementParameterType

use of org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType in project tdi-studio-se by Talend.

the class LimitESBConsumerJobChecker method checkLimitFeaturesWhenBuildStandalone.

private String checkLimitFeaturesWhenBuildStandalone(NodeType nodeType) {
    @SuppressWarnings("unchecked") List<ElementParameterType> params = nodeType.getElementParameter();
    boolean useLocator = false;
    boolean useSAM = false;
    for (ElementParameterType param : params) {
        // check Use_Registry has priority to SL/SAM.
        if (PluginChecker.isTIS() && param.getName().equals("USE_SR") && "true".equals(param.getValue())) {
            return Messages.getString("LimitESBConsumerJobChecker.limitFeaturesWithStandalone.SR", nodeType.getComponentName());
        }
        if (param.getName().equals("SERVICE_LOCATOR") && "true".equals(param.getValue())) {
            useLocator = true;
        }
        if (param.getName().equals("SERVICE_ACTIVITY_MONITOR") && "true".equals(param.getValue())) {
            useSAM = true;
        }
    }
    if (useLocator) {
        return Messages.getString("LimitESBConsumerJobChecker.limitFeaturesWithStandalone.locator", nodeType.getComponentName());
    }
    if (useSAM) {
        return Messages.getString("LimitESBConsumerJobChecker.limitFeaturesWithStandalone.SAM", nodeType.getComponentName());
    }
    return null;
}
Also used : ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType)

Example 22 with ElementParameterType

use of org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType in project tesb-studio-se by Talend.

the class JavaCamelJobScriptsExportWSAction method exportAllReferenceRoutelets.

@SuppressWarnings("unchecked")
protected final void exportAllReferenceRoutelets(String routeName, ProcessItem routeProcess, Set<String> routelets) throws InvocationTargetException, InterruptedException {
    for (NodeType node : (Collection<NodeType>) routeProcess.getProcess().getNode()) {
        if (!EmfModelUtils.isComponentActive(node)) {
            continue;
        }
        final ElementParameterType routeletId = EmfModelUtils.findElementParameterByName(EParameterName.PROCESS_TYPE.getName() + ':' + EParameterName.PROCESS_TYPE_PROCESS.getName(), node);
        if (null != routeletId) {
            final IRepositoryNode referencedRouteletNode;
            try {
                referencedRouteletNode = getJobRepositoryNode(routeletId.getValue(), CamelRepositoryNodeType.repositoryRouteletType);
            // getRouteletRepositoryNode(routeletId);
            } catch (PersistenceException e) {
                throw new InvocationTargetException(e);
            }
            final ProcessItem routeletProcess = (ProcessItem) referencedRouteletNode.getObject().getProperty().getItem();
            final String className = RouteJavaScriptOSGIForESBManager.getClassName(routeletProcess);
            String idSuffix = "-" + routeName;
            if (!routelets.add(className + idSuffix)) {
                continue;
            }
            String routeletVersion = EmfModelUtils.findElementParameterByName(EParameterName.PROCESS_TYPE.getName() + ':' + EParameterName.PROCESS_TYPE_VERSION.getName(), node).getValue();
            if (RelationshipItemBuilder.LATEST_VERSION.equals(routeletVersion)) {
                routeletVersion = referencedRouteletNode.getObject().getVersion();
            }
            final File routeletFile;
            try {
                routeletFile = File.createTempFile("routelet", FileConstants.JAR_FILE_SUFFIX, //$NON-NLS-1$
                new File(getTempDir()));
            } catch (IOException e) {
                throw new InvocationTargetException(e);
            }
            String routeletName = referencedRouteletNode.getObject().getLabel();
            String routeletBundleName = routeName + "_" + routeletName;
            String routeletBundleSymbolicName = routeletBundleName;
            Project project = ProjectManager.getInstance().getCurrentProject();
            if (project != null) {
                String projectName = project.getLabel();
                if (projectName != null && projectName.length() > 0) {
                    routeletBundleSymbolicName = projectName.toLowerCase() + '.' + routeletBundleSymbolicName;
                }
            }
            BundleModel routeletModel = new BundleModel(getGroupId(), routeletBundleName, getArtifactVersion(), routeletFile);
            if (featuresModel.addBundle(routeletModel)) {
                exportRouteBundle(referencedRouteletNode, routeletFile, routeletVersion, routeletBundleName, routeletBundleSymbolicName, bundleVersion, idSuffix, null, EmfModelUtils.findElementParameterByName(EParameterName.PROCESS_TYPE.getName() + ':' + EParameterName.PROCESS_TYPE_CONTEXT.getName(), node).getValue());
                CamelFeatureUtil.addFeatureAndBundles(routeletProcess, featuresModel);
                exportAllReferenceRoutelets(routeName, routeletProcess, routelets);
            }
        }
    }
}
Also used : ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType) Project(org.talend.core.model.general.Project) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ProcessItem(org.talend.core.model.properties.ProcessItem) ENodeType(org.talend.repository.model.IRepositoryNode.ENodeType) NodeType(org.talend.designer.core.model.utils.emf.talendfile.NodeType) CamelRepositoryNodeType(org.talend.camel.model.CamelRepositoryNodeType) PersistenceException(org.talend.commons.exception.PersistenceException) BundleModel(org.talend.designer.publish.core.models.BundleModel) Collection(java.util.Collection) IOException(java.io.IOException) File(java.io.File) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 23 with ElementParameterType

use of org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType in project tesb-studio-se by Talend.

the class CamelFeatureUtil method handleSetHeaderCase.

private static void handleSetHeaderCase(Collection<FeatureModel> features, NodeType currentNode) {
    ElementParameterType element = EmfModelUtils.findElementParameterByName("VALUES", currentNode);
    Iterator<?> iterator = element.getElementValue().iterator();
    while (iterator.hasNext()) {
        Object next = iterator.next();
        if (!(next instanceof ElementValueType)) {
            continue;
        }
        ElementValueType evt = (ElementValueType) next;
        String elementRef = evt.getElementRef();
        if ("LANGUAGE".equals(elementRef) && JAVA_SCRIPT.equals(evt.getValue())) {
            features.add(FEATURE_CAMEL_SCRIPT_JAVASCRIPT);
            break;
        }
    }
}
Also used : ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType) ElementValueType(org.talend.designer.core.model.utils.emf.talendfile.ElementValueType) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Example 24 with ElementParameterType

use of org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType in project tesb-studio-se by Talend.

the class ExManifestItem method satisfy.

private boolean satisfy(final NodeType nodeType) {
    if (predicates.isEmpty()) {
        return true;
    }
    final Collection<?> parameters = nodeType.getElementParameter();
    for (Map.Entry<String, String> predicate : predicates.entrySet()) {
        String attributeName = predicate.getKey();
        final String attributeValue = predicate.getValue();
        final String[] segments = attributeName.split(SEPARATOR);
        String valueName = null;
        if (segments.length > 1) {
            attributeName = segments[0];
            valueName = segments[1];
        }
        for (Object o : parameters) {
            final ElementParameterType ept = (ElementParameterType) o;
            if (ept.getName().equals(attributeName)) {
                if (null == valueName) {
                    if (!attributeValue.equals(ept.getValue())) {
                        return false;
                    }
                } else {
                    boolean found = false;
                    for (Object e : ept.getElementValue()) {
                        final ElementValueType evt = (ElementValueType) e;
                        if (valueName.equals(evt.getElementRef()) && attributeValue.equals(evt.getValue())) {
                            found = true;
                            break;
                        }
                    }
                    if (!found) {
                        return false;
                    }
                }
                break;
            }
        }
    }
    return true;
}
Also used : ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType) ElementValueType(org.talend.designer.core.model.utils.emf.talendfile.ElementValueType) Map(java.util.Map) HashMap(java.util.HashMap)

Example 25 with ElementParameterType

use of org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType in project tesb-studio-se by Talend.

the class UtilTool method addParameterType.

public static void addParameterType(NodeType node, String field, String name, String value, List<?> elementParameterTypes) {
    ElementParameterType paramType = createParameterType(field, name, value, elementParameterTypes);
    addParameterType(node, paramType);
}
Also used : ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType)

Aggregations

ElementParameterType (org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType)197 NodeType (org.talend.designer.core.model.utils.emf.talendfile.NodeType)126 ProcessType (org.talend.designer.core.model.utils.emf.talendfile.ProcessType)114 PersistenceException (org.talend.commons.exception.PersistenceException)86 IComponentConversion (org.talend.core.model.components.conversions.IComponentConversion)85 IComponentFilter (org.talend.core.model.components.filters.IComponentFilter)83 NameComponentFilter (org.talend.core.model.components.filters.NameComponentFilter)83 EList (org.eclipse.emf.common.util.EList)40 ElementValueType (org.talend.designer.core.model.utils.emf.talendfile.ElementValueType)28 ProxyRepositoryFactory (org.talend.core.repository.model.ProxyRepositoryFactory)25 List (java.util.List)22 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)19 ArrayList (java.util.ArrayList)16 ProcessItem (org.talend.core.model.properties.ProcessItem)16 ParametersType (org.talend.designer.core.model.utils.emf.talendfile.ParametersType)15 ConnectionType (org.talend.designer.core.model.utils.emf.talendfile.ConnectionType)13 JobletProcessItem (org.talend.core.model.properties.JobletProcessItem)9 HashMap (java.util.HashMap)7 IOException (java.io.IOException)6 IElementParameter (org.talend.core.model.process.IElementParameter)6