Class DbAdminRepository
java.lang.Object
tech.ailef.dbadmin.external.dbmapping.DbAdminRepository
Implements the basic CRUD operations (and some more)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
attachManyToMany
(DbObjectSchema schema, Object id, Map<String, List<String>> params) long
count
(DbObjectSchema schema) long
count
(DbObjectSchema schema, String query, Set<QueryFilter> queryFilters) Counts the elements that match the fuzzy searchcreate
(DbObjectSchema schema, Map<String, String> values, Map<String, org.springframework.web.multipart.MultipartFile> files, String primaryKey) Create a new object with the specific primary key and values, returns the primary key of the created objectvoid
delete
(DbObjectSchema schema, String id) Delete a specific objectfindAll
(DbObjectSchema schema, int page, int pageSize, String sortKey, String sortOrder) Find all the objects in the schema.findById
(DbObjectSchema schema, Object id) Find an object by IDsearch
(DbObjectSchema schema, String query) Fuzzy search on primary key value and display namesearch
(DbObjectSchema schema, String query, int page, int pageSize, String sortKey, String sortOrder, Set<QueryFilter> queryFilters) Fuzzy search on primary key value and display namevoid
update
(DbObjectSchema schema, Map<String, String> params, Map<String, org.springframework.web.multipart.MultipartFile> files) Update an existing object with new values
-
Constructor Details
-
DbAdminRepository
public DbAdminRepository(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
-
-
Method Details
-
findById
Find an object by ID- Parameters:
schema
- the schema where to lookid
- the primary key value- Returns:
- an optional with the object with the specified primary key value
-
count
-
count
Counts the elements that match the fuzzy search- Parameters:
schema
-query
-- Returns:
-
findAll
public PaginatedResult<DbObject> findAll(DbObjectSchema schema, int page, int pageSize, String sortKey, String sortOrder) Find all the objects in the schema. Only returns a single page of results based on the input parameters.- Parameters:
schema
-page
-pageSize
-sortKey
-sortOrder
-- Returns:
-
update
@Transactional("transactionManager") public void update(DbObjectSchema schema, Map<String, String> params, Map<String, org.springframework.web.multipart.MultipartFile> files) Update an existing object with new values- Parameters:
schema
-params
-
-
attachManyToMany
-
create
public Object create(DbObjectSchema schema, Map<String, String> values, Map<String, org.springframework.web.multipart.MultipartFile> files, String primaryKey) Create a new object with the specific primary key and values, returns the primary key of the created object- Parameters:
schema
-values
-primaryKey
-
-
search
public PaginatedResult<DbObject> search(DbObjectSchema schema, String query, int page, int pageSize, String sortKey, String sortOrder, Set<QueryFilter> queryFilters) Fuzzy search on primary key value and display name- Parameters:
schema
-query
-- Returns:
-
search
Fuzzy search on primary key value and display name- Parameters:
schema
-query
-- Returns:
-
delete
Delete a specific object- Parameters:
schema
-id
-
-