Return-Path: X-Original-To: apmail-chemistry-dev-archive@www.apache.org Delivered-To: apmail-chemistry-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6651D18FE3 for ; Tue, 26 Jan 2016 10:10:40 +0000 (UTC) Received: (qmail 28020 invoked by uid 500); 26 Jan 2016 10:10:40 -0000 Delivered-To: apmail-chemistry-dev-archive@chemistry.apache.org Received: (qmail 27937 invoked by uid 500); 26 Jan 2016 10:10:40 -0000 Mailing-List: contact dev-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list dev@chemistry.apache.org Received: (qmail 27781 invoked by uid 99); 26 Jan 2016 10:10:40 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jan 2016 10:10:40 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id C76A82C1F57 for ; Tue, 26 Jan 2016 10:10:39 +0000 (UTC) Date: Tue, 26 Jan 2016 10:10:39 +0000 (UTC) From: "Xian Zou (JIRA)" To: dev@chemistry.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (CMIS-968) Broswer binding failed to check the property list for secondary type when update/create properties for secondary type MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Xian Zou created CMIS-968: ----------------------------- Summary: Broswer binding failed to check the property list for secondary type when update/create properties for secondary type Key: CMIS-968 URL: https://issues.apache.org/jira/browse/CMIS-968 Project: Chemistry Issue Type: Bug Components: opencmis-server Affects Versions: OpenCMIS 0.13.0 Environment: Windows2008R2 Reporter: Xian Zou I am developing retention management in CMIS1.1 which cmis:secondaryObjectTypeIds is cmis:rm_destructionRetention. After complete the server code for CM repository, I tried to develop a JUNIT case to create/update a document with the cmis:rm_expirationDate and cmis:rm_destructionDate property. All create/update operations works as design for atompub binding, but failed in browser binding with the following error. org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException: cmis:rm_expirationDate is unknown! at org.apache.chemistry.opencmis.client.bindings.spi.browser.AbstractBrowserBindingService.convertStatusCode(AbstractBrowserBindingService.java:249) at org.apache.chemistry.opencmis.client.bindings.spi.browser.AbstractBrowserBindingService.post(AbstractBrowserBindingService.java:377) at org.apache.chemistry.opencmis.client.bindings.spi.browser.ObjectServiceImpl.updateProperties(ObjectServiceImpl.java:400) at org.apache.chemistry.opencmis.client.runtime.AbstractCmisObject.updateProperties(AbstractCmisObject.java:349) at org.apache.chemistry.opencmis.client.runtime.AbstractCmisObject.updateProperties(AbstractCmisObject.java:313) at com.ibm.ecm.cmis.test.opencmis.util.TestUtils.updateDocument(TestUtils.java:2568) at com.ibm.ecm.cmis.test.opencmis.object.common.DocumentCRUD.createDocument(DocumentCRUD.java:172) Here is my sample code for the update logic as the example. Map updateProperties = new HashMap(); String newName = "updatedname" + TestUtils.getRandomInt(10000); updateProperties.put("cmis:name", newName); updateProperties.put("clbNonGroup.CMISString", newName); Calendar c = getTestCalendar(2); Calendar c2 = getTestCalendar(3); updateProperties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondObjTypeIds); updateProperties.put(PropertyIds.EXPIRATION_DATE, c); updateProperties.put(PropertyIds.DESTRUCTION_DATE, c2); Document updatedDoc = TestUtils.updateDocument(session, doc.getId(), updateProperties); I checked the chemistry code and found the following logic may cause the "cmis:rm_expirationDate is unknown!" error" in createNewProperties and createUpdateProperties methods in AbstractBrowserServiceCall.java. PropertiesImpl result = new PropertiesImpl(); for (Map.Entry> property : properties.entrySet()) { PropertyDefinition propDef = typeCache.getPropertyDefinition(property.getKey()); if (propDef == null && objectIds != null) { for (String objectId : objectIds) { typeCache.getTypeDefinitionForObject(objectId); propDef = typeCache.getPropertyDefinition(property.getKey()); if (propDef != null) { break; } } } if (propDef == null) { throw new CmisInvalidArgumentException(property.getKey() + " is unknown!"); } result.addProperty(createPropertyData(propDef, property.getValue())); } Actually, when we create/update an document, the type definition in the code above will be gotten from the primary object type. The properties for secondary object types will not be gotten in the type definitions , so I think it should be a bug for browser binding. Here are some possible solutions for the issue. Possible solution 1: Don't check the properties and throw the CmisInvalidArgumentException(property.getKey() + " is unknown!"); exception for browser binding like other bindings. Possible solution 2: Check the properties in type definitions in both primary object type and all possible/passed secondary types. If we find the property in either of them. We will not throw the exception. If I develop the code in wrong way, please tell me how to write it correctly. Thanks. -- This message was sent by Atlassian JIRA (v6.3.4#6332)