AnsweredAssumed Answered

Can't create object with custom model CMIS

Question asked by imran on Jan 10, 2015
Latest reply on Jan 11, 2015 by imran
Hello Experts,
I have created and registered a custom content model in alfresco. Everything works fine in alfresco share, as well as from cmis when I query "select * from tf:user" where tf:user is my type, correct info is being returned. However, when I try to create a new object with that type from cmis,cmis says Type 'tf:user' is unknown!.

This is my code

        Folder folder=(Folder) session.getObjectByPath("/TF/Users");
        Map properties=new HashMap();
        properties.put("cmis:name",format.format(date) );;
        properties.put("cmis:baseTypeId", "cmis:folder");
        properties.put(PropertyIds.OBJECT_TYPE_ID, "tf:user");
        List l=new ArrayList();
        folder.createFolder(properties);


Tried this as well, but no luck.

   properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder,tf:user");


This is how I acquire a session.

  public static Session openCMISSession(String username, String password) {
        loadProperties();
   Map<String, String> parameter = new HashMap<>();
   parameter.put(SessionParameter.USER, username);
   parameter.put(SessionParameter.PASSWORD, password);
   parameter.put(SessionParameter.ATOMPUB_URL,"http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom");
        parameter.put(SessionParameter.BINDING_TYPE,BindingType.ATOMPUB.value());
   parameter.put(SessionParameter.REPOSITORY_ID, repository);
        // Set the alfresco object factory
        parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
   SessionFactory sf=SessionFactoryImpl.newInstance();
        List<Repository> repositories = sf.getRepositories(parameter);
        return sf.getRepositories(parameter).get(0).createSession();
    }


I am using anlfresco cmis extension as well.
Any pointers?

Thanks in advance

Outcomes