public static List<Map<String, String>> getTableElementParameterValue( IElementParameter parameter) { if (parameter.getFieldType() == EParameterFieldType.TABLE) { return createTableValues((List<Map<String, Object>>) parameter.getValue(), parameter); } return null; }
/** * Only work with one element. * * @param element * @param text * @return */ public static Object getObjectValueXML(final IElement element, final String text) { if (text == null) { return null; } IElementParameter param; for (int i = 0; i < element.getElementParameters().size(); i++) { param = element.getElementParameters().get(i); if (text.indexOf(param.getVariableName()) != -1) { if (param.getFieldType() == EParameterFieldType.TABLE) { return createTableValuesXML((List<Map<String, Object>>) param.getValue(), param); } return param.getValue(); } } return null; }
/** * Only work with one element. * * @param element * @param text * @return */ public static Object getObjectValue(final IElement element, final String text) { if (text == null) { return null; } IElementParameter param; List<IElementParameter> params = (List<IElementParameter>) element.getElementParametersWithChildrens(); if (params != null && !params.isEmpty()) { for (int i = 0; i < params.size(); i++) { param = params.get(i); if (text.indexOf(param.getVariableName()) != -1 || (param.getVariableName() != null && param.getVariableName().contains(text))) { if (param.getFieldType() == EParameterFieldType.TABLE) { return createTableValues((List<Map<String, Object>>) param.getValue(), param); } return param.getValue(); } } } return null; }
public boolean isGeneratedAsVirtualComponent() { IElementParameter param = getElementParameter("IS_VIRTUAL_COMPONENT"); // $NON-NLS-1$ if (param != null) { // now only available for tUniqRow. return (Boolean) param.getValue(); } List<IMultipleComponentManager> multipleComponentManagers = getComponent().getMultipleComponentManagers(); for (IMultipleComponentManager mcm : multipleComponentManagers) { if (!mcm.isLookupMode()) { return true; } } return false; }
@SuppressWarnings("unchecked") private static String getDisplayValue(final IElementParameter param) { Object value = param.getValue(); if (value instanceof String) { if (param.getName().equals("PROCESS_TYPE_VERSION") && value.equals(RelationshipItemBuilder.LATEST_VERSION)) { // $NON-NLS-1$ String jobId = (String) param .getParentParameter() .getChildParameters() .get("PROCESS_TYPE_PROCESS") .getValue(); //$NON-NLS-1$ ProcessItem processItem = ItemCacheManager.getProcessItem(jobId); if (processItem == null) { return ""; //$NON-NLS-1$ } return processItem.getProperty().getVersion(); } if (param.getName().equals("PROCESS_TYPE_CONTEXT")) { // $NON-NLS-1$ String jobId = (String) param .getParentParameter() .getChildParameters() .get("PROCESS_TYPE_PROCESS") .getValue(); //$NON-NLS-1$ ProcessItem processItem = ItemCacheManager.getProcessItem(jobId); if (processItem == null) { return ""; //$NON-NLS-1$ } // check if the selected context exists, if not, use the default context of the job. boolean contextExists = false; for (Object object : processItem.getProcess().getContext()) { if (object instanceof ContextType) { if (((ContextType) object).getName() != null && ((ContextType) object).getName().equals(value)) { contextExists = true; continue; } } } if (!contextExists) { return processItem.getProcess().getDefaultContext(); } return (String) value; } // hywang add for 6484 if ("SELECTED_FILE".equals(param.getRepositoryValue())) { // $NON-NLS-N$ //$NON-NLS-1$ IElementParameter propertyParam = param .getElement() .getElementParameter( "PROPERTY:REPOSITORY_PROPERTY_TYPE"); // $NON-NLS-N$ //$NON-NLS-1$ if (propertyParam != null && propertyParam.getValue() != null && !propertyParam.getValue().equals("")) { // $NON-NLS-1$ try { IRepositoryViewObject object = CoreRuntimePlugin.getInstance() .getProxyRepositoryFactory() .getLastVersion((String) propertyParam.getValue()); if (object != null) { Item item = object.getProperty().getItem(); String extension = null; String rule = ""; // $NON-NLS-1$ String processLabelAndVersion = null; if (item instanceof RulesItem) { RulesItem rulesItem = (RulesItem) item; extension = rulesItem.getExtension(); if (param.getElement() instanceof INode) { INode node = (INode) param.getElement(); IProcess process = node.getProcess(); String jobLabel = process.getName(); String jobVersion = process.getVersion(); processLabelAndVersion = JavaResourcesHelper.getJobFolderName(jobLabel, jobVersion); } rule = "rules/final/" + processLabelAndVersion + "/" + rulesItem.getProperty().getLabel() // $NON-NLS-1$ //$NON-NLS-2$ + rulesItem.getProperty().getVersion() + extension; } return TalendQuoteUtils.addQuotes(rule); } else { return param.getValue().toString(); } } catch (Exception e) { ExceptionHandler.process(e); } } } return (String) value; } if (param.getFieldType() == EParameterFieldType.RADIO || param.getFieldType() == EParameterFieldType.CHECK || param.getFieldType() == EParameterFieldType.AS400_CHECK) { if (value instanceof Boolean) { return ((Boolean) param.getValue()).toString(); } else { return Boolean.FALSE.toString(); } } if (param.getFieldType() == EParameterFieldType.TABLE) { List<Map<String, Object>> tableValues = (List<Map<String, Object>>) param.getValue(); String[] items = param.getListItemsDisplayCodeName(); String stringValues = "{"; // $NON-NLS-1$ for (int i = 0; i < tableValues.size(); i++) { Map<String, Object> lineValues = tableValues.get(i); stringValues += "["; // $NON-NLS-1$ for (int j = 0; j < items.length; j++) { Object currentValue = lineValues.get(items[j]); if (currentValue instanceof Integer) { IElementParameter tmpParam = (IElementParameter) param.getListItemsValue()[j]; if (tmpParam.getListItemsDisplayName().length != 0) { stringValues += tmpParam.getListItemsDisplayName()[(Integer) currentValue]; } } else { stringValues += currentValue; } if (j != (items.length - 1)) { stringValues += ","; // $NON-NLS-1$ } } stringValues += "]"; // $NON-NLS-1$ if (i != (tableValues.size() - 1)) { stringValues += ","; // $NON-NLS-1$ } } stringValues += "}"; // $NON-NLS-1$ return stringValues; } return new String(""); // $NON-NLS-1$ }