Search in sources :

Example 51 with StringObjectId

use of org.pentaho.di.repository.StringObjectId in project pentaho-kettle by pentaho.

the class SingleThreaderMeta method loadXML.

public void loadXML(Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore) throws KettleXMLException {
    try {
        String method = XMLHandler.getTagValue(stepnode, "specification_method");
        specificationMethod = ObjectLocationSpecificationMethod.getSpecificationMethodByCode(method);
        String transId = XMLHandler.getTagValue(stepnode, "trans_object_id");
        transObjectId = Utils.isEmpty(transId) ? null : new StringObjectId(transId);
        transName = XMLHandler.getTagValue(stepnode, "trans_name");
        fileName = XMLHandler.getTagValue(stepnode, "filename");
        directoryPath = XMLHandler.getTagValue(stepnode, "directory_path");
        batchSize = XMLHandler.getTagValue(stepnode, "batch_size");
        batchTime = XMLHandler.getTagValue(stepnode, "batch_time");
        injectStep = XMLHandler.getTagValue(stepnode, "inject_step");
        retrieveStep = XMLHandler.getTagValue(stepnode, "retrieve_step");
        Node parametersNode = XMLHandler.getSubNode(stepnode, "parameters");
        String passAll = XMLHandler.getTagValue(parametersNode, "pass_all_parameters");
        passingAllParameters = Utils.isEmpty(passAll) || "Y".equalsIgnoreCase(passAll);
        int nrParameters = XMLHandler.countNodes(parametersNode, "parameter");
        allocate(nrParameters);
        for (int i = 0; i < nrParameters; i++) {
            Node knode = XMLHandler.getSubNodeByNr(parametersNode, "parameter", i);
            parameters[i] = XMLHandler.getTagValue(knode, "name");
            parameterValues[i] = XMLHandler.getTagValue(knode, "value");
        }
    } catch (Exception e) {
        throw new KettleXMLException(BaseMessages.getString(PKG, "SingleThreaderMeta.Exception.ErrorLoadingTransformationStepFromXML"), e);
    }
}
Also used : Node(org.w3c.dom.Node) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) StringObjectId(org.pentaho.di.repository.StringObjectId) KettleException(org.pentaho.di.core.exception.KettleException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleStepException(org.pentaho.di.core.exception.KettleStepException)

Example 52 with StringObjectId

use of org.pentaho.di.repository.StringObjectId in project pentaho-metaverse by pentaho.

the class AbstractJobEntryJsonSerializer method writeRepoAttributes.

protected void writeRepoAttributes(T meta, JsonGenerator json) throws IOException {
    ObjectId jobId = meta.getObjectId() == null ? new StringObjectId(meta.getName()) : meta.getObjectId();
    LineageRepository repo = getLineageRepository();
    if (repo != null) {
        Map<String, Object> attrs = repo.getJobEntryAttributesCache(jobId);
        json.writeObjectField(JSON_PROPERTY_ATTRIBUTES, attrs);
        List<Map<String, Object>> fields = repo.getJobEntryFieldsCache(jobId);
        json.writeObjectField(JSON_PROPERTY_FIELDS, fields);
    }
}
Also used : ObjectId(org.pentaho.di.repository.ObjectId) StringObjectId(org.pentaho.di.repository.StringObjectId) LineageRepository(org.pentaho.metaverse.impl.model.kettle.LineageRepository) StringObjectId(org.pentaho.di.repository.StringObjectId) Map(java.util.Map)

Example 53 with StringObjectId

use of org.pentaho.di.repository.StringObjectId in project pentaho-metaverse by pentaho.

the class AbstractStepMetaJsonSerializer method writeRepoAttributes.

protected void writeRepoAttributes(T meta, JsonGenerator json) throws IOException {
    StepMeta parentStepMeta = meta.getParentStepMeta();
    if (parentStepMeta != null) {
        String id = meta.getObjectId() == null ? parentStepMeta.getName() : meta.getObjectId().toString();
        ObjectId stepId = new StringObjectId(id);
        LineageRepository repo = getLineageRepository();
        if (repo != null) {
            Map<String, Object> attrs = repo.getStepAttributesCache(stepId);
            json.writeObjectField(JSON_PROPERTY_ATTRIBUTES, attrs);
            List<Map<String, Object>> fields = repo.getStepFieldsCache(stepId);
            json.writeObjectField(JSON_PROPERTY_FIELDS, fields);
        }
    }
}
Also used : StringObjectId(org.pentaho.di.repository.StringObjectId) ObjectId(org.pentaho.di.repository.ObjectId) LineageRepository(org.pentaho.metaverse.impl.model.kettle.LineageRepository) StepMeta(org.pentaho.di.trans.step.StepMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) StringObjectId(org.pentaho.di.repository.StringObjectId) Map(java.util.Map)

Example 54 with StringObjectId

use of org.pentaho.di.repository.StringObjectId in project pentaho-metaverse by pentaho.

the class TransMetaJsonSerializer method serializeSteps.

@Override
protected void serializeSteps(TransMeta meta, JsonGenerator json) throws IOException {
    json.writeArrayFieldStart(JSON_PROPERTY_STEPS);
    for (StepMeta stepMeta : meta.getSteps()) {
        BaseStepMeta step = getBaseStepMetaFromStepMeta(stepMeta);
        LineageRepository repo = getLineageRepository();
        String id = stepMeta.getObjectId() == null ? stepMeta.getName() : stepMeta.getObjectId().toString();
        ObjectId stepId = new StringObjectId(id);
        try {
            step.saveRep(repo, null, null, stepId);
        } catch (KettleException e) {
            LOGGER.warn(Messages.getString("INFO.Serialization.Trans.Step", stepMeta.getName()), e);
        }
        json.writeObject(step);
    }
    json.writeEndArray();
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) ObjectId(org.pentaho.di.repository.ObjectId) StringObjectId(org.pentaho.di.repository.StringObjectId) LineageRepository(org.pentaho.metaverse.impl.model.kettle.LineageRepository) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) StringObjectId(org.pentaho.di.repository.StringObjectId)

