mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.0/Cloud)
88169: Merged V4.2-BUG-FIX (4.2.4) to HEAD-BUG-FIX (5.0/Cloud) 87959: Merged DEV (4.2.4) to V4.2-BUG-FIX (4.2.4) 87891: MNT-12367 : Relaxed mode for mandatory association not possible Added support for relaxed mode of mandatory association target. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@94563 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -125,8 +125,9 @@ public class AssocTargetMultiplicityIntegrityEvent extends AbstractIntegrityEven
|
|||||||
// get the source multiplicity
|
// get the source multiplicity
|
||||||
boolean mandatory = assocDef.isTargetMandatory();
|
boolean mandatory = assocDef.isTargetMandatory();
|
||||||
boolean allowMany = assocDef.isTargetMany();
|
boolean allowMany = assocDef.isTargetMany();
|
||||||
|
boolean enforced = assocDef.isTargetMandatoryEnforced();
|
||||||
// do we need to check
|
// do we need to check
|
||||||
if (!mandatory && allowMany)
|
if (!(mandatory && enforced) && allowMany)
|
||||||
{
|
{
|
||||||
// it is not mandatory and it allows many on both sides of the assoc
|
// it is not mandatory and it allows many on both sides of the assoc
|
||||||
return;
|
return;
|
||||||
@@ -165,7 +166,7 @@ public class AssocTargetMultiplicityIntegrityEvent extends AbstractIntegrityEven
|
|||||||
actualSize = targetAssocRefs.size();
|
actualSize = targetAssocRefs.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mandatory && actualSize == 0) || (!allowMany && actualSize > 1))
|
if (((mandatory && enforced) && actualSize == 0) || (!allowMany && actualSize > 1))
|
||||||
{
|
{
|
||||||
if (actualSize == 0)
|
if (actualSize == 0)
|
||||||
{
|
{
|
||||||
|
@@ -72,6 +72,7 @@ public class IntegrityTest extends TestCase
|
|||||||
public static final QName TEST_TYPE_WITH_ASSOCS = QName.createQName(NAMESPACE, "typeWithAssocs");
|
public static final QName TEST_TYPE_WITH_ASSOCS = QName.createQName(NAMESPACE, "typeWithAssocs");
|
||||||
public static final QName TEST_TYPE_WITH_CHILD_ASSOCS = QName.createQName(NAMESPACE, "typeWithChildAssocs");
|
public static final QName TEST_TYPE_WITH_CHILD_ASSOCS = QName.createQName(NAMESPACE, "typeWithChildAssocs");
|
||||||
public static final QName TEST_TYPE_WITH_NON_ENFORCED_CHILD_ASSOCS = QName.createQName(NAMESPACE, "typeWithNonEnforcedChildAssocs");
|
public static final QName TEST_TYPE_WITH_NON_ENFORCED_CHILD_ASSOCS = QName.createQName(NAMESPACE, "typeWithNonEnforcedChildAssocs");
|
||||||
|
public static final QName TEST_TYPE_WITH_NON_ENFORCED_TARGET_ASSOCS = QName.createQName(NAMESPACE, "typeWithNonEnforcedTargetAssocs");
|
||||||
|
|
||||||
public static final QName TEST_ASSOC_NODE_ZEROMANY_ZEROMANY = QName.createQName(NAMESPACE, "assoc-0to* - 0to*");
|
public static final QName TEST_ASSOC_NODE_ZEROMANY_ZEROMANY = QName.createQName(NAMESPACE, "assoc-0to* - 0to*");
|
||||||
public static final QName TEST_ASSOC_CHILD_ZEROMANY_ZEROMANY = QName.createQName(NAMESPACE, "child-0to* - 0to*");
|
public static final QName TEST_ASSOC_CHILD_ZEROMANY_ZEROMANY = QName.createQName(NAMESPACE, "child-0to* - 0to*");
|
||||||
@@ -80,6 +81,7 @@ public class IntegrityTest extends TestCase
|
|||||||
public static final QName TEST_ASSOC_CHILD_ONE_ONE = QName.createQName(NAMESPACE, "child-1to1 - 1to1");
|
public static final QName TEST_ASSOC_CHILD_ONE_ONE = QName.createQName(NAMESPACE, "child-1to1 - 1to1");
|
||||||
public static final QName TEST_ASSOC_ASPECT_ONE_ONE = QName.createQName(NAMESPACE, "aspect-assoc-1to1 - 1to1");
|
public static final QName TEST_ASSOC_ASPECT_ONE_ONE = QName.createQName(NAMESPACE, "aspect-assoc-1to1 - 1to1");
|
||||||
public static final QName TEST_ASSOC_CHILD_NON_ENFORCED = QName.createQName(NAMESPACE, "child-non-enforced");
|
public static final QName TEST_ASSOC_CHILD_NON_ENFORCED = QName.createQName(NAMESPACE, "child-non-enforced");
|
||||||
|
public static final QName TEST_ASSOC_TARGET_NON_ENFORCED = QName.createQName(NAMESPACE, "target-non-enforced");
|
||||||
|
|
||||||
public static final QName TEST_ASPECT_WITH_PROPERTIES = QName.createQName(NAMESPACE, "aspectWithProperties");
|
public static final QName TEST_ASPECT_WITH_PROPERTIES = QName.createQName(NAMESPACE, "aspectWithProperties");
|
||||||
public static final QName TEST_ASPECT_WITH_ASSOC = QName.createQName(NAMESPACE, "aspectWithAssoc");
|
public static final QName TEST_ASPECT_WITH_ASSOC = QName.createQName(NAMESPACE, "aspectWithAssoc");
|
||||||
@@ -483,4 +485,15 @@ public class IntegrityTest extends TestCase
|
|||||||
nodeService.removeAssociation(source1, target1, TEST_ASSOC_NODE_ONE_MANY);
|
nodeService.removeAssociation(source1, target1, TEST_ASSOC_NODE_ONE_MANY);
|
||||||
checkIntegrityNoFailure();
|
checkIntegrityNoFailure();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for MNT-12367
|
||||||
|
*/
|
||||||
|
public void testRelaxedMandatoryAssociation() throws Exception
|
||||||
|
{
|
||||||
|
assertEquals("Per-transaction override not correct", false, IntegrityChecker.isWarnInTransaction());
|
||||||
|
// create node
|
||||||
|
NodeRef nodeRef = createNode("relaxedAssocNode", TEST_TYPE_WITH_NON_ENFORCED_TARGET_ASSOCS, null);
|
||||||
|
checkIntegrityNoFailure();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
<imports>
|
<imports>
|
||||||
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
|
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
|
||||||
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
|
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
|
||||||
|
<import uri='http://www.alfresco.org/model/content/1.0' prefix='cm'/>
|
||||||
</imports>
|
</imports>
|
||||||
|
|
||||||
<namespaces>
|
<namespaces>
|
||||||
@@ -154,6 +155,24 @@
|
|||||||
</child-association>
|
</child-association>
|
||||||
</associations>
|
</associations>
|
||||||
</type>
|
</type>
|
||||||
|
<!-- Type with mandatory non-enforced assocs -->
|
||||||
|
<type name="test:typeWithNonEnforcedTargetAssocs">
|
||||||
|
<title>Type With Non Enforced Assocs</title>
|
||||||
|
<parent>cm:content</parent>
|
||||||
|
<associations>
|
||||||
|
<association name="test:target-non-enforced">
|
||||||
|
<source>
|
||||||
|
<mandatory>false</mandatory>
|
||||||
|
<many>true</many>
|
||||||
|
</source>
|
||||||
|
<target>
|
||||||
|
<class>cm:content</class>
|
||||||
|
<mandatory enforced="false">true</mandatory>
|
||||||
|
<many>false</many>
|
||||||
|
</target>
|
||||||
|
</association>
|
||||||
|
</associations>
|
||||||
|
</type>
|
||||||
</types>
|
</types>
|
||||||
|
|
||||||
<aspects>
|
<aspects>
|
||||||
|
Reference in New Issue
Block a user