Return-Path: X-Original-To: apmail-jackrabbit-dev-archive@www.apache.org Delivered-To: apmail-jackrabbit-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 01F099C49 for ; Thu, 13 Oct 2011 10:38:52 +0000 (UTC) Received: (qmail 16698 invoked by uid 500); 13 Oct 2011 10:38:51 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 16316 invoked by uid 500); 13 Oct 2011 10:38:50 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 16308 invoked by uid 99); 13 Oct 2011 10:38:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Oct 2011 10:38:49 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=MSGID_MULTIPLE_AT,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [217.11.236.49] (HELO xitee.com) (217.11.236.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Oct 2011 10:38:41 +0000 Received: (qmail 27396 invoked from network); 13 Oct 2011 12:38:19 +0200 Received: from mail.ee-consultants.de (HELO karnak) (213.61.130.122) by xitee.com with (RC4-MD5 encrypted) SMTP; 13 Oct 2011 12:38:19 +0200 From: "Kamil Nezval" To: Subject: Property constraints modification Date: Thu, 13 Oct 2011 12:38:14 +0200 Organization: xITee Message-ID: <000c01cc8994$36e5b290$a4b117b0$@nezval@xitee.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcyJlDYuWW0qrfpBRfmyblqlxDcKUA== Content-Language: cs Hi, I've been playing around with a possibility to modify already registered node types and found 2 things (bugs?) regarding to changing property constraints: 1) according to the java doc (http://jackrabbit.apache.org/api/2.2/org/apache/jackrabbit/spi/commons/node type/NodeTypeDefDiff.html) it should be possible to remove all constraints from a property, but it is not (marked as a MAJOR change). 2) it's allowed (TRIVIAL) to set a constraint to a property that had no constraint at all before, which is wrong, because it could affect the consistency of existing repository content. In NodeTypeDefDiff.PropDefDiff.init() there is this test that covers both situations: if (!set1.equals(set2)) { // valueConstraints have been modified if (set2.containsAll(set1)) { // new set is a superset of old set // => constraints have been removed // (TRIVIAL change, since constraints are OR'ed) type = TRIVIAL; } else { // constraint have been removed/modified (MAJOR change); // since we're unable to semantically compare // value constraints (e.g. regular expressions), all // modifications are considered a MAJOR change. type = MAJOR; } } where set1 is a list of original constraints and set2 contains new constraints. I think the correct version should be something like this (not saying exactly): if (!set1.equals(set2)) { // valueConstraints have been modified if (set2.isEmpty()) { // removing all constraints is a TRIVIAL change type = TRIVIAL; } else if (set1.isEmpty()){ // setting constraints is a MAJOR change type = MAJOR; } else if (set2.containsAll(set1))) { // new set is a superset of old set // => constraints have been added // (TRIVIAL change, since constraints are OR'ed) type = TRIVIAL; } else { .... type = MAJOR; } Could anyone confirm my thoughts? Or am I missing anything? Thanks. Kamil