mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Dictionary M2 support to add/remove property constraint ref
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@15988 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -66,6 +66,11 @@ public class M2Constraint
|
||||
return ref;
|
||||
}
|
||||
|
||||
public void setRef(String refName)
|
||||
{
|
||||
this.ref = refName;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package org.alfresco.repo.dictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -50,7 +51,7 @@ public class M2Property
|
||||
private boolean isIndexedAtomically = true;
|
||||
private boolean isStoredInIndex = false;
|
||||
private IndexTokenisationMode indexTokenisationMode = IndexTokenisationMode.TRUE;
|
||||
private List<M2Constraint> constraints;
|
||||
private List<M2Constraint> constraints = new ArrayList<M2Constraint>();
|
||||
|
||||
/*package*/ M2Property()
|
||||
{
|
||||
@@ -235,4 +236,30 @@ public class M2Property
|
||||
return constraints;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasConstraints()
|
||||
{
|
||||
return ((this.constraints != null) && (constraints.size() > 0));
|
||||
}
|
||||
|
||||
public M2Constraint addConstraintRef(String refName)
|
||||
{
|
||||
M2Constraint constraint = new M2Constraint();
|
||||
constraint.setRef(refName);
|
||||
constraints.add(constraint);
|
||||
return constraint;
|
||||
}
|
||||
|
||||
|
||||
public void removeConstraintRef(String refName)
|
||||
{
|
||||
List<M2Constraint> cons = new ArrayList<M2Constraint>(getConstraints());
|
||||
for (M2Constraint con : cons)
|
||||
{
|
||||
if (con.getRef().equals(refName))
|
||||
{
|
||||
constraints.remove(con);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -115,7 +115,7 @@
|
||||
<value name="stored" field="isStoredInIndex" usage="optional"/>
|
||||
<value name="tokenised" field="indexTokenisationMode" usage="optional" serializer="org.alfresco.repo.dictionary.IndexTokenisationMode.serializer" deserializer="org.alfresco.repo.dictionary.IndexTokenisationMode.deserializer"/>
|
||||
</structure>
|
||||
<structure name="constraints" usage="optional">
|
||||
<structure name="constraints" test-method="hasConstraints" usage="optional">
|
||||
<collection field="constraints" item-type="org.alfresco.repo.dictionary.M2Constraint" factory="org.alfresco.repo.dictionary.M2Model.createList" usage="optional"/>
|
||||
</structure>
|
||||
</mapping>
|
||||
|
Reference in New Issue
Block a user