annotate gwt-client/src/main/java/org/dive4elements/river/client/shared/model/DefaultCollection.java @ 6540:24ca2f683c00

Doc, yay, adds color.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 05 Jul 2013 09:01:57 +0200
parents ea9eef426962
children 4b42ab2e9060
rev   line source
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
6 * documentation coming with Dive4Elements River for details.
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
9 package org.dive4elements.river.client.shared.model;
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
17
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
11 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
12 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
13 import java.util.HashMap;
17
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
14 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
15 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
16
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 /**
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 * 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
20 *
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 * @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
22 */
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 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
24
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 /** 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
26 protected String uuid;
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27
1430
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
28 /** The name of the collection. */
95
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
29 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
30
1430
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
31 /** The creation time of this collection. */
95
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
32 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
33
1430
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
34 /**
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
35 * The time to live of the collection.
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
36 * If this value is 0, it will never die.
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
37 */
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
38 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
39
17
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
40 /** 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
41 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
42
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
43 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
44
1430
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
45 /**
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
46 * ThemeList by outputmode name.
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
47 */
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 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
49
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
50 /**
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
51 * Settings by outputmode name.
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
52 */
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
53 protected Map<String, Settings> settings;
67
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
54
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
55 /**
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
56 * 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
57 */
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
58 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
59 }
17
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
60
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61
856
ec5c75da5c7a Bugfix flys/issue166: Parse Collection names from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 840
diff changeset
62 public DefaultCollection(String uuid, long ttl, String name) {
1430
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
63 this.uuid = uuid;
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
64 this.ttl = ttl;
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
65 this.name = name;
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
66 this.items = new ArrayList<CollectionItem>();
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
67 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
68 this.recommendations = new ArrayList<Recommendation>();
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
69 this.settings = new HashMap<String, Settings>();
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
70 }
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
71
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
72
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
73 /**
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
74 * 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
75 *
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
76 * @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
77 */
856
ec5c75da5c7a Bugfix flys/issue166: Parse Collection names from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 840
diff changeset
78 public DefaultCollection(
ec5c75da5c7a Bugfix flys/issue166: Parse Collection names from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 840
diff changeset
79 String uuid,
ec5c75da5c7a Bugfix flys/issue166: Parse Collection names from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 840
diff changeset
80 long ttl,
ec5c75da5c7a Bugfix flys/issue166: Parse Collection names from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 840
diff changeset
81 String name,
ec5c75da5c7a Bugfix flys/issue166: Parse Collection names from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 840
diff changeset
82 List<Recommendation> recs
ec5c75da5c7a Bugfix flys/issue166: Parse Collection names from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 840
diff changeset
83 ) {
ec5c75da5c7a Bugfix flys/issue166: Parse Collection names from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 840
diff changeset
84 this(uuid, ttl, 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
85
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
86 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
87 }
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
88
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
89
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
90 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
91 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
92 long ttl,
856
ec5c75da5c7a Bugfix flys/issue166: Parse Collection names from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 840
diff changeset
93 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
94 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
95 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
96 {
856
ec5c75da5c7a Bugfix flys/issue166: Parse Collection names from DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 840
diff changeset
97 this(uuid, ttl, name, recommendations);
840
18fc7afe0251 Ensure list of recommendations is non-null after construction of DefaultCollection.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 809
diff changeset
98 this.themeLists = themeLists;
3
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
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
102 public DefaultCollection(
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
103 String uuid,
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
104 long ttl,
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
105 String name,
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
106 List<Recommendation> recommendations,
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
107 Map<String, ThemeList> themeLists,
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
108 Map<String, Settings> settings)
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
109 {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
110 this(uuid, ttl, name, recommendations);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
111 this.themeLists = themeLists;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
112 this.settings = settings;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
113 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
114
1544
2b3d02626823 Opened Collection interface in preparation of Manual Points-Feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1464
diff changeset
115
95
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
116 /**
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
117 * 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
118 *
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
119 * @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
120 * @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
121 * @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
122 */
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
123 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
124 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
125
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
126 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
127 }
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
128
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
129
5
14bf7895a2ec Added a new method that returns the UUID of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3
diff changeset
130 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
131 return uuid;
14bf7895a2ec Added a new method that returns the UUID of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3
diff changeset
132 }
14bf7895a2ec Added a new method that returns the UUID of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3
diff changeset
133
14bf7895a2ec Added a new method that returns the UUID of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3
diff changeset
134
95
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
135 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
136 return creation;
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
137 }
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
138
e2abb6b9dc7e A collection provides a method to retrieve its creation time now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 67
diff changeset
139
1430
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
140 /**
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
141 * Returns now.
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
142 * TODO candidate for removal?
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
143 */
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 public Date getLastAccess() {
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 return new Date();
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146 }
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148
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
149 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
150 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
151 }
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
152
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
153
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
154 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
155 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
156 }
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
157
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
158
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 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
160 return name;
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 }
17
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
162
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
163
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
164 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
165 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
166 }
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
167
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
168
67
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
169 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
170 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
171 items.add(item);
17
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
172 }
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
173 }
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
174
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
175
67
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
176 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
177 return items.size();
17
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
178 }
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
179
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
180
1544
2b3d02626823 Opened Collection interface in preparation of Manual Points-Feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1464
diff changeset
181 /** Returns item at index (0-based), or null if out of range. */
67
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
182 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
183 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
184 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
185 }
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
186
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
187 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
188 }
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
189
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
190
1544
2b3d02626823 Opened Collection interface in preparation of Manual Points-Feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1464
diff changeset
191 /**
2b3d02626823 Opened Collection interface in preparation of Manual Points-Feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1464
diff changeset
192 * Get item whose identifier is the given string.
2b3d02626823 Opened Collection interface in preparation of Manual Points-Feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1464
diff changeset
193 * @param uuid identifier of collection item (artifacts uuid).
2b3d02626823 Opened Collection interface in preparation of Manual Points-Feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1464
diff changeset
194 * @return CollectionItem whose identifier is given String, null if not found.
2b3d02626823 Opened Collection interface in preparation of Manual Points-Feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1464
diff changeset
195 */
2b3d02626823 Opened Collection interface in preparation of Manual Points-Feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1464
diff changeset
196 public CollectionItem getItem(String uuid) {
2b3d02626823 Opened Collection interface in preparation of Manual Points-Feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1464
diff changeset
197 int size = getItemLength();
2b3d02626823 Opened Collection interface in preparation of Manual Points-Feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1464
diff changeset
198 for (int i = 0; i < size; i++) {
2b3d02626823 Opened Collection interface in preparation of Manual Points-Feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1464
diff changeset
199 CollectionItem item = getItem(i);
2b3d02626823 Opened Collection interface in preparation of Manual Points-Feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1464
diff changeset
200 if (item.identifier().equals(uuid)) {
2b3d02626823 Opened Collection interface in preparation of Manual Points-Feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1464
diff changeset
201 return item;
2b3d02626823 Opened Collection interface in preparation of Manual Points-Feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1464
diff changeset
202 }
2b3d02626823 Opened Collection interface in preparation of Manual Points-Feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1464
diff changeset
203 }
2b3d02626823 Opened Collection interface in preparation of Manual Points-Feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1464
diff changeset
204 return null;
2b3d02626823 Opened Collection interface in preparation of Manual Points-Feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1464
diff changeset
205 }
2b3d02626823 Opened Collection interface in preparation of Manual Points-Feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1464
diff changeset
206
2b3d02626823 Opened Collection interface in preparation of Manual Points-Feature.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1464
diff changeset
207
67
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
208 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
209 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
210
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
211 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
212 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
213
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
214 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
215 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
216 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
217 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
218 // 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
219 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
220 }
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
221 }
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
222 }
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
223 }
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
224
74257b95567b Added CollectionItems and Facets and replaced Artifact references in Collection with CollectionItems.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 17
diff changeset
225 return modes;
17
6cb8aff3cd6b Enhanced the Collection and its default implementation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 5
diff changeset
226 }
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
227
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
228
1430
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
229 /**
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
230 * Returns ThemeList for given output name.
6bb6d43eeb2d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 856
diff changeset
231 */
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
232 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
233 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
234 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
235 }
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
236
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
237 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
238 }
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
239
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
240
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
241 /**
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
242 * Returns Settings for given output name.
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
243 */
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
244 public Settings getSettings(String outName) {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
245 if (settings != null) {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
246 return settings.get(outName);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
247 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
248
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
249 return null;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
250 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
251
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
252
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
253 public void setSettings(Map<String, Settings> settings) {
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
254 this.settings = settings;
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
255 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
256
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
257
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
258 public void addSettings(String outname, Settings settings) {
1464
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1439
diff changeset
259 if (this.settings == null) {
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1439
diff changeset
260 this.settings = new HashMap<String, Settings>();
c899a7ffdc8f Extract and parse the output settings from describe document and add settings
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1439
diff changeset
261 }
1439
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
262 this.settings.put(outname, settings);
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
263 }
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
264
4df2d9a4b9b4 Added interfaces and container for output settings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1435
diff changeset
265
1435
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1430
diff changeset
266 /** Set the outputname to themelist map. */
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1430
diff changeset
267 public void setThemeLists(Map<String, ThemeList> map) {
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1430
diff changeset
268 this.themeLists = map;
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1430
diff changeset
269 }
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1430
diff changeset
270
f6fbfdc813f0 Allow client to access artifacts data via CollectionItems and Themes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1430
diff changeset
271
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
272 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
273 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
274 }
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
275
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
276
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
277 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
278 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
279 }
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
280
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
281
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
282 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
283 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
284 }
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
285
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
286
6540
24ca2f683c00 Doc, yay, adds color.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5993
diff changeset
287 /**
24ca2f683c00 Doc, yay, adds color.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5993
diff changeset
288 * Returns true if a recommendation with given factory and id
24ca2f683c00 Doc, yay, adds color.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5993
diff changeset
289 * is already member of this collection.
24ca2f683c00 Doc, yay, adds color.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 5993
diff changeset
290 */
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
291 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
292 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
293 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
294
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
295 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
296 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
297 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
298
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
299 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
300 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
301 }
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
302 }
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
303
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
304 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
305 }
4660
bb9ce9aece70 Add new method hasItems to Collection class
Björn Ricks <bjoern.ricks@intevation.de>
parents: 1544
diff changeset
306
bb9ce9aece70 Add new method hasItems to Collection class
Björn Ricks <bjoern.ricks@intevation.de>
parents: 1544
diff changeset
307
bb9ce9aece70 Add new method hasItems to Collection class
Björn Ricks <bjoern.ricks@intevation.de>
parents: 1544
diff changeset
308 @Override
bb9ce9aece70 Add new method hasItems to Collection class
Björn Ricks <bjoern.ricks@intevation.de>
parents: 1544
diff changeset
309 public boolean hasItems() {
bb9ce9aece70 Add new method hasItems to Collection class
Björn Ricks <bjoern.ricks@intevation.de>
parents: 1544
diff changeset
310 return items.isEmpty();
bb9ce9aece70 Add new method hasItems to Collection class
Björn Ricks <bjoern.ricks@intevation.de>
parents: 1544
diff changeset
311 }
4689
79f11188da21 Add a Collection method to return a string to be displayed in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4660
diff changeset
312
79f11188da21 Add a Collection method to return a string to be displayed in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4660
diff changeset
313 /**
79f11188da21 Add a Collection method to return a string to be displayed in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4660
diff changeset
314 * Returns the name of the collection or uuid if no name is set
79f11188da21 Add a Collection method to return a string to be displayed in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4660
diff changeset
315 */
79f11188da21 Add a Collection method to return a string to be displayed in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4660
diff changeset
316 @Override
79f11188da21 Add a Collection method to return a string to be displayed in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4660
diff changeset
317 public String getDisplayName() {
79f11188da21 Add a Collection method to return a string to be displayed in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4660
diff changeset
318 if (this.name != null) {
79f11188da21 Add a Collection method to return a string to be displayed in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4660
diff changeset
319 return this.name;
79f11188da21 Add a Collection method to return a string to be displayed in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4660
diff changeset
320 }
79f11188da21 Add a Collection method to return a string to be displayed in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4660
diff changeset
321 return this.uuid;
79f11188da21 Add a Collection method to return a string to be displayed in the gui
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4660
diff changeset
322 }
3
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
323 }
9cf5a40b62c7 Added an interface and a default implementation of a Collection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
324 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org