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);
}
}
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);
}
}
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);
}
}
}
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();
}
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);
}
Aggregations