use of org.talend.metadata.managment.ui.utils.OtherConnectionContextUtils.EParamName in project tdi-studio-se by Talend.
the class JSONConnectionContextHelper method getConnVariables.
private static Set<String> getConnVariables(ConnectionItem connectionItem, Set<IConnParamName> paramSet) {
if (connectionItem == null) {
return null;
}
Set<String> varList = new HashSet<String>();
Iterator<IConnParamName> paramIt = paramSet.iterator();
while (paramIt.hasNext()) {
Object param = paramIt.next();
if (param instanceof EDBParamName) {
varList.add(((EDBParamName) param).name());
}
if (param instanceof EFileParamName) {
varList.add(((EFileParamName) param).name());
}
if (param instanceof EParamName) {
varList.add(((EParamName) param).name());
}
}
return varList;
}
use of org.talend.metadata.managment.ui.utils.OtherConnectionContextUtils.EParamName in project tdi-studio-se by Talend.
the class JSONConnectionContextHelper method setJSONFilePropertiesForExistContextMode.
static void setJSONFilePropertiesForExistContextMode(JSONFileConnection jsonConn, Set<IConnParamName> paramSet, Map<ContextItem, List<ConectionAdaptContextVariableModel>> map) {
if (jsonConn == null) {
return;
}
String jsonVariableName = null;
for (IConnParamName param : paramSet) {
if (param instanceof EParamName) {
EParamName jsonParam = (EParamName) param;
if (map != null && map.size() > 0) {
for (Map.Entry<ContextItem, List<ConectionAdaptContextVariableModel>> entry : map.entrySet()) {
List<ConectionAdaptContextVariableModel> modelList = entry.getValue();
for (ConectionAdaptContextVariableModel model : modelList) {
if (model.getValue().equals(jsonParam.name())) {
jsonVariableName = model.getName();
break;
}
}
}
}
if (jsonConn.isInputModel()) {
switch(jsonParam) {
case FilePath:
jsonConn.setJSONFilePath(ContextParameterUtils.getNewScriptCode(jsonVariableName, LANGUAGE));
break;
case Encoding:
jsonConn.setEncoding(ContextParameterUtils.getNewScriptCode(jsonVariableName, LANGUAGE));
break;
case XPathQuery:
EList schema = jsonConn.getSchema();
if (schema != null) {
if (schema.get(0) instanceof JSONXPathLoopDescriptor) {
JSONXPathLoopDescriptor descriptor = (JSONXPathLoopDescriptor) schema.get(0);
descriptor.setAbsoluteXPathQuery(ContextParameterUtils.getNewScriptCode(jsonVariableName, LANGUAGE));
}
}
default:
}
} else {
if (jsonParam.equals(EParamName.OutputFilePath)) {
jsonConn.setOutputFilePath(ContextParameterUtils.getNewScriptCode(jsonVariableName, LANGUAGE));
}
}
}
}
}
Aggregations