use of org.talend.metadata.managment.ui.utils.GenericConnParamName in project tdi-studio-se by Talend.
the class GenericContextUtil method setPropertiesForContextMode.
public static void setPropertiesForContextMode(String prefixName, Connection connection, Set<IConnParamName> paramSet) {
if (connection == null) {
return;
}
if (connection instanceof GenericConnection) {
GenericConnection genericConn = (GenericConnection) connection;
ComponentProperties componentProperties = getComponentProperties(genericConn);
String originalVariableName = prefixName + ConnectionContextHelper.LINE;
String genericVariableName = null;
for (IConnParamName param : paramSet) {
if (param instanceof GenericConnParamName) {
GenericConnParamName genericParam = (GenericConnParamName) param;
String paramVarName = genericParam.getContextVar();
genericVariableName = originalVariableName + paramVarName;
matchContextForAttribues(componentProperties, genericParam, genericVariableName);
}
}
updateComponentProperties(genericConn, componentProperties);
}
}
use of org.talend.metadata.managment.ui.utils.GenericConnParamName in project tdi-studio-se by Talend.
the class GenericContextUtilTest method createConnParamName.
private GenericConnParamName createConnParamName(String paramName) {
GenericConnParamName connParamName = new GenericConnParamName();
connParamName.setName(paramName);
connParamName.setContextVar(getValidContextVarName(paramName));
return connParamName;
}
use of org.talend.metadata.managment.ui.utils.GenericConnParamName in project tdi-studio-se by Talend.
the class GenericContextHandler method getContextParams.
@Override
public Set<IConnParamName> getContextParams() {
Set<IConnParamName> contextParams = new HashSet<>();
if (parameters != null) {
for (IElementParameter param : parameters) {
if (param instanceof GenericElementParameter) {
GenericElementParameter genericElementParameter = (GenericElementParameter) param;
if (genericElementParameter.isSupportContext()) {
GenericConnParamName connParamName = new GenericConnParamName();
String paramName = genericElementParameter.getName();
connParamName.setName(paramName);
connParamName.setContextVar(getValidContextVarName(paramName));
contextParams.add(connParamName);
}
}
}
}
return contextParams;
}
use of org.talend.metadata.managment.ui.utils.GenericConnParamName in project tdi-studio-se by Talend.
the class GenericContextUtil method matchContextForAttribues.
private static void matchContextForAttribues(ComponentProperties componentProperties, IConnParamName param, String genericVariableName) {
GenericConnParamName genericParam = (GenericConnParamName) param;
String paramName = genericParam.getName();
String paramValue = ContextParameterUtils.getNewScriptCode(genericVariableName, ECodeLanguage.JAVA);
setPropertyValue(componentProperties, paramName, paramValue, true);
}
use of org.talend.metadata.managment.ui.utils.GenericConnParamName in project tdi-studio-se by Talend.
the class GenericContextUtil method setPropertiesForExistContextMode.
public static void setPropertiesForExistContextMode(Connection connection, Set<IConnParamName> paramSet, Map<ContextItem, List<ConectionAdaptContextVariableModel>> adaptMap) {
if (connection == null) {
return;
}
if (connection instanceof GenericConnection) {
GenericConnection genericConn = (GenericConnection) connection;
ComponentProperties componentProperties = getComponentProperties(genericConn);
ContextItem currentContext = null;
for (IConnParamName param : paramSet) {
if (param instanceof GenericConnParamName) {
String genericVariableName = null;
GenericConnParamName genericParam = (GenericConnParamName) param;
if (adaptMap != null && adaptMap.size() > 0) {
for (Map.Entry<ContextItem, List<ConectionAdaptContextVariableModel>> entry : adaptMap.entrySet()) {
currentContext = entry.getKey();
List<ConectionAdaptContextVariableModel> modelList = entry.getValue();
for (ConectionAdaptContextVariableModel model : modelList) {
if (model.getValue().equals(genericParam.getName())) {
genericVariableName = model.getName();
break;
}
}
}
}
if (genericVariableName != null) {
genericVariableName = getCorrectVariableName(currentContext, genericVariableName, genericParam);
matchContextForAttribues(componentProperties, genericParam, genericVariableName);
}
}
}
updateComponentProperties(genericConn, componentProperties);
}
}
Aggregations