use of org.talend.repository.model.migration.EncryptPasswordInComponentsMigrationTask.FakeNode in project tdi-studio-se by Talend.
the class UnifyPasswordEncryption4ParametersInJobMigrationTask method checkNodes.
protected boolean checkNodes(Item item, ProcessType processType) throws Exception {
boolean modified = checkNodesFromEmf(item, processType);
if (!modified) {
// some versions of the job doesn't have any field type saved in the job, so we will check from the existing
// component field type
ComponentCategory category = ComponentCategory.getComponentCategoryFromItem(item);
for (Object nodeObjectType : processType.getNode()) {
NodeType nodeType = (NodeType) nodeObjectType;
IComponent component = ComponentsFactoryProvider.getInstance().get(nodeType.getComponentName(), category.getName());
if (component == null) {
continue;
}
FakeNode fNode = new FakeNode(component);
for (Object paramObjectType : nodeType.getElementParameter()) {
ElementParameterType param = (ElementParameterType) paramObjectType;
IElementParameter paramFromEmf = fNode.getElementParameter(param.getName());
if (paramFromEmf != null) {
if (EParameterFieldType.PASSWORD.equals(paramFromEmf.getFieldType()) && param.getValue() != null) {
param.setField(EParameterFieldType.PASSWORD.getName());
if (reencryptValueIfNeeded(param)) {
modified = true;
}
}
}
}
}
}
return modified;
}
Aggregations