Changeset 3475


Ignore:
Timestamp:
08/25/13 21:05:37 (11 years ago)
Author:
olhsha
Message:

making javadoc comments for signatures in all dao-s (except dispatcher)

Location:
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/AnnotationDao.java

    r3465 r3475  
    3333 */
    3434
    35 // TODO: Getting Target Sources from Body and testing must be added!!!
    36 
    3735
    3836public interface AnnotationDao extends ResourceDao{
     
    4442     *
    4543     * @param annotationID
    46      * @return the Annotation object with empty list of sources
    47      * constructing a complete Annotation object from the result and "retrieveSourceIDs" is done in "DaoDispatchter"
     44     * @return the Annotation object with empty list of sources.
     45     *
     46     * (Constructing a complete Annotation object using  "getAnnotationWithoutSources" and "retrieveSourceIDs" is done in "DaoDispatchter"
    4847     *
    4948     */
     
    5352     /**
    5453     *
    55      * @param annotationIDs optional
    56      * @param text optional
    57      * @param access optional
    58      * @param namespace optional TODO: do not know what to do with it
    59      * @param ownerID optional
    60      * @param after optional
    61      * @param before optional
     54     * @param annotationIDs: the list of annotationID-s from which the resulting annotations are to be selected.
     55     * @param text: the text which the resulting annotations' bodies must contain.
     56     * @param access: the resulting annotations must have permission "access" (owner, or writer, or reader) for the currently inlogged user.
     57     * @param namespace TODO: do not know what to do with it
     58     * @param ownerID: the resulting annotations are owned by the owner "ownerID".
     59     * @param after: the resulting annotations must have timestamp later than "after".
     60     * @param before: the resulting annotations must have timestamp earlier than "before".
    6261     * @return the sub-list of internal annotation identifiers from the list "internalIDs" for annotations
    6362     * -- bodies of which contain the "text",
     
    6665     * -- added to the database between "before" and "after" time-dates.
    6766     *
    68      *
    69      * The first step for GET api/annotations?<filters>
    7067     */
    7168    public List<Number> getFilteredAnnotationIDs(List<Number> annotationIDs, String text, String access, String namespace, Number ownerID, Timestamp after, Timestamp before);
     
    7471     *
    7572     * @param annotationIDs
    76      * @return the list of annotationInfos (owner, headline, target sources, external_id) for the internal Ids from the  input list
    77      * used on the second step for GET api/annotations?<filters>
     73     * @return the list of annotationInfos (owner, headline, target sources, external_id) for the annotations with the internal IDs from the  input list.
     74     *
    7875     */
    7976    public List<AnnotationInfo> getAnnotationInfos(List<Number> annotationIDs);   
     
    8380     *
    8481     * @param annotationIDs
    85      * @return list of resource references where an i-th reference is constructed from
     82     * @return list of resource references where an i-th reference is constructed from the external identifier of the annotation with the i-th internal identifier from the list.
    8683     */
    8784    public List<ResourceREF> getAnnotationREFs(List<Number> annotationIDs);
     
    9087     *
    9188     * @param sourceIDs
    92      * @return the list of annotationdIDs of the annotations that are having target sources from "sourceIDs" list
     89     * @return the list of annotationdIDs of the annotations which target sources are from "sourceIDs" list.
    9390     */
    9491    public List<Number> retrieveAnnotationList(List<Number> sourceIDs);
     
    9895     *
    9996     * @param annotationID
    100      * @return the list of the source's internal IDs of all the target sources of annotationID
     97     * @return the list of the internal IDs of all the target sources of "annotationID".
    10198     */
    10299    public List<Number> retrieveSourceIDs(Number annotationID);   
     
    106103     *
    107104     * @param annotationId
    108      * @return retrieves all the pairs (user-permission) for "annotationId" from the table annotations_principals permissions
     105     * @return all the pairs (user-permission) for "annotationId" from the table annotations_principals permissions.
    109106     */
    110107    public List<Map<Number, String>>  retrievePermissions(Number annotationId);
    111108   
    112109   
     110    /**
     111     *
     112     * @param sourceID
     113     * @return true if "annotationID" is mentioned in at least one of the joint tables:
     114     * "annotations_target_sources", "annotations_principals_permissions", "notebook_annotations".
     115     * Otherwise return "false".
     116     */
     117    public boolean annotationIsInUse(Number annotationID);
    113118   
    114119    ///////////// ADDERS /////////////////////
    115120   
    116      public int addAnnotationSourcePair(Number annotationID, Number sourceID) throws SQLException;
     121    /**
     122     *
     123     * @param annotationID
     124     * @param sourceID
     125     * @return # updated rows in the joint table "annotations_target_sources".
     126     * @throws SQLException
     127     * Connects the annotation to its target source by adding the pair (annotationID, sourceID) to the joint table.
     128     */
     129    public int addAnnotationSourcePair(Number annotationID, Number sourceID) throws SQLException;
    117130   
    118131   
     
    122135     * @param userID
    123136     * @param permission
    124      * @return the amount of rows added to the table annotations_principals_permissions
     137     * @return # rows added to the table "annotations_principals_permissions"
     138     * Sets the "permission" for the "userID" w.r.t. the annotation with "annotationID".
    125139     */
    126140    public int addAnnotationPrincipalPermission(Number annotationID, Number userID, Permission permission) throws SQLException;
     
    130144     /**
    131145     *
    132      * @param annotation added to the table with annotations
    133      * @return  internal Id of the added annotation
     146     * @param annotation: the object to be added to the table "annotation".
     147     * @return  the internal ID of the added annotation, if it is added, or null otherwise.
    134148     **/
    135149   
     
    138152     
    139153    /////// UPDATERS //////////////////
    140    
     154    /**
     155     *
     156     * @param annotationID
     157     * @param serializedNewBody
     158     * @return # of updated rows in "annotation" table after updating the annotation's body with "serializedNewBody". Should return 1.
     159     */
    141160    public int updateBody(Number annotationID, String serializedNewBody);
    142161   
     
    147166     *
    148167     * @param annotationId
    149      * @return removed annotation rows (should be 1)
     168     * @return # rows in the table "annotation". It should be "1" if the annotation with "annotationID" is successfully deleted, and "0" otherwise.
    150169     */
    151170   
     
    157176     *
    158177     * @param annotationId
    159      * @return # removed annotation_source rows for given annotationID
     178     * @return # removed rows in the table "annotations_target_sources".
    160179     */
    161180   
    162     public int deleteAllAnnotationSource(Number annotationId) throws SQLException;
     181    public int deleteAllAnnotationSource(Number annotationID) throws SQLException;
    163182   
    164183   
    165    
     184   /**
     185    *
     186    * @param annotationID
     187    * @return # removed rows in the table "annotations_principals_permissions".
     188    * @throws SQLException
     189    */
    166190    public int deleteAnnotationPrincipalPermissions(Number annotationID) throws SQLException ;
    167191
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/CachedRepresentationDao.java

    r3465 r3475  
    3232     *
    3333     * @param internalID
    34      * @return the object "cCachedRepresentationInfo"  with the internal id "internalID"
     34     * @return the object of the class "CachedRepresentationInfo"  with the internal id "internalID".
    3535     */
    3636    public CachedRepresentationInfo getCachedRepresentationInfo(Number internalID);
     
    4040     *
    4141     * @param cached
    42      * @return the internal Id of the just added "cached"
     42     * @return the internal ID of the just added "cached", or null if the cached representation is not added for some reason.
    4343     */
    4444    public Number addCachedRepresentationInfo(CachedRepresentationInfo cached);
     
    4848     *
    4949     * @param internalID
    50      * @return  # deleted rows on the table "cached_representation"
     50     * @return  # deleted rows on the table "cached_representation".
    5151     */
    5252    public  int deleteCachedRepresentationInfo(Number internalID);
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/NotebookDao.java

    r3465 r3475  
    3131 * @author Peter Withers <peter.withers@mpi.nl>
    3232 */
     33
     34// TODO: not yet fully updated.
     35
    3336public interface NotebookDao extends ResourceDao {
    3437
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/ResourceDao.java

    r3461 r3475  
    2828   
    2929    public void setServiceURI(String serviceURI);
     30   
    3031     /**
    3132     *
    3233     * @param externalID
    33      * @return internal identifier of the resource with externalID
     34     * @return internal identifier of the resource with externalID, or null if there is no resource with this identifier
    3435     */
    3536    public Number getInternalID(UUID externalId);
    3637   
     38    /**
     39     *
     40     * @param internalId
     41     * @return the UUID (external ID) of the resource with the "internalID".
     42     */
    3743    public UUID getExternalID(Number internalId);
    3844}
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/SourceDao.java

    r3465 r3475  
    3737     *
    3838     * @param inernalID
    39      * @return the object containing the source with the intrenal Id "internalId"
     39     * @return the source with the intrenal Id "internalID".
    4040     */
    4141    public Source getSource(Number internalID);
    4242   
    43    
     43    /**
     44     *
     45     * @param sources
     46     * @return the list of SoirceInfo objects corresponding to the sources with the internalIds from the list "sources".
     47     */
    4448    public List<SourceInfo> getSourceInfos(List<Number> sources);
    4549     
     
    4751     *
    4852     * @param sourceID
    49      * @return the list of the internal version id-s for the  target source with the internal Id "sourceID"
     53     * @return the list of the internal version ID-s ("siblings") for the target source with the internal ID "sourceID".
    5054     */
    5155    public List<Number> retrieveVersionList(Number sourceID);
     
    5559     *
    5660     * @param link
    57      * @return the list source ID's which link-fields contain "link" as a substring
     61     * @return the list of source ID's which link-fields contain "link" as a substring.
    5862     */
    5963    public List<Number> getSourcesForLink(String link);
    6064 
    6165   
     66    /**
     67     *
     68     * @param sourceID
     69     * @return true if "sourceID" occurs in at least one of the joint tables "annotations_target_sources" and "sources_versions".
     70     */
    6271    public boolean sourceIsInUse(Number sourceID);
    6372 
     
    6877     /**
    6978     *
    70      * @param source
    71      * @param versionID
    72      * adds freshSource to the DB and assigns the fresh external Identifier to it
    73      * @return the internal ID of the just added source
    74      * return -1 id the source cannot be added because its version is not in the DB
     79     * @param source: the Source-object of the source to be added to "source" table.
     80     * @return the internal ID of the just added source or null if it has not been added.
    7581     */
    7682    public Number addSource(Source source) throws SQLException;   
    7783   
     84    /**
     85     *
     86     * @param sourceID
     87     * @param versionID
     88     * @return # added rows to the table "annotations_target_sources". Should be "1" if the pair (sourceID, versionID) has been added.
     89     * @throws SQLException
     90     */
    7891    public int addSourceVersion(Number sourceID, Number versionID) throws SQLException;
    7992   
     
    8699     *
    87100     * @param internalId
    88      * @return # deleted rows in "source" table
     101     * @return # deleted rows in "source" table. Should be "1" if the source has been deleted.
    89102     */
    90103    public int deleteSource(Number internalID);
    91104   
    92105   
    93    
     106    /**
     107     *
     108     * @param sourceID
     109     * @return # deleted rows in the table "sources_versions" when deleting all the pairs of the form (sourceID, *).
     110     * @throws SQLException
     111     */
    94112    public int deleteAllSourceVersion(Number sourceID) throws SQLException; 
    95113   
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/VersionDao.java

    r3465 r3475  
    3434     *
    3535     * @param internalID
    36      * @return the instance of Version.class  with the internal Id equal to "internalID"
     36     * @return the Version-object build from the version  with the "internalID".
    3737     *
    3838     */
     
    4343     *
    4444     * @param versionID
    45      * @return The list of the cached representation internal id-s of all the cached representations of the version with "versionID"
     45     * @return The list of the cached-representation internal ID-s of all the cached representations of the version with "versionID".
    4646     */
    4747    public List<Number> retrieveCachedRepresentationList(Number versionID);
    4848   
    4949     
    50     // Not tested
    51     public boolean versionIsInUse(Number versionsID);
     50    /**
     51     *
     52     * @param versionsID
     53     * @return true if "versionID" occurs in the table "versions_cached_representations".
     54     */
     55    public boolean versionIsInUse(Number versionID);
    5256   
    5357   
     
    5660     **/
    5761   
    58    
     62    /**
     63     *
     64     * @param versionID
     65     * @param cachedID
     66     * @return # rows added to the table "versions_cached_representations", when adding the pair (versionID, sourceID). Should be 1, if it has been added.
     67     */
    5968    public int addVersionCachedRepresentation(Number versionID, Number cachedID);
    6069   
     
    6372     *
    6473     * @param version
    65      * @return the internal Id of the just added version
     74     * @return the internal Id of the just added "version", or null if it has not been added.
    6675     *
    6776     */
     
    7685     
    7786    /** @param versionID
    78      * @return deleted rows in "version" table
     87     * @return # deleted rows in "version" table after deleting the version with "versionID". Should be "1" if the version has been deleted.
    7988     */
    8089   
    8190    public int deleteVersion(Number versionID);
    8291   
    83    
     92    /**
     93     *
     94     * @param versionID
     95     * @param cachedID
     96     * @return # deleted rows in the table "versions_cached_representations" after deleting the pair (versionID, cachedID).
     97     */
    8498    public int deleteVersionCachedRepresentation(Number versionID, Number cachedID);
    8599   
    86100   
    87    
     101    /**
     102     *
     103     * @param versionID
     104     * @return # deleted rows in the table "versions_cached_representations" after deleting all the pairs of the form (versionID, *).
     105     */
    88106    public int deleteAllVersionCachedRepresentation(Number versionID);
    89107   
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/impl/JdbcAnnotationDao.java

    r3463 r3475  
    219219   
    220220   /////////////////////////////
    221    
    222     private boolean annotationIsInUse(Number sourceID) {
     221    @Override
     222    public boolean annotationIsInUse(Number annotationID) {
    223223        StringBuilder sqlNotebooks = new StringBuilder("SELECT ");
    224224        sqlNotebooks.append(notebook_id).append(" FROM ").append(notebooksAnnotationsTableName).append(" WHERE ").append(annotation_id).append("= ? LIMIT 1");
    225         List<Number> resultNotebooks = getSimpleJdbcTemplate().query(sqlNotebooks.toString(), notebookIDRowMapper, sourceID);
     225        List<Number> resultNotebooks = getSimpleJdbcTemplate().query(sqlNotebooks.toString(), notebookIDRowMapper, annotationID);
    226226        if (resultNotebooks.size() > 0) {
    227227            return true;
     
    230230        StringBuilder sqlSources = new StringBuilder("SELECT ");
    231231        sqlSources.append(source_id).append(" FROM ").append(annotationsSourcesTableName).append(" WHERE ").append(annotation_id).append("= ? LIMIT 1");
    232         List<Number> resultSources = getSimpleJdbcTemplate().query(sqlSources.toString(), sourceIDRowMapper, sourceID);
     232        List<Number> resultSources = getSimpleJdbcTemplate().query(sqlSources.toString(), sourceIDRowMapper, annotationID);
    233233        if (resultSources.size() > 0) {
    234234            return true;
     
    237237        StringBuilder sqlPermissions = new StringBuilder("SELECT ");
    238238        sqlPermissions.append(principal_id).append(" FROM ").append(permissionsTableName).append(" WHERE ").append(annotation_id).append("= ? LIMIT 1");
    239         List<Number> resultPermissions = getSimpleJdbcTemplate().query(sqlPermissions.toString(), principalIDRowMapper, sourceID);
     239        List<Number> resultPermissions = getSimpleJdbcTemplate().query(sqlPermissions.toString(), principalIDRowMapper, annotationID);
    240240        return (resultPermissions.size() > 0);
    241241    }
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/impl/JdbcNotebookDao.java

    r3463 r3475  
    4747 * @author Peter Withers <peter.withers@mpi.nl>
    4848 */
     49
     50// TODO: not updated fully yet.
     51
    4952public class JdbcNotebookDao extends JdbcResourceDao implements NotebookDao {
    5053
Note: See TracChangeset for help on using the changeset viewer.