Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/shared/model/Recommendation.java @ 1503:3304608baf35
Issue 433.
Allways load original chart settings when opening the dialog.
flys-client/trunk@3632 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Mon, 09 Jan 2012 17:07:17 +0000 |
parents | 4a6814be92ba |
children | 0b79630e3bcb |
rev | line source |
---|---|
807
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.shared.model; |
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
3 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
4 import java.util.List; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
5 import java.util.Map; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
6 import java.util.HashMap; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
7 |
807
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import java.io.Serializable; |
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 /** |
1442
4a6814be92ba
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
11 * Information bundle to let client create/clone an artifact with facets. |
807
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 */ |
839
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
14 public class Recommendation implements Serializable { |
807
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
1271
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
16 /** Index and name of a facet. */ |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
17 public static class Facet implements Serializable { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
18 |
1442
4a6814be92ba
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
19 /** Facet name. */ |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
20 protected String name; |
1442
4a6814be92ba
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
21 /** Facet name. */ |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
22 protected String index; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
23 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
24 public Facet() { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
25 } |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
26 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
27 public Facet(String name, String index) { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
28 this.name = name; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
29 this.index = index; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
30 } |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
31 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
32 public String getName() { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
33 return name; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
34 } |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
35 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
36 public String getIndex() { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
37 return index; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
38 } |
1271
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
39 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
40 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
41 @Override |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
42 public int hashCode() { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
43 int hash = 0; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
44 if (getName() != null) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
45 hash += getName().hashCode(); |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
46 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
47 if (getIndex() != null) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
48 hash += getIndex().hashCode(); |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
49 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
50 return hash; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
51 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
52 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
53 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
54 @Override |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
55 public boolean equals(Object other) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
56 if (!(other instanceof Facet) || other == null) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
57 return false; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
58 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
59 Facet facet = (Facet) other; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
60 return (same(facet.getIndex(), this.getIndex())) |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
61 && (same(facet.getName(), this.getName())); |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
62 } |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
63 } // class Facet |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
64 |
1271
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
65 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
66 /** Mapping of outnames to Facet-Lists. */ |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
67 public static class Filter implements Serializable { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
68 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
69 protected Map<String, List<Facet>> outs; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
70 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
71 public Filter() { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
72 outs = new HashMap<String, List<Facet>>(); |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
73 } |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
74 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
75 public void add(String out, List<Facet> facets) { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
76 outs.put(out, facets); |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
77 } |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
78 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
79 public Map<String, List<Facet>> getOuts() { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
80 return outs; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
81 } |
1271
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
82 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
83 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
84 @Override |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
85 public int hashCode() { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
86 if (getOuts() != null) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
87 return getOuts().hashCode(); |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
88 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
89 return 0; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
90 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
91 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
92 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
93 @Override |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
94 public boolean equals(Object other) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
95 if (!(other instanceof Filter) || other == null) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
96 return false; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
97 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
98 Filter filter = (Filter) other; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
99 return Recommendation.same(filter.getOuts(), this.getOuts()); |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
100 } |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
101 } // class Filter |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
102 |
1442
4a6814be92ba
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
103 /** Factory to speak to when creating/cloning. */ |
839
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
104 protected String factory; |
1442
4a6814be92ba
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
105 /** Sometimes database ids, sometimes other freeform text. */ |
839
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
106 protected String ids; |
844
ac70261bb3f8
Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
839
diff
changeset
|
107 protected String masterArtifact; |
1442
4a6814be92ba
Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1352
diff
changeset
|
108 /** Optional facet filter. */ |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
109 protected Filter filter; |
1352
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
110 protected String displayName = null; |
839
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
111 |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
112 public Recommendation() { |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
113 } |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
114 |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
115 public Recommendation(String factory, String ids) { |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
116 this(factory, ids, null, null); |
839
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
117 } |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
118 |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
119 public Recommendation( |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
120 String factory, |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
121 String ids, |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
122 String masterArtifact, |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
123 Filter filter |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
124 ) { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
125 this.factory = factory; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
126 this.ids = ids; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
127 this.masterArtifact = masterArtifact; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
128 this.filter = filter; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
129 } |
839
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
130 |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
131 public String getFactory() { |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
132 return factory; |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
133 } |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
134 |
1349
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1271
diff
changeset
|
135 public void setFactory(String factory) { |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1271
diff
changeset
|
136 this.factory = factory; |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1271
diff
changeset
|
137 } |
46a4b74d87bf
Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1271
diff
changeset
|
138 |
1352
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
139 public void setDisplayName(String displayName) { |
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
140 this.displayName = displayName; |
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
141 } |
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
142 |
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
143 public String getDisplayName() { |
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
144 return this.displayName; |
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
145 } |
01b18db3b288
In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1349
diff
changeset
|
146 |
839
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
147 public String getIDs() { |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
148 return ids; |
6a1cd38e6e18
Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
807
diff
changeset
|
149 } |
844
ac70261bb3f8
Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
839
diff
changeset
|
150 |
ac70261bb3f8
Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
839
diff
changeset
|
151 public String getMasterArtifact() { |
ac70261bb3f8
Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
839
diff
changeset
|
152 return masterArtifact; |
ac70261bb3f8
Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
839
diff
changeset
|
153 } |
ac70261bb3f8
Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
839
diff
changeset
|
154 |
ac70261bb3f8
Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
839
diff
changeset
|
155 public void setMasterArtifact(String masterArtifact) { |
ac70261bb3f8
Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
839
diff
changeset
|
156 this.masterArtifact = masterArtifact; |
ac70261bb3f8
Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
839
diff
changeset
|
157 } |
845
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
158 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
159 public Filter getFilter() { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
160 return filter; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
161 } |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
162 |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
163 public void setFilter(Filter filter) { |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
164 this.filter = filter; |
4db672cdacb2
Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
844
diff
changeset
|
165 } |
1271
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
166 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
167 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
168 @Override |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
169 public int hashCode() { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
170 int hash = 0; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
171 hash += (getFactory() != null) |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
172 ? getFactory().hashCode() |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
173 : 0; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
174 hash += (getIDs() != null) |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
175 ? getIDs().hashCode() |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
176 : 0; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
177 hash += (getFilter() != null) |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
178 ? getFilter().hashCode() |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
179 : 0; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
180 hash += (getMasterArtifact() != null) |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
181 ? getMasterArtifact().hashCode() |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
182 : 0; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
183 return hash; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
184 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
185 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
186 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
187 /** |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
188 * Null-pointer guarded equals. |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
189 * Two null's are assumed equal (returns true); |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
190 * @param a Object to compare against parameter b. |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
191 * @param b Object to compare against parameter a. |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
192 * @return true if either a and b are null or a.equals(b) returns true. |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
193 */ |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
194 protected static boolean same(Object a, Object b) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
195 // Do null-check. |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
196 if (a == null) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
197 return b == null; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
198 } else if (b == null) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
199 return false; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
200 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
201 return a.equals(b); |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
202 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
203 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
204 |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
205 @Override |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
206 public boolean equals(Object other) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
207 if (!(other instanceof Recommendation) || other == null) { |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
208 return false; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
209 } |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
210 Recommendation rec = (Recommendation) other; |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
211 return (same(this.getFactory(), rec.getFactory())) |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
212 && (same(this.getIDs(), rec.getIDs())) |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
213 && (same(this.getFilter(), rec.getFilter())) |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
214 && (same(this.getMasterArtifact(), rec.getMasterArtifact())); |
3e7717b6e2bc
Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
845
diff
changeset
|
215 } |
807
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
216 } |
6f65e70fa11d
Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
217 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |