Changeset 1633 for ComponentRegistry/branches/jeaferversion/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/model/Comment.java
- Timestamp:
- 11/30/11 13:18:31 (13 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/branches/jeaferversion/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/model/Comment.java
r1631 r1633 5 5 package clarin.cmdi.componentregistry.model; 6 6 7 import clarin.cmdi.componentregistry.ComponentRegistry; 8 import clarin.cmdi.componentregistry.IdSequence; 7 9 import java.text.ParseException; 10 import java.util.ArrayList; 8 11 import java.util.Date; 12 import java.util.List; 9 13 import javax.xml.bind.annotation.XmlAccessType; 10 14 import javax.xml.bind.annotation.XmlAccessorType; 15 import javax.xml.bind.annotation.XmlElement; 16 import javax.xml.bind.annotation.XmlRootElement; 11 17 import org.apache.commons.lang.time.DateFormatUtils; 12 18 import org.apache.commons.lang.time.DateUtils; … … 16 22 * @author jeafer 17 23 */ 18 public class CommentMapping { 19 20 @XmlAccessorType(XmlAccessType.FIELD) 21 public static class Comment {22 24 @XmlRootElement(name = "comment") 25 @XmlAccessorType(XmlAccessType.FIELD) 26 public class Comment { 27 @XmlElement(name = "Comment_Type") 28 protected List<Comment> commentType; 23 29 private String comments; 24 30 private String commentDate; … … 28 34 private String id; 29 35 36 37 public List<Comment> getComments() { 38 if (commentType == null) { 39 commentType = new ArrayList<Comment>(); 40 } 41 return this.commentType; 42 } 43 30 44 public void setComment(String comment) { 31 45 this.comments = comment; … … 47 61 this.id = commentId; 48 62 } 49 50 63 51 64 public String getId() { … … 69 82 } 70 83 71 public void setUserI D(String userId) {84 public void setUserId(String userId) { 72 85 this.userId = userId; 73 86 } 74 75 87 76 88 public String getUserId() { … … 81 93 return createNewDate(new Date().getTime()); 82 94 } 83 84 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 } 87 99 88 100 public static String createNewDate(long time) { 89 101 return DateFormatUtils.formatUTC(time, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern()); 90 102 } 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; 91 110 } 92 }111 }
Note: See TracChangeset
for help on using the changeset viewer.