Changeset 1640 for ComponentRegistry/branches/jeaferversion/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/CommentsDao.java
- Timestamp:
- 12/08/11 12:53:53 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/branches/jeaferversion/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/CommentsDao.java
r1639 r1640 69 69 */ 70 70 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); 72 72 } 73 73 … … 79 79 */ 80 80 public Comment getSpecifiedCommentFromProfile(String commentId) throws DataAccessException { 81 //String select = SELECT_BASE + " WHERE " + COLUMN_ID + " = ?";82 81 return getFirstOrNull(SELECT_BASE + " WHERE " + COLUMN_ID + " = ?", Integer.parseInt(commentId)); 83 82 } … … 90 89 */ 91 90 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); 93 92 } 94 93 … … 134 133 * @throws DataAccessException 135 134 */ 136 public Number insertComment(Comment comment, String content,Number userId) throws DataAccessException {135 public Number insertComment(Comment comment, Number userId) throws DataAccessException { 137 136 TransactionStatus transaction = getTransaction(); 138 137 try { 139 SimpleJdbcInsert insert = new SimpleJdbcInsert(getDataSource()).withTableName(TABLE_COMMENTS).usingGeneratedKeyColumns(140 COLUMN_ID);141 138 SimpleJdbcInsert insertComment = new SimpleJdbcInsert(getDataSource()).withTableName(getTableName()).usingGeneratedKeyColumns(COLUMN_ID); 142 139 Map<String, Object> params = new HashMap<String, Object>(); … … 241 238 return getFirstOrNull(SELECT_BASE + " WHERE comments = ?", aComment); 242 239 } 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 } 243 248 }
Note: See TracChangeset
for help on using the changeset viewer.