Search in sources :

Example 1 with NodeReturn

use of org.talend.designer.core.model.components.NodeReturn 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;
}
Also used : ComponentProperties(org.talend.components.api.properties.ComponentProperties) ArrayList(java.util.ArrayList) NodeReturn(org.talend.designer.core.model.components.NodeReturn) ComponentPropertiesImpl(org.talend.components.api.properties.ComponentPropertiesImpl)

Aggregations

ArrayList (java.util.ArrayList)1 ComponentProperties (org.talend.components.api.properties.ComponentProperties)1 ComponentPropertiesImpl (org.talend.components.api.properties.ComponentPropertiesImpl)1 NodeReturn (org.talend.designer.core.model.components.NodeReturn)1