use of org.talend.core.model.process.IElementParameter in project tdi-studio-se by Talend.
the class DynamicTabbedPropertySection method updateQuery.
@SuppressWarnings("unchecked")
private void updateQuery() {
Object propertyValue = elem.getPropertyValue(EParameterName.REPOSITORY_QUERYSTORE_TYPE.getName());
if (//$NON-NLS-1$
propertyValue == null || !(propertyValue instanceof String) || "".equals(propertyValue) || elem.getPropertyValue(EParameterName.QUERYSTORE_TYPE.getName()).equals(EmfComponent.BUILTIN)) {
return;
}
if (repositoryQueryStoreMap.containsKey(propertyValue)) {
Query query = repositoryQueryStoreMap.get(propertyValue);
for (IElementParameter param : (List<IElementParameter>) elem.getElementParameters()) {
if (param.getFieldType() == EParameterFieldType.MEMO_SQL) {
elem.setPropertyValue(param.getName(), convertSQL(query.getValue()));
param.setRepositoryValueUsed(true);
}
}
}
}
use of org.talend.core.model.process.IElementParameter in project tdi-studio-se by Talend.
the class DynamicTabbedPropertySection method updateProcessList.
/**
* ftang Comment method "updateProcessList".
*/
private void updateProcessList() {
List<String> processNameList = new ArrayList<String>();
List<String> processValueList = new ArrayList<String>();
processMap = new HashMap<String, IRepositoryViewObject>();
IProxyRepositoryFactory factory = DesignerPlugin.getDefault().getProxyRepositoryFactory();
try {
RootContainer<String, IRepositoryViewObject> processContainer = factory.getMetadata(ERepositoryObjectType.PROCESS);
ContentList<String, IRepositoryViewObject> processAbsoluteMembers = processContainer.getAbsoluteMembers();
String currentProcess = part.getTalendEditor().getProcess().getLabel();
for (Content<String, IRepositoryViewObject> object : processAbsoluteMembers.values()) {
IRepositoryViewObject process = object.getContent();
if (factory.getStatus(process) != ERepositoryStatus.DELETED && !currentProcess.equals(process.getLabel())) {
String path = object.getParent().getPath().toString();
String name;
if (path.equals("")) {
//$NON-NLS-1$
name = IPath.SEPARATOR + process.getLabel();
} else {
name = IPath.SEPARATOR + path + IPath.SEPARATOR + process.getLabel();
}
processNameList.add(name);
processMap.put(name, process);
}
}
} catch (PersistenceException e) {
// e.printStackTrace();
ExceptionHandler.process(e);
}
List<String> tempFolderList = new ArrayList<String>();
List<String> tempProcessNameList = new ArrayList<String>();
tempProcessNameList.addAll(processNameList);
for (String string : tempProcessNameList) {
// Put jobs which in a folder into a new list.s
if (string.lastIndexOf("/") != 0) {
//$NON-NLS-1$
tempFolderList.add(string);
processNameList.remove(string);
}
}
sortList(processNameList);
sortList(tempFolderList);
// Always put the jobs which in a folder on the top of the job list
tempFolderList.addAll(processNameList);
processNameList = tempFolderList;
for (String name : processNameList) {
IRepositoryViewObject process = processMap.get(name);
processValueList.add(process.getLabel());
}
String[] processTableNameList = processNameList.toArray(new String[0]);
String[] processTableValueList = processValueList.toArray(new String[0]);
for (int i = 0; i < elem.getElementParameters().size(); i++) {
IElementParameter param = elem.getElementParameters().get(i);
if (param.getName().equals(EParameterName.PROCESS_TYPE_PROCESS.getName())) {
param.setListItemsDisplayName(processTableNameList);
param.setListItemsValue(processTableValueList);
if (elem instanceof Node) {
((Node) elem).checkAndRefreshNode();
}
}
}
}
use of org.talend.core.model.process.IElementParameter in project tdi-studio-se by Talend.
the class DynamicTabbedPropertySection method updateContextList.
/**
* ftang Comment method "updateContextList".
*/
private void updateContextList() {
List<String> contextNameList = new ArrayList<String>();
List<String> contextValueList = new ArrayList<String>();
IProxyRepositoryFactory factory = DesignerPlugin.getDefault().getProxyRepositoryFactory();
String selectedProcess = null;
for (int i = 0; (i < elem.getElementParameters().size()) && (selectedProcess == null); i++) {
IElementParameter param = elem.getElementParameters().get(i);
if (param.getName().equals(EParameterName.PROCESS_TYPE_PROCESS.getName())) {
selectedProcess = (String) param.getValue();
}
}
if (selectedProcess == null) {
return;
}
try {
List<IRepositoryViewObject> list = factory.getAll(ERepositoryObjectType.PROCESS);
for (IRepositoryViewObject process : list) {
String id = process.getLabel();
if (selectedProcess.equals(id)) {
if (process.getProperty().getItem() instanceof ProcessItem) {
ProcessItem processItem = (ProcessItem) process.getProperty().getItem();
for (Object o : processItem.getProcess().getContext()) {
if (o instanceof ContextType) {
ContextType context = (ContextType) o;
contextNameList.add(context.getName());
contextValueList.add(context.getName());
}
}
}
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
String[] contextTableNameList = contextNameList.toArray(new String[0]);
String[] contextTableValueList = contextValueList.toArray(new String[0]);
for (int i = 0; i < elem.getElementParameters().size(); i++) {
IElementParameter param = elem.getElementParameters().get(i);
if (param.getName().equals(EParameterName.PROCESS_TYPE_CONTEXT.getName())) {
param.setListItemsDisplayName(contextTableNameList);
param.setListItemsValue(contextTableValueList);
if (!contextValueList.contains(param.getValue())) {
if (contextTableNameList.length > 0) {
elem.setPropertyValue(EParameterName.PROCESS_TYPE_CONTEXT.getName(), contextTableValueList[0]);
}
} else {
// force to store the value again to activate the code
// generation in Node.setPropertyValue
elem.setPropertyValue(EParameterName.PROCESS_TYPE_CONTEXT.getName(), param.getValue());
}
}
}
}
use of org.talend.core.model.process.IElementParameter in project tdi-studio-se by Talend.
the class StatsAndLogsHelper method statsAndLogsParametersFinalPart.
private static void statsAndLogsParametersFinalPart(Element elem) {
ElementParameter param;
IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore();
List<IElementParameter> paramList = (List<IElementParameter>) elem.getElementParameters();
//$NON-NLS-1$
String languagePrefix = LanguageManager.getCurrentLanguage().toString() + "_";
// Catch runtime errors
param = new ElementParameter(elem);
//$NON-NLS-1$
param.setName("CATCH_RUNTIME_ERRORS");
param.setValue(preferenceStore.getBoolean(languagePrefix + EParameterName.CATCH_RUNTIME_ERRORS.getName()));
param.setDisplayName(EParameterName.CATCH_RUNTIME_ERRORS.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(90);
//$NON-NLS-1$
param.setShowIf("ON_LOGCATCHER_FLAG == 'true'");
paramList.add(param);
// Catch user errors
param = new ElementParameter(elem);
//$NON-NLS-1$
param.setName("CATCH_USER_ERRORS");
param.setValue(preferenceStore.getBoolean(languagePrefix + EParameterName.CATCH_USER_ERRORS.getName()));
param.setDisplayName(EParameterName.CATCH_USER_ERRORS.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(90);
//$NON-NLS-1$
param.setShowIf("ON_LOGCATCHER_FLAG == 'true'");
paramList.add(param);
// Catch user warning
param = new ElementParameter(elem);
//$NON-NLS-1$
param.setName("CATCH_USER_WARNING");
param.setValue(preferenceStore.getBoolean(languagePrefix + EParameterName.CATCH_USER_WARNING.getName()));
param.setDisplayName(EParameterName.CATCH_USER_WARNING.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(90);
//$NON-NLS-1$
param.setShowIf("ON_LOGCATCHER_FLAG == 'true'");
paramList.add(param);
// Catch realtime statistics
param = new ElementParameter(elem);
//$NON-NLS-1$
param.setName("CATCH_REALTIME_STATS");
param.setValue(preferenceStore.getBoolean(languagePrefix + EParameterName.CATCH_REALTIME_STATS.getName()));
param.setDisplayName(//$NON-NLS-1$
EParameterName.CATCH_REALTIME_STATS.getDisplayName() + " (" + EParameterName.TSTATCATCHER_STATS.getDisplayName() + //$NON-NLS-1$
")");
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(91);
//$NON-NLS-1$
param.setShowIf("ON_STATCATCHER_FLAG == 'true'");
paramList.add(param);
}
use of org.talend.core.model.process.IElementParameter in project tdi-studio-se by Talend.
the class ProjectSettingManager method createImplicitContextLoadParameters.
/**
*
* create parameter for ImplicitContextLoad.
*/
static void createImplicitContextLoadParameters(Element elem) {
ElementParameter param;
List<IElementParameter> paramList = (List<IElementParameter>) elem.getElementParameters();
param = new ElementParameter(elem);
param.setName(EParameterName.UPDATE_COMPONENTS.getName());
param.setValue(Boolean.FALSE);
param.setDisplayName(EParameterName.UPDATE_COMPONENTS.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(1);
param.setReadOnly(true);
param.setRequired(false);
param.setShow(false);
paramList.add(param);
param = new ElementParameter(elem);
param.setName(EParameterName.IMPLICIT_TCONTEXTLOAD.getName());
param.setValue(preferenceStore.getBoolean(getPreferenceName(EParameterName.IMPLICIT_TCONTEXTLOAD)));
param.setGroupDisplayName(EParameterName.IMPLICIT_TCONTEXTLOAD.getDisplayName());
param.setDisplayName(EParameterName.IMPLICIT_TCONTEXTLOAD.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.EXTRA);
param.setGroup(IMPLICIT_GROUP);
param.setNumRow(3);
param.setShow(true);
paramList.add(param);
param = new ElementParameter(elem);
param.setName(EParameterName.IMPLICT_DEFAULT_PROJECTSETTING.getName());
param.setValue(Boolean.TRUE);
param.setGroupDisplayName(EParameterName.IMPLICT_DEFAULT_PROJECTSETTING.getDisplayName());
param.setDisplayName(EParameterName.IMPLICT_DEFAULT_PROJECTSETTING.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.EXTRA);
param.setGroup(IMPLICIT_GROUP);
param.setNumRow(3);
param.setShow(false);
paramList.add(param);
// on files
param = new ElementParameter(elem);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.FROM_FILE_FLAG.getName()));
param.setValue(preferenceStore.getBoolean(getPreferenceName(EParameterName.FROM_FILE_FLAG)));
param.setDisplayName(EParameterName.FROM_FILE_FLAG.getDisplayName());
param.setFieldType(EParameterFieldType.RADIO);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(4);
param.setShowIf(JobSettingsConstants.addBrackets(CONTEXTLOAD_CONDITION));
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
// on database
param = new ElementParameter(elem);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.FROM_DATABASE_FLAG.getName()));
param.setValue(preferenceStore.getBoolean(getPreferenceName(EParameterName.FROM_DATABASE_FLAG)));
param.setDisplayName(EParameterName.FROM_DATABASE_FLAG.getDisplayName());
param.setFieldType(EParameterFieldType.RADIO);
param.setCategory(EComponentCategory.EXTRA);
param.setNumRow(5);
param.setShowIf(JobSettingsConstants.addBrackets(CONTEXTLOAD_CONDITION));
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
// on file
createExtraOnFileParameters(elem);
// on database
createExtraOnDBParameters(elem);
// tContextLoad
createExtraContextLoadParameters(elem);
}
Aggregations