annotate flys-client/src/main/java/de/intevation/flys/client/shared/model/Recommendation.java @ 5200:42bb6ff78d1b 2.9.11

Directly set the connectionInitSqls on the datasource Somehow the factory fails to set the connectionInitSqls if we add it to the dbcpProperties. So we now set it directly
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 08 Mar 2013 11:48:33 +0100
parents 0b79630e3bcb
children
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;
1543
0b79630e3bcb Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1442
diff changeset
21
0b79630e3bcb Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1442
diff changeset
22 /** Facet index. */
845
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
23 protected String index;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
24
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
25 public Facet() {
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
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
28 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
29 this.name = name;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
30 this.index = index;
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
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
33 public String getName() {
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
34 return name;
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
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
37 public String getIndex() {
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
38 return index;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
39 }
1271
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
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
42 @Override
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
43 public int hashCode() {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
44 int hash = 0;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
45 if (getName() != null) {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
46 hash += getName().hashCode();
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
47 }
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
48 if (getIndex() != null) {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
49 hash += getIndex().hashCode();
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
50 }
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
51 return hash;
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
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
55 @Override
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
56 public boolean equals(Object other) {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
57 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
58 return false;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
59 }
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
60 Facet facet = (Facet) other;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
61 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
62 && (same(facet.getName(), this.getName()));
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
63 }
845
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
64 } // class Facet
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
65
1271
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
66
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
67 /** 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
68 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
69
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
70 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
71
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
72 public Filter() {
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
73 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
74 }
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
75
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
76 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
77 outs.put(out, facets);
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
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
80 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
81 return outs;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
82 }
1271
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
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
85 @Override
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
86 public int hashCode() {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
87 if (getOuts() != null) {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
88 return getOuts().hashCode();
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
89 }
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
90 return 0;
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
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
94 @Override
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
95 public boolean equals(Object other) {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
96 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
97 return false;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
98 }
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
99 Filter filter = (Filter) other;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
100 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
101 }
845
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
102 } // class Filter
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
103
1442
4a6814be92ba Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1352
diff changeset
104 /** 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
105 protected String factory;
1442
4a6814be92ba Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1352
diff changeset
106 /** 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
107 protected String ids;
1543
0b79630e3bcb Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1442
diff changeset
108 /** Artifacts uuid that should serve as master artifact. */
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
109 protected String masterArtifact;
1442
4a6814be92ba Cosmetics, doc.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1352
diff changeset
110 /** Optional facet filter. */
845
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
111 protected Filter filter;
1352
01b18db3b288 In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1349
diff changeset
112 protected String displayName = null;
839
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 public Recommendation() {
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
115 }
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
116
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
117 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
118 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
119 }
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
120
845
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
121 public Recommendation(
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
122 String factory,
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
123 String ids,
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
124 String masterArtifact,
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
125 Filter filter
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
126 ) {
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
127 this.factory = factory;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
128 this.ids = ids;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
129 this.masterArtifact = masterArtifact;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
130 this.filter = filter;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
131 }
839
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
132
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
133 public String getFactory() {
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
134 return factory;
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
135 }
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
136
1349
46a4b74d87bf Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1271
diff changeset
137 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
138 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
139 }
46a4b74d87bf Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1271
diff changeset
140
1352
01b18db3b288 In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1349
diff changeset
141 public void setDisplayName(String displayName) {
01b18db3b288 In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1349
diff changeset
142 this.displayName = displayName;
01b18db3b288 In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1349
diff changeset
143 }
01b18db3b288 In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1349
diff changeset
144
01b18db3b288 In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1349
diff changeset
145 public String getDisplayName() {
01b18db3b288 In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1349
diff changeset
146 return this.displayName;
01b18db3b288 In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1349
diff changeset
147 }
01b18db3b288 In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1349
diff changeset
148
839
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
149 public String getIDs() {
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
150 return ids;
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
151 }
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
152
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 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
154 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
155 }
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
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 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
158 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
159 }
845
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
160
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
161 public Filter getFilter() {
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
162 return filter;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
163 }
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
164
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
165 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
166 this.filter = filter;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
167 }
1271
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
168
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
169
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
170 @Override
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
171 public int hashCode() {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
172 int hash = 0;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
173 hash += (getFactory() != null)
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
174 ? getFactory().hashCode()
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
175 : 0;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
176 hash += (getIDs() != null)
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
177 ? getIDs().hashCode()
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
178 : 0;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
179 hash += (getFilter() != null)
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
180 ? getFilter().hashCode()
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
181 : 0;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
182 hash += (getMasterArtifact() != null)
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
183 ? getMasterArtifact().hashCode()
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
184 : 0;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
185 return hash;
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
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
189 /**
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
190 * Null-pointer guarded equals.
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
191 * 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
192 * @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
193 * @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
194 * @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
195 */
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
196 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
197 // Do null-check.
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
198 if (a == null) {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
199 return b == null;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
200 } else if (b == null) {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
201 return false;
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 return a.equals(b);
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
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
206
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
207 @Override
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
208 public boolean equals(Object other) {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
209 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
210 return false;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
211 }
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
212 Recommendation rec = (Recommendation) other;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
213 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
214 && (same(this.getIDs(), rec.getIDs()))
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
215 && (same(this.getFilter(), rec.getFilter()))
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
216 && (same(this.getMasterArtifact(), rec.getMasterArtifact()));
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
217 }
807
6f65e70fa11d Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
218 }
6f65e70fa11d Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
219 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org