cancel
Showing results for 
Search instead for 
Did you mean: 

Get Document Types

stallapragada
Champ in-the-making
Champ in-the-making
Hi
I have this requirement of displaying the list of content types in my web page. I have around 5-6 custom document types (whose parent is cm:content) defined in my custom content model. I am able to see a dropdown for content types in the Alfresco web client and would want to emulate the same in my web page. Is there a way I can get this list using Alfresco WebServices API?

-Thanks
Srikant
Principal Consultant
IntrospeQt Software India Pvt Ltd
http://www.introspeQt.com
1 REPLY 1

stallapragada
Champ in-the-making
Champ in-the-making
Hi

I have figured this one out and it seemed to be pretty easy after all. Here is the code snippet for the same.

package com.introspeqt.examples;

import java.rmi.RemoteException;

import org.alfresco.webservice.dictionary.DictionaryServiceSoapBindingStub;
import org.alfresco.webservice.repository.RepositoryFault;
import org.alfresco.webservice.types.PropertyDefinition;
import org.alfresco.webservice.util.AuthenticationUtils;
import org.alfresco.webservice.util.WebServiceFactory;

public class AlfTypes {

   public static void main(String[] args) throws RepositoryFault,
         RemoteException {
      AuthenticationUtils.startSession("admin", "admin");

      DictionaryServiceSoapBindingStub dictService = WebServiceFactory
            .getDictionaryService();
      org.alfresco.webservice.types.ClassDefinition[] cds = dictService
            .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].getSuperClass().equalsIgnoreCase(contentClass)) {
               System.out.println("Class Name: " + cds[i].getName());
            }
         }
      }
      AuthenticationUtils.endSession();
   }

}


-Thanks
Srikant
Principal Consultant
IntrospeQt Software India Pvt Ltd
http://www.introspeQt.com