Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultCollection.java @ 557:92c200887b20
#21 There might be just a single window for each project now. Users can't open a project twice.
flys-client/trunk@2083 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 08 Jun 2011 13:21:46 +0000 |
parents | ba238f917b94 |
children | 53ad6dd2cb2b |
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 |
17
6cb8aff3cd6b
Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
5
diff
changeset
|
26 /** 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
|
27 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
|
28 |
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
|
29 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
|
30 |
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 |
74257b95567b
Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
17
diff
changeset
|
32 /** |
74257b95567b
Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
17
diff
changeset
|
33 * 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
|
34 */ |
74257b95567b
Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
17
diff
changeset
|
35 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
|
36 } |
17
6cb8aff3cd6b
Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
5
diff
changeset
|
37 |
3
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 /** |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 * Creates a new DefaultCollection with a UUID. |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 * |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 * @param uuid The UUID. |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 */ |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 public DefaultCollection(String uuid) { |
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
|
45 this.uuid = uuid; |
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.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
|
47 this.themeLists = new HashMap<String, ThemeList>(); |
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 } |
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 |
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
|
50 |
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 public DefaultCollection(String uuid, 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
|
52 this(uuid); |
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 |
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
|
54 this.themeLists = themeLists; |
3
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 } |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 |
95
e2abb6b9dc7e
A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
67
diff
changeset
|
58 /** |
e2abb6b9dc7e
A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
67
diff
changeset
|
59 * 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
|
60 * |
e2abb6b9dc7e
A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
67
diff
changeset
|
61 * @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
|
62 * @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
|
63 */ |
e2abb6b9dc7e
A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
67
diff
changeset
|
64 public DefaultCollection(String uuid, String name) { |
e2abb6b9dc7e
A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
67
diff
changeset
|
65 this(uuid); |
e2abb6b9dc7e
A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
67
diff
changeset
|
66 |
e2abb6b9dc7e
A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
67
diff
changeset
|
67 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
|
68 } |
e2abb6b9dc7e
A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
67
diff
changeset
|
69 |
e2abb6b9dc7e
A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
67
diff
changeset
|
70 |
e2abb6b9dc7e
A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
67
diff
changeset
|
71 /** |
e2abb6b9dc7e
A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
67
diff
changeset
|
72 * 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
|
73 * |
e2abb6b9dc7e
A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
67
diff
changeset
|
74 * @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
|
75 * @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
|
76 * @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
|
77 */ |
e2abb6b9dc7e
A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
67
diff
changeset
|
78 public DefaultCollection(String uuid, String name, Date creation) { |
e2abb6b9dc7e
A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
67
diff
changeset
|
79 this(uuid, name); |
e2abb6b9dc7e
A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
67
diff
changeset
|
80 |
e2abb6b9dc7e
A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
67
diff
changeset
|
81 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
|
82 } |
e2abb6b9dc7e
A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
67
diff
changeset
|
83 |
e2abb6b9dc7e
A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
67
diff
changeset
|
84 |
5
14bf7895a2ec
Added a new method that returns the UUID of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
85 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
|
86 return uuid; |
14bf7895a2ec
Added a new method that returns the UUID of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
87 } |
14bf7895a2ec
Added a new method that returns the UUID of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
88 |
14bf7895a2ec
Added a new method that returns the UUID of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
89 |
95
e2abb6b9dc7e
A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
67
diff
changeset
|
90 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
|
91 return creation; |
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 |
e2abb6b9dc7e
A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
67
diff
changeset
|
94 |
3
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 public Date getLastAccess() { |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 return new Date(); |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 } |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 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
|
101 return name; |
3
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 } |
17
6cb8aff3cd6b
Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
5
diff
changeset
|
103 |
6cb8aff3cd6b
Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
5
diff
changeset
|
104 |
67
74257b95567b
Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
17
diff
changeset
|
105 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
|
106 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
|
107 items.add(item); |
17
6cb8aff3cd6b
Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
5
diff
changeset
|
108 } |
6cb8aff3cd6b
Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
5
diff
changeset
|
109 } |
6cb8aff3cd6b
Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
5
diff
changeset
|
110 |
6cb8aff3cd6b
Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
5
diff
changeset
|
111 |
67
74257b95567b
Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
17
diff
changeset
|
112 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
|
113 return items.size(); |
17
6cb8aff3cd6b
Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
5
diff
changeset
|
114 } |
6cb8aff3cd6b
Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
5
diff
changeset
|
115 |
6cb8aff3cd6b
Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
5
diff
changeset
|
116 |
67
74257b95567b
Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
17
diff
changeset
|
117 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
|
118 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
|
119 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
|
120 } |
74257b95567b
Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
17
diff
changeset
|
121 |
74257b95567b
Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
17
diff
changeset
|
122 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
|
123 } |
74257b95567b
Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
17
diff
changeset
|
124 |
74257b95567b
Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
17
diff
changeset
|
125 |
74257b95567b
Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
17
diff
changeset
|
126 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
|
127 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
|
128 |
74257b95567b
Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
17
diff
changeset
|
129 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
|
130 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
|
131 |
74257b95567b
Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
17
diff
changeset
|
132 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
|
133 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
|
134 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
|
135 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
|
136 // 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
|
137 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
|
138 } |
74257b95567b
Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
17
diff
changeset
|
139 } |
74257b95567b
Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
17
diff
changeset
|
140 } |
74257b95567b
Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
17
diff
changeset
|
141 } |
74257b95567b
Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
17
diff
changeset
|
142 |
74257b95567b
Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
17
diff
changeset
|
143 return modes; |
17
6cb8aff3cd6b
Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
5
diff
changeset
|
144 } |
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
|
145 |
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
|
146 |
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
|
147 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
|
148 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
|
149 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
|
150 } |
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
|
151 |
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
|
152 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
|
153 } |
3
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 } |
9cf5a40b62c7
Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |