Class IdentifiableRepositoryImpl<I extends de.digitalcollections.model.identifiable.Identifiable>
- java.lang.Object
-
- de.digitalcollections.cudami.server.backend.impl.database.AbstractPagingAndSortingRepositoryImpl
-
- de.digitalcollections.cudami.server.backend.impl.jdbi.JdbiRepositoryImpl
-
- de.digitalcollections.cudami.server.backend.impl.jdbi.identifiable.IdentifiableRepositoryImpl<I>
-
- All Implemented Interfaces:
IdentifiableRepository<I>
- Direct Known Subclasses:
EntityRepositoryImpl,FamilyNameRepositoryImpl,FileResourceMetadataRepositoryImpl,GivenNameRepositoryImpl,WebpageRepositoryImpl
@Repository public class IdentifiableRepositoryImpl<I extends de.digitalcollections.model.identifiable.Identifiable> extends JdbiRepositoryImpl implements IdentifiableRepository<I>
-
-
Field Summary
Fields Modifier and Type Field Description BiFunction<Map<UUID,I>,org.jdbi.v3.core.result.RowView,Map<UUID,I>>additionalReduceRowsBiFunctionBiFunction<Map<UUID,I>,org.jdbi.v3.core.result.RowView,Map<UUID,I>>basicReduceRowsBiFunctionBiFunction<Map<UUID,I>,org.jdbi.v3.core.result.RowView,Map<UUID,I>>fullReduceRowsBiFunctionprotected ClassidentifiableImplClassstatic StringMAPPING_PREFIXprotected StringsqlSelectAllFieldsprotected StringsqlSelectAllFieldsJoinsprotected StringsqlSelectReducedFieldsstatic StringTABLE_ALIASstatic StringTABLE_NAME-
Fields inherited from class de.digitalcollections.cudami.server.backend.impl.jdbi.JdbiRepositoryImpl
dbi, mappingPrefix, tableAlias, tableName
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedIdentifiableRepositoryImpl(org.jdbi.v3.core.Jdbi dbi)protectedIdentifiableRepositoryImpl(org.jdbi.v3.core.Jdbi dbi, String tableName, String tableAlias, String mappingPrefix, Class identifiableImplClass, String sqlSelectAllFields, String sqlSelectReducedFields, String sqlInsertFields, String sqlInsertValues, String sqlUpdateFieldValues)protectedIdentifiableRepositoryImpl(org.jdbi.v3.core.Jdbi dbi, String tableName, String tableAlias, String mappingPrefix, Class identifiableImplClass, String sqlSelectAllFields, String sqlSelectReducedFields, String sqlInsertFields, String sqlInsertValues, String sqlUpdateFieldValues, String sqlSelectAllFieldsJoins)protectedIdentifiableRepositoryImpl(org.jdbi.v3.core.Jdbi dbi, String tableName, String tableAlias, String mappingPrefix, Class identifiableImplClass, String sqlSelectAllFields, String sqlSelectReducedFields, String sqlInsertFields, String sqlInsertValues, String sqlUpdateFieldValues, String sqlSelectAllFieldsJoins, BiFunction<Map<UUID,I>,org.jdbi.v3.core.result.RowView,Map<UUID,I>> additionalReduceRowsBiFunction)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddRelatedEntity(UUID identifiableUuid, UUID entityUuid)voidaddRelatedFileresource(UUID identifiableUuid, UUID fileResourceUuid)booleandelete(List<UUID> uuids)protected StringescapeTermForJsonpath(String term)Escape characters that must not appear in jsonpath inner strings.de.digitalcollections.model.paging.PageResponse<I>find(de.digitalcollections.model.paging.PageRequest pageRequest)protected de.digitalcollections.model.paging.PageResponse<I>find(de.digitalcollections.model.paging.PageRequest pageRequest, String commonSql, Map<String,Object> argumentMappings)de.digitalcollections.model.paging.SearchPageResponse<I>find(de.digitalcollections.model.paging.SearchPageRequest searchPageRequest)protected de.digitalcollections.model.paging.SearchPageResponse<I>find(de.digitalcollections.model.paging.SearchPageRequest searchPageRequest, String commonSql, Map<String,Object> argumentMappings)List<I>findAllFull()List<I>findAllReduced()de.digitalcollections.model.paging.PageResponse<I>findByLanguageAndInitial(de.digitalcollections.model.paging.PageRequest pageRequest, String language, String initial)Deprecated.IfindOne(de.digitalcollections.model.identifiable.Identifier identifier)IfindOne(UUID uuid, de.digitalcollections.model.filter.Filtering filtering)protected List<String>getAllowedOrderByFields()protected StringgetColumnName(String modelProperty)protected StringgetCommonSearchSql(String tblAlias)intgetIndex(List<? extends de.digitalcollections.model.identifiable.Identifiable> list, de.digitalcollections.model.identifiable.Identifiable identifiable)intgetIndex(List<UUID> list, UUID uuid)List<Locale>getLanguages()List<de.digitalcollections.model.identifiable.entity.Entity>getRelatedEntities(UUID identifiableUuid)List<de.digitalcollections.model.identifiable.resource.FileResource>getRelatedFileResources(UUID identifiableUuid)protected List<String>getSearchTermTemplates(String tableAlias)static StringgetSqlInsertFields()static StringgetSqlInsertValues()StringgetSqlSelectAllFields()static StringgetSqlSelectAllFields(String tableAlias, String mappingPrefix)StringgetSqlSelectReducedFields()static StringgetSqlSelectReducedFields(String tableAlias, String mappingPrefix)static StringgetSqlUpdateFieldValues()longretrieveCount(StringBuilder sqlCount, Map<String,Object> argumentMappings)List<I>retrieveList(String fieldsSql, StringBuilder innerQuery, Map<String,Object> argumentMappings, String orderBy)IretrieveOne(String fieldsSql, String sqlSelectAllFieldsJoins, de.digitalcollections.model.filter.Filtering filtering)IretrieveOne(String fieldsSql, String sqlSelectAllFieldsJoins, de.digitalcollections.model.filter.Filtering filtering, Map<String,Object> argumentMappings)Isave(I identifiable, Map<String,Object> bindings)List<de.digitalcollections.model.identifiable.entity.Entity>saveRelatedEntities(UUID identifiableUuid, List<de.digitalcollections.model.identifiable.entity.Entity> entities)List<de.digitalcollections.model.identifiable.resource.FileResource>saveRelatedFileResources(UUID identifiableUuid, List<de.digitalcollections.model.identifiable.resource.FileResource> fileResources)Iupdate(I identifiable, Map<String,Object> bindings)-
Methods inherited from class de.digitalcollections.cudami.server.backend.impl.jdbi.JdbiRepositoryImpl
addFiltering, addFiltering, count, getFilterClauses, getMappingPrefix, getTableAlias, getTableName, getWhereClause, retrieveNextSortIndexForParentChildren
-
Methods inherited from class de.digitalcollections.cudami.server.backend.impl.database.AbstractPagingAndSortingRepositoryImpl
addLimit, addOffset, addOrderBy, addPageRequestParams, getOrderBy
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.digitalcollections.cudami.server.backend.api.repository.identifiable.IdentifiableRepository
addRelatedEntity, addRelatedFileresource, count, delete, find, findOne, findOneByIdentifier, getRelatedEntities, getRelatedFileResources, save, saveRelatedEntities, saveRelatedFileResources, update
-
-
-
-
Field Detail
-
MAPPING_PREFIX
public static final String MAPPING_PREFIX
- See Also:
- Constant Field Values
-
TABLE_ALIAS
public static final String TABLE_ALIAS
- See Also:
- Constant Field Values
-
TABLE_NAME
public static final String TABLE_NAME
- See Also:
- Constant Field Values
-
additionalReduceRowsBiFunction
public BiFunction<Map<UUID,I extends de.digitalcollections.model.identifiable.Identifiable>,org.jdbi.v3.core.result.RowView,Map<UUID,I extends de.digitalcollections.model.identifiable.Identifiable>> additionalReduceRowsBiFunction
-
basicReduceRowsBiFunction
public final BiFunction<Map<UUID,I extends de.digitalcollections.model.identifiable.Identifiable>,org.jdbi.v3.core.result.RowView,Map<UUID,I extends de.digitalcollections.model.identifiable.Identifiable>> basicReduceRowsBiFunction
-
fullReduceRowsBiFunction
public final BiFunction<Map<UUID,I extends de.digitalcollections.model.identifiable.Identifiable>,org.jdbi.v3.core.result.RowView,Map<UUID,I extends de.digitalcollections.model.identifiable.Identifiable>> fullReduceRowsBiFunction
-
identifiableImplClass
protected final Class identifiableImplClass
-
sqlSelectAllFields
protected String sqlSelectAllFields
-
sqlSelectAllFieldsJoins
protected final String sqlSelectAllFieldsJoins
-
sqlSelectReducedFields
protected String sqlSelectReducedFields
-
-
Constructor Detail
-
IdentifiableRepositoryImpl
@Autowired protected IdentifiableRepositoryImpl(org.jdbi.v3.core.Jdbi dbi)
-
IdentifiableRepositoryImpl
protected IdentifiableRepositoryImpl(org.jdbi.v3.core.Jdbi dbi, String tableName, String tableAlias, String mappingPrefix, Class identifiableImplClass, String sqlSelectAllFields, String sqlSelectReducedFields, String sqlInsertFields, String sqlInsertValues, String sqlUpdateFieldValues)
-
IdentifiableRepositoryImpl
protected IdentifiableRepositoryImpl(org.jdbi.v3.core.Jdbi dbi, String tableName, String tableAlias, String mappingPrefix, Class identifiableImplClass, String sqlSelectAllFields, String sqlSelectReducedFields, String sqlInsertFields, String sqlInsertValues, String sqlUpdateFieldValues, String sqlSelectAllFieldsJoins)
-
IdentifiableRepositoryImpl
protected IdentifiableRepositoryImpl(org.jdbi.v3.core.Jdbi dbi, String tableName, String tableAlias, String mappingPrefix, Class identifiableImplClass, String sqlSelectAllFields, String sqlSelectReducedFields, String sqlInsertFields, String sqlInsertValues, String sqlUpdateFieldValues, String sqlSelectAllFieldsJoins, BiFunction<Map<UUID,I>,org.jdbi.v3.core.result.RowView,Map<UUID,I>> additionalReduceRowsBiFunction)
-
-
Method Detail
-
getSqlInsertFields
public static String getSqlInsertFields()
-
getSqlInsertValues
public static String getSqlInsertValues()
-
getSqlSelectAllFields
public static String getSqlSelectAllFields(String tableAlias, String mappingPrefix)
-
getSqlSelectReducedFields
public static String getSqlSelectReducedFields(String tableAlias, String mappingPrefix)
-
getSqlUpdateFieldValues
public static String getSqlUpdateFieldValues()
-
addRelatedEntity
public void addRelatedEntity(UUID identifiableUuid, UUID entityUuid)
- Specified by:
addRelatedEntityin interfaceIdentifiableRepository<I extends de.digitalcollections.model.identifiable.Identifiable>
-
addRelatedFileresource
public void addRelatedFileresource(UUID identifiableUuid, UUID fileResourceUuid)
- Specified by:
addRelatedFileresourcein interfaceIdentifiableRepository<I extends de.digitalcollections.model.identifiable.Identifiable>
-
delete
public boolean delete(List<UUID> uuids)
- Specified by:
deletein interfaceIdentifiableRepository<I extends de.digitalcollections.model.identifiable.Identifiable>
-
escapeTermForJsonpath
protected 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
-
find
public de.digitalcollections.model.paging.PageResponse<I> find(de.digitalcollections.model.paging.PageRequest pageRequest)
- Specified by:
findin interfaceIdentifiableRepository<I extends de.digitalcollections.model.identifiable.Identifiable>
-
find
protected de.digitalcollections.model.paging.PageResponse<I> find(de.digitalcollections.model.paging.PageRequest pageRequest, String commonSql, Map<String,Object> argumentMappings)
-
find
public de.digitalcollections.model.paging.SearchPageResponse<I> find(de.digitalcollections.model.paging.SearchPageRequest searchPageRequest)
- Specified by:
findin interfaceIdentifiableRepository<I extends de.digitalcollections.model.identifiable.Identifiable>
-
find
protected de.digitalcollections.model.paging.SearchPageResponse<I> find(de.digitalcollections.model.paging.SearchPageRequest searchPageRequest, String commonSql, Map<String,Object> argumentMappings)
-
findAllFull
public List<I> findAllFull()
- Specified by:
findAllFullin interfaceIdentifiableRepository<I extends de.digitalcollections.model.identifiable.Identifiable>
-
findAllReduced
public List<I> findAllReduced()
- Specified by:
findAllReducedin interfaceIdentifiableRepository<I extends de.digitalcollections.model.identifiable.Identifiable>
-
findByLanguageAndInitial
@Deprecated public de.digitalcollections.model.paging.PageResponse<I> findByLanguageAndInitial(de.digitalcollections.model.paging.PageRequest pageRequest, String language, String initial)
Deprecated.- Specified by:
findByLanguageAndInitialin interfaceIdentifiableRepository<I extends de.digitalcollections.model.identifiable.Identifiable>
-
findOne
public I findOne(UUID uuid, de.digitalcollections.model.filter.Filtering filtering)
- Specified by:
findOnein interfaceIdentifiableRepository<I extends de.digitalcollections.model.identifiable.Identifiable>
-
findOne
public I findOne(de.digitalcollections.model.identifiable.Identifier identifier)
- Specified by:
findOnein interfaceIdentifiableRepository<I extends de.digitalcollections.model.identifiable.Identifiable>
-
getAllowedOrderByFields
protected List<String> getAllowedOrderByFields()
- Specified by:
getAllowedOrderByFieldsin classAbstractPagingAndSortingRepositoryImpl- Returns:
- model properties names that are applicable for sorting, will be mapped to database column names using @see #getColumnName
-
getColumnName
protected String getColumnName(String modelProperty)
- Specified by:
getColumnNamein classAbstractPagingAndSortingRepositoryImpl- Parameters:
modelProperty- name of model property passed as String, e.g. "lastModified"- Returns:
- full qualified column name as used in sql queries ("last_modified" or e.g. "w.last_modified" if prefix used in queries)
-
getIndex
public int getIndex(List<? extends de.digitalcollections.model.identifiable.Identifiable> list, de.digitalcollections.model.identifiable.Identifiable identifiable)
-
getLanguages
public List<Locale> getLanguages()
- Specified by:
getLanguagesin interfaceIdentifiableRepository<I extends de.digitalcollections.model.identifiable.Identifiable>
-
getRelatedEntities
public List<de.digitalcollections.model.identifiable.entity.Entity> getRelatedEntities(UUID identifiableUuid)
- Specified by:
getRelatedEntitiesin interfaceIdentifiableRepository<I extends de.digitalcollections.model.identifiable.Identifiable>
-
getRelatedFileResources
public List<de.digitalcollections.model.identifiable.resource.FileResource> getRelatedFileResources(UUID identifiableUuid)
- Specified by:
getRelatedFileResourcesin interfaceIdentifiableRepository<I extends de.digitalcollections.model.identifiable.Identifiable>
-
getSqlSelectAllFields
public String getSqlSelectAllFields()
-
getSqlSelectReducedFields
public String getSqlSelectReducedFields()
-
retrieveCount
public long retrieveCount(StringBuilder sqlCount, Map<String,Object> argumentMappings)
-
retrieveList
public List<I> retrieveList(String fieldsSql, StringBuilder innerQuery, Map<String,Object> argumentMappings, String orderBy)
-
retrieveOne
public I retrieveOne(String fieldsSql, String sqlSelectAllFieldsJoins, de.digitalcollections.model.filter.Filtering filtering)
-
retrieveOne
public I retrieveOne(String fieldsSql, String sqlSelectAllFieldsJoins, de.digitalcollections.model.filter.Filtering filtering, Map<String,Object> argumentMappings)
-
save
public I save(I identifiable, Map<String,Object> bindings)
- Specified by:
savein interfaceIdentifiableRepository<I extends de.digitalcollections.model.identifiable.Identifiable>
-
saveRelatedEntities
public List<de.digitalcollections.model.identifiable.entity.Entity> saveRelatedEntities(UUID identifiableUuid, List<de.digitalcollections.model.identifiable.entity.Entity> entities)
- Specified by:
saveRelatedEntitiesin interfaceIdentifiableRepository<I extends de.digitalcollections.model.identifiable.Identifiable>
-
saveRelatedFileResources
public List<de.digitalcollections.model.identifiable.resource.FileResource> saveRelatedFileResources(UUID identifiableUuid, List<de.digitalcollections.model.identifiable.resource.FileResource> fileResources)
- Specified by:
saveRelatedFileResourcesin interfaceIdentifiableRepository<I extends de.digitalcollections.model.identifiable.Identifiable>
-
-