use of org.pentaho.di.core.KettleAttribute in project pentaho-kettle by pentaho.
the class BaseStepMeta method loadStepAttributes.
/**
* Load step attributes.
*
* @throws KettleException
* the kettle exception
*/
protected void loadStepAttributes() throws KettleException {
try (InputStream inputStream = getClass().getResourceAsStream(STEP_ATTRIBUTES_FILE)) {
if (inputStream != null) {
Document document = XMLHandler.loadXMLFile(inputStream);
Node attrsNode = XMLHandler.getSubNode(document, "attributes");
List<Node> nodes = XMLHandler.getNodes(attrsNode, "attribute");
attributes = new ArrayList<KettleAttributeInterface>();
for (Node node : nodes) {
String key = XMLHandler.getTagAttribute(node, "id");
String xmlCode = XMLHandler.getTagValue(node, "xmlcode");
String repCode = XMLHandler.getTagValue(node, "repcode");
String description = XMLHandler.getTagValue(node, "description");
String tooltip = XMLHandler.getTagValue(node, "tooltip");
int valueType = ValueMetaFactory.getIdForValueMeta(XMLHandler.getTagValue(node, "valuetype"));
String parentId = XMLHandler.getTagValue(node, "parentid");
KettleAttribute attribute = new KettleAttribute(key, xmlCode, repCode, description, tooltip, valueType, findParent(attributes, parentId));
attributes.add(attribute);
}
}
} catch (Exception e) {
throw new KettleException("Unable to load file " + STEP_ATTRIBUTES_FILE, e);
}
}
Aggregations