From 9b5ea4b71bcddfaf10df7a46bf11ba08e8a0d885 Mon Sep 17 00:00:00 2001 From: Jamal Kaabi-Mofrad Date: Tue, 11 Aug 2015 21:53:28 +0000 Subject: [PATCH] Merged CMM to HEAD 109799: SHA-1234: Modified boolean property with enhanced indexing option to not set the facetable attribute. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@109926 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../rest/api/impl/CustomModelsImpl.java | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/source/java/org/alfresco/rest/api/impl/CustomModelsImpl.java b/source/java/org/alfresco/rest/api/impl/CustomModelsImpl.java index 4579cf82b9..80d14d2c7a 100644 --- a/source/java/org/alfresco/rest/api/impl/CustomModelsImpl.java +++ b/source/java/org/alfresco/rest/api/impl/CustomModelsImpl.java @@ -115,6 +115,7 @@ public class CustomModelsImpl implements CustomModels protected ValueDataTypeValidator valueDataTypeValidator; private static final String DEFAULT_DATA_TYPE = "d:text"; + private static final String BOOLEAN_DATA_TYPE = "d:boolean"; private static final String SELECT_ALL = "all"; private static final String SELECT_STATUS = "status"; private static final String SELECT_PROPS = "props"; @@ -954,17 +955,6 @@ public class CustomModelsImpl implements CustomModels m2Property.setMandatory(prop.isMandatory()); m2Property.setMandatoryEnforced(prop.isMandatoryEnforced()); m2Property.setMultiValued(prop.isMultiValued()); - // Set indexing options - m2Property.setIndexed(prop.isIndexed()); - if (Facetable.TRUE == prop.getFacetable()) - { - m2Property.setFacetable(true); - } - else if (Facetable.FALSE == prop.getFacetable()) - { - m2Property.setFacetable(false); - } - m2Property.setIndexTokenisationMode(prop.getIndexTokenisationMode()); String dataType = prop.getDataType(); // Default type is d:text @@ -991,6 +981,24 @@ public class CustomModelsImpl implements CustomModels } m2Property.setType(dataType); m2Property.setDefaultValue(prop.getDefaultValue()); + + // Set indexing options + m2Property.setIndexed(prop.isIndexed()); + // SHA-1234 + // This 'if' statement can be removed when we fix the Solr schema + // so it can support boolean data type. + if (!BOOLEAN_DATA_TYPE.equals(dataType)) + { + if (Facetable.TRUE == prop.getFacetable()) + { + m2Property.setFacetable(true); + } + else if (Facetable.FALSE == prop.getFacetable()) + { + m2Property.setFacetable(false); + } + } + m2Property.setIndexTokenisationMode(prop.getIndexTokenisationMode()); // Check for constraints List constraintRefs = prop.getConstraintRefs();