AnsweredAssumed Answered

Problem read all properties  FacesContext must not be null

Question asked by ersecchio on Mar 9, 2011
Latest reply on Aug 29, 2011 by wass
I implemented the following method to read all the properties of a model

AuthenticationUtils.startSession("admin", "MYPASSWORD");
FacesContext fc = FacesContext.getCurrentInstance();
ServiceRegistry services = Repository.getServiceRegistry(fc);
DictionaryService dd = services.getDictionaryService();
List<PropertyDefinition> res = new ArrayList<PropertyDefinition>();
QName typeQName = Repository.resolveToQName("sc:sc_article");
System.out.println("Type QNAME:" + typeQName);
   if (typeQName != null) {
      TypeDefinition typeDef = dd.getType(typeQName);
         System.out.println("Type Def:" + typeDef);
         if (typeDef != null) {
            Map<QName, org.alfresco.service.cmr.dictionary.PropertyDefinition> props = typeDef.getProperties();
            for (QName prop : props.keySet()) {
               System.out.println("Prop Name:" + prop);
               PropertyDefinition propDef = (PropertyDefinition) props.get(prop);
               System.out.println("Prop DEF:" + propDef);

but when I do I get the following error

Exception in thread "main" java.lang.IllegalArgumentException: FacesContext must not be null
   at org.springframework.util.Assert.notNull(
   at org.springframework.web.jsf.FacesContextUtils.getWebApplicationContext(
   at org.springframework.web.jsf.FacesContextUtils.getRequiredWebApplicationContext(
   at org.alfresco.web.bean.repository.Repository.getServiceRegistry(
   at ritornaProprieta.main(

could someone help me