Class BaseCodeAndDescriptionDeletableService<T extends BaseCodeAndDescriptionDeletableEntity>
- java.lang.Object
-
- com.github.collinalpert.java2db.services.BaseService<T>
-
- com.github.collinalpert.java2db.services.BaseDeletableService<T>
-
- com.github.collinalpert.java2db.services.BaseCodeAndDescriptionDeletableService<T>
-
public class BaseCodeAndDescriptionDeletableService<T extends BaseCodeAndDescriptionDeletableEntity> extends BaseDeletableService<T>
Describes a service class for an entity which contains an id, an isDeleted flag, a code and a description. Note that when deleting entities which have an isDeleted flag with this service, they will not actually be deleted from the database, but the flag will be set totrue.- Author:
- Collin Alpert
-
-
Field Summary
-
Fields inherited from class com.github.collinalpert.java2db.services.BaseService
tableName, type
-
-
Constructor Summary
Constructors Constructor Description BaseCodeAndDescriptionDeletableService()
-
Method Summary
Modifier and Type Method Description Optional<T>getByCode(String code)Retrieves an entry from a table based on its unique code.EntityQuery<T>getByDescription(String description)Retrieves entries from a table based on their description.-
Methods inherited from class com.github.collinalpert.java2db.services.BaseDeletableService
delete, delete, delete, delete, delete, delete
-
Methods inherited from class com.github.collinalpert.java2db.services.BaseService
any, any, count, count, create, create, create, createPagination, createPagination, createPagination, createPagination, createQuery, createSingleQuery, getAll, getAll, getAll, getAll, getAll, getById, getFirst, getMultiple, getSingle, hasDuplicates, max, max, min, min, truncateTable, update, update, update, update, update, update
-
-
-
-
Method Detail
-
getByCode
public Optional<T> getByCode(String code)
Retrieves an entry from a table based on its unique code.- Parameters:
code- The code to get the entity from.- Returns:
- An entity matching this code. It is assumed that a code, just like the id, is unique in a table.
-
getByDescription
public EntityQuery<T> getByDescription(String description)
Retrieves entries from a table based on their description. This is an uncommon method but exists for completeness sakes.- Parameters:
description- The description to get the results by.- Returns:
- A list of entities matching a certain description.
-
-