We are using feign client api's in our implementation to fetch the data from Alfresco.
Below dependency of alfresco is used n pom to fetch the data
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-java-rest-api-spring-boot-starter</artifactId>
<version>5.0.4</version>
</dependency>
In many if the API methods there is one parameter which is a List of String, in which we can define the extra parameters whose values is required in the response which we receive.
For Eg: path, permissions, aspectNames etc.
In one of our case we were trying to fetch multiple values like path and permissions both, but we are getting only one which we add first in the list.
For Eg: If you see the below code snippet in which we included permissions and path both. Please find the code snipper below.
public final NodeEntry getNode(String nodeId) {
NodesApiClient nodesApi = Feign.builder().contract(new SpringMvcContract()).decoder(feignDecoder())
.requestInterceptor(getBasicAuth()).target(NodesApiClient.class, url);
NodeEntry node;
List include = new ArrayList();
include.add("permissions");
include.add("path");
node = nodesApi.getNode(nodeId, include, null, null).getBody();
return node;
}
When we run the above code, in the result we are getting permissions only and not the path and this we have observed in almost with all the api methods.
Note: When we hit the same api as a swagger in the browser then we get the expected results.
Are we doing something wrong here?
Solved! Go to Solution.
I reproduced your problem with the exact versions you are using.
The problem has been detailed in following ticket:
https://github.com/Alfresco/alfresco-java-sdk/issues/97
While this is being solved, you can apply this workaround:
String nodeId = "8bb36efb-c26d-4d2b-9199-ab6922f53c28"; List<String> include = List.of("permissions,path"); Node node = nodesApi.getNode(nodeId, include, null, null).getBody().getEntry(); LOG.info("Permissions: " + node.getPermissions()); LOG.info("Path: " + node.getPath());
I've made a basic tests using Alfresco REST Client SDK, sample available in
https://github.com/aborroy/alfresco-rest-client
Following code allows me to get "path" and "permissions" in the results:
List<String> include = new ArrayList<>(); include.add("permissions"); include.add("path"); nodesApi.getNode("2ba6f3b7-fd7c-48b6-8f6e-dd6c250db89b", include, null, null);
Very strange,
Don't know why its not working for me.
Is working on community version can be the issue for this?
Are you working on community version or enterprise version of ACS.
Thanks
I reproduced your problem with the exact versions you are using.
The problem has been detailed in following ticket:
https://github.com/Alfresco/alfresco-java-sdk/issues/97
While this is being solved, you can apply this workaround:
String nodeId = "8bb36efb-c26d-4d2b-9199-ab6922f53c28"; List<String> include = List.of("permissions,path"); Node node = nodesApi.getNode(nodeId, include, null, null).getBody().getEntry(); LOG.info("Permissions: " + node.getPermissions()); LOG.info("Path: " + node.getPath());
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.