From 18f1598fe38952d168f677053573ca905857965a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Wed, 25 Apr 2012 10:22:07 +0200
Subject: [PATCH] Improve constraints for Slave and Software Instance.

They shall have maximum one related predecessor.
---
 .../predecessor_related_constraint.xml        | 80 +++++++++++++++++++
 .../predecessor_related_constraint.xml        | 80 +++++++++++++++++++
 master/bt5/vifib_base/bt/revision             |  2 +-
 3 files changed, 161 insertions(+), 1 deletion(-)
 create mode 100644 master/bt5/vifib_base/PropertySheetTemplateItem/portal_property_sheets/SlaveInstanceConstraint/predecessor_related_constraint.xml
 create mode 100644 master/bt5/vifib_base/PropertySheetTemplateItem/portal_property_sheets/SoftwareInstanceConstraint/predecessor_related_constraint.xml

diff --git a/master/bt5/vifib_base/PropertySheetTemplateItem/portal_property_sheets/SlaveInstanceConstraint/predecessor_related_constraint.xml b/master/bt5/vifib_base/PropertySheetTemplateItem/portal_property_sheets/SlaveInstanceConstraint/predecessor_related_constraint.xml
new file mode 100644
index 000000000..6cc33a122
--- /dev/null
+++ b/master/bt5/vifib_base/PropertySheetTemplateItem/portal_property_sheets/SlaveInstanceConstraint/predecessor_related_constraint.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="TALES Constraint" module="erp5.portal_type"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_identity_criterion</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_range_criterion</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>expression</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+python: len(context.getPredecessorRelatedList()) <= 1
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>predecessor_related_constraint</string> </value>
+        </item>
+        <item>
+            <key> <string>message_expression_false</string> </key>
+            <value> <string>There is more then one related predecessor</string> </value>
+        </item>
+        <item>
+            <key> <string>portal_type</string> </key>
+            <value> <string>TALES Constraint</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="PersistentMapping" module="Persistence.mapping"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>data</string> </key>
+            <value>
+              <dictionary/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="3" aka="AAAAAAAAAAM=">
+    <pickle>
+      <global name="PersistentMapping" module="Persistence.mapping"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>data</string> </key>
+            <value>
+              <dictionary/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/master/bt5/vifib_base/PropertySheetTemplateItem/portal_property_sheets/SoftwareInstanceConstraint/predecessor_related_constraint.xml b/master/bt5/vifib_base/PropertySheetTemplateItem/portal_property_sheets/SoftwareInstanceConstraint/predecessor_related_constraint.xml
new file mode 100644
index 000000000..6cc33a122
--- /dev/null
+++ b/master/bt5/vifib_base/PropertySheetTemplateItem/portal_property_sheets/SoftwareInstanceConstraint/predecessor_related_constraint.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="TALES Constraint" module="erp5.portal_type"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_identity_criterion</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_range_criterion</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>expression</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+python: len(context.getPredecessorRelatedList()) <= 1
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>predecessor_related_constraint</string> </value>
+        </item>
+        <item>
+            <key> <string>message_expression_false</string> </key>
+            <value> <string>There is more then one related predecessor</string> </value>
+        </item>
+        <item>
+            <key> <string>portal_type</string> </key>
+            <value> <string>TALES Constraint</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="PersistentMapping" module="Persistence.mapping"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>data</string> </key>
+            <value>
+              <dictionary/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="3" aka="AAAAAAAAAAM=">
+    <pickle>
+      <global name="PersistentMapping" module="Persistence.mapping"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>data</string> </key>
+            <value>
+              <dictionary/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/master/bt5/vifib_base/bt/revision b/master/bt5/vifib_base/bt/revision
index 1fde7522a..5a40cf687 100644
--- a/master/bt5/vifib_base/bt/revision
+++ b/master/bt5/vifib_base/bt/revision
@@ -1 +1 @@
-434
\ No newline at end of file
+435
\ No newline at end of file
-- 
2.30.9