Execute Validation from a Workflow
I cannot find documentation on how to execute validation on an asset from a workflow. I imagine it’s a simple line of code, e.g. Asset.executeValidation(), or better yet, there may be a Collibra Java class I can use for this purpose. There are classes such as com.collibra.dgc.core.workflow.activiti.delegate.ChangeStatusDelegate. Is there something like this for kicking off validation?
P.S. The reason I want to do this is so that when a particular asset type is created or modified, I want the validation rules associated with that asset type to execute.
guygore
Posted 5 years ago · Edited 1 year ago·Last reply 1 year ago
6 comments
S Benson
·2 years ago · EditedI am not a developer, but I am trying to write a simple script that will execute a validation routine. So far, I’ve gotten:
com.collibra.dgc.core.api.component.validation
validationApi.validate(UUID assetId)
How do I identify the specific validation routine I want to execute? Am I even on the right track?
THANKS
BUAmina
·1 year ago@scottbenson feel you. Here is my approach, which works. I have also included a user task and a button to "revalidate".
import com.collibra.dgc.core.api.component.instance.AssetApi;
import com.collibra.dgc.core.api.component.validation.ValidationApi;
import com.collibra.dgc.core.api.component.logger.LoggerApi;
currentAsset = assetApi.getAsset(item.getId())
loggerApi.info("AssetId has been taken: ")
boolean finalResult = true
List validationResults = validationApi.validate(currentAsset.getId())
for (result:validationResults) {
if (result.getResult() == false)
finalResult = false
}
execution.setVariable('finalResult',finalResult)
arthurburkhardt
·5 years ago · EditedYes, the
validationApi.validate(UUID assetId)method is available in the API documentation.guygore
OP5 years ago · EditedSorry fo r the delay in responding. Your reply got me on the right path and I thank you for that. Ultimately I used this line of code:
validationApi.validate(item.id);
This did NOT work if I had the script language set to JavaScript but it DID work when I set the script language to Groovy.
khanhdung_dao
·3 years ago · EditedThis method returns a list of ValidationResult. How can I get the final validation result (Validation result column) of an asset?
Tom Friesen
·3 years ago · EditedThere are a couple of ways to get the combined result, some of which depend on the means by which you did the Validation.