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);
res.add(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(Assert.java:112)
at org.springframework.web.jsf.FacesContextUtils.getWebApplicationContext(FacesContextUtils.java:50)
at org.springframework.web.jsf.FacesContextUtils.getRequiredWebApplicationContext(FacesContextUtils.java:81)
at org.alfresco.web.bean.repository.Repository.getServiceRegistry(Repository.java:584)
at ritornaProprieta.main(ritornaProprieta.java:25)
could someone help me :?: