Skip to content

Commit

Permalink
getAssets now correctly returns an asset & classification. #216
Browse files Browse the repository at this point in the history
Signed-off-by: Nigel Jones <nigel.l.jones+git@gmail.com>
  • Loading branch information
planetf1 committed Sep 25, 2018
1 parent d7b6a2b commit 879cd24
Showing 1 changed file with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ private void addClassificationInfoToEntry(GovernedAsset entry, EntityDetail enti

// Get the current list of assigned classification
List<GovernanceClassificationUsage> usageList = entry.getAssignedGovernanceClassifications();
if (usageList == null)
usageList = new ArrayList<GovernanceClassificationUsage>();

// Add the new assignment locally (in case of copying)
GovernanceClassificationUsage usage = new GovernanceClassificationUsage();
Expand All @@ -225,15 +227,19 @@ private void addClassificationInfoToEntry(GovernedAsset entry, EntityDetail enti

// And now let's pull in the properties
Map<String,String> m = new HashMap<>();
Map<String, InstancePropertyValue> ip=entityClassification.getProperties().getInstanceProperties();

//mapping them to our map
ip.entrySet().stream().forEach(props -> {
// TODO Mapping of types between OMRS and Ranger should be abstracted
// TODO Mapping of alpha name is fragile - temporary for initial debug
m.put(props.getKey(),props.getValue().toString());
});

InstanceProperties ip2 = entityClassification.getProperties();
if (ip2!=null) {
Map<String, InstancePropertyValue> ip = ip2.getInstanceProperties();
if (ip != null) {
//mapping them to our map
ip.entrySet().stream().forEach(props -> {
// TODO Mapping of types between OMRS and Ranger should be abstracted
// TODO Mapping of alpha name is fragile - temporary for initial debug
m.put(props.getKey(), props.getValue().toString());
});
}
}
// And set them back
usage.setAttributeValues(m);
usageList.add(usage);
Expand Down

0 comments on commit 879cd24

Please sign in to comment.