11-07-2016 03:29 AM
Hello,
I would like to use some of the methods in Alfresco's SiteService and respectively its implementation.
For example - I want to list all currently created Sites in Alfresco system in a Java code.
What exactly should I inject in my code and what bean should I include.....Its not exactly clear for me.
Thank you in advance.
11-07-2016 07:08 AM
You also need to add the setter, ie.
public void setSiteService(SiteService siteService)
{
this.siteService = siteService;
}
Regards,
Jan
11-08-2016 08:40 AM
well....as an other option. The SiteService is now working and I use the method findSites() to list all sites, however the returned object is different than this one in the /api/sites, so if I want to get the json object from /api/sites, I don't know other option....
If you know, I will be glad if you share it.
11-09-2016 07:54 AM
You can read those values from alfresco-global.properties.
The following links describes how to do so
Accessing values from Alfresco's alfresco-global.properties file - Stack Overflow
Accessing values from Alfresco's alfresco-global.properties file - Stack Overflow
11-09-2016 04:31 PM
I think SysAdminParams service is what I was looking for.
11-07-2016 07:39 AM
Yes,you need to add setter method in your xxx.demoamp.CustomWebScript class as @Jan Vonka said
11-07-2016 04:09 AM
Alternatively, you can also inject the ServiceRegistry into your custom bean XML extension file:
<property name="serviceRegistry" ref="ServiceRegistry"/>
and then get the SiteService locally (or other public services, as needed):
private ServiceRegistry serviceRegistry;
public void setServiceRegistry(ServiceRegistry serviceRegistry){
this.serviceRegistry = serviceRegistry;
}public void myMethod()
{
SiteService siteService = serviceRegistry.getSiteService();
// ... more here
}
Regards,
Jan
11-08-2016 08:05 AM
Jan Vonka is this a safe method as ServiceRegistry is providing lower case service beans?
11-08-2016 08:12 AM
Angel Borroy Are you sure ? In general, ServiceRegistry returns upper-case public service beans.
11-08-2016 08:21 AM
Jan Vonka You are right: community-edition/ServiceRegistry.java at master · Alfresco/community-edition · GitHub
My mistake, thanks for the clarification!
11-08-2016 08:22 AM
ServiceRegistry do return upper-case public service beans,but but getting some service bean via the ServiceRegistry is not recommended any more.
11-08-2016 08:25 AM
I have the following code:
String query = "SELECT * FROM cmis:document";
OperationContext oc = session.createOperationContext();
oc.setMaxItemsPerPage(1000000);
resultado = session.query(query.toString(), false, oc);
But I have more than 5 thousand documents and the cmis returns me only a thousand. How do I increase the number of pages that it searches? I believe he is bringing a page with only his maximum (thousand documents).
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.