use of org.pentaho.platform.api.repository2.unified.data.node.DataNode in project pentaho-kettle by pentaho.
the class RepositoryProxy method saveConditionStepAttribute.
public void saveConditionStepAttribute(ObjectId idTransformation, ObjectId idStep, String code, Condition condition) throws KettleException {
DataNode conditionNode = node.addNode(code);
conditionNode.setProperty(PROPERTY_XML, condition.getXML());
}
use of org.pentaho.platform.api.repository2.unified.data.node.DataNode in project pentaho-kettle by pentaho.
the class RepositoryProxy method loadConditionFromStepAttribute.
public Condition loadConditionFromStepAttribute(ObjectId idStep, String code) throws KettleException {
DataNode conditionNode = node.getNode(code);
if (conditionNode.hasProperty(PROPERTY_XML)) {
String xml = conditionNode.getProperty(PROPERTY_XML).getString();
Condition condition = new Condition(XMLHandler.getSubNode(XMLHandler.loadXMLString(xml), Condition.XML_TAG));
return condition;
} else {
return null;
}
}
use of org.pentaho.platform.api.repository2.unified.data.node.DataNode in project pentaho-kettle by pentaho.
the class PurRepositoryMetaStore method attributeToDataNode.
protected void attributeToDataNode(IMetaStoreAttribute attribute, DataNode dataNode) {
String id = attribute.getId();
Object value = attribute.getValue();
if (id == null) {
throw new NullPointerException();
} else if (value != null) {
if (value instanceof Double) {
dataNode.setProperty(id, (Double) value);
} else if (value instanceof Date) {
dataNode.setProperty(id, (Date) value);
} else if (value instanceof Long) {
dataNode.setProperty(id, (Long) value);
} else {
dataNode.setProperty(id, value.toString());
}
}
for (IMetaStoreAttribute child : attribute.getChildren()) {
DataNode subNode = new DataNode(child.getId());
attributeToDataNode(child, subNode);
dataNode.addNode(subNode);
}
}
use of org.pentaho.platform.api.repository2.unified.data.node.DataNode in project pentaho-kettle by pentaho.
the class PurRepositoryMetaStore method dataNodeToElement.
protected void dataNodeToElement(DataNode dataNode, IMetaStoreElement element) throws MetaStoreException {
DataProperty nameProperty = dataNode.getProperty(PROP_NAME);
if (nameProperty != null) {
element.setName(nameProperty.getString());
}
DataNode childrenNode = dataNode.getNode(PROP_ELEMENT_CHILDREN);
dataNodeToAttribute(childrenNode, element);
}
use of org.pentaho.platform.api.repository2.unified.data.node.DataNode in project pentaho-kettle by pentaho.
the class PurRepositoryMetaStore method elementToDataNode.
protected void elementToDataNode(IMetaStoreElement element, DataNode elementDataNode) {
elementDataNode.setProperty(PROP_NAME, element.getName());
DataNode childrenNode = elementDataNode.addNode(PROP_ELEMENT_CHILDREN);
if (Utils.isEmpty(element.getId())) {
element.setId(element.getName());
}
attributeToDataNode(element, childrenNode);
}
Aggregations