AnsweredAssumed Answered

getServiceRegistry, getRepositoryContext

Question asked by tasso on Oct 22, 2009
Latest reply on Mar 19, 2010 by thomasg
getServiceRegistry, getRepositoryContext

I recently upgraded from to the 3.2 CE edition of alfresco. In our previous version of alfresco we used java backed webscripts and in many of our webscripts we used the get getServiceRegistry and getRepositoryContext methods as they were available through the AbstractWebScript class.  Since upgrading to version 3.2 it looks like these methods have been removed from the AbstractWebScript class. Below is an example of abstract class where we extended AbstractWebScript and called these methods

   protected AuthenticationService getAuthenticationService() {
      AuthenticationService returnAuthenticationService = this.getServiceRegistry().getAuthenticationService();
      return returnAuthenticationService;
   }
   protected AuthorityService getAuthorityService() {
      AuthorityService returnAuthorityService = this.getServiceRegistry().getAuthorityService();
      return returnAuthorityService;
   }

   protected NodeRef getCompanyHomeReference() {
      NodeRef nodeRef = this.getRepositoryContext().getCompanyHome();
      return nodeRef;
   }


Since the getServiceRegistry() and getRepositoryContext() methods are no longer available from the AbstractWebScript class, what is the best way to adapt the methods above  in order to utilize the getAuthenticationService(), getAuthorityService() and getCompanyHome() methods in 3.2? In other words how can I get access to the methods in the ServiceRegistry interface in org.alfresco.service?

Thank you

Outcomes