use of org.pentaho.metaverse.api.analyzer.kettle.ComponentDerivationRecord in project pentaho-metaverse by pentaho.
the class StringsReplaceStepAnalyzer method getChangeRecords.
@Override
public Set<ComponentDerivationRecord> getChangeRecords(final ReplaceStringMeta stringsReplaceMeta) throws MetaverseAnalyzerException {
renameIndex.clear();
Set<ComponentDerivationRecord> changeRecords = new HashSet<ComponentDerivationRecord>();
for (int i = 0; i < stringsReplaceMeta.getFieldInStream().length; i++) {
ComponentDerivationRecord changeRecord = buildChangeRecord(stringsReplaceMeta, i);
changeRecords.add(changeRecord);
}
return changeRecords;
}
use of org.pentaho.metaverse.api.analyzer.kettle.ComponentDerivationRecord in project pentaho-metaverse by pentaho.
the class AbstractStepMetaJsonSerializer method writeFieldTransforms.
protected void writeFieldTransforms(T meta, JsonGenerator json, SerializerProvider serializerProvider) throws IOException, JsonGenerationException {
json.writeArrayFieldStart(JSON_PROPERTY_TRANSFORMS);
IFieldLineageMetadataProvider mapper = getFieldLineageMetadataProvider(meta);
try {
Set<ComponentDerivationRecord> changes = mapper.getChangeRecords(meta);
if (changes != null) {
for (ComponentDerivationRecord change : changes) {
if (change.hasDelta()) {
json.writeObject(change);
}
}
}
} catch (MetaverseAnalyzerException e) {
LOGGER.warn(Messages.getString("WARNING.Serialization.Step.WriteFieldTransforms", meta.getParentStepMeta().getName()), e);
}
json.writeEndArray();
}
use of org.pentaho.metaverse.api.analyzer.kettle.ComponentDerivationRecord in project pentaho-metaverse by pentaho.
the class SplitFieldsStepAnalyzerTest method testGetChangeRecords.
@Test
public void testGetChangeRecords() throws Exception {
Set<ComponentDerivationRecord> changeRecords = analyzer.getChangeRecords(meta);
assertEquals(3, changeRecords.size());
for (ComponentDerivationRecord changeRecord : changeRecords) {
assertEquals("splitField", changeRecord.getOriginalEntityName());
assertTrue(ArrayUtils.contains(outputFields, changeRecord.getChangedEntityName()));
Operations operations = changeRecord.getOperations();
// Only data operations
assertEquals(1, operations.size());
List<IOperation> dataOperations = operations.get(ChangeType.DATA);
assertEquals(1, dataOperations.size());
}
}
use of org.pentaho.metaverse.api.analyzer.kettle.ComponentDerivationRecord in project pentaho-metaverse by pentaho.
the class StringsCutStepAnalyzerTest method testGetChangeRecords.
@Test
public void testGetChangeRecords() throws Exception {
Set<ComponentDerivationRecord> changeRecords = analyzer.getChangeRecords(stringsCutMeta);
assertEquals(changeRecords.size(), 3);
List<String> inFields = Arrays.asList(stringsCutMeta.getFieldInStream());
for (ComponentDerivationRecord change : changeRecords) {
assertTrue(inFields.contains(change.getOriginalEntityName()));
assertEquals(1, change.getOperations(ChangeType.DATA).size());
assertNull(change.getOperations(ChangeType.METADATA));
}
}
use of org.pentaho.metaverse.api.analyzer.kettle.ComponentDerivationRecord in project pentaho-metaverse by pentaho.
the class StringsReplaceStepAnalyzerTest method testGetChangeRecords.
@Test
public void testGetChangeRecords() throws Exception {
Set<ComponentDerivationRecord> changeRecords = analyzer.getChangeRecords(stringsReplaceMeta);
assertEquals(changeRecords.size(), 3);
List<String> inFields = Arrays.asList(stringsReplaceMeta.getFieldInStream());
for (ComponentDerivationRecord change : changeRecords) {
assertTrue(inFields.contains(change.getOriginalEntityName()));
assertEquals(1, change.getOperations(ChangeType.DATA).size());
assertNull(change.getOperations(ChangeType.METADATA));
}
}
Aggregations