Search in sources :

Example 51 with DataNode

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());
}
Also used : DataNode(org.pentaho.platform.api.repository2.unified.data.node.DataNode)

Example 52 with DataNode

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;
    }
}
Also used : Condition(org.pentaho.di.core.Condition) DataNode(org.pentaho.platform.api.repository2.unified.data.node.DataNode)

Example 53 with DataNode

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);
    }
}
Also used : DataNode(org.pentaho.platform.api.repository2.unified.data.node.DataNode) IMetaStoreAttribute(org.pentaho.metastore.api.IMetaStoreAttribute) Date(java.util.Date)

Example 54 with DataNode

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);
}
Also used : DataNode(org.pentaho.platform.api.repository2.unified.data.node.DataNode) DataProperty(org.pentaho.platform.api.repository2.unified.data.node.DataProperty)

Example 55 with DataNode

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);
}
Also used : DataNode(org.pentaho.platform.api.repository2.unified.data.node.DataNode)

Aggregations

DataNode (org.pentaho.platform.api.repository2.unified.data.node.DataNode)63 NodeRepositoryFileData (org.pentaho.platform.api.repository2.unified.data.node.NodeRepositoryFileData)22 Test (org.junit.Test)17 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)17 DataProperty (org.pentaho.platform.api.repository2.unified.data.node.DataProperty)15 DataNodeRef (org.pentaho.platform.api.repository2.unified.data.node.DataNodeRef)11 Matchers.anyString (org.mockito.Matchers.anyString)7 Date (java.util.Date)6 IUnifiedRepository (org.pentaho.platform.api.repository2.unified.IUnifiedRepository)6 ArrayList (java.util.ArrayList)5 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)5 ITenant (org.pentaho.platform.api.mt.ITenant)5 HashMap (java.util.HashMap)4 Map (java.util.Map)4 NotePadMeta (org.pentaho.di.core.NotePadMeta)4 KettleException (org.pentaho.di.core.exception.KettleException)4 JobMeta (org.pentaho.di.job.JobMeta)4 JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)4 StringObjectId (org.pentaho.di.repository.StringObjectId)4 Properties (java.util.Properties)3