use of org.pentaho.metaverse.impl.model.kettle.LineageRepository 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);
}
}
use of org.pentaho.metaverse.impl.model.kettle.LineageRepository 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);
}
}
}
use of org.pentaho.metaverse.impl.model.kettle.LineageRepository 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();
}
use of org.pentaho.metaverse.impl.model.kettle.LineageRepository in project pentaho-metaverse by pentaho.
the class TransMetaJsonSerializerTest method setUp.
@Before
public void setUp() throws Exception {
serializer = new TransMetaJsonSerializer(TransMeta.class);
serializer.setLineageRepository(new LineageRepository());
when(transMeta.getName()).thenReturn("TestTransName");
when(transMeta.getDescription()).thenReturn("Trans description");
}
use of org.pentaho.metaverse.impl.model.kettle.LineageRepository in project pentaho-metaverse by pentaho.
the class JobMetaJsonSerializer method serializeSteps.
@Override
protected void serializeSteps(JobMeta meta, JsonGenerator json) throws IOException {
json.writeArrayFieldStart(JSON_PROPERTY_STEPS);
int numberOfEntries = meta.nrJobEntries();
for (int i = 0; i < numberOfEntries; i++) {
JobEntryCopy jobEntry = meta.getJobEntry(i);
LineageRepository repo = getLineageRepository();
ObjectId jobId = meta.getObjectId() == null ? new StringObjectId(meta.getName()) : meta.getObjectId();
ObjectId entryId = jobEntry.getObjectId() == null ? new StringObjectId(jobEntry.getName()) : jobEntry.getObjectId();
JobEntryInterface jobEntryInterface = jobEntry.getEntry();
JobEntryBase jobEntryBase = getJobEntryBase(jobEntryInterface);
Job job = new Job(null, meta);
jobEntryBase.setParentJob(job);
jobEntryInterface.setObjectId(entryId);
try {
jobEntryInterface.saveRep(repo, null, jobId);
} catch (KettleException e) {
LOGGER.warn(Messages.getString("INFO.Serialization.Trans.Step", jobEntry.getName()), e);
}
json.writeObject(jobEntryBase);
}
json.writeEndArray();
}
Aggregations