Ignore:
Timestamp:
11/30/11 13:18:31 (13 years ago)
Author:
jeafer
Message:

Jean-Charles branch commit2,
Changes regarding comment on the ComponentRegistry service.
Delete_comment from RestService? to Database access (CommentsDao?) implemented.
Post_comment from RestService? to Database access (CommentsDao?) implemented. (Not yet tested)
Comment class updated
TestComment? class updated
DataBase? : Table comment updated, Corrections of fkey references
Validate classes implemented to validate comment

File:
1 moved

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/branches/jeaferversion/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/model/Comment.java

    r1631 r1633  
    55package clarin.cmdi.componentregistry.model;
    66
     7import clarin.cmdi.componentregistry.ComponentRegistry;
     8import clarin.cmdi.componentregistry.IdSequence;
    79import java.text.ParseException;
     10import java.util.ArrayList;
    811import java.util.Date;
     12import java.util.List;
    913import javax.xml.bind.annotation.XmlAccessType;
    1014import javax.xml.bind.annotation.XmlAccessorType;
     15import javax.xml.bind.annotation.XmlElement;
     16import javax.xml.bind.annotation.XmlRootElement;
    1117import org.apache.commons.lang.time.DateFormatUtils;
    1218import org.apache.commons.lang.time.DateUtils;
     
    1622 * @author jeafer
    1723 */
    18 public class CommentMapping {
    19 
    20     @XmlAccessorType(XmlAccessType.FIELD)
    21     public static class Comment {
    22 
     24@XmlRootElement(name = "comment")
     25@XmlAccessorType(XmlAccessType.FIELD)
     26public class Comment {
     27        @XmlElement(name = "Comment_Type")
     28    protected List<Comment> commentType;
    2329        private String comments;
    2430        private String commentDate;
     
    2834        private String id;
    2935
     36       
     37        public List<Comment> getComments() {
     38        if (commentType == null) {
     39            commentType = new ArrayList<Comment>();
     40        }
     41        return this.commentType;
     42    }
     43       
    3044        public void setComment(String comment) {
    3145            this.comments = comment;
     
    4761            this.id = commentId;
    4862        }
    49 
    5063
    5164        public String getId() {
     
    6982        }
    7083
    71         public void setUserID(String userId) {
     84        public void setUserId(String userId) {
    7285            this.userId = userId;
    7386        }
    74 
    7587
    7688        public String getUserId() {
     
    8193            return createNewDate(new Date().getTime());
    8294        }
    83        
    84             public static Date getDate(String registrationDate) throws ParseException {
    85         return DateUtils.parseDate(registrationDate, new String[] { DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern() });
    86     }
     95
     96        public static Date getDate(String registrationDate) throws ParseException {
     97            return DateUtils.parseDate(registrationDate, new String[]{DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern()});
     98        }
    8799
    88100        public static String createNewDate(long time) {
    89101            return DateFormatUtils.formatUTC(time, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern());
    90102        }
     103       
     104            public static Comment createANewComment() {
     105        String id = ComponentRegistry.REGISTRY_ID + "p_" + IdSequence.get();
     106        Comment com = new Comment();
     107        com.setId(id);
     108        com.setCommentDate(createNewDate());
     109        return com;
    91110    }
    92 }
     111    }
Note: See TracChangeset for help on using the changeset viewer.