mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ACE-3290: Added date facet fields in their own bean, so it can be overridden, rather than the full date display handler bean.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@89637 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.search.impl.solr.facet;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.extensions.surf.util.ParameterCheck;
|
||||
|
||||
/**
|
||||
* A simple bean class to provide facet fields.
|
||||
*
|
||||
* @author Jamal Kaabi-Mofrad
|
||||
* @since 5.0
|
||||
*/
|
||||
public class FacetFieldBean
|
||||
{
|
||||
private final Set<String> fields;
|
||||
|
||||
public FacetFieldBean(Set<String> fields)
|
||||
{
|
||||
ParameterCheck.mandatory("fields", fields);
|
||||
this.fields = new HashSet<>(fields);
|
||||
}
|
||||
|
||||
public Set<String> getFields()
|
||||
{
|
||||
return Collections.unmodifiableSet(this.fields);
|
||||
}
|
||||
}
|
@@ -51,7 +51,7 @@ public class SolrFacetHelper
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param serviceRegistry
|
||||
* @param facetQueryProviders
|
||||
*/
|
||||
public SolrFacetHelper(List<FacetQueryProvider> facetQueryProviders)
|
||||
{
|
||||
|
@@ -80,7 +80,7 @@ public abstract class AbstractFacetLabelDisplayHandler implements FacetLabelDisp
|
||||
/**
|
||||
* Set the registry to register with
|
||||
*
|
||||
* @param registry a metadata extracter registry
|
||||
* @param registry a facet label display handler registry
|
||||
*/
|
||||
public void setRegistry(FacetLabelDisplayHandlerRegistry registry)
|
||||
{
|
||||
|
@@ -30,6 +30,7 @@ import java.util.Map.Entry;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.alfresco.repo.search.impl.solr.facet.FacetFieldBean;
|
||||
import org.alfresco.repo.search.impl.solr.facet.FacetQueryProvider;
|
||||
import org.alfresco.repo.search.impl.solr.facet.SolrFacetConfigException;
|
||||
import org.springframework.extensions.surf.util.ParameterCheck;
|
||||
@@ -52,7 +53,7 @@ public class DateBucketsDisplayHandler extends AbstractFacetLabelDisplayHandler
|
||||
ParameterCheck.mandatory("facetQueryFields", facetQueryFields);
|
||||
ParameterCheck.mandatory("dateBucketsMap", dateBucketsMap);
|
||||
|
||||
this.supportedFieldFacets = Collections.unmodifiableSet(facetQueryFields);
|
||||
this.supportedFieldFacets = facetQueryFields;
|
||||
|
||||
facetLabelMap = new HashMap<>(dateBucketsMap.size());
|
||||
Map<String, List<String>> facetQueries = new LinkedHashMap<>(facetQueryFields.size());
|
||||
@@ -84,6 +85,11 @@ public class DateBucketsDisplayHandler extends AbstractFacetLabelDisplayHandler
|
||||
this.facetQueriesMap = Collections.unmodifiableMap(facetQueries);
|
||||
}
|
||||
|
||||
public DateBucketsDisplayHandler(FacetFieldBean dateFacetField, LinkedHashMap<String, String> dateBucketsMap)
|
||||
{
|
||||
this(dateFacetField.getFields(), dateBucketsMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FacetLabel getDisplayLabel(String value)
|
||||
{
|
||||
@@ -96,5 +102,4 @@ public class DateBucketsDisplayHandler extends AbstractFacetLabelDisplayHandler
|
||||
{
|
||||
return this.facetQueriesMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user