Search in sources :

Example 66 with IMetaverseNode

use of org.pentaho.metaverse.api.IMetaverseNode in project pentaho-metaverse by pentaho.

the class MongoDbInputStepAnalyzer method createOutputFieldNode.

@Override
protected IMetaverseNode createOutputFieldNode(IAnalysisContext context, ValueMetaInterface fieldMeta, String targetStepName, String nodeType) {
    IMetaverseNode mongoFieldNode = super.createOutputFieldNode(context, fieldMeta, targetStepName, nodeType);
    List<MongoField> mongoFields = baseStepMeta.getMongoFields();
    if (mongoFields != null) {
        for (MongoField mongoField : mongoFields) {
            if (fieldMeta.getName().equals(mongoField.getName())) {
                mongoFieldNode.setProperty(JSON_PATH, mongoField.m_fieldPath);
                mongoFieldNode.setProperty(MINMAX_RANGE, mongoField.m_arrayIndexInfo);
                mongoFieldNode.setProperty(OCCUR_RATIO, mongoField.m_occurenceFraction);
                mongoFieldNode.setProperty(INDEXED_VALS, mongoField.m_indexedVals);
                mongoFieldNode.setProperty(DISPARATE_TYPES, mongoField.m_disparateTypes);
                break;
            }
        }
    }
    return mongoFieldNode;
}
Also used : IMetaverseNode(org.pentaho.metaverse.api.IMetaverseNode) MongoField(org.pentaho.mongo.wrapper.field.MongoField)

Example 67 with IMetaverseNode

use of org.pentaho.metaverse.api.IMetaverseNode in project pentaho-metaverse by pentaho.

the class RestClientStepAnalyzer method createResourceNode.

@Override
public IMetaverseNode createResourceNode(IExternalResourceInfo resource) throws MetaverseException {
    MetaverseComponentDescriptor componentDescriptor = new MetaverseComponentDescriptor(resource.getName(), getResourceInputNodeType(), descriptor.getNamespace(), descriptor.getContext());
    IMetaverseNode node = createNodeFromDescriptor(componentDescriptor);
    return node;
}
Also used : IMetaverseNode(org.pentaho.metaverse.api.IMetaverseNode) MetaverseComponentDescriptor(org.pentaho.metaverse.api.MetaverseComponentDescriptor)

Example 68 with IMetaverseNode

use of org.pentaho.metaverse.api.IMetaverseNode in project pentaho-metaverse by pentaho.

the class TableInputStepAnalyzer method createTableNode.

@Override
protected IMetaverseNode createTableNode(IExternalResourceInfo resource) throws MetaverseAnalyzerException {
    BaseDatabaseResourceInfo resourceInfo = (BaseDatabaseResourceInfo) resource;
    Object obj = resourceInfo.getAttributes().get(DictionaryConst.PROPERTY_QUERY);
    String query = obj == null ? null : obj.toString();
    // create a node for the table
    MetaverseComponentDescriptor componentDescriptor = new MetaverseComponentDescriptor("SQL", DictionaryConst.NODE_TYPE_SQL_QUERY, getConnectionNode(), getDescriptor().getContext());
    // set the namespace to be the id of the connection node.
    IMetaverseNode tableNode = createNodeFromDescriptor(componentDescriptor);
    tableNode.setProperty(DictionaryConst.PROPERTY_NAMESPACE, componentDescriptor.getNamespace().getNamespaceId());
    tableNode.setProperty(DictionaryConst.PROPERTY_QUERY, query);
    tableNode.setLogicalIdGenerator(DictionaryConst.LOGICAL_ID_GENERATOR_DB_QUERY);
    return tableNode;
}
Also used : BaseDatabaseResourceInfo(org.pentaho.metaverse.api.model.BaseDatabaseResourceInfo) IMetaverseNode(org.pentaho.metaverse.api.IMetaverseNode) MetaverseComponentDescriptor(org.pentaho.metaverse.api.MetaverseComponentDescriptor)

Example 69 with IMetaverseNode

use of org.pentaho.metaverse.api.IMetaverseNode in project pentaho-metaverse by pentaho.

the class TransExecutorStepAnalyzer method connectToSubTransOutputFields.

protected void connectToSubTransOutputFields(TransExecutorMeta meta, TransMeta subTransMeta, IMetaverseNode subTransNode, IComponentDescriptor descriptor) {
    if (meta.getOutputRowsSourceStep() != null) {
        String outputStep = meta.getOutputRowsSourceStep();
        for (int i = 0; i < meta.getOutputRowsField().length; i++) {
            String fieldName = meta.getOutputRowsField()[i];
            IMetaverseNode outNode = getOutputs().findNode(outputStep, fieldName);
            if (outNode != null) {
                // add link, if needed, from sub tran result fields to the node just created
                linkResultFieldToSubTrans(outNode, subTransMeta, subTransNode, descriptor);
            }
        }
    }
    if (meta.getExecutorsOutputStep() != null) {
        String outputStep = meta.getExecutorsOutputStep();
        for (int i = 0; i < meta.getOutputRowsField().length; i++) {
            String fieldName = meta.getOutputRowsField()[i];
            IMetaverseNode outNode = getOutputs().findNode(outputStep, fieldName);
            if (outNode != null) {
                // add link, if needed, from sub tran result fields to the node just created
                linkResultFieldToSubTrans(outNode, subTransMeta, subTransNode, descriptor);
            }
        }
    }
}
Also used : IMetaverseNode(org.pentaho.metaverse.api.IMetaverseNode)

Example 70 with IMetaverseNode

use of org.pentaho.metaverse.api.IMetaverseNode in project pentaho-metaverse by pentaho.

the class BlueprintsGraphMetaverseReader method findNode.

@Override
public IMetaverseNode findNode(String id) {
    Vertex vertex = getGraph().getVertex(id);
    if (vertex == null) {
        return null;
    }
    MetaverseUtil.enhanceVertex(vertex);
    MetaverseNode node = new MetaverseNode(vertex);
    return node;
}
Also used : Vertex(com.tinkerpop.blueprints.Vertex) MetaverseNode(org.pentaho.metaverse.impl.MetaverseNode) IMetaverseNode(org.pentaho.metaverse.api.IMetaverseNode)

Aggregations

IMetaverseNode (org.pentaho.metaverse.api.IMetaverseNode)131 Test (org.junit.Test)77 IComponentDescriptor (org.pentaho.metaverse.api.IComponentDescriptor)30 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)23 MetaverseComponentDescriptor (org.pentaho.metaverse.api.MetaverseComponentDescriptor)16 ValueMeta (org.pentaho.di.core.row.ValueMeta)13 IExternalResourceInfo (org.pentaho.metaverse.api.model.IExternalResourceInfo)12 IAnalysisContext (org.pentaho.metaverse.api.IAnalysisContext)11 MetaverseAnalyzerException (org.pentaho.metaverse.api.MetaverseAnalyzerException)11 Vertex (com.tinkerpop.blueprints.Vertex)10 ArrayList (java.util.ArrayList)10 INamespace (org.pentaho.metaverse.api.INamespace)10 TransMeta (org.pentaho.di.trans.TransMeta)9 BaseStepMeta (org.pentaho.di.trans.step.BaseStepMeta)9 MetaverseTransientNode (org.pentaho.dictionary.MetaverseTransientNode)9 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)8 Namespace (org.pentaho.metaverse.api.Namespace)8 StepField (org.pentaho.metaverse.api.StepField)8 HashMap (java.util.HashMap)7 Matchers.anyString (org.mockito.Matchers.anyString)7