How to get the noderef of the sites using sitename?

cancel
Showing results for 
Search instead for 
Did you mean: 
madhu_sudireddy
Active Member

How to get the noderef of the sites using sitename?

Jump to solution

Is there any web url for this?

1 Solution

Accepted Solutions
vidhipanchal
Established Member

Re: How to get the noderef of the sites using sitename?

Jump to solution

Hi,

You can use the 'SiteService' (Java API) to get noderef and other detalis of site by site's shortName as below: 

SiteInfo site = serviceRegistry.getSiteService().getSite("test");
NodeRef siteNode = site.getNodeRef();

This Link provides more information to you about siteServices.

As well as you can use Javascript API for getting noderef of site

var site = siteService.getSite("jncasr");
var siteNodeRef = site.getNode().getNodeRef();

Regards,

Vidhi

ContCentric

Regards,
Vidhi

View solution in original post

3 Replies
vidhipanchal
Established Member

Re: How to get the noderef of the sites using sitename?

Jump to solution

Hi,

You can use the 'SiteService' (Java API) to get noderef and other detalis of site by site's shortName as below: 

SiteInfo site = serviceRegistry.getSiteService().getSite("test");
NodeRef siteNode = site.getNodeRef();

This Link provides more information to you about siteServices.

As well as you can use Javascript API for getting noderef of site

var site = siteService.getSite("jncasr");
var siteNodeRef = site.getNode().getNodeRef();

Regards,

Vidhi

ContCentric

Regards,
Vidhi
atultalhar
Member II

Re: How to get the noderef of the sites using sitename?

Jump to solution

serviceRegistry does not have "getSiteService()" methode.

can you please let me know exact way ?

abhinavmishra14
Advanced

Re: How to get the noderef of the sites using sitename?

Jump to solution

ServiceRegistery does have proxy for SiteService. 

https://github.com/Alfresco/alfresco-repository/blob/master/src/main/java/org/alfresco/service/Servi...

Which version of ACS you are on?

You have option to inject siteService via spring bean as well. Example of a bean def:

<bean id="example.action" class="com.example.TestAction" parent="action-executer">
   <constructor-arg ref="SiteService" /> <!-- proxy SiteService -->
</bean>

or

<bean id="example.action" class="com.example.TestAction" parent="action-executer">
<constructor-arg ref="siteService" />
</bean> or <bean id="example.action" class="com.example.TestAction" parent="action-executer"> <property name="siteService" ref="SiteService" /> <!-- proxy SiteService --> </bean>

or

<bean id="example.action" class="com.example.TestAction" parent="action-executer">
<property name="siteService" ref="siteService" />
</bean>

 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)