Change asset status
I’m trying to change an asset’s status as follows:
import com.collibra.dgc.core.api.dto.instance.asset.ChangeAssetRequest;
java.util.UUID assetIdUuid = string2Uuid(issue.id);
java.util.UUID assignedStatus = string2Uuid(“4d8c7028-24a9-4a54-a47a-e5478d545240”);
assetApi.changeAsset(ChangeAssetRequest.builder()
.id(assetIdUuid)
.statusId(assignedStatus)
);
This code doesnt’t work and I get the following in the console log
“Caused by: groovy.lang.MissingMethodException: No signature of method: com.sun.proxy.$Proxy384.changeAsset() is applicable for argument types: (com.collibra.dgc.core.api.dto.instance.asset.ChangeAssetRequest$Builder) values: [ChangeAssetRequest.Builder(id=d3251754-47f3-4935-9326-41f143ff5ef7, name=null, displayName=null, typeId=null, statusId=4d8c7028-24a9-4a54-a47a-e5478d545240, domainId=null, excludedFromAutoHyperlinking=null)]”
Any suggestions?
georgecheung
·5 years ago · EditedSounds like what could be happening is that another workflow is being triggered upon the event of status change.
If it runs fine without the changing status, then it is likely that the workflow isn’t being triggered and not running into that error.
If the triggered workflows fails, then the event that caused it will also fail.
The error message ‘java.lang.IndexOutOfBoundsException: Index: 0, Size: 0’ typically means that it is trying to get the first element from an empty list, since it is empty it runs into the out of bounds exception.
Based on the code provided, nothing is a list, and there isn’t anything trying to get an element from an empty list.
Former User
OP5 years ago · EditedThanks Arthur! That seemed to have fixed the error. But now I’m getting the following error:
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:659)
at java.util.ArrayList.get(ArrayList.java:435)
at java_util_List$get$0.call(Unknown Source)
at Script13.run(Script13.groovy:20)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)
at org.flowable.common.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:88)
at org.flowable.common.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:74)
at org.flowable.engine.impl.bpmn.behavior.ScriptTaskActivityBehavior.execute(ScriptTaskActivityBehavior.java:78)
This error is tied to the script task. Specifically, if I remove :
assetApi.changeAsset(ChangeAssetRequest.builder()
.id(assetIdUuid)
.statusId(assignedStatus)
.build()
);
it works. It’s not the assetIdUuid piece as I’ve tested that elsewhere and it works. For some reason I can’t run the assetApi piece related to changing the the incident’s status.
Former User
OP5 years ago · EditedThanks Arthur! That seemed to have fixed the error. But now I’m getting the following error:
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:659)
at java.util.ArrayList.get(ArrayList.java:435)
at java_util_List$get$0.call(Unknown Source)
at Script13.run(Script13.groovy:20)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)
at org.flowable.common.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:88)
at org.flowable.common.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:74)
at org.flowable.engine.impl.bpmn.behavior.ScriptTaskActivityBehavior.execute(ScriptTaskActivityBehavior.java:78)
This error is tied to the script task. Specifically, if I remove :
assetApi.changeAsset(ChangeAssetRequest.builder()
.id(assetIdUuid)
.statusId(assignedStatus)
.build()
);
it works. It’s not the assetIdUuid piece as I’ve tested that elsewhere and it works. For some reason I can’t run the assetApi piece related to changing the the incident’s status.
arthurburkhardt
·5 years ago · EditedI would suggest that you put logging in multiple parts of your script to see what breaks. You might be surprised.
just use
loggingApi.info("Value of assetIdUuid: ${assetIdUuid}")and such to see what goes wrong.arthurburkhardt
·5 years ago · Editedyes, you’re missing a “.build()” at the end of your request.
This should work.