- Timestamp:
- 02/20/15 15:17:07 (9 years ago)
- Location:
- DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/ILambda.java
r5850 r6004 22 22 23 23 /** 24 * 24 * This is a help interface used in wrapper methods for REST requests, see RequestWrappers.java; 25 * "R" may stay for resource, e.g. Annotation. 25 26 * @author olhsha 26 27 */ 27 28 public interface ILambda<Map, R> { 28 29 30 /** 31 * 32 * @param params list of pairs parameter->value, e.g. such map can contain the external Id of a resource, e.g. an annotation. 33 * @return an instance of "R" corresponding to these parameter values,e.g. an annotation if R is instantiated as "Annotation". 34 * @throws NotInDataBaseException see various implementations in REST resource classes. 35 * @throws ForbiddenException see various implementations in REST resource classes. 36 */ 29 37 public R apply(Map params) throws NotInDataBaseException, ForbiddenException; 30 38 -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/ILambdaPrincipal.java
r5053 r6004 22 22 23 23 /** 24 * 24 * This is a help interface used in wrapper methods for REST requests, see RequestWrappers.java; 25 25 * @author olhsha 26 26 */ 27 27 public interface ILambdaPrincipal<Map, R> { 28 28 29 /** 30 * 31 * @param params list of pairs parameter -> value. 32 * @return the object corresponding to the parameter values from the "params". 33 * @throws NotInDataBaseException see the implementations. 34 * @throws PrincipalExists see the implementations 35 */ 29 36 public R apply(Map params) throws NotInDataBaseException, PrincipalExists; 30 37 -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/NotebookDao.java
r4834 r6004 43 43 **/ 44 44 45 /** 46 * 47 * @param notebookID the internal ID of a notebook. 48 * @return the internal database Id of the owner of the notebook. 49 */ 45 50 Number getOwner(Number notebookID); 46 51 47 52 48 53 /** 54 * 55 * @param principalID the internal database id of some principal. 56 * @param acessMode {@link Access} object, representing one of the access modes: 57 * "all", "write", "read" or "none". 58 * @return the list of internal database id's of the notebooks for which "principalID" has ""accessMode" access. 59 */ 49 60 List<Number> getNotebookIDs(Number principalID, Access acessMode); 50 61 51 // Returns a list of notebook Ids for the notebooks for which the given principal "principalID" is the owner. 62 /** 63 * @param principaID the internal database id of some principal. 64 * @return the list of internal database id's of the notebooks for which "principalID" is the owner. 65 */ 52 66 List<Number> getNotebookIDsOwnedBy(Number principaID); 53 67 … … 56 70 /** 57 71 * 58 * @param notebookID 59 * @return the notebook info for the notebook with notebookID 72 * @param notebookID the internal database id of a notebook. 73 * @return the {@link NotebookInfo} object built for the notebook with notebookID upon the corresponding row 74 * in the "notebook" table. 60 75 */ 61 76 NotebookInfo getNotebookInfoWithoutOwner(Number notebookID); … … 64 79 /** 65 80 * 66 * @param notebookID 67 * @return notebook metadata for the notebook with notebookID 81 * @param notebookID the internal database id of a notebook. 82 * @return the {@link Notebook} object built for the notebook with notebookID upon the corresponding row 83 * in the "notebook" table. 68 84 */ 69 85 Notebook getNotebookWithoutAnnotationsAndAccesssAndOwner(Number notebookID); … … 81 97 82 98 83 /** 84 * 85 * @param notebookID 86 * @return true if updated, false otherwise. Logs the reason if the notebook is not updated. 99 100 /** 101 * 102 * @param notebookID the internal database id of a notebook. 103 * @param title a new title for the notebook. 104 * @param ownerID the internal database id of the owner principal of the notebook. 105 * @return true if the title "notebookID" is updated to "title", false otherwise. 87 106 */ 88 107 boolean updateNotebookMetadata(Number notebookID, String title, Number ownerID); 89 108 109 110 /** 111 * 112 * @param notebookID the internal database id of a notebook. 113 * @param ownerID the internal database id of a new owner for the notebook. 114 * @return true if the owner_id is in "notebook" table is updated to "ownerID", false otherwise. 115 */ 90 116 boolean setOwner(Number notebookID, Number ownerID); 91 117 118 /** 119 * 120 * @param notebookID the internal database id of a notebook. 121 * @param principalID the internal database id of a principal. 122 * @param access an {@link Access} object. 123 * @return true iff the access mode to "notebookID" for "principalID" has been assigned to "access"'s value. 124 */ 92 125 boolean updatePrincipalAccessForNotebook(Number notebookID, Number principalID, Access access); 93 126 … … 99 132 */ 100 133 134 /** 135 * 136 * @param notebook the {@link Notebook} object representing a notebook to be created in the database. 137 * @param ownerID the internal database id of the owner principal. 138 * @return the internal id of the created notebook. 139 * @throws NotInDataBaseException if creation the notebook fails. 140 */ 101 141 public Number createNotebookWithoutAccesssAndAnnotations(Notebook notebook, Number ownerID) throws NotInDataBaseException; 102 142 143 /** 144 * 145 * @param notebookID the internal database ID of a notebook. 146 * @param annotationID the internal database ID of an annotation. 147 * @return true if the row for the (ntebookID,annotationID) has been added to the junction table 148 * "notebooks_annotations". 149 */ 103 150 boolean addAnnotationToNotebook(Number notebookID, Number annotationID); 104 151 152 /** 153 * 154 * @param notebookID the internal database ID of a notebook. 155 * @param principalID the internal database ID of a principal. 156 * @param access access an {@link Access} object. 157 * @return true iff the "access" mode to "notebookID" has been assigned for "principalID" 158 * in the corresponding junction table. 159 */ 105 160 boolean addAccessToNotebook(Number notebookID, Number principalID, Access access); 106 161 … … 114 169 */ 115 170 171 /** 172 * 173 * @param notebookID the internal database ID of a notebook. 174 * @param annotationID annotationID the internal database ID of an annotation. 175 * @return true iff the row for the (notebookID,annotationID) has been deleted from the junction table 176 * "notebooks_annotations". 177 */ 116 178 boolean deleteAnnotationFromNotebook(Number notebookID, Number annotationID); 117 179 180 /** 181 * 182 * @param notebookID the internal database ID of a notebook. 183 * @return true iff all the rows with "notebookID" have been removed from "notebooks_annotations" table. 184 */ 118 185 boolean deleteAllAnnotationsFromNotebook(Number notebookID); 119 186 187 /** 188 * 189 * @param notebookID the internal database ID of a notebook. 190 * @param principalID the internal database ID of a principal. 191 * @return true iff the row for the pair (notebookID, principlaID) has been removed from the "notebooks_principals_accesses" table. 192 */ 120 193 boolean deleteNotebookPrincipalAccess(Number notebookID, Number principalID); 121 194 195 /** 196 * 197 * @param notebookID the internal database ID of a notebook. 198 * @return true iff all the rows with "notebookID" have been removed from from the "notebooks_principals_accesses" table. 199 */ 122 200 boolean deleteAllAccesssForNotebook(Number notebookID); 123 201 202 /** 203 * 204 * @param notebookID the internal database ID of a notebook. 205 * @return true iff the notebook with "notebookID" has been removed from the "notebook" table. 206 */ 124 207 boolean deleteNotebook(Number notebookID); 125 208 } -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/PrincipalDao.java
r5661 r6004 32 32 public interface PrincipalDao extends ResourceDao{ 33 33 34 35 /** 36 * 37 * @param internalID the internal database ID of a principal. 38 * @return the {@link Principal} object with the internal database id "internalID". 39 */ 34 40 public Principal getPrincipal(Number internalID); 35 41 42 /** 43 * 44 * @param eMail an e-mail string. 45 * @return the {@link Principal} object with th e-mail "email". 46 * @throws NotInDataBaseException, if such a principal is not found. 47 */ 36 48 public Principal getPrincipalByInfo(String eMail) throws NotInDataBaseException; 37 49 50 /** 51 * 52 * @return the internalID of a principal who is the admin of the data base (the first admin in the list of admins). 53 */ 38 54 public Number getDBAdminID(); 39 55 40 // where is it used? 56 /** 57 * 58 * @param principalID the internal database id of a principal. 59 * @return true iff "principalID" occurs in one of the junction tables. 60 */ 41 61 public boolean principalIsInUse(Number principalID); 42 62 43 // where is it used?? 63 /** 64 * 65 * @param remoteID the string representing the remote id of a principal. 66 * @return true iff a principal with "remoteID" exists in the table "principal". 67 */ 44 68 public boolean principalExists(String remoteID); 45 69 70 /** 71 * 72 * @param internalID the internal database id of a principal. 73 * @return the type of a principal account: admin, developer, user. 74 */ 46 75 public String getTypeOfPrincipalAccount(Number internalID); 47 76 77 /** 78 * 79 * @param internalID the internal database id of a principal. 80 * @return the string representing the remote id of the principal. 81 */ 48 82 public String getRemoteID(Number internalID); 49 83 50 84 85 /** 86 * 87 * @param remoteID the string representing the remote id of a principal. 88 * @return the interna ld database id of the principal with "remotedID". 89 * @throws NotInDataBaseException if there is no principal with "remoteID". 90 */ 51 91 public Number getPrincipalInternalIDFromRemoteID(String remoteID) throws NotInDataBaseException; 52 92 93 /** 94 * 95 * @param remoteID the string representing the remote id of a principal. 96 * @return the external UUID of the principal with "remotedID". 97 * @throws NotInDataBaseException if there is no principal with "remoteID". 98 */ 53 99 public UUID getPrincipalExternalIDFromRemoteID(String remoteID) throws NotInDataBaseException; 54 100 101 /** 102 * 103 * @param fullName the string representing the full name of a principal. 104 * @return the external UUID of the principal with "fullName. 105 * @throws NotInDataBaseException if there is no principal with "fullName". 106 */ 55 107 public UUID getExternalIdFromName(String fullName) throws NotInDataBaseException; 56 108 109 /** 110 * 111 * @param notebookID the internal database id of a notebook. 112 * @param access an {@link Access} object. 113 * @return the list of internal database ids of the principals which have access "access"-value 114 * for the "notebookID". 115 */ 57 116 public List<Number> getPrincipalIDsWithAccessForNotebook(Number notebookID, Access access); 58 117 118 /** 119 * 120 * @param externalID the external UUID of a principal. 121 * @param account a string representing the type of an account: admin, developer, user. 122 * @return true, if the account of "externalId" has been updated to "account". 123 * @throws NotInDataBaseException iff no principal with "externalId" is found. 124 */ 59 125 public boolean updateAccount(UUID externalID, String account) throws NotInDataBaseException; 60 126 127 /** 128 * 129 * @param principal a {@link Principal} object which must update the principal referred by "externakId" given in this object. 130 * @return the internal id of a principal which has been updated. 131 * @throws NotInDataBaseException if principal with the externalId given in the "principal" is not found. 132 */ 61 133 public Number updatePrincipal(Principal principal) throws NotInDataBaseException; 62 134 135 /** 136 * 137 * @param principal a {@link Principal} object to be added to the database. 138 * @param remoteID a string representing the remote of of the principal to be added. 139 * @return the internal id of the just added principal. 140 * @throws NotInDataBaseException if adding the principal fails. 141 */ 63 142 public Number addPrincipal(Principal principal, String remoteID) throws NotInDataBaseException; 64 143 144 /** 145 * 146 * @param username the name of a user for spring basic authentication. 147 * @param password a password of a user for spring authentication. 148 * @param strength the strength of a password. 149 * @param salt 150 * @return a number of added rows in "users" table; must be 1 of the user is added. 151 */ 65 152 public int addSpringUser(String username, String password, int strength, String salt); 66 153 154 /** 155 * 156 * @param username the name of a user for spring basic authentication. 157 * @return the amount of rows added o "authorities" tables; "1" if "username" is added with the default "ROLE_USER"; 0 otherwise. 158 */ 67 159 public int addSpringAuthorities(String username); 68 160 161 /** 162 * 163 * @param intenralID the internal ID of a principal to be deleted, 164 * @return the amount f deleted rows; "1" if deleted, "0" otherwise. 165 * @throws PrincipalCannotBeDeleted if the principal is in use, i.e. mentioned in one of the junction tables. 166 */ 69 167 public int deletePrincipal(Number intenralID) throws PrincipalCannotBeDeleted; 70 168 -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/ResourceDao.java
r5468 r6004 25 25 26 26 /** 27 * 27 * This interfaces describes signatures common for all resources: Annotation, Target, Cached Representation, Principal, Notebook; 28 * the implementation must contain field "resourceTableName" whose value is one of the five names of resource tables: 29 * "annotation", "target", "cached_representation", "principal", "notebook". 28 30 * @author olhsha 29 31 */ 30 32 public interface ResourceDao { 31 33 34 /** 35 * 36 * @param relResourcePath a string, representing "[relative-servise-url]/[resource]", e.g. "my-servlet/annotations". 37 */ 32 38 void setResourcePath(String relResourcePath); 33 39 40 /** 41 * 42 * @param externalId the external UUId of a resource. 43 * @return the internal ID of the resource. 44 * @throws NotInDataBaseException if the resource with this id is not found. 45 */ 34 46 Number getInternalID(UUID externalId) throws NotInDataBaseException; 35 47 48 /** 49 * 50 * @param internalId the internal ID of the resource. 51 * @return the external UUID of the resource. 52 */ 36 53 UUID getExternalID(Number internalId); 37 54 55 /** 56 * 57 * @param oldIdentifier the current external UUId of a resource. 58 * @param newIdentifier the new external ID of the resource. 59 * @return true iff the external id of the resource have been updated to the value of "newIDentifier". 60 */ 38 61 boolean updateResourceIdentifier(UUID oldIdentifier, UUID newIdentifier); 39 62 40 63 /** 41 64 * 42 * @param internalID 43 * @return URI string of the resource )of the type set in resourceTableName) 44 * with internalID 65 * @param internalID the internal databaseID of the resource. 66 * @return the hyper-reference string of the resource with "internalID". 45 67 */ 46 68 String getHrefFromInternalID(Number internalID); 47 69 70 /** 71 * 72 * @param href the hyper-reference of a resource. 73 * @return the internal ID of the resource with "href". 74 * @throws NotInDataBaseException if the resource with ""href" is not found in the corresponding database. 75 */ 48 76 Number getInternalIDFromHref(String href) throws NotInDataBaseException; 49 77 78 /** 79 * 80 * @param resourceID the internal database id of a resource. 81 * @return mapping "principal internal id" -> "access" for a given "resourceID"; 82 * till now makes sense only for annotations and notebooks. 83 */ 50 84 List<Map<Number, String>> getPermissions(Number resourceID); 51 85 86 /** 87 * 88 * @param resourceID the internal database id of a resource. 89 * @return the public access mode for "resourceID"; till now makes sense only for annotations and notebooks. 90 */ 52 91 Access getPublicAttribute(Number resourceID); 53 92 -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/TargetDao.java
r5385 r6004 37 37 /** 38 38 * 39 * @param inernalID 40 * @return the Target with the intrenal Id "internalID".39 * @param inernalID the internal database id of a target. 40 * @return the {@link Target} object with the intrenal Id "internalID". 41 41 */ 42 42 public Target getTarget(Number internalID); … … 44 44 /** 45 45 * 46 * @param targets 47 * @return the list of TargetInfo objects corresponding to the Targets with 48 * the internalIds from the list "Targets". 46 * @param targets the list of internal database ids of targets. 47 * @return the list of {@link TargetInfo} objects corresponding to the targets with the internalIds from the list "targets". 49 48 */ 50 49 public List<TargetInfo> getTargetInfos(List<Number> targets); … … 52 51 /** 53 52 * 54 * @param targetID 55 * @return the list of pairs (cached_representation_id, fragment_descriptor) 56 * for the target with the internal ID "targetID". 53 * @param targetID the internal database id of a target. 54 * @return the list of pairs "cached_representation_id -> fragment_descriptor" for the target with the internal ID "targetID". 57 55 */ 58 56 public Map<Number, String> getCachedRepresentationFragmentPairs(Number targetID); … … 62 60 /** 63 61 * 64 * @param targetID 65 * @return The link (uri) to the source to which the target refers 62 * @param targetID the internal database id of a target. 63 * @return The link (uri) to the source to which the target refers. 66 64 */ 67 65 public String getLink(Number targetID); … … 69 67 /** 70 68 * 71 * @param link 72 * @return the list of Target ID's which link-fields is exactly "link"69 * @param link a string representing a link (uri) to a target source. 70 * @return the list of internal database target ID's whose link-fields is exactly "link". 73 71 */ 74 72 public List<Number> getTargetsForLink(String link); 75 73 74 /** 75 * 76 * @param cachedID the internal database id of a cached representation. 77 * @return true iff "cachedID" is referred to for some target in "targets_cached_representations" table. 78 */ 76 79 boolean cachedIsInUse(Number cachedID); 77 80
Note: See TracChangeset
for help on using the changeset viewer.