cancel
Showing results for 
Search instead for 
Did you mean: 

Get List of Content Types

mjuarez
Champ in-the-making
Champ in-the-making
Hi, i need a list of all content types created in alfresco, and list all the attributes for each type.

I don't can perform this. Please help me!!! bye!
3 REPLIES 3

mrogers
Star Contributor
Star Contributor
The DictionaryService will give you that information.

mjuarez
Champ in-the-making
Champ in-the-making
thanks mrogers… Now, i test this and reply if is works.

mjuarez
Champ in-the-making
Champ in-the-making
Of this way i can get list of content types. I hope someone will be useful!


public Map<String, String> getAllContentTypes() throws DictionaryFault,
         RemoteException {
      Map<String, String> contentTypesList = new HashMap<String, String>();
      ClassDefinition[] cds = DSSBS.getClasses(null, null);
      String contentClass = "{http://www.alfresco.org/model/content/1.0}content";
      for (int i = 0; i < cds.length; i++) {
         if (cds[i].getSuperClass() != null) {
            if (cds[i].getName().equals(contentClass)) {
               contentTypesList.put(cds[i].getName(), cds[i].getTitle());
            }
            if (cds[i].getSuperClass().equalsIgnoreCase(contentClass)) {
               if (!cds[i].getName().startsWith(
                     "{http://www.alfresco.org/model/")) {
                  contentTypesList.put(cds[i].getName(), cds[i]
                        .getTitle());
               }
            }
         }
      }
      return contentTypesList;
   }