use of org.talend.components.api.properties.ComponentPropertiesImpl in project tdi-studio-se by Talend.
the class Component method createReturns.
@Override
public List<NodeReturn> createReturns() {
List<NodeReturn> listReturn = new ArrayList<>();
ComponentProperties componentProperties = ComponentsUtils.getComponentProperties(getName());
if (!(componentProperties instanceof ComponentPropertiesImpl)) {
return listReturn;
}
NodeReturn nodeRet = new NodeReturn();
nodeRet.setType(JavaTypesManager.STRING.getLabel());
nodeRet.setDisplayName(ComponentReturnVariableUtils.getTranslationForVariable(ComponentDefinition.RETURN_ERROR_MESSAGE, ComponentDefinition.RETURN_ERROR_MESSAGE));
nodeRet.setName(ComponentReturnVariableUtils.getStudioNameFromVariable(ComponentDefinition.RETURN_ERROR_MESSAGE));
//$NON-NLS-1$
nodeRet.setAvailability("AFTER");
listReturn.add(nodeRet);
for (Property<?> child : componentDefinition.getReturnProperties()) {
nodeRet = new NodeReturn();
nodeRet.setType(ComponentsUtils.getTalendTypeFromProperty(child).getId());
nodeRet.setDisplayName(ComponentReturnVariableUtils.getTranslationForVariable(child.getName(), child.getDisplayName()));
nodeRet.setName(ComponentReturnVariableUtils.getStudioNameFromVariable(child.getName()));
if (nodeRet.getName().equals(ERROR_MESSAGE)) {
continue;
}
Object object = child.getTaggedValue(IGenericConstants.AVAILABILITY);
if (object != null) {
nodeRet.setAvailability(object.toString());
} else {
//$NON-NLS-1$
nodeRet.setAvailability("AFTER");
}
listReturn.add(nodeRet);
}
return listReturn;
}
Aggregations