Example 55 with StringObjectId

use of org.pentaho.di.repository.StringObjectId in project pentaho-metaverse by pentaho.

the class LineageRepositoryTest method setUp.

@Before
public void setUp() throws Exception {
    repo = new LineageRepository();
    stepId = new StringObjectId("testStepId");
    saveStepId = new StringObjectId("saveStepId");
    jobId = new StringObjectId("testJobId");
    jobEntryId = new StringObjectId("saveJobEntryId");
    Map<String, Object> attrs = new HashMap<String, Object>();
    List<Map<String, Object>> stepFields = new ArrayList<Map<String, Object>>();
    Map<String, Object> boolField = new HashMap<String, Object>();
    boolField.put("name", "test");
    boolField.put("boolField", true);
    attrs.put("boolField", true);
    stepFields.add(0, boolField);
    Map<String, Object> intField = new HashMap<String, Object>();
    intField.put("name", "test");
    intField.put("intField", 4);
    attrs.put("intField", 4);
    stepFields.add(1, intField);
    Map<String, Object> stringField = new HashMap<String, Object>();
    stringField.put("name", "test");
    stringField.put("stringField", "hello world");
    attrs.put("stringField", "hello world");
    stepFields.add(2, stringField);
    repo.stepFieldCache.put(stepId, stepFields);
    repo.stepAttributeCache.put(stepId, attrs);
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) StringObjectId(org.pentaho.di.repository.StringObjectId) Map(java.util.Map) HashMap(java.util.HashMap) Before(org.junit.Before)

Aggregations

StringObjectId (org.pentaho.di.repository.StringObjectId)123 KettleException (org.pentaho.di.core.exception.KettleException)49 ObjectId (org.pentaho.di.repository.ObjectId)38 Test (org.junit.Test)34 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)25 KettleFileException (org.pentaho.di.core.exception.KettleFileException)21 MetaStoreException (org.pentaho.metastore.api.exceptions.MetaStoreException)18 MetaStoreNamespaceExistsException (org.pentaho.metastore.api.exceptions.MetaStoreNamespaceExistsException)18 ArrayList (java.util.ArrayList)16 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)15 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)14 RepositoryObject (org.pentaho.di.repository.RepositoryObject)14 TransMeta (org.pentaho.di.trans.TransMeta)14 IdNotFoundException (org.pentaho.di.core.exception.IdNotFoundException)13 KettleSecurityException (org.pentaho.di.core.exception.KettleSecurityException)13 UnifiedRepositoryCreateFileException (org.pentaho.platform.api.repository2.unified.UnifiedRepositoryCreateFileException)13 UnifiedRepositoryUpdateFileException (org.pentaho.platform.api.repository2.unified.UnifiedRepositoryUpdateFileException)13 Repository (org.pentaho.di.repository.Repository)11 IOException (java.io.IOException)10 FileObject (org.apache.commons.vfs2.FileObject)10