CMIS 1.1 中未设置的方面的属性

Properties from aspects not set in CMIS 1.1

文件夹对象和自定义方面有问题:

...
properties.put(PropertyIds.OBJECT_TYPE_ID, "F:sd:folderDocument,P:sd:info");
properties.put("sd:cause", "asdfg");
Folder stDocument = folder.createFolder(properties);
...

sd:cause 的内容在 CMIS 1.1 中是 "nothing",但在 CMIS 1.0 中工作正常。

不工作!

params.put(SessionParameter.ATOMPUB_URL, "http://localhost:8084/alfresco/api/-default-/public/cmis/versions/1.1/atom");

工作!

params.put(SessionParameter.ATOMPUB_URL, "http://localhost:8084/alfresco/api/-default-/public/cmis/versions/1.0/atom");

我们需要在 1.1 版中工作

在 CMIS 1.1 中,您可以通过将方面类型 ID 添加到 cmis:secondaryObjectTypeIds 属性 来添加方面。这是一个例子:https://gist.github.com/jpotts/7242070

确保您在使用 CMIS 1.1 时没有使用 CMIS 扩展项目中的露天对象工厂。

cmis:secondaryObjectTypeIds 的单元测试是:

    @Test
    public void createStDocumentWithCMIS11() {
        String folderId = "workspace://SpacesStore/03de40f1-e80d-4e0d-8b67-67e93f6e30a1";

        // Connection and session to CMIS 1.1
        HashMap<String, String> params = new HashMap<>();
        params.put(SessionParameter.ATOMPUB_URL, "http://localhost:8084/alfresco/api/-default-/cmis/versions/1.1/atom");
        params.put(SessionParameter.USER, "admin");
        params.put(SessionParameter.PASSWORD, "admin");
        params.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
        params.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");

        SessionFactory factory = SessionFactoryImpl.newInstance();
        Session session = factory.getRepositories(params).get(0).createSession();

        // Find root folder
        Folder folder = (Folder) session.getObject(folderId);
        assertNotNull(folder);

        // Properties for type
        Map<String, Object> properties = new HashMap<>();
        properties.put(PropertyIds.NAME, "Test CMIS folder type stDocument");
        properties.put(PropertyIds.OBJECT_TYPE_ID, "F:sd:structDocument");
        properties.put("sd:situation", "situation");

        // Create folder
        Folder stDocument = folder.createFolder(properties);
        assertNotNull(stDocument);

        // Add secondary objects (Aspects)
        List<Object> aspects = stDocument.getProperty("cmis:secondaryObjectTypeIds").getValues();
        aspects.add("P:sd:additionalInfo");
        HashMap<String, Object> props = new HashMap<>();
        props.put("cmis:secondaryObjectTypeIds", aspects);
        stDocument.updateProperties(props);

        // Add aspect's property
        HashMap<String, Object> propsAspects = new HashMap<>();
        propsAspects.put("sd:cause", "test");
        stDocument.updateProperties(propsAspects);

        assertEquals("test", stDocument.getProperty("sd:cause").getValueAsString());
    }

但是不行...:(