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

问题描述 投票:0回答:2

我们在Folder对象和自定义方面遇到问题:

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

sd的内容:因为在CMIS 1.1中“没有”,但在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中的工作

alfresco cmis aspect
2个回答
0
投票

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


0
投票

具有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());
    }

但不起作用...:(

Error in JUnit

Field is empty

© www.soinside.com 2019 - 2024. All rights reserved.