Download and update file Alfresco with SpringBoot

cancel
Showing results for 
Search instead for 
Did you mean: 
Bouden
Member II

Download and update file Alfresco with SpringBoot

Jump to solution

Hi everybody, I'm new to Alfresco. I need a solution to be able to communicate alfresco with spring boot so I need a solution rest api that I can download and update file on my application spring and saved it in alfresco

1 Solution

Accepted Solutions
angelborroy
Alfresco Employee

Re: Download and update file Alfresco with SpringBoot

Jump to solution

This is a sample using Spring Boot and CMIS REST API:

https://github.com/aborroy/cmis-associations-alfresco

You can adapt it in order to use the REST API (https://api-explorer.alfresco.com/api-explorer/)

Hyland Developer Evangelist

View solution in original post

5 Replies
angelborroy
Alfresco Employee

Re: Download and update file Alfresco with SpringBoot

Jump to solution

This is a sample using Spring Boot and CMIS REST API:

https://github.com/aborroy/cmis-associations-alfresco

You can adapt it in order to use the REST API (https://api-explorer.alfresco.com/api-explorer/)

Hyland Developer Evangelist
Bouden
Member II

Re: Download and update file Alfresco with SpringBoot

Jump to solution

thank you for this solution but I received this problem:

No active profile set, falling back to default profiles: default
Started App in 0.863 seconds (JVM running for 1.6)
--Creating documents...
created document A 48a7b390-4905-4e81-a2a2-a82ff8e138fe;1.0
created document B c17518eb-e9ce-42f8-822a-63200099a238;1.0
--Setting aspects...
Application run failed
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:821)
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:802)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:341)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1277)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1265)
at org.alfresco.cmis.assoc.App.main(App.java:34)
Caused by: org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException: Type 'P:cmisassoc:relationable' is unknown!
at org.apache.chemistry.opencmis.client.bindings.spi.browser.AbstractBrowserBindingService.convertStatusCode(AbstractBrowserBindingService.java:296)
at org.apache.chemistry.opencmis.client.bindings.spi.browser.AbstractBrowserBindingService.read(AbstractBrowserBindingService.java:410)
at org.apache.chemistry.opencmis.client.bindings.spi.browser.AbstractBrowserBindingService.getTypeDefinitionInternal(AbstractBrowserBindingService.java:518)
at org.apache.chemistry.opencmis.client.bindings.spi.browser.RepositoryServiceImpl.getTypeDefinition(RepositoryServiceImpl.java:82)
at org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getTypeDefinition(RepositoryServiceImpl.java:153)
at org.apache.chemistry.opencmis.client.bindings.impl.RepositoryServiceImpl.getTypeDefinition(RepositoryServiceImpl.java:131)
at org.apache.chemistry.opencmis.client.runtime.SessionImpl.getTypeDefinition(SessionImpl.java:836)
at org.apache.chemistry.opencmis.client.runtime.repository.ObjectFactoryImpl.convertProperties(ObjectFactoryImpl.java:439)
at org.apache.chemistry.opencmis.client.runtime.AbstractCmisObject.updateProperties(AbstractCmisObject.java:398)
at org.apache.chemistry.opencmis.client.runtime.AbstractCmisObject.updateProperties(AbstractCmisObject.java:360)
at org.alfresco.cmis.assoc.service.CmisService.addAspect(CmisService.java:117)
at org.alfresco.cmis.assoc.App.run(App.java:47)
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:818)
... 5 common frames omitted

angelborroy
Alfresco Employee

Re: Download and update file Alfresco with SpringBoot

Jump to solution

As I said, that is a sample Spring Boot application using CMIS REST API. As it's using "cmisassoc:relationable" aspect, it will fail if you haven't deployed that custom model in your Repository. You just need to replace the CMIS REST API client with your Alfresco REST API client.

Hyland Developer Evangelist
yaakoubanis
Member II

Re: Download and update file Alfresco with SpringBoot

Jump to solution

hello ; is there a front part corresponding to the backend spring boot part??

Bouden
Member II

Re: Download and update file Alfresco with SpringBoot

Jump to solution

do you have an explication which i can change the CMIS REST API client with my alfresco REST API !