public class DefaultFlexibleCMSItemSearchService extends java.lang.Object implements CMSItemSearchService
CMSItemSearchService implementation that performs partial
matching of the mask param on both UID and NAME fields, and exact matching on typeCode(s) and additional parameter
fields| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CATALOG_VERSION_QUERY_PARAM |
static java.lang.String |
EXCLUDED_TYPES_QUERY_PARAM |
static java.lang.String |
ITEM_SEARCH_PARAM_CHECK |
static java.lang.String |
ITEM_SEARCH_PARAM_CHECK_NULL |
static java.lang.String |
MASK_CHECK |
static java.lang.String |
MASK_QUERY_PARAM |
static java.lang.String |
ORDER_BY |
static java.lang.String |
QUERY |
static java.lang.String |
TYPECODES_QUERY_PARAM |
| Constructor and Description |
|---|
DefaultFlexibleCMSItemSearchService() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
appendSearchParams(java.util.Map<java.lang.String,java.lang.String> itemSearchParams,
java.lang.StringBuilder queryBuilder,
java.util.Map<java.lang.String,java.lang.Object> queryParameters,
java.lang.String typeCode)
Append the item search data to the query builder
|
protected void |
appendSort(java.lang.String sortNameAndDirection,
java.lang.StringBuilder queryBuilder,
java.lang.String typeCode)
Append the
ORDER BY clause to the query builder |
protected void |
appendTypeExclusions(java.util.List<ComposedTypeModel> composedTypes,
java.lang.StringBuilder queryBuilder,
java.util.Map<java.lang.String,java.lang.Object> queryParameters)
Append the type codes to be excluded from the query to the query builder.
|
protected java.util.function.Predicate<Sort> |
attributeExistsForType(java.lang.String typeCode) |
protected java.lang.String |
buildSortStatement(java.lang.String typeCode,
Sort sort)
Create the
String representation of the sort parameter and direction by formatting the sort parameter by
applying the syntax required by the Flexible Search query. |
SearchResult<CMSItemModel> |
findCMSItems(CMSItemSearchData cmsItemSearchData,
PageableData pageableData)
Paged Search for CMSItems
|
protected java.util.List<ComposedTypeModel> |
getAllSubTypes(ComposedTypeModel composedType)
Get the list of all the sub types given a composedType.
|
protected java.util.List<java.lang.String> |
getAllSuperTypeCodes(ComposedTypeModel composedType)
Get the list of all the super typeCodes given a composedType, including the composedType typeCode.
|
protected CatalogVersionService |
getCatalogVersionService() |
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getCmsItemSearchTypeBlacklistMap() |
protected SortStatementFormatter |
getDefaultSortStatementFormatter() |
protected java.lang.String |
getFirstCommonAncestorTypeCode(java.util.List<ComposedTypeModel> composedTypes)
Get the first common ancestor typeCode given a list of composed types.
|
protected java.lang.String |
getFirstCommonElement(java.util.List<java.util.List<java.lang.String>> collections)
Get the first common element given multiple collections.
|
protected FlexibleSearchAttributeValueConverter |
getFlexibleSearchAttributeValueConverter() |
protected FlexibleSearchService |
getFlexibleSearchService() |
protected java.util.List<java.lang.String> |
getInheritedTypeCodes(java.util.List<ComposedTypeModel> composedTypes)
Get all the inherited typeCodes given a list of composed types.
|
protected PermissionCRUDService |
getPermissionCRUDService() |
protected SearchHelper |
getSearchHelper() |
protected java.util.List<SortStatementFormatter> |
getSortStatementFormatters() |
protected java.util.List<java.lang.String> |
getTypeCodesFromSearchData(CMSItemSearchData cmsItemSearchData)
Get the list of typeCodes given the cmsItemSearchData.
|
protected TypeService |
getTypeService() |
protected java.util.List<ComposedTypeModel> |
getValidComposedTypes(CMSItemSearchData cmsItemSearchData)
Get the list of all valid composed types given cmsItemSearchData
|
protected java.util.List<ComposedTypeModel> |
getValidComposedTypes(java.util.List<java.lang.String> typeCodes)
Get the list of all valid composed types given a list of typeCodes
|
boolean |
hasCommonAncestorForTypeCodes(java.util.List<java.lang.String> typeCodes)
Validate if there is a common ancestor typeCode given a list of typeCodes
|
protected java.lang.StringBuilder |
prepareQueryBuilder(java.util.List<ComposedTypeModel> composedTypes,
java.lang.String typeCode,
java.util.Map<java.lang.String,java.lang.Object> queryParameters)
Prepare the query builder to set the parent query typeCode, the inherited typeCodes and the excluded typeCodes.
|
void |
setCatalogVersionService(CatalogVersionService catalogVersionService) |
void |
setCmsItemSearchTypeBlacklistMap(java.util.Map<java.lang.String,java.util.List<java.lang.String>> cmsItemSearchTypeBlacklistMap) |
void |
setDefaultSortStatementFormatter(SortStatementFormatter defaultSortStatementFormatter) |
void |
setFlexibleSearchAttributeValueConverter(FlexibleSearchAttributeValueConverter flexibleSearchAttributeValueConverter) |
void |
setFlexibleSearchService(FlexibleSearchService flexibleSearchService) |
void |
setPermissionCRUDService(PermissionCRUDService permissionCRUDService) |
void |
setSearchHelper(SearchHelper searchHelper) |
void |
setSortStatementFormatters(java.util.List<SortStatementFormatter> sortStatementFormatters) |
void |
setTypeService(TypeService typeService) |
protected java.util.function.Predicate<java.lang.String> |
typeCodeExists() |
protected void |
validateCommonAncestorTypeCode(java.util.List<java.lang.String> typeCodes) |
protected void |
validateSearchData(CMSItemSearchData cmsItemSearchData,
PageableData pageableData)
Validate the cms item search data and pageable data
|
public static final java.lang.String QUERY
public static final java.lang.String TYPECODES_QUERY_PARAM
public static final java.lang.String CATALOG_VERSION_QUERY_PARAM
public static final java.lang.String MASK_CHECK
public static final java.lang.String MASK_QUERY_PARAM
public static final java.lang.String ITEM_SEARCH_PARAM_CHECK
public static final java.lang.String ITEM_SEARCH_PARAM_CHECK_NULL
public static final java.lang.String EXCLUDED_TYPES_QUERY_PARAM
public static final java.lang.String ORDER_BY
public SearchResult<CMSItemModel> findCMSItems(CMSItemSearchData cmsItemSearchData, PageableData pageableData)
CMSItemModel._TYPECODE.null as
value.findCMSItems in interface CMSItemSearchServicecmsItemSearchData - All the required and optional search params, excluding pagingpageableData - Paging search paramspublic boolean hasCommonAncestorForTypeCodes(java.util.List<java.lang.String> typeCodes)
CMSItemSearchServicehasCommonAncestorForTypeCodes in interface CMSItemSearchServicetypeCodes - the list of typeCodesprotected void validateCommonAncestorTypeCode(java.util.List<java.lang.String> typeCodes)
protected void validateSearchData(CMSItemSearchData cmsItemSearchData, PageableData pageableData)
cmsItemSearchData - pageableData - java.lang.IllegalArgumentException - if both typeCode and typeCodes are used.protected java.lang.StringBuilder prepareQueryBuilder(java.util.List<ComposedTypeModel> composedTypes, java.lang.String typeCode, java.util.Map<java.lang.String,java.lang.Object> queryParameters)
composedTypes - typeCode - queryParameters - protected java.util.List<ComposedTypeModel> getValidComposedTypes(CMSItemSearchData cmsItemSearchData)
cmsItemSearchData - protected java.util.List<ComposedTypeModel> getValidComposedTypes(java.util.List<java.lang.String> typeCodes)
typeCodes - protected java.util.function.Predicate<java.lang.String> typeCodeExists()
protected java.lang.String getFirstCommonAncestorTypeCode(java.util.List<ComposedTypeModel> composedTypes)
composedTypes - the list of composed typesString representation of the first common ancestor typeCodeprotected java.util.List<java.lang.String> getAllSuperTypeCodes(ComposedTypeModel composedType)
composedType - List of String representation of all the super typeCodes given a composedType,
including the composedType typeCode.protected java.util.List<java.lang.String> getInheritedTypeCodes(java.util.List<ComposedTypeModel> composedTypes)
composedTypes - the list of composed typesprotected java.util.List<ComposedTypeModel> getAllSubTypes(ComposedTypeModel composedType)
composedType - List of ComposedTypeModel representation of all the sub types given a composedType,protected java.lang.String getFirstCommonElement(java.util.List<java.util.List<java.lang.String>> collections)
collections - the collections to iterate overString representation of the first common element from amongst all the given Collections.protected java.util.List<java.lang.String> getTypeCodesFromSearchData(CMSItemSearchData cmsItemSearchData)
CMSItemModel _TYPECODE by default if
typeCode(s) is blank.cmsItemSearchData - protected void appendTypeExclusions(java.util.List<ComposedTypeModel> composedTypes, java.lang.StringBuilder queryBuilder, java.util.Map<java.lang.String,java.lang.Object> queryParameters)
composedTypes - the composedTypes which may have a list of blacklisted types definedqueryBuilder - the query builder for the query statementqueryParameters - map of key-value pairs of query parameter fields and Object valuesprotected void appendSearchParams(java.util.Map<java.lang.String,java.lang.String> itemSearchParams,
java.lang.StringBuilder queryBuilder,
java.util.Map<java.lang.String,java.lang.Object> queryParameters,
java.lang.String typeCode)
itemSearchParams - the item search paramsqueryBuilder - the query builder for the query statementqueryParameters - map of key-value pairs of query parameter fields and Object valuestypeCode - the typeCodeprotected void appendSort(java.lang.String sortNameAndDirection,
java.lang.StringBuilder queryBuilder,
java.lang.String typeCode)
ORDER BY clause to the query buildersortNameAndDirection - string containing the field name to be sorted and the sort orderqueryBuilder - the query builder for the query statementtypeCode - the typeCodeprotected java.util.function.Predicate<Sort> attributeExistsForType(java.lang.String typeCode)
protected java.lang.String buildSortStatement(java.lang.String typeCode,
Sort sort)
String representation of the sort parameter and direction by formatting the sort parameter by
applying the syntax required by the Flexible Search query. This uses a custom SortStatementFormatter to
format the sort parameter value if applicable, otherwise the default formatter is used instead.typeCode - the typeCode value of the cms items to be retrievedsort - the Sort object containing the parameter to be sorted and the sort directionString representation of the formatted sort parameter and directionprotected CatalogVersionService getCatalogVersionService()
public void setCatalogVersionService(CatalogVersionService catalogVersionService)
protected FlexibleSearchService getFlexibleSearchService()
public void setFlexibleSearchService(FlexibleSearchService flexibleSearchService)
protected FlexibleSearchAttributeValueConverter getFlexibleSearchAttributeValueConverter()
public void setFlexibleSearchAttributeValueConverter(FlexibleSearchAttributeValueConverter flexibleSearchAttributeValueConverter)
protected TypeService getTypeService()
public void setTypeService(TypeService typeService)
protected java.util.List<SortStatementFormatter> getSortStatementFormatters()
public void setSortStatementFormatters(java.util.List<SortStatementFormatter> sortStatementFormatters)
protected SortStatementFormatter getDefaultSortStatementFormatter()
public void setDefaultSortStatementFormatter(SortStatementFormatter defaultSortStatementFormatter)
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> getCmsItemSearchTypeBlacklistMap()
public void setCmsItemSearchTypeBlacklistMap(java.util.Map<java.lang.String,java.util.List<java.lang.String>> cmsItemSearchTypeBlacklistMap)
protected SearchHelper getSearchHelper()
public void setSearchHelper(SearchHelper searchHelper)
protected PermissionCRUDService getPermissionCRUDService()
public void setPermissionCRUDService(PermissionCRUDService permissionCRUDService)
Copyright © 2018 SAP SE. All Rights Reserved.