annotate flys-client/src/main/java/de/intevation/flys/client/shared/model/Recommendation.java @ 1352:01b18db3b288

In WDiff datacage input make names survive backjumps. flys-client/trunk@3027 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 19 Oct 2011 11:08:03 +0000
parents 46a4b74d87bf
children 4a6814be92ba
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 /**
6f65e70fa11d Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 * @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
12 */
839
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
13 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
14
1271
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
15 /** 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
16 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
17
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
18 protected String name;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
19 protected String index;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
20
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
21 public Facet() {
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
22 }
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(String name, String index) {
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
25 this.name = name;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
26 this.index = index;
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
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
29 public String getName() {
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
30 return name;
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 getIndex() {
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
34 return index;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
35 }
1271
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
36
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
37
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
38 @Override
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
39 public int hashCode() {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
40 int hash = 0;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
41 if (getName() != null) {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
42 hash += getName().hashCode();
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
43 }
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
44 if (getIndex() != null) {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
45 hash += getIndex().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 return hash;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
48 }
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
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
51 @Override
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
52 public boolean equals(Object other) {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
53 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
54 return false;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
55 }
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
56 Facet facet = (Facet) other;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
57 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
58 && (same(facet.getName(), this.getName()));
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
59 }
845
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
60 } // class Facet
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
61
1271
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
62
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
63 /** 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
64 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
65
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
66 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
67
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
68 public Filter() {
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
69 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
70 }
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 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
73 outs.put(out, facets);
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 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
77 return outs;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
78 }
1271
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
79
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
80
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
81 @Override
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
82 public int hashCode() {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
83 if (getOuts() != null) {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
84 return getOuts().hashCode();
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
85 }
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
86 return 0;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
87 }
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
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
90 @Override
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
91 public boolean equals(Object other) {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
92 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
93 return false;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
94 }
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
95 Filter filter = (Filter) other;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
96 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
97 }
845
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
98 } // class Filter
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
99
839
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
100 protected String factory;
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
101 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
102 protected String masterArtifact;
845
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
103 protected Filter filter;
1352
01b18db3b288 In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1349
diff changeset
104 protected String displayName = null;
839
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
105
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
106 public Recommendation() {
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
107 }
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
108
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
109 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
110 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
111 }
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
112
845
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
113 public Recommendation(
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
114 String factory,
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
115 String ids,
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
116 String masterArtifact,
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
117 Filter filter
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
118 ) {
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
119 this.factory = factory;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
120 this.ids = ids;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
121 this.masterArtifact = masterArtifact;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
122 this.filter = filter;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
123 }
839
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
124
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
125 public String getFactory() {
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
126 return factory;
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
127 }
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
128
1349
46a4b74d87bf Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1271
diff changeset
129 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
130 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
131 }
46a4b74d87bf Allow (yet limited) usage of zus and flood-protection data in wdiffs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1271
diff changeset
132
1352
01b18db3b288 In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1349
diff changeset
133 public void setDisplayName(String displayName) {
01b18db3b288 In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1349
diff changeset
134 this.displayName = displayName;
01b18db3b288 In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1349
diff changeset
135 }
01b18db3b288 In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1349
diff changeset
136
01b18db3b288 In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1349
diff changeset
137 public String getDisplayName() {
01b18db3b288 In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1349
diff changeset
138 return this.displayName;
01b18db3b288 In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1349
diff changeset
139 }
01b18db3b288 In WDiff datacage input make names survive backjumps.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1349
diff changeset
140
839
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
141 public String getIDs() {
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
142 return ids;
6a1cd38e6e18 Made Recommendation a class for direct use.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 807
diff changeset
143 }
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
144
ac70261bb3f8 Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 839
diff changeset
145 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
146 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
147 }
ac70261bb3f8 Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 839
diff changeset
148
ac70261bb3f8 Allow passing no master artifact to RPC service when creating new artifact.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 839
diff changeset
149 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
150 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
151 }
845
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
152
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
153 public Filter getFilter() {
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
154 return filter;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
155 }
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
156
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
157 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
158 this.filter = filter;
4db672cdacb2 Added outs/facet filters when creation new artifacts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 844
diff changeset
159 }
1271
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
160
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
161
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
162 @Override
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
163 public int hashCode() {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
164 int hash = 0;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
165 hash += (getFactory() != null)
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
166 ? getFactory().hashCode()
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
167 : 0;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
168 hash += (getIDs() != null)
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
169 ? getIDs().hashCode()
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
170 : 0;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
171 hash += (getFilter() != null)
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
172 ? getFilter().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 += (getMasterArtifact() != null)
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
175 ? getMasterArtifact().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 return hash;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
178 }
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
179
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
180
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
181 /**
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
182 * Null-pointer guarded equals.
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
183 * 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
184 * @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
185 * @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
186 * @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
187 */
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
188 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
189 // Do null-check.
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
190 if (a == null) {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
191 return b == null;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
192 } else if (b == null) {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
193 return false;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
194 }
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
195 return a.equals(b);
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
196 }
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
197
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
198
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
199 @Override
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
200 public boolean equals(Object other) {
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
201 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
202 return false;
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 Recommendation rec = (Recommendation) other;
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
205 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
206 && (same(this.getIDs(), rec.getIDs()))
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
207 && (same(this.getFilter(), rec.getFilter()))
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
208 && (same(this.getMasterArtifact(), rec.getMasterArtifact()));
3e7717b6e2bc Implement equals und hashCode for Recommendation and associates.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 845
diff changeset
209 }
807
6f65e70fa11d Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
210 }
6f65e70fa11d Repaired broken recommendation parsing from Artifact's DESCRIBE document (which structure has changed).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
211 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org