Estoy tratando de eliminar documentos archivados con el método deleteContentOfArchivedDocument pero tengo un error:
Caused by: org.bonitasoft.engine.bpm.document.DocumentNotFoundException: The document with id 6224 could not be found
at org.bonitasoft.engine.api.impl.DocumentAPIImpl.deleteContentOfArchivedDocument(DocumentAPIImpl.java:456)
at org.bonitasoft.engine.api.impl.ProcessAPIImpl.deleteContentOfArchivedDocument(ProcessAPIImpl.java:5770)
at org.bonitasoft.engine.api.DocumentAPI$deleteContentOfArchivedDocument$0.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at BScript4.run(BScript4.groovy:15)
at org.bonitasoft.engine.expression.impl.GroovyScriptExpressionExecutorCacheStrategy.evaluate(GroovyScriptExpressionExecutorCacheStrategy.java:141)
… 33 more
Caused by: org.bonitasoft.engine.commons.exceptions.SObjectNotFoundException: Document not found with identifier: 6224
at org.bonitasoft.engine.core.document.api.impl.DocumentServiceImpl.getArchivedDocument(DocumentServiceImpl.java:195)
at org.bonitasoft.engine.core.document.api.impl.DocumentServiceImpl.deleteContentOfArchivedDocument(DocumentServiceImpl.java:477)
at org.bonitasoft.engine.api.impl.DocumentAPIImpl.deleteContentOfArchivedDocument(DocumentAPIImpl.java:454)
… 40 more
El código es el siguiente:
import org.bonitasoft.engine.bpm.document.Document;
Document lista = apiAccessor.processAPI.getDocumentAtProcessInstantiation(processInstanceId, “reportTemplate”);
apiAccessor.processAPI.deleteContentOfArchivedDocument(lista.contentStorageId.toLong());
return null;