Changeset 2259
- Timestamp:
- 09/27/12 16:38:55 (12 years ago)
- Location:
- ComponentRegistry/branches/ComponentRegistry-1.13.0-olha/ComponentRegistry/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/branches/ComponentRegistry-1.13.0-olha/ComponentRegistry/src/main/binding/rss/rss-2_0.xsd
r2252 r2259 76 76 </xs:annotation> 77 77 </xs:element> 78 <xs:element name="description" type="xs:string" minOccurs="0">79 <xs:annotation>80 <xs:documentation>The item synopsis.</xs:documentation>81 </xs:annotation>82 </xs:element>83 78 <xs:element name="link" type="xs:anyURI" minOccurs="0"> 84 79 </xs:element> 80 <xs:element name="description" type="xs:string" minOccurs="0"> 81 <xs:annotation> 82 <xs:documentation>The item synopsis.</xs:documentation> 83 </xs:annotation> 84 </xs:element> 85 85 <xs:element name="category" type="Category" minOccurs="0"> 86 86 <xs:annotation> … … 123 123 </xs:annotation> 124 124 </xs:element> 125 125 126 <xs:element name="link" type="xs:anyURI"> 126 127 <xs:annotation> … … 128 129 </xs:annotation> 129 130 </xs:element> 131 130 132 <xs:element name="description" type="xs:string"> 131 133 <xs:annotation> … … 133 135 </xs:annotation> 134 136 </xs:element> 137 135 138 <xs:element name="language" type="xs:language" minOccurs="0"> 136 139 <xs:annotation> -
ComponentRegistry/branches/ComponentRegistry-1.13.0-olha/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/RssCreator.java
r2256 r2259 81 81 } 82 82 83 public String getTitle(){ 84 return this.title; 85 } 86 83 87 /** 84 88 * Sets the value of the link property. … … 91 95 } 92 96 97 public String getLink(){ 98 return this.link; 99 } 100 93 101 /** 94 102 * Sets the value of the description property. -
ComponentRegistry/branches/ComponentRegistry-1.13.0-olha/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/model/AbstractDescription.java
r2221 r2259 5 5 import java.util.Comparator; 6 6 import java.util.Date; 7 import javax.xml.bind.DatatypeConverter; 7 8 8 9 import javax.xml.bind.annotation.XmlAccessType; … … 186 187 //compare two components by the date of registration 187 188 // the dates, which are strings accrording to ISO 8601, compared lexicographically 188 189 @Override 189 190 public int compare(AbstractDescription o1, AbstractDescription o2) { 190 191 191 192 int result = 0; 192 193 DateFormat df = DateFormat.getDateTimeInstance(); 194 195 try{ 196 Date d1 = df.parse(o1.getRegistrationDate()); 197 Date d2 = df.parse(o2.getRegistrationDate()); 198 199 result = d1.compareTo(d2); 200 201 } catch (ParseException pe) {return 0;}; 202 203 193 194 Date d1 = DatatypeConverter.parseDateTime(o1.getRegistrationDate()).getTime(); 195 Date d2 = DatatypeConverter.parseDateTime(o2.getRegistrationDate()).getTime(); 196 197 result = d2.compareTo(d1); 204 198 205 199 return result; -
ComponentRegistry/branches/ComponentRegistry-1.13.0-olha/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/model/Comment.java
r2229 r2259 1 1 package clarin.cmdi.componentregistry.model; 2 2 3 import java.text.DateFormat; 3 4 import java.text.ParseException; 5 import java.util.Comparator; 4 6 import java.util.Date; 7 import javax.xml.bind.DatatypeConverter; 5 8 import javax.xml.bind.annotation.XmlAccessType; 6 9 import javax.xml.bind.annotation.XmlAccessorType; … … 132 135 return com; 133 136 } 137 138 139 public static final Comparator<Comment> COMPARE_ON_DATE = new Comparator<Comment>() { 140 141 //compare two commments by the date of registration 142 // the dates, which are strings accrording to ISO 8601, compared lexicographically 143 @Override 144 public int compare(Comment o1, Comment o2) { 145 146 int result = 0; 147 148 Date d1 = DatatypeConverter.parseDateTime(o1.getCommentDate()).getTime(); 149 Date d2 = DatatypeConverter.parseDateTime(o2.getCommentDate()).getTime(); 150 151 result = d2.compareTo(d1); 152 153 return result; 154 } 155 }; 134 156 } -
ComponentRegistry/branches/ComponentRegistry-1.13.0-olha/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestService.java
r2257 r2259 1043 1043 // ?? this is for debugging. But, anyway, how to get all the profiles without the need to type them in? 1044 1044 // what if a user do not remember his/her id of profile? 1045 / *grabbing all registered profile names from the register and outputting them on the tomcat terminal */1046 List<ProfileDescription> lprfaux = getRegisteredProfiles(userspace, true);1045 // grabbing all registered profile names from the register and outputting them on the tomcat terminal */ 1046 /*List<ProfileDescription> lprfaux = getRegisteredProfiles(userspace, true); 1047 1047 1048 1048 for (ProfileDescription currentProfile : lprfaux) { … … 1050 1050 LOG.debug(currentProfileId); 1051 1051 } 1052 /* end of grabbing*/1053 1054 1055 // TODO: add sorting ! 1052 */ 1053 // end of grabbing */ 1054 1055 1056 1056 1057 1057 final Principal principal = security.getUserPrincipal(); … … 1059 1059 1060 1060 String baseUri = getApplicationBaseURI()+"/"; 1061 LOG.debug("Basis uri "+baseUri);1062 1061 1063 1062 … … 1066 1065 if (comments.size()<limitInt) {limitInt = comments.size();}; 1067 1066 List<Comment> sublist = comments.subList(0, limitInt); 1068 1069 1067 Collections.sort(sublist, Comment.COMPARE_ON_DATE); 1068 1069 for (Comment comm: sublist){ 1070 LOG.debug(comm.getCommentDate()); 1071 } 1070 1072 1071 1073 RssCreatorComments instance = new RssCreatorComments(baseUri); 1072 1074 instance.setFlagIsFromProfile(true); 1073 1075 instance.setDescription("Update of comments for current profile"); 1074 instance.setTitle("Comments feed for the profile \""+ 1076 1077 String hrefPostfix = "&view=comments"; 1078 String hrefInfix = "?item="; 1079 instance.setLink(baseUri+hrefInfix+profileId+hrefPostfix); 1080 1081 String title="Comments feed for the profile \""+ 1075 1082 getRegistry(getStatus(userspace)).getProfileDescription(profileId).getName()+ 1076 "\" "); 1077 instance.setLink(baseUri+"profiles/rss"); 1083 "\" "; 1084 instance.setTitle(title); 1085 1078 1086 1079 1087 Rss result = instance.makeRss(sublist); 1080 1081 1082 1088 1083 1089 // testing stuff -
ComponentRegistry/branches/ComponentRegistry-1.13.0-olha/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/RssCreatorCommentsTest.java
r2256 r2259 124 124 System.out.println(resitems.get(i).getPubDate()); 125 125 System.out.println(resitems.get(i).getDescription()); 126 System.out.println(resitems.get(i).getLink()); 126 127 System.out.println(resitems.get(i).getGuid().getValue()); 127 128 System.out.println(" ");
Note: See TracChangeset
for help on using the changeset viewer.