- Timestamp:
- 08/09/14 20:45:17 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
FCSSimpleEndpoint/trunk/src/main/java/eu/clarin/sru/server/fcs/ResourceInfo.java
r5485 r5546 9 9 * This class implements a resource info record, which provides supplementary 10 10 * information about a resource that is available at the endpoint. 11 * 12 * @see ResourceInfoInventory11 * 12 * @see EndpointDescription 13 13 */ 14 14 public class ResourceInfo { 15 15 private final String pid; 16 @Deprecated17 private final int resourceCount;18 16 private final Map<String, String> title; 19 17 private final Map<String, String> description; 20 18 private final String landingPageURI; 21 19 private final List<String> languages; 22 private List<String> availableDataViews;23 private List<ResourceInfo> subResources;24 20 private final List<DataView> availableDataViews; 21 private final List<ResourceInfo> subResources; 22 25 23 26 24 /** … … 29 27 * @param pid 30 28 * the persistent identifier of the resource 31 * @param resourceCount32 * the number of items within the resource or <code>-1</code> if33 * not applicable34 29 * @param title 35 30 * the title of the resource represented as a map with pairs of … … 45 40 * the languages represented within this resource represented as 46 41 * a list of ISO-632-3 three letter language codes 42 * @param availableDataViews 43 * the list of available data views for this resource 47 44 * @param subResources 48 45 * a list of resource sub-ordinate to this resource or 49 46 * <code>null</code> if not applicable 50 47 */ 51 public ResourceInfo(String pid, int resourceCount,52 Map<String, String> title, Map<String, String> description,53 String landingPageURI, List<String> languages,48 public ResourceInfo(String pid, Map<String, String> title, 49 Map<String, String> description, String landingPageURI, 50 List<String> languages, List<DataView> availableDataViews, 54 51 List<ResourceInfo> subResources) { 55 52 if (pid == null) { 56 throw new NullPointerException(" id == null");53 throw new NullPointerException("pid == null"); 57 54 } 58 55 this.pid = pid; 59 this.resourceCount = (resourceCount > 0) ? resourceCount : -1; 56 60 57 if (title == null) { 61 58 throw new NullPointerException("title == null"); … … 70 67 this.description = null; 71 68 } 69 72 70 this.landingPageURI = landingPageURI; 73 71 if (languages == null) { … … 78 76 } 79 77 this.languages = languages; 80 78 79 if (availableDataViews == null) { 80 throw new IllegalArgumentException("availableDataViews == null"); 81 } 82 this.availableDataViews = 83 Collections.unmodifiableList(availableDataViews); 84 81 85 if ((subResources != null) && !subResources.isEmpty()) { 82 86 this.subResources = Collections.unmodifiableList(subResources); 83 87 } else { 84 88 this.subResources = null; 85 } 89 } 86 90 } 87 91 88 public ResourceInfo(String pid, int resourceCount,89 Map<String, String> title, Map<String, String> description,90 String landingPageURI, List<String> languages,91 List<String> availableDataViews,92 List<ResourceInfo> subResources) {93 this(pid,resourceCount, title, description, landingPageURI, languages, subResources);94 95 if (availableDataViews == null){96 throw new IllegalArgumentException("available data views == null");97 }98 if (availableDataViews.isEmpty()){99 throw new IllegalArgumentException("available data views are empty");100 }101 this.availableDataViews = availableDataViews;102 }103 104 92 105 93 /** … … 110 98 public String getPid() { 111 99 return pid; 112 }113 114 115 /**116 * Get the number of resources within this resource. If this resource has117 * sub-ordinate resources, this number should be the sum of all items within118 * the sub-ordinate resources plus the number of items within this resource.119 *120 * @return a number of items or <code>-1</code> if not applicable121 */122 @Deprecated123 public int getResourceCount() {124 return resourceCount;125 100 } 126 101 … … 217 192 218 193 219 public List< String> getAvailableDataViews() {194 public List<DataView> getAvailableDataViews() { 220 195 return availableDataViews; 221 196 } 222 197 223 224 198 } // class ResourceInfo
Note: See TracChangeset
for help on using the changeset viewer.