当前位置: 首页>>代码示例>>Java>>正文


Java CustomProperties类代码示例

本文整理汇总了Java中org.alfresco.repo.search.impl.solr.facet.SolrFacetProperties.CustomProperties的典型用法代码示例。如果您正苦于以下问题:Java CustomProperties类的具体用法?Java CustomProperties怎么用?Java CustomProperties使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CustomProperties类属于org.alfresco.repo.search.impl.solr.facet.SolrFacetProperties包,在下文中一共展示了CustomProperties类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createNodeProperties

import org.alfresco.repo.search.impl.solr.facet.SolrFacetProperties.CustomProperties; //导入依赖的package包/类
private Map<QName, Serializable> createNodeProperties(SolrFacetProperties facetProperties)
{
    if (facetProperties.getFilterID() == null)
    {
        throw new SolrFacetConfigException("Filter Id cannot be null.");
    }

    boolean isDefaultFP = defaultFacetsMap.containsKey(facetProperties.getFilterID());
    Map<QName, Serializable> properties = new HashMap<>(15);

    properties.put(ContentModel.PROP_NAME, facetProperties.getFilterID());
    properties.put(SolrFacetModel.PROP_IS_DEFAULT, isDefaultFP);

    addNodeProperty(properties, SolrFacetModel.PROP_FIELD_TYPE, facetProperties.getFacetQName());
    addNodeProperty(properties, SolrFacetModel.PROP_FIELD_LABEL, facetProperties.getDisplayName());
    addNodeProperty(properties, SolrFacetModel.PROP_DISPLAY_CONTROL, facetProperties.getDisplayControl());
    addNodeProperty(properties, SolrFacetModel.PROP_MAX_FILTERS, facetProperties.getMaxFilters());
    addNodeProperty(properties, SolrFacetModel.PROP_HIT_THRESHOLD, facetProperties.getHitThreshold());
    addNodeProperty(properties, SolrFacetModel.PROP_MIN_FILTER_VALUE_LENGTH, facetProperties.getMinFilterValueLength());
    addNodeProperty(properties, SolrFacetModel.PROP_SCOPE, facetProperties.getScope());
    addNodeProperty(properties, SolrFacetModel.PROP_SORT_BY, facetProperties.getSortBy());
    addNodeProperty(properties, SolrFacetModel.PROP_SCOPED_SITES, (Serializable) facetProperties.getScopedSites());
    addNodeProperty(properties, SolrFacetModel.PROP_IS_ENABLED, facetProperties.isEnabled());

    Set<CustomProperties> customProperties = facetProperties.getCustomProperties();
    if (customProperties != null)
    {
        properties.put(SolrFacetModel.PROP_EXTRA_INFORMATION, new ArrayList<>(customProperties));
    }

    return properties;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:33,代码来源:SolrFacetServiceImpl.java

示例2: getFacetCustomProperties

import org.alfresco.repo.search.impl.solr.facet.SolrFacetProperties.CustomProperties; //导入依赖的package包/类
/**
 * Gets a map containing the facet's custom properties
 * 
 * @return map containing the custom properties of the facet
 */
private Map<QName, Serializable> getFacetCustomProperties(Map<QName, Serializable> properties)
{
    Map<QName, Serializable> customProperties = new HashMap<>(5);

    for (Map.Entry<QName, Serializable> entry : properties.entrySet())
    {
        if (SolrFacetModel.SOLR_FACET_CUSTOM_PROPERTY_URL.equals(entry.getKey().getNamespaceURI()))
        {
            Serializable values = entry.getValue();
            if (SolrFacetModel.PROP_EXTRA_INFORMATION.equals(entry.getKey()) && values instanceof List)
            {

                @SuppressWarnings("unchecked")
                List<CustomProperties> list = (List<CustomProperties>) values;
                for (CustomProperties cp : list)
                {
                    customProperties.put(cp.getName(), cp.getValue());
                }
            }
            else
            {
                customProperties.put(entry.getKey(), entry.getValue());
            }
        }
    }
    return customProperties;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:33,代码来源:SolrFacetServiceImpl.java

示例3: getCustomProps

import org.alfresco.repo.search.impl.solr.facet.SolrFacetProperties.CustomProperties; //导入依赖的package包/类
private static Set<CustomProperties> getCustomProps(Set<String> additionalProps, String field, Map<String, String> propValues)
{
    if (additionalProps == null)
    {
        return null;
    }

    Set<CustomProperties> customProps = new HashSet<>();
    for (String extraInfo : additionalProps)
    {
        String value = propValues.get(field + KEY_EXTRA_INFO + extraInfo);
        if (value != null)
        {
            QName qName = QName.createQName(SolrFacetModel.SOLR_FACET_CUSTOM_PROPERTY_URL, extraInfo);
            String[] extra = value.split(",");
            if (extra.length == 1)
            {
                customProps.add(new CustomProperties(qName, extra[0]));
            }
            else
            {
                List<String> list = Arrays.asList(extra);
                customProps.add(new CustomProperties(qName, (Serializable) list));
            }
        }
    }
    return customProps;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:SolrFacetConfig.java

示例4: getFacetProperties

import org.alfresco.repo.search.impl.solr.facet.SolrFacetProperties.CustomProperties; //导入依赖的package包/类
/**
 * Gets the {@link SolrFacetProperties} stored on the specified {@link NodeRef}.
 * @throws org.alfresco.service.cmr.repository.InvalidNodeRefException if the nodeRef does not exist.
 */
private SolrFacetProperties getFacetProperties(NodeRef nodeRef)
{
    Map<QName, Serializable> properties = nodeService.getProperties(nodeRef);
    if (properties.isEmpty())
    {
        return new SolrFacetProperties.Builder().build();
    }

    String filterID = (String) properties.get(ContentModel.PROP_NAME);
    boolean isDefault = (Boolean) properties.get(SolrFacetModel.PROP_IS_DEFAULT);

    SolrFacetProperties defaultFacet = defaultFacetsMap.get(filterID);
    if(defaultFacet == null)
    {
        defaultFacet = new SolrFacetProperties.Builder().build();
    }

    QName fieldQName = getDefaultIfNull(defaultFacet.getFacetQName(), (QName) properties.get(SolrFacetModel.PROP_FIELD_TYPE));
    String displayName = getDefaultIfNull(defaultFacet.getDisplayName(), (String) properties.get(SolrFacetModel.PROP_FIELD_LABEL));
    String displayControl = getDefaultIfNull(defaultFacet.getDisplayControl(), (String) properties.get(SolrFacetModel.PROP_DISPLAY_CONTROL));
    int maxFilters = getDefaultIfNull(defaultFacet.getMaxFilters(), (Integer) properties.get(SolrFacetModel.PROP_MAX_FILTERS));
    int hitThreshold = getDefaultIfNull(defaultFacet.getHitThreshold(), (Integer) properties.get(SolrFacetModel.PROP_HIT_THRESHOLD));
    int minFilterValueLength = getDefaultIfNull(defaultFacet.getMinFilterValueLength(), (Integer) properties.get(SolrFacetModel.PROP_MIN_FILTER_VALUE_LENGTH));
    String sortBy = getDefaultIfNull(defaultFacet.getSortBy(), (String) properties.get(SolrFacetModel.PROP_SORT_BY));
    String scope = getDefaultIfNull(defaultFacet.getScope(), (String) properties.get(SolrFacetModel.PROP_SCOPE));
    Boolean isEnabled = getDefaultIfNull(defaultFacet.isEnabled(), (Boolean) properties.get(SolrFacetModel.PROP_IS_ENABLED));
    @SuppressWarnings("unchecked")
    List<String> scSites = (List<String>) properties.get(SolrFacetModel.PROP_SCOPED_SITES);
    Set<String> scopedSites = getDefaultIfNull(defaultFacet.getScopedSites(), (scSites == null) ? null : new HashSet<>(scSites));

    Set<CustomProperties> extraProps = null;
    Map<QName, Serializable> customProperties = getFacetCustomProperties(properties);
    boolean hasAspect = nodeService.hasAspect(nodeRef, SolrFacetModel.ASPECT_CUSTOM_PROPERTIES);
    if (!hasAspect && customProperties.isEmpty())
    {
        extraProps = defaultFacet.getCustomProperties();
    }
    else
    {
        extraProps = new HashSet<>(customProperties.size());
        for (Entry<QName, Serializable> cp : customProperties.entrySet())
        {
            extraProps.add(new CustomProperties(cp.getKey(), cp.getValue()));
        }
    }
    // Construct the FacetProperty object
    SolrFacetProperties fp = new SolrFacetProperties.Builder()
                .filterID(filterID)
                .facetQName(fieldQName)
                .displayName(displayName)
                .displayControl(displayControl)
                .maxFilters(maxFilters)
                .hitThreshold(hitThreshold)
                .minFilterValueLength(minFilterValueLength)
                .sortBy(sortBy)
                .scope(scope)
                .isEnabled(isEnabled)
                .isDefault(isDefault)
                .scopedSites(scopedSites)
                .customProperties(extraProps).build();

    return fp;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:68,代码来源:SolrFacetServiceImpl.java

示例5: getCustomProperties

import org.alfresco.repo.search.impl.solr.facet.SolrFacetProperties.CustomProperties; //导入依赖的package包/类
protected Set<CustomProperties> getCustomProperties(JSONObject customPropsJsonObj) throws JSONException
{
    if (customPropsJsonObj == null)
    {
        return null;
    }
    JSONArray keys = customPropsJsonObj.names();
    if (keys == null)
    {
        return Collections.emptySet();
    }

    Set<CustomProperties> customProps = new HashSet<>(keys.length());
    for (int i = 0, length = keys.length(); i < length; i++)
    {
        JSONObject jsonObj = customPropsJsonObj.getJSONObject((String) keys.get(i));

        QName name = resolveToQName(getValue(String.class, jsonObj.opt(CUSTOM_PARAM_NAME), null));
        validateMandatoryCustomProps(name, CUSTOM_PARAM_NAME);
        
        Serializable value = null;
        Object customPropValue = jsonObj.opt(CUSTOM_PARAM_VALUE);
        validateMandatoryCustomProps(customPropValue, CUSTOM_PARAM_VALUE);
        
        if(customPropValue instanceof JSONArray)
        {
            JSONArray array = (JSONArray) customPropValue;
            ArrayList<Serializable> list = new ArrayList<>(array.length());
            for(int j = 0; j < array.length(); j++)
            {
                list.add(getSerializableValue(array.get(j)));
            }
            value = list;
        }
        else
        {
            value = getSerializableValue(customPropValue);
        }
        
       customProps.add(new CustomProperties(name, value));
    }

    if (logger.isDebugEnabled() && customProps.size() > 0)
    {
        logger.debug("Processed custom properties:" + customProps);
    }

    return customProps;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:50,代码来源:AbstractSolrFacetConfigAdminWebScript.java


注:本文中的org.alfresco.repo.search.impl.solr.facet.SolrFacetProperties.CustomProperties类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。