Snapshot Manager Workflow has thrown error
I used “Snapshot Manager” from the Collibra Marketplace workflow and while comparing the snapshots the workflow is giving an error “Invalid Uuid - [55, 49, 44, 78, 49, 56]”. I checked in the code and the error is in following code snippet : –
currentSourceRelationsMap=[:]
sourceRelationsFound = relationApi.findRelations(FindRelationsRequest.builder().sourceId(currentAsset.getId()).build()).getResults()
sourceRelationTypes = sourceRelationsFound.collect{it.getType().getId().toString()}
for(relnType in sourceRelationTypes.unique()){
currentSourceRelationsMap.put("${relnType}:TARGET",[])
}
for(relation in sourceRelationsFound){
currentSourceRelationsMap.get("${relation.getType().getId().toString()}:TARGET").add(relation.getTarget().getId().toString())
}
for(reln in currentSourceRelationsMap){
StringBuilder relnTable = new StringBuilder()
relnTypeObj = relationTypeApi.getRelationType(string2Uuid(reln.key.tokenize(’:’).first().toString()))
loggerApi.info("${relnTypeObj.getRole()} [${relnTypeObj.getTargetType().getName()}]")
header[reln.key] = “${relnTypeObj.getRole()} [${relnTypeObj.getTargetType().getName()}]”
relnValues = reln.value.collect { it.value } ------------------------------------------------------->> relnValues = [55, 49, 44, 78, 49, 56]
for (snapReln in relnValues) {
assetUrl = “${baseUrl}asset/${snapReln.toString()}”
assetName = assetApi.getAsset(string2Uuid(snapReln.toString())).getName() --------------------->> This Line is throwing error
relnTable.append("
}
row["${reln.key}"] = relnTable.toString()
}
The relnValues list is not fetching UUID values properly from the currentSourceRelationsMap. Any help will be appreciaterd. Thanks in advance.
harryhazelwood
·3 years ago · EditedHey,
I’m not a current user of Snapshot Manager but from the code you’ve shown I can see your issue if it was custom written.
As you’ve correctly said reinValues are coming out that are not UUIDs, as such you are getting an error when feeding the assetApi a non UUID.
relnValues = reln.value.collect { it.value }
As you are already looping through the reIn iterable, and then already indexing to the ‘value (reIn.value)’, you do not need the .value after it when collecting the iterable.
As such the code should read:
I may be wrong but that would be my take away from reading the code. without testing it.