Changeset 1639 for ComponentRegistry/branches/jeaferversion/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/model/Comment.java
- Timestamp:
- 12/07/11 10:24:43 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/branches/jeaferversion/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/model/Comment.java
r1635 r1639 1 /*2 * To change this template, choose Tools | Templates3 * and open the template in the editor.4 */5 1 package clarin.cmdi.componentregistry.model; 6 2 … … 8 4 import clarin.cmdi.componentregistry.IdSequence; 9 5 import java.text.ParseException; 10 import java.util.ArrayList;11 6 import java.util.Date; 12 import java.util.List;13 7 import javax.xml.bind.annotation.XmlAccessType; 14 8 import javax.xml.bind.annotation.XmlAccessorType; 15 import javax.xml.bind.annotation.XmlElement;16 9 import javax.xml.bind.annotation.XmlRootElement; 17 10 import org.apache.commons.lang.time.DateFormatUtils; … … 20 13 /** 21 14 * 22 * @author jea fer15 * @author jean-charles FerriÚres <jean-charles.ferrieres@mpi.nl> 23 16 */ 24 17 @XmlRootElement(name = "comment") 25 18 @XmlAccessorType(XmlAccessType.FIELD) 26 19 public class Comment { 27 @XmlElement(name = "Comment_Type")28 protected List<Comment> commentType;29 private String comments;30 private String commentDate;31 private String componentDescriptionId;32 private String profileDescriptionId;33 private String userId;34 private String id;35 20 36 37 public List<Comment> getComments() { 38 if (commentType == null) { 39 commentType = new ArrayList<Comment>(); 40 } 41 return this.commentType; 21 private String comments; 22 private String commentDate; 23 private String componentDescriptionId; 24 private String profileDescriptionId; 25 private String userId; 26 private String id; 27 28 public void setComment(String comment) { 29 this.comments = comment; 42 30 } 43 44 public void setComment(String comment) {45 this.comments = comment;46 }47 31 48 49 50 32 public String getComment() { 33 return comments; 34 } 51 35 52 53 54 36 public void setCommentDate(String commentDate) { 37 this.commentDate = commentDate; 38 } 55 39 56 57 58 40 public String getCommentDate() { 41 return commentDate; 42 } 59 43 60 61 62 44 public void setId(String commentId) { 45 this.id = commentId; 46 } 63 47 64 65 66 48 public String getId() { 49 return id; 50 } 67 51 68 69 70 52 public String getComponentDescriptionId() { 53 return componentDescriptionId; 54 } 71 55 72 73 74 56 public void setComponentDescriptionId(String ComponentDescriptionId) { 57 this.componentDescriptionId = ComponentDescriptionId; 58 } 75 59 76 77 78 60 public void setProfileDescriptionId(String profileDescriptionId) { 61 this.profileDescriptionId = profileDescriptionId; 62 } 79 63 80 81 82 64 public String getProfileDescriptionId() { 65 return profileDescriptionId; 66 } 83 67 84 85 86 68 public void setUserId(String userId) { 69 this.userId = userId; 70 } 87 71 88 89 90 72 public String getUserId() { 73 return userId; 74 } 91 75 92 public static String createNewDate(){93 return createNewDate(new Date().getTime());94 76 public static Date getDate(String registrationDate) throws ParseException { 77 return DateUtils.parseDate(registrationDate, new String[]{DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern()}); 78 } 95 79 96 public static Date getDate(String registrationDate) throws ParseException { 97 return DateUtils.parseDate(registrationDate, new String[]{DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern()}); 98 } 80 /* 81 * Helper method to set the Date 82 */ 83 public static String createNewDate() { 84 return createNewDate(new Date().getTime()); 85 } 86 87 /* 88 * Helper method to set the Date in the same format 89 * @param time, long that contains the time to be set 90 */ 99 91 100 public static String createNewDate(long time) { 101 return DateFormatUtils.formatUTC(time, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern()); 102 } 103 104 public static Comment createANewComment() { 105 String descriptionId = ComponentRegistry.REGISTRY_ID+ "p_" + IdSequence.get(); 106 Comment com = new Comment(); 107 com.setComment("Actual"); 108 com.setProfileDescriptionId(descriptionId); 109 com.setCommentDate(createNewDate()); 110 return com; 92 public static String createNewDate(long time) { 93 return DateFormatUtils.formatUTC(time, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern()); 111 94 } 95 96 public static Comment createANewComment() { 97 String Id = ComponentRegistry.REGISTRY_ID + IdSequence.get(); 98 Comment com = new Comment(); 99 com.setId(Id); 100 com.setCommentDate(createNewDate()); 101 return com; 112 102 } 103 }
Note: See TracChangeset
for help on using the changeset viewer.