| Michael Hanl | deb3c21 | 2015-10-16 23:02:24 +0200 | [diff] [blame] | 1 | package de.ids_mannheim.korap.interfaces.db; |
| Michael Hanl | 86fcd61 | 2015-09-14 18:32:22 +0200 | [diff] [blame] | 2 | |
| 3 | import de.ids_mannheim.korap.exceptions.KustvaktException; |
| 4 | import de.ids_mannheim.korap.resources.KustvaktResource; |
| 5 | import de.ids_mannheim.korap.user.User; |
| 6 | |
| 7 | import java.util.Collection; |
| 8 | import java.util.List; |
| 9 | |
| 10 | // todo: for transaction to work this should go into core module!?! |
| 11 | // todo: user instance only required for auditing pointcut operations |
| 12 | public interface ResourceOperationIface<T extends KustvaktResource> { |
| 13 | |
| 14 | Class<T> getType(); |
| 15 | |
| 16 | <T extends KustvaktResource> T findbyId(String id, User user) |
| 17 | throws KustvaktException; |
| 18 | |
| 19 | <T extends KustvaktResource> T findbyId(Integer id, User user) |
| 20 | throws KustvaktException; |
| 21 | |
| 22 | List<T> getResources(Collection<Object> ids, User user) |
| 23 | throws KustvaktException; |
| 24 | |
| 25 | int updateResource(T resource, User user) throws KustvaktException; |
| 26 | |
| 27 | int[] updateResources(List<T> resources, User user) |
| 28 | throws KustvaktException; |
| 29 | |
| 30 | /** |
| 31 | * store a resource and return the id of the inserted value |
| 32 | * |
| 33 | * @param resource |
| 34 | * @return |
| 35 | * @throws KustvaktException |
| 36 | */ |
| 37 | int storeResource(T resource, User user) throws KustvaktException; |
| 38 | |
| 39 | // public void deleteResource(Integer id, User user) throws KorAPException; |
| 40 | int deleteResource(String id, User user) throws KustvaktException; |
| 41 | |
| Michael Hanl | 1939065 | 2016-01-16 11:01:24 +0100 | [diff] [blame] | 42 | int deleteAll() throws KustvaktException; |
| 43 | |
| Michael Hanl | 86fcd61 | 2015-09-14 18:32:22 +0200 | [diff] [blame] | 44 | } |