Mercurial > dive4elements > gnv-client
annotate gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactFactory.java @ 1022:28a0628b11b0
Added license file and license header.
gnv/trunk@1258 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 02 Nov 2010 17:15:08 +0000 |
parents | d5d4dbda17cc |
children |
rev | line source |
---|---|
1022
28a0628b11b0
Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
958
diff
changeset
|
1 /* |
28a0628b11b0
Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
958
diff
changeset
|
2 * Copyright (c) 2010 by Intevation GmbH |
28a0628b11b0
Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
958
diff
changeset
|
3 * |
28a0628b11b0
Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
958
diff
changeset
|
4 * This program is free software under the LGPL (>=v2.1) |
28a0628b11b0
Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
958
diff
changeset
|
5 * Read the file LGPL.txt coming with the software for details |
28a0628b11b0
Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
958
diff
changeset
|
6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
28a0628b11b0
Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
958
diff
changeset
|
7 */ |
28a0628b11b0
Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
958
diff
changeset
|
8 |
2
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
9 package de.intevation.gnv.artifactdatabase.objects; |
36
ad381cc47217
Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents:
7
diff
changeset
|
10 |
2
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
11 /** |
958 | 12 * Implementation of an <code>ArtifactObject> which represents an |
13 * <code>ArtifactFactory</code> | |
14 * This Class provides the name, the description, the URL where the | |
15 * the <code>ArtifactDatabase</code> the factory belongs to could be reached | |
16 * and if the <code>ArtifacFactory</code> is currently selected or not. | |
17 * | |
684
57fa8019fbdc
Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
683
diff
changeset
|
18 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> |
2
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
19 */ |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
20 public class ArtifactFactory implements ArtifactObject { |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
21 |
165
183850730a90
Made all Interfaces Serailizable and add UID to all Objects issue71
Tim Englich <tim.englich@intevation.de>
parents:
36
diff
changeset
|
22 /** |
183850730a90
Made all Interfaces Serailizable and add UID to all Objects issue71
Tim Englich <tim.englich@intevation.de>
parents:
36
diff
changeset
|
23 * The UID of this Class. |
183850730a90
Made all Interfaces Serailizable and add UID to all Objects issue71
Tim Englich <tim.englich@intevation.de>
parents:
36
diff
changeset
|
24 */ |
183850730a90
Made all Interfaces Serailizable and add UID to all Objects issue71
Tim Englich <tim.englich@intevation.de>
parents:
36
diff
changeset
|
25 private static final long serialVersionUID = 5453748230625831527L; |
183850730a90
Made all Interfaces Serailizable and add UID to all Objects issue71
Tim Englich <tim.englich@intevation.de>
parents:
36
diff
changeset
|
26 |
958 | 27 /** |
28 * The name of the factory. | |
29 */ | |
2
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
30 private String name = null; |
36
ad381cc47217
Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents:
7
diff
changeset
|
31 |
958 | 32 /** |
33 * The description of the Factory. | |
34 */ | |
2
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
35 private String description = null; |
36
ad381cc47217
Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents:
7
diff
changeset
|
36 |
958 | 37 /** |
38 * Flag which mark the Artifactfactory as selected if value is true | |
39 * unselected if value is false. | |
40 */ | |
36
ad381cc47217
Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents:
7
diff
changeset
|
41 private boolean selected = false; |
ad381cc47217
Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents:
7
diff
changeset
|
42 |
958 | 43 /** |
44 * The URL where the Factory could be reached. | |
45 */ | |
2
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
46 private String dataBaseUrl = null; |
36
ad381cc47217
Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents:
7
diff
changeset
|
47 |
2
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
48 /** |
690
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
49 * Returns the url of the artifact server. |
699
af22fa5567a6
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
693
diff
changeset
|
50 * |
2
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
51 * @return the dataBaseUrl |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
52 */ |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
53 public String getDataBaseUrl() { |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
54 return dataBaseUrl; |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
55 } |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
56 |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
57 /** |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
58 * Constructor |
693
d4d1eb56d725
Added more JavaDocs
Tim Englich <tim.englich@intevation.de>
parents:
690
diff
changeset
|
59 * @param name the name of the factory |
d4d1eb56d725
Added more JavaDocs
Tim Englich <tim.englich@intevation.de>
parents:
690
diff
changeset
|
60 * @param description the description of the Factory |
d4d1eb56d725
Added more JavaDocs
Tim Englich <tim.englich@intevation.de>
parents:
690
diff
changeset
|
61 * @param dataBaseUrl the URL where the Factory could be reached. |
2
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
62 */ |
958 | 63 public ArtifactFactory(String name, |
64 String description, | |
65 String dataBaseUrl) { | |
2
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
66 super(); |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
67 this.name = name; |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
68 this.description = description; |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
69 this.dataBaseUrl = dataBaseUrl; |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
70 } |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
71 |
690
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
72 |
2
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
73 public String getId() { |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
74 return this.name; |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
75 } |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
76 |
690
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
77 |
2
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
78 public boolean isSelected() { |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
79 |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
80 return this.selected; |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
81 } |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
82 |
690
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
83 |
2
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
84 public void setSelected(boolean selected) { |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
85 this.selected = selected; |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
86 } |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
87 |
690
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
88 |
2
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
89 public String getName() { |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
90 return name; |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
91 } |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
92 |
690
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
93 |
2
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
94 public String getDescription() { |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
95 return description; |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
96 } |
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
97 |
690
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
98 |
7
fe6a64545552
Support for creating an Artifact integrated
Tim Englich <tim.englich@intevation.de>
parents:
2
diff
changeset
|
99 public String getHash() { |
fe6a64545552
Support for creating an Artifact integrated
Tim Englich <tim.englich@intevation.de>
parents:
2
diff
changeset
|
100 return null; |
fe6a64545552
Support for creating an Artifact integrated
Tim Englich <tim.englich@intevation.de>
parents:
2
diff
changeset
|
101 } |
fe6a64545552
Support for creating an Artifact integrated
Tim Englich <tim.englich@intevation.de>
parents:
2
diff
changeset
|
102 |
690
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
103 /** |
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
104 * Two ArtifactFactories are equal, if the name and the url to the artifact |
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
105 * server are equal. |
699
af22fa5567a6
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
693
diff
changeset
|
106 * |
690
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
107 * @param obj |
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
108 * @return true, if the factories are equal - otherwise false. |
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
109 */ |
558
8032da9e8b70
Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents:
165
diff
changeset
|
110 @Override |
8032da9e8b70
Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents:
165
diff
changeset
|
111 public boolean equals(Object obj) { |
8032da9e8b70
Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents:
165
diff
changeset
|
112 boolean returnValue = false; |
8032da9e8b70
Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents:
165
diff
changeset
|
113 if (obj instanceof ArtifactFactory){ |
8032da9e8b70
Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents:
165
diff
changeset
|
114 ArtifactFactory af = (ArtifactFactory)obj; |
8032da9e8b70
Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents:
165
diff
changeset
|
115 returnValue = this.getName().equals(af.getName()) && |
8032da9e8b70
Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents:
165
diff
changeset
|
116 this.getDataBaseUrl().equals(af.getDataBaseUrl()); |
8032da9e8b70
Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents:
165
diff
changeset
|
117 } |
8032da9e8b70
Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents:
165
diff
changeset
|
118 return returnValue; |
8032da9e8b70
Added further business logic for the MapViewer-Interface
Tim Englich <tim.englich@intevation.de>
parents:
165
diff
changeset
|
119 } |
2
5e94403971af
infrastructur for Communicationg with the ArtifactDatabase added.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
120 } |
700
89ade245ca7a
Using unix line endings only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
699
diff
changeset
|
121 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |