Hi @awnz,
I have added sardine extension from maven repository into Bonita via this way:
Overview -> Add a custom extension -> Other... -> From a Repository:
<groupId>com.github.lookfirst</groupId>
<artifactId>sardine</artifactId>
<version>5.10</version>
and, I defined the groovy script for Connectors Out for human task upload documents:
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.github.sardine.*
Logger LOGGER = LoggerFactory.getLogger("mycompany")
LOGGER.info("the claims in sardine: ${claims.get(0)}")
LOGGER.info("the claimsDocumentInput in sardine: ${claimsDocumentInput.get(0)}")
Sardine dav = SardineFactory.begin('myusername', 'mypassword')
dav.enablePreemptiveAuthentication("mynextcloudserver") // it seems uploads are more reliable this way
if (!dav.exists('Documents/1')) {
dav.createDirectory('Documents/1')
}
def doc = claims.get(0)
LOGGER.info("the doc in sardine: ${doc}")
dav.put('Documents/1' + "/" + 'test2027.txt', apiAccessor.getProcessAPI().getDocumentContent(doc.id.toString())) // upload a document
But, I got this error after submitted task:
Script1.groovy: 17: unable to resolve class Sardine
@ line 17, column 9.
Sardine dav = SardineFactory.begin('myusername', 'mypassword')
^
1 error
wrapped by org.bonitasoft.engine.connector.ConnectorException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 17: unable to resolve class Sardine
@ line 17, column 9.
Sardine dav = SardineFactory.begin('myusername', 'mypassword')
^
1 error
wrapped by org.bonitasoft.engine.connector.exception.SConnectorException: org.bonitasoft.engine.connector.ConnectorException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 17: unable to resolve class Sardine
@ line 17, column 9.
Sardine dav = SardineFactory.begin('myusername', 'mypassword')
^
1 error
wrapped by org.bonitasoft.engine.commons.exceptions.SBonitaRuntimeException: org.bonitasoft.engine.connector.exception.SConnectorException: org.bonitasoft.engine.connector.ConnectorException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 17: unable to resolve class Sardine
@ line 17, column 9.
Sardine dav = SardineFactory.begin('myusername', 'mypassword')
^
1 error
exception was generated here:Script1.groovy: 17: unable to resolve class Sardine
@ line 17, column 9.
Sardine dav = SardineFactory.begin('myusername', 'mypassword')
Could you please share the way that you use sardine in your Bonita's project?
I'm using Bonita community 2022.1 and Sardine 5.10.
Thank you a lot,
Tam