Class JdbiRepositoryImpl
- java.lang.Object
-
- de.digitalcollections.cudami.server.backend.impl.database.AbstractPagingAndSortingRepositoryImpl
-
- de.digitalcollections.cudami.server.backend.impl.jdbi.JdbiRepositoryImpl
-
- Direct Known Subclasses:
DigitalObjectLinkedDataFileResourceRepositoryImpl,DigitalObjectRenderingFileResourceRepositoryImpl,EntityRelationRepositoryImpl,HeadwordRepositoryImpl,IdentifiableRepositoryImpl,IdentifierRepositoryImpl,IdentifierTypeRepositoryImpl,LicenseRepositoryImpl,PredicateRepositoryImpl,RenderingTemplateRepositoryImpl,UrlAliasRepositoryImpl,UserRepositoryImpl,VersionRepositoryImpl
public abstract class JdbiRepositoryImpl extends AbstractPagingAndSortingRepositoryImpl
-
-
Field Summary
Fields Modifier and Type Field Description protected org.jdbi.v3.core.Jdbidbiprotected StringmappingPrefixprotected StringtableAliasprotected StringtableName-
Fields inherited from class de.digitalcollections.cudami.server.backend.impl.database.AbstractPagingAndSortingRepositoryImpl
offsetForAlternativePaging
-
-
Constructor Summary
Constructors Constructor Description JdbiRepositoryImpl(org.jdbi.v3.core.Jdbi dbi, String tableName, String tableAlias, String mappingPrefix, int offsetForAlternativePaging)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFiltering(de.digitalcollections.model.list.filtering.Filtering filtering, StringBuilder sqlQuery, Map<String,Object> argumentMappings)voidaddFiltering(de.digitalcollections.model.list.paging.PageRequest pageRequest, StringBuilder sqlQuery, Map<String,Object> argumentMappings)protected StringaddSearchTerm(de.digitalcollections.model.list.paging.PageRequest pageRequest, StringBuilder innerQuery, Map<String,Object> argumentMappings)protected StringaddSearchTermMappings(String searchTerm, Map<String,Object> argumentMappings)Add the search term to the argument map.longcount()longcount(String commonSql, Map<String,Object> argumentMappings)protected StringescapeTermForJsonpath(String term)Escape characters that must not appear in jsonpath inner strings.StringgetCommonSearchSql(String tblAlias, String originalSearchTerm)protected StringgetFilterClauses(de.digitalcollections.model.list.filtering.Filtering filtering, Map<String,Object> argumentMappings)StringgetMappingPrefix()protected List<String>getSearchTermTemplates(String tableAlias, String originalSearchTerm)StringgetTableAlias()StringgetTableName()protected StringgetWhereClause(de.digitalcollections.model.list.filtering.FilterCriterion<?> fc, Map<String,Object> argumentMappings, int criterionCount)protected voidmapFilterExpressionsToOtherTableColumnNames(de.digitalcollections.model.list.filtering.Filtering filtering, AbstractPagingAndSortingRepositoryImpl otherRepository)protected IntegerretrieveNextSortIndexForParentChildren(org.jdbi.v3.core.Jdbi dbi, String tableName, String columNameParentUuid, UUID parentUuid)-
Methods inherited from class de.digitalcollections.cudami.server.backend.impl.database.AbstractPagingAndSortingRepositoryImpl
addOrderBy, addPageRequestParams, getAllowedOrderByFields, getColumnName, getOrderBy, getUniqueField, supportsCaseSensitivityForProperty
-
-
-
-
Method Detail
-
addFiltering
public void addFiltering(de.digitalcollections.model.list.paging.PageRequest pageRequest, StringBuilder sqlQuery, Map<String,Object> argumentMappings)
-
addFiltering
public void addFiltering(de.digitalcollections.model.list.filtering.Filtering filtering, StringBuilder sqlQuery, Map<String,Object> argumentMappings)
-
addSearchTerm
protected String addSearchTerm(de.digitalcollections.model.list.paging.PageRequest pageRequest, StringBuilder innerQuery, Map<String,Object> argumentMappings)
-
addSearchTermMappings
protected String addSearchTermMappings(String searchTerm, Map<String,Object> argumentMappings)
Add the search term to the argument map. By overriding this method custom modifications can be made. Belongs togetSearchTermTemplates(String, String)andaddSearchTerm(PageRequest, StringBuilder, Map).- Parameters:
searchTerm- original term from thePageRequestargumentMappings-- Returns:
- the search term that should be used for the
ListResponse.setExecutedSearchTerm(String)
-
count
public long count()
-
escapeTermForJsonpath
protected final String escapeTermForJsonpath(String term)
Escape characters that must not appear in jsonpath inner strings.This method should always be used to clean up strings, e.g. search terms, that are intended to appear in an jsonpath inner string, i.e. between double quotes. If the inserted term contains double quotes then the jsonpath breaks. Hence we remove double quotes at start and end of the provided string (they do not have any meaning for the search at all) and escape the remaining ones with a backslash.
- Parameters:
term- can be null- Returns:
- term with forbidden characters removed or escaped
-
getFilterClauses
protected String getFilterClauses(de.digitalcollections.model.list.filtering.Filtering filtering, Map<String,Object> argumentMappings)
-
getMappingPrefix
public String getMappingPrefix()
-
getSearchTermTemplates
protected List<String> getSearchTermTemplates(String tableAlias, String originalSearchTerm)
-
getTableAlias
public String getTableAlias()
-
getTableName
public String getTableName()
-
getWhereClause
protected String getWhereClause(de.digitalcollections.model.list.filtering.FilterCriterion<?> fc, Map<String,Object> argumentMappings, int criterionCount) throws IllegalArgumentException, UnsupportedOperationException
-
mapFilterExpressionsToOtherTableColumnNames
protected void mapFilterExpressionsToOtherTableColumnNames(de.digitalcollections.model.list.filtering.Filtering filtering, AbstractPagingAndSortingRepositoryImpl otherRepository)
-
-