Search in sources :

Example 16 with EHadoopParamName

use of org.talend.metadata.managment.ui.utils.ExtendedNodeConnectionContextUtils.EHadoopParamName in project tbd-studio-se by Talend.

the class HadoopClusterContextHandler method setPropertiesForExistContextMode.

@Override
public void setPropertiesForExistContextMode(Connection connection, Set<IConnParamName> paramSet, Map<ContextItem, List<ConectionAdaptContextVariableModel>> adaptMap) {
    if (connection == null) {
        return;
    }
    if (connection instanceof HadoopClusterConnection) {
        HadoopClusterConnection hadoopConn = (HadoopClusterConnection) connection;
        ContextItem currentContext = null;
        for (IConnParamName param : paramSet) {
            if (param instanceof EHadoopParamName) {
                String hadoopVariableName = null;
                EHadoopParamName hadoopParam = (EHadoopParamName) 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(hadoopParam.name())) {
                                hadoopVariableName = model.getName();
                                break;
                            }
                        }
                    }
                }
                if (hadoopVariableName != null) {
                    hadoopVariableName = getCorrectVariableName(currentContext, hadoopVariableName, hadoopParam);
                    matchContextForAttribues(hadoopConn, hadoopParam, hadoopVariableName);
                }
            }
        }
        matchAdditionProperties(hadoopConn, adaptMap);
    }
}
Also used : ContextItem(org.talend.core.model.properties.ContextItem) EHadoopParamName(org.talend.metadata.managment.ui.utils.ExtendedNodeConnectionContextUtils.EHadoopParamName) IConnParamName(org.talend.metadata.managment.ui.model.IConnParamName) ArrayList(java.util.ArrayList) List(java.util.List) HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) ConectionAdaptContextVariableModel(org.talend.core.ui.context.model.table.ConectionAdaptContextVariableModel) Map(java.util.Map)

Aggregations

EHadoopParamName (org.talend.metadata.managment.ui.utils.ExtendedNodeConnectionContextUtils.EHadoopParamName)16 IConnParamName (org.talend.metadata.managment.ui.model.IConnParamName)12 ArrayList (java.util.ArrayList)8 Map (java.util.Map)8 List (java.util.List)4 IContextParameter (org.talend.core.model.process.IContextParameter)4 ContextItem (org.talend.core.model.properties.ContextItem)4 ConectionAdaptContextVariableModel (org.talend.core.ui.context.model.table.ConectionAdaptContextVariableModel)4 HadoopClusterConnection (org.talend.repository.model.hadoopcluster.HadoopClusterConnection)4 HCatalogConnection (org.talend.repository.model.hcatalog.HCatalogConnection)4 HDFSConnection (org.talend.repository.model.hdfs.HDFSConnection)4 NoSQLConnection (org.talend.repository.model.nosql.NoSQLConnection)4 JSONArray (org.talend.utils.json.JSONArray)3 JSONException (org.talend.utils.json.JSONException)3 JSONObject (org.talend.utils.json.JSONObject)3 JavaType (org.talend.core.model.metadata.types.JavaType)1