Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 67CDC200B80 for ; Tue, 30 Aug 2016 12:49:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 668EA160AA8; Tue, 30 Aug 2016 10:49:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B01C0160AC5 for ; Tue, 30 Aug 2016 12:49:21 +0200 (CEST) Received: (qmail 71759 invoked by uid 500); 30 Aug 2016 10:49:20 -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 71495 invoked by uid 99); 30 Aug 2016 10:49:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Aug 2016 10:49:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 82C9F2C1B7D for ; Tue, 30 Aug 2016 10:49:20 +0000 (UTC) Date: Tue, 30 Aug 2016 10:49:20 +0000 (UTC) From: =?utf-8?Q?Florian_M=C3=BCller_=28JIRA=29?= To: dev@chemistry.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (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: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 30 Aug 2016 10:49:22 -0000 [ https://issues.apache.org/jira/browse/CMIS-968?page=3Dcom.atlassian.= jira.plugin.system.issuetabpanels:all-tabpanel ] Florian M=C3=BCller resolved CMIS-968. --------------------------------- Resolution: Not A Problem > Broswer binding failed to check the property list for secondary type when= update/create properties for secondary type=20 > -------------------------------------------------------------------------= --------------------------------------------- > > Key: CMIS-968 > URL: https://issues.apache.org/jira/browse/CMIS-968 > Project: Chemistry > Issue Type: Test > Components: opencmis-server > Affects Versions: OpenCMIS 0.13.0 > Environment: Windows2008R2=20 > Reporter: Xian Zou > > I am developing retention management in CMIS1.1 which cmis:secondaryObjec= tTypeIds is cmis:rm_destructionRetention. After complete the server code fo= r CM repository, I tried to develop a JUNIT case to create/update a documen= t with the cmis:rm_expirationDate and cmis:rm_destructionDate property. All= create/update operations works as design for atompub binding, but failed i= n browser binding with the following error. > org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentExcep= tion: cmis:rm_expirationDate is unknown! > =09at org.apache.chemistry.opencmis.client.bindings.spi.browser.AbstractB= rowserBindingService.convertStatusCode(AbstractBrowserBindingService.java:2= 49) > =09at org.apache.chemistry.opencmis.client.bindings.spi.browser.AbstractB= rowserBindingService.post(AbstractBrowserBindingService.java:377) > =09at org.apache.chemistry.opencmis.client.bindings.spi.browser.ObjectSer= viceImpl.updateProperties(ObjectServiceImpl.java:400) > =09at org.apache.chemistry.opencmis.client.runtime.AbstractCmisObject.upd= ateProperties(AbstractCmisObject.java:349) > =09at org.apache.chemistry.opencmis.client.runtime.AbstractCmisObject.upd= ateProperties(AbstractCmisObject.java:313) > =09at com.ibm.ecm.cmis.test.opencmis.util.TestUtils.updateDocument(TestUt= ils.java:2568) > =09at com.ibm.ecm.cmis.test.opencmis.object.common.DocumentCRUD.createDoc= ument(DocumentCRUD.java:172) > Here is my sample code for the update logic as the example. > Map updateProperties =3D new HashMap(); > String newName =3D "updatedname" + TestUtils.getRandomInt(100= 00); > updateProperties.put("cmis:name", newName); > updateProperties.put("clbNonGroup.CMISString", newName); > Calendar c =3D getTestCalendar(2); > Calendar c2 =3D getTestCalendar(3); > updateProperties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, s= econdObjTypeIds); > updateProperties.put(PropertyIds.EXPIRATION_DATE, c); > updateProperties.put(PropertyIds.DESTRUCTION_DATE, c2); > Document updatedDoc =3D 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 crea= teUpdateProperties methods in AbstractBrowserServiceCall.java. > PropertiesImpl result =3D new PropertiesImpl(); > for (Map.Entry> property : properties.entryS= et()) { > PropertyDefinition propDef =3D typeCache.getPropertyDefini= tion(property.getKey()); > if (propDef =3D=3D null && objectIds !=3D null) { > for (String objectId : objectIds) { > typeCache.getTypeDefinitionForObject(objectId); > propDef =3D typeCache.getPropertyDefinition(property.= getKey()); > if (propDef !=3D null) { > break; > } > } > } > if (propDef =3D=3D null) { > throw new CmisInvalidArgumentException(property.getKey() = + " is unknown!"); > } > result.addProperty(createPropertyData(propDef, property.getVa= lue())); > } > Actually, when we create/update an document, the type definition in the c= ode above will be gotten from the primary object type. The properties for s= econdary object types will not be gotten in the type definitions , so I thi= nk 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 CmisInvalid= ArgumentException(property.getKey() + " is unknown!"); exception for browse= r binding like other bindings. > Possible solution 2: Check the properties in type definitions in both pri= mary object type and all possible/passed secondary types. If we find the pr= operty 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 correc= tly. > Thanks. -- This message was sent by Atlassian JIRA (v6.3.4#6332)