use of org.talend.core.model.process.IElementParameter in project tdi-studio-se by Talend.
the class StatsAndLogsManager method createLogsNode.
private static DataNode createLogsNode(boolean useFile, boolean console, String dbOutput) {
JobLogsComponent logsComponent = new JobLogsComponent(useFile, console, dbOutput);
DataNode logsNode = new DataNode(logsComponent, LOG_UNIQUE_NAME);
logsNode.setStart(true);
logsNode.setSubProcessStart(true);
logsNode.setActivate(true);
logsNode.getMetadataList().clear();
// load the tLogCatcher to get the schema.
IComponent tmpComponent = ComponentsFactoryProvider.getInstance().get("tLogCatcher", //$NON-NLS-1$
ComponentCategory.CATEGORY_4_DI.getName());
//$NON-NLS-1$
DataNode tmpNode = new DataNode(tmpComponent, "tmp");
boolean found = false;
for (int k = 0; k < tmpNode.getElementParameters().size() && !found; k++) {
IElementParameter currentParam = tmpNode.getElementParameters().get(k);
if (currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
Object value = currentParam.getValue();
if (value instanceof IMetadataTable) {
IMetadataTable table = ((IMetadataTable) value).clone();
table.setTableName(LOG_UNIQUE_NAME);
table.setAttachedConnector(currentParam.getContext());
logsNode.getMetadataList().add(table);
}
found = true;
}
}
return logsNode;
}
use of org.talend.core.model.process.IElementParameter in project tdi-studio-se by Talend.
the class StatsAndLogsManager method statsAndLogsParametersFilePart.
private static List<IElementParameter> statsAndLogsParametersFilePart(IProcess process) {
ElementParameter param;
IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore();
List<IElementParameter> paramList = new ArrayList<IElementParameter>();
//$NON-NLS-1$
String languagePrefix = LanguageManager.getCurrentLanguage().toString() + "_";
// on files
param = new ElementParameter(process);
param.setName(EParameterName.ON_FILES_FLAG.getName());
param.setValue(preferenceStore.getBoolean(languagePrefix + EParameterName.ON_FILES_FLAG.getName()));
param.setDisplayName(EParameterName.ON_FILES_FLAG.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(10);
//$NON-NLS-1$
param.setShowIf("(ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')");
paramList.add(param);
// file path
param = new ElementParameter(process);
param.setName(EParameterName.FILE_PATH.getName());
param.setValue(addQuotes(replaceSlash(preferenceStore.getString(languagePrefix + EParameterName.FILE_PATH.getName()))));
param.setDisplayName(EParameterName.FILE_PATH.getDisplayName());
param.setFieldType(EParameterFieldType.DIRECTORY);
param.setCategory(EComponentCategory.STATSANDLOGS);
//$NON-NLS-1$
param.setShowIf("(ON_FILES_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')");
param.setNumRow(11);
paramList.add(param);
// stats file name
param = new ElementParameter(process);
param.setName(EParameterName.FILENAME_STATS.getName());
param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.FILENAME_STATS.getName())));
param.setDisplayName(EParameterName.FILENAME_STATS.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.STATSANDLOGS);
//$NON-NLS-1$
param.setShowIf("(ON_FILES_FLAG == 'true' and ON_STATCATCHER_FLAG == 'true')");
param.setRequired(true);
param.setNumRow(12);
paramList.add(param);
param = new ElementParameter(process);
param.setName(EParameterName.FILENAME_LOGS.getName());
param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.FILENAME_LOGS.getName())));
param.setDisplayName(EParameterName.FILENAME_LOGS.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.STATSANDLOGS);
//$NON-NLS-1$
param.setShowIf("(ON_FILES_FLAG == 'true' and ON_LOGCATCHER_FLAG == 'true')");
param.setNumRow(13);
param.setRequired(true);
paramList.add(param);
param = new ElementParameter(process);
param.setName(EParameterName.FILENAME_METTER.getName());
param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.FILENAME_METTER.getName())));
param.setDisplayName(EParameterName.FILENAME_METTER.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.STATSANDLOGS);
//$NON-NLS-1$
param.setShowIf("(ON_FILES_FLAG == 'true' and ON_METERCATCHER_FLAG == 'true')");
param.setRequired(true);
param.setNumRow(14);
paramList.add(param);
// stats log encoding
ElementParameter encodingParam = new ElementParameter(process);
encodingParam.setName(EParameterName.ENCODING.getName());
encodingParam.setDisplayName(EParameterName.ENCODING.getDisplayName());
encodingParam.setCategory(EComponentCategory.STATSANDLOGS);
encodingParam.setFieldType(EParameterFieldType.ENCODING_TYPE);
encodingParam.setShowIf(//$NON-NLS-1$
"(ON_FILES_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')");
encodingParam.setValue(ENCODING_TYPE_ISO_8859_15);
encodingParam.setNumRow(15);
paramList.add(encodingParam);
ElementParameter childPram = new ElementParameter(process);
childPram.setName(EParameterName.ENCODING_TYPE.getName());
childPram.setDisplayName(EParameterName.ENCODING_TYPE.getDisplayName());
childPram.setFieldType(EParameterFieldType.TECHNICAL);
childPram.setCategory(EComponentCategory.STATSANDLOGS);
childPram.setListItemsDisplayName(new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
childPram.setListItemsDisplayCodeName(new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
childPram.setListItemsValue(new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
childPram.setValue(ENCODING_TYPE_ISO_8859_15);
childPram.setNumRow(15);
childPram.setShowIf(//$NON-NLS-1$
"(ON_FILES_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')");
childPram.setParentParameter(encodingParam);
return paramList;
}
use of org.talend.core.model.process.IElementParameter in project tdi-studio-se by Talend.
the class AbstractMultiPageTalendEditor method covertJobscriptOnPageChange.
private void covertJobscriptOnPageChange() {
try {
boolean isDirty = jobletEditor.isDirty();
jobletEditor.doSave(null);
IProcess2 oldProcess = getProcess();
ICreateXtextProcessService n = CorePlugin.getDefault().getCreateXtextProcessService();
Item item = oldProcess.getProperty().getItem();
ProcessType processType = null;
if (item instanceof ProcessItem) {
processType = n.convertDesignerEditorInput(((IFile) jobletEditor.getEditorInput().getAdapter(IResource.class)).getLocation().toOSString(), oldProcess.getProperty());
} else if (item instanceof JobletProcessItem) {
processType = n.convertJobletDesignerEditorInput(((IFile) jobletEditor.getEditorInput().getAdapter(IResource.class)).getLocation().toOSString(), oldProcess.getProperty());
}
if (item instanceof ProcessItem) {
((Process) oldProcess).updateProcess(processType);
} else if (item instanceof JobletProcessItem) {
((Process) oldProcess).updateProcess(processType);
}
oldProcess.getUpdateManager().updateAll();
designerEditor.setDirty(isDirty);
List<Node> nodes = (List<Node>) oldProcess.getGraphicalNodes();
List<Node> newNodes = new ArrayList<Node>();
newNodes.addAll(nodes);
for (Node node : newNodes) {
node.getProcess().checkStartNodes();
node.checkAndRefreshNode();
IElementParameter ep = node.getElementParameter("ACTIVATE");
if (ep != null && ep.getValue().equals(Boolean.FALSE)) {
node.setPropertyValue(EParameterName.ACTIVATE.getName(), true);
node.setPropertyValue(EParameterName.ACTIVATE.getName(), false);
} else if (ep != null && ep.getValue().equals(Boolean.TRUE)) {
node.setPropertyValue(EParameterName.ACTIVATE.getName(), false);
node.setPropertyValue(EParameterName.ACTIVATE.getName(), true);
}
for (IElementParameter param : node.getElementParameters()) {
if (!param.getChildParameters().isEmpty()) {
if (param.getValue() != null && param.getValue() instanceof String && ((String) param.getValue()).contains(":")) {
String[] splited = ((String) param.getValue()).split(":");
String childNameNeeded = splited[0].trim();
String valueChild = TalendQuoteUtils.removeQuotes(splited[1].trim());
if (param.getChildParameters().containsKey(childNameNeeded)) {
param.getChildParameters().get(childNameNeeded).setValue(valueChild);
}
}
}
}
if (node.getNodeContainer() instanceof JobletContainer) {
JobletContainer jc = (JobletContainer) node.getNodeContainer();
if (node.isMapReduceStart()) {
//$NON-NLS-1$
jc.updateState("UPDATE_STATUS", "", jc.getPercentMap(), jc.getPercentReduce());
}
}
}
} catch (PersistenceException e) {
}
}
use of org.talend.core.model.process.IElementParameter in project tdi-studio-se by Talend.
the class AbstractMultiPageTalendEditor method isVirtualNode.
/**
*
* DOC YeXiaowei Comment method "isVirtualNode".
*
* @param node
* @return
*/
private boolean isVirtualNode(final INode node) {
boolean isVirtualNode = false;
//$NON-NLS-1$
IElementParameter param = node.getElementParameter("IS_VIRTUAL_COMPONENT");
if (param != null) {
// now only available for tUniqRow.
return (Boolean) param.getValue() && param.isRequired(node.getElementParameters());
}
final String componentName = node.getComponent().getName();
if (componentName.equals("tMap")) {
//$NON-NLS-1$
isVirtualNode = CorePlugin.getDefault().getMapperService().isVirtualComponent(node);
} else if (componentName.equals("tXMLMap")) {
//$NON-NLS-1$
isVirtualNode = CorePlugin.getDefault().getXMLMapperService().isVirtualComponent(node);
} else if (componentName.equals("tAvroMap")) {
//$NON-NLS-1$
isVirtualNode = CorePlugin.getDefault().getSparkMapperService().isVirtualComponent(node);
} else {
List<IMultipleComponentManager> multipleComponentManagers = node.getComponent().getMultipleComponentManagers();
for (IMultipleComponentManager mcm : multipleComponentManagers) {
if (!mcm.isLookupMode()) {
return true;
}
}
}
if (!isVirtualNode) {
if (node.getExternalNode() != null) {
return node.getExternalNode().isGeneratedAsVirtualComponent();
}
}
return isVirtualNode;
}
use of org.talend.core.model.process.IElementParameter in project tdi-studio-se by Talend.
the class AbstractTraceAction method calculateEnabled.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.ui.actions.WorkbenchPartAction#calculateEnabled()
*/
@Override
protected boolean calculateEnabled() {
List parts = getSelectedObjects();
if (parts.size() != 1) {
return false;
}
Object input = parts.get(0);
if (input instanceof ConnectionPart) {
ConnectionPart connPart = (ConnectionPart) input;
List childParts = connPart.getChildren();
for (Object part : childParts) {
if (part != null && part instanceof ConnectionTraceEditPart) {
Connection conn = (Connection) connPart.getModel();
if (conn.enableTraces() && conn.checkTraceShowEnable()) {
IElementParameter element = conn.getElementParameter(EParameterName.TRACES_CONNECTION_ENABLE.getName());
Boolean flag = (Boolean) element.getValue();
if (flag != isEnableAction()) {
return true;
}
}
}
}
}
if (input instanceof ConnLabelEditPart) {
ConnLabelEditPart labelPart = (ConnLabelEditPart) input;
ConnectionPart connPart = (ConnectionPart) labelPart.getParent();
List childParts = connPart.getChildren();
for (Object part : childParts) {
if (part != null && part instanceof ConnectionTraceEditPart) {
Connection conn = (Connection) connPart.getModel();
if (conn.enableTraces() && conn.checkTraceShowEnable()) {
IElementParameter element = conn.getElementParameter(EParameterName.TRACES_CONNECTION_ENABLE.getName());
Boolean flag = (Boolean) element.getValue();
if (flag != isEnableAction()) {
return true;
}
}
}
}
}
if (input instanceof ConnectionTraceEditPart) {
ConnectionTraceEditPart tracePart = (ConnectionTraceEditPart) input;
ConnectionPart connPart = (ConnectionPart) tracePart.getParent();
Connection conn = (Connection) connPart.getModel();
if (conn.enableTraces() && conn.checkTraceShowEnable()) {
IElementParameter element = conn.getElementParameter(EParameterName.TRACES_CONNECTION_ENABLE.getName());
Boolean flag = (Boolean) element.getValue();
if (flag != isEnableAction()) {
return true;
}
}
}
return false;
}
Aggregations