Fix ALF-2299: CMOS AtomPub binding - Property definition does not map Alfresco content model defined MINMAX constraints

- MINMAX constraint now mapped to minValue and maxValue in CMIS property definition

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19706 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2010-03-31 16:35:45 +00:00
parent fcc149147f
commit d452965061
2 changed files with 42 additions and 1 deletions

View File

@@ -35,6 +35,7 @@ import org.alfresco.cmis.mapping.AbstractProperty;
import org.alfresco.cmis.mapping.CMISMapping;
import org.alfresco.repo.dictionary.IndexTokenisationMode;
import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint;
import org.alfresco.repo.dictionary.constraint.NumericRangeConstraint;
import org.alfresco.repo.dictionary.constraint.StringLengthConstraint;
import org.alfresco.repo.search.impl.lucene.analysis.DateAnalyser;
import org.alfresco.repo.search.impl.lucene.analysis.DateTimeAnalyser;
@@ -73,6 +74,10 @@ public class CMISBasePropertyDefinition implements CMISPropertyDefinition, Seria
private CMISCardinalityEnum cardinality;
private Double minValue = null;
private Double maxValue = null;
private int maximumLength = -1;
private Collection<CMISChoice> choices = new HashSet<CMISChoice>();
@@ -126,6 +131,12 @@ public class CMISBasePropertyDefinition implements CMISPropertyDefinition, Seria
StringLengthConstraint slc = (StringLengthConstraint) constraint;
maximumLength = slc.getMaxLength();
}
if (constraint instanceof NumericRangeConstraint)
{
NumericRangeConstraint nrc = (NumericRangeConstraint) constraint;
minValue = nrc.getMinValue();
maxValue = nrc.getMaxValue();
}
}
required = propDef.isMandatory();
defaultValue = propDef.getDefaultValue();
@@ -259,6 +270,22 @@ public class CMISBasePropertyDefinition implements CMISPropertyDefinition, Seria
return maximumLength;
}
/* (non-Javadoc)
* @see org.alfresco.cmis.CMISPropertyDefinition#getMinValue()
*/
public Double getMinValue()
{
return minValue;
}
/* (non-Javadoc)
* @see org.alfresco.cmis.CMISPropertyDefinition#getMaxValue()
*/
public Double getMaxValue()
{
return maxValue;
}
/**
* Get the choices available as values for this property TODO: not implemented yet
*