annotate flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultCollection.java @ 840:18fc7afe0251

Ensure list of recommendations is non-null after construction of DefaultCollection. flys-client/trunk@2560 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 24 Aug 2011 13:17:22 +0000
parents e9337488bac3
children ec5c75da5c7a
rev   line source
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.shared.model;
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
17
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
3 import java.util.ArrayList;
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import java.util.Date;
67
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
5 import java.util.HashMap;
17
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
6 import java.util.List;
67
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
7 import java.util.Map;
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 /**
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 * The default implementation of a {@link Collection}.
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 *
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 */
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 public class DefaultCollection implements Collection {
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 /** The uuid of the collection. */
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 protected String uuid;
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19
95
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
20 /** The name of the collection.*/
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
21 protected String name;
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
22
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
23 /** The creation time of this collection.*/
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
24 protected Date creation;
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
25
587
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
26 /** The time to live of the collection. If this value is 0, it will never
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
27 * die.*/
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
28 protected long ttl;
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
29
17
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
30 /** The list of artifacts that are managed by this Collection.*/
67
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
31 protected List<CollectionItem> items;
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
32
809
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
33 protected List<Recommendation> recommendations;
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
34
524
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 95
diff changeset
35 protected Map<String, ThemeList> themeLists;
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 95
diff changeset
36
67
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
37
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
38 /**
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
39 * Constructor without arguments is necessary for GWT.
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
40 */
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
41 public DefaultCollection() {
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
42 }
17
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
43
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44
587
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
45 public DefaultCollection(String uuid, long ttl) {
524
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 95
diff changeset
46 this.uuid = uuid;
587
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
47 this.ttl = ttl;
524
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 95
diff changeset
48 this.items = new ArrayList<CollectionItem>();
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 95
diff changeset
49 this.themeLists = new HashMap<String, ThemeList>();
840
18fc7afe0251 Ensure list of recommendations is non-null after construction of DefaultCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 809
diff changeset
50 this.recommendations = new ArrayList<Recommendation>();
524
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 95
diff changeset
51 }
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 95
diff changeset
52
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 95
diff changeset
53
809
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
54 /**
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
55 * Creates a new DefaultCollection with a UUID.
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
56 *
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
57 * @param uuid The UUID.
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
58 */
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
59 public DefaultCollection(String uuid, long ttl, List<Recommendation> recs) {
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
60 this(uuid, ttl);
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
61
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
62 this.recommendations = recs;
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
63 }
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
64
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
65
587
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
66 public DefaultCollection(
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
67 String uuid,
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
68 long ttl,
809
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
69 List<Recommendation> recommendations,
587
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
70 Map<String, ThemeList> themeLists)
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
71 {
840
18fc7afe0251 Ensure list of recommendations is non-null after construction of DefaultCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 809
diff changeset
72 this(uuid, ttl, recommendations);
18fc7afe0251 Ensure list of recommendations is non-null after construction of DefaultCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 809
diff changeset
73 this.themeLists = themeLists;
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 }
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76
95
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
77 /**
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
78 * Creates a new DefaultCollection with uuid and name.
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
79 *
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
80 * @param uuid The identifier of this collection.
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
81 * @param name The name of this collection.
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
82 */
587
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
83 public DefaultCollection(String uuid, long ttl, String name) {
809
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
84 this(uuid, ttl, new ArrayList<Recommendation>());
95
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
85
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
86 this.name = name;
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
87 }
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
88
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
89
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
90 /**
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
91 * Creates a new DefaultCollection with uuid and name.
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
92 *
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
93 * @param uuid The identifier of this collection.
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
94 * @param name The name of this collection.
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
95 * @param creation The creation time.
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
96 */
587
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
97 public DefaultCollection(String uuid, long ttl, String name, Date creation){
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
98 this(uuid, ttl, name);
95
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
99
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
100 this.creation = creation;
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
101 }
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
102
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
103
5
14bf7895a2ec Added a new method that returns the UUID of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3
diff changeset
104 public String identifier() {
14bf7895a2ec Added a new method that returns the UUID of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3
diff changeset
105 return uuid;
14bf7895a2ec Added a new method that returns the UUID of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3
diff changeset
106 }
14bf7895a2ec Added a new method that returns the UUID of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3
diff changeset
107
14bf7895a2ec Added a new method that returns the UUID of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3
diff changeset
108
95
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
109 public Date getCreationTime() {
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
110 return creation;
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
111 }
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
112
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
113
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 public Date getLastAccess() {
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 return new Date();
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 }
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118
587
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
119 public long getTTL() {
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
120 return ttl;
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
121 }
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
122
53ad6dd2cb2b The project list displays the favorite state of a collection now. A gold star means, that a collection is a owner's favorite project and will never die. A silver star means, that the project is a common project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 524
diff changeset
123
597
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
124 public void setTTL(long ttl) {
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
125 this.ttl = ttl;
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
126 }
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
127
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
128
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 public String getName() {
95
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
130 return name;
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 }
17
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
132
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
133
597
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
134 public void setName(String name) {
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
135 this.name = name;
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
136 }
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
137
14e5e51a7de4 Improved the project list - listeners are notified after setting the name and ttl of a project.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 587
diff changeset
138
67
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
139 public void addItem(CollectionItem item) {
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
140 if (item != null) {
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
141 items.add(item);
17
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
142 }
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
143 }
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
144
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
145
67
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
146 public int getItemLength() {
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
147 return items.size();
17
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
148 }
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
149
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
150
67
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
151 public CollectionItem getItem(int idx) {
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
152 if (idx >= getItemLength()) {
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
153 return null;
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
154 }
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
155
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
156 return items.get(idx);
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
157 }
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
158
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
159
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
160 public Map<String, OutputMode> getOutputModes() {
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
161 Map<String, OutputMode> modes = new HashMap<String, OutputMode>();
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
162
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
163 for (CollectionItem item: items) {
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
164 List<OutputMode> itemModes = item.getOutputModes();
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
165
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
166 if (itemModes != null) {
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
167 for (OutputMode itemMode: itemModes) {
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
168 String name = itemMode.getName();
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
169 if (!modes.containsKey(name)) {
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
170 // we dont want duplicated OutputModes in our result.
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
171 modes.put(name, itemMode);
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
172 }
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
173 }
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
174 }
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
175 }
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
176
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
177 return modes;
17
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
178 }
524
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 95
diff changeset
179
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 95
diff changeset
180
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 95
diff changeset
181 public ThemeList getThemeList(String outName) {
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 95
diff changeset
182 if (themeLists != null) {
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 95
diff changeset
183 return themeLists.get(outName);
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 95
diff changeset
184 }
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 95
diff changeset
185
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 95
diff changeset
186 return null;
ba238f917b94 The theme list information stored in the attribute of a collection is read and added in form of Themes and ThemeLists to the Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 95
diff changeset
187 }
809
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
188
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
189
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
190 public List<Recommendation> getRecommendations() {
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
191 return recommendations;
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
192 }
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
193
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
194
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
195 public void addRecommendation(Recommendation recommendation) {
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
196 recommendations.add(recommendation);
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
197 }
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
198
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
199
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
200 public void addRecommendations(List<Recommendation> recommendations) {
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
201 this.recommendations.addAll(recommendations);
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
202 }
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
203
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
204
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
205 public boolean loadedRecommendation(Recommendation recommendation) {
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
206 String factory = recommendation.getFactory();
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
207 String dbids = recommendation.getIDs();
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
208
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
209 for (Recommendation in: recommendations) {
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
210 String inFactory = in.getFactory();
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
211 String inDbids = in.getIDs();
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
212
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
213 if (factory.equals(inFactory) && dbids.equals(inDbids)) {
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
214 return true;
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
215 }
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
216 }
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
217
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
218 return false;
e9337488bac3 The Collection now knows its already loaded recommendations - the CollectionView will not load recommendations that have already been loaded before.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 597
diff changeset
219 }
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
220 }
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
221 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org