【问题标题】:Properties from aspects not set in CMIS 1.1CMIS 1.1 中未设置的方面的属性
【发布时间】:2020-03-04 10:12:11
【问题描述】:

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

...
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 中是“无”,但在 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


    【解决方案1】:

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

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

    【讨论】:

    • 对象是自定义文件夹但不更新方面的属性。
    • 好的,杰夫。我在 Alfresco 扩展属性中发现了这个问题,现在可以正常工作了!谢谢!
    【解决方案2】:

    使用 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());
        }
    

    但不起作用... :(

    【讨论】:

    • 我不明白,我使用化学中的文件夹对象,而不是 AlfrescoFolder 和其他对象。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-10
    • 2019-07-04
    • 1970-01-01
    相关资源
    最近更新 更多