cancel
Showing results for 
Search instead for 
Did you mean: 

Can't create object with custom model CMIS

imran
Champ on-the-rise
Champ on-the-rise
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
1 REPLY 1

imran
Champ on-the-rise
Champ on-the-rise
it should have been F:tf:user instead of tf:user