Ignore:
Timestamp:
12/08/11 12:53:53 (12 years ago)
Author:
jeafer
Message:

Jean-Charles branch ComponentRegistry commit5 (functionnal),
Changes regarding comment on the ComponentRegistry.

Modification of classes CommentsDao?
Response class has been split up. A general class ComponentRegistryResponse?
a abstractDescription response: RegisterResponse?
a comment response : CommentResponse?
Improvement of validation process for comments
Improvement of ComponentRegistryRestService?
New classes test CommentResponseTest? and CommentValidatorTest?

Documentation added to most classes
Clean up code in other classes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/branches/jeaferversion/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/CommentsDao.java

    r1639 r1640  
    6969     */
    7070    public List<Comment> getCommentsFromProfile(String profileId) throws DataAccessException {
    71         return getList(SELECT_BASE + " WHERE profile_description_id = ?", profileId);
     71        return getList((SELECT_BASE + " WHERE profile_description_id = ?").concat(getOrderByDate()), profileId);
    7272    }
    7373
     
    7979     */
    8080    public Comment getSpecifiedCommentFromProfile(String commentId) throws DataAccessException {
    81         //String select = SELECT_BASE + " WHERE " + COLUMN_ID + " = ?";
    8281        return getFirstOrNull(SELECT_BASE + " WHERE " + COLUMN_ID + " = ?", Integer.parseInt(commentId));
    8382    }
     
    9089     */
    9190    public List<Comment> getCommentsFromComponent(String componentId) throws DataAccessException {
    92         return getList(SELECT_BASE + " WHERE component_description_id = ?", componentId);
     91        return getList((SELECT_BASE + " WHERE component_description_id = ?").concat(getOrderByDate()), componentId);
    9392    }
    9493
     
    134133     * @throws DataAccessException
    135134     */
    136     public Number insertComment(Comment comment, String content, Number userId) throws DataAccessException {
     135    public Number insertComment(Comment comment, Number userId) throws DataAccessException {
    137136        TransactionStatus transaction = getTransaction();
    138137        try {
    139             SimpleJdbcInsert insert = new SimpleJdbcInsert(getDataSource()).withTableName(TABLE_COMMENTS).usingGeneratedKeyColumns(
    140                     COLUMN_ID);
    141138            SimpleJdbcInsert insertComment = new SimpleJdbcInsert(getDataSource()).withTableName(getTableName()).usingGeneratedKeyColumns(COLUMN_ID);
    142139            Map<String, Object> params = new HashMap<String, Object>();
     
    241238        return getFirstOrNull(SELECT_BASE + " WHERE comments = ?", aComment);
    242239    }
     240   
     241    /**
     242     * Sort the returned comments per date from the most recent to the oldest
     243     * @return
     244     */
     245        private String getOrderByDate() {
     246        return " order by comment_date asc ";
     247    }
    243248}
Note: See TracChangeset for help on using the changeset viewer.