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