annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/Recommendations.java @ 1178:1b432c260e97

Enabled the FloodMapState to fetch waterlevel data from external Artifact. flys-artifacts/trunk@2764 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 15 Sep 2011 15:36:05 +0000
parents 0a5eff5511b1
children 3ca999f507b7
rev   line source
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.datacage;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import java.util.Map;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4 import java.util.HashMap;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5 import java.util.List;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6 import java.util.ArrayList;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8 import java.io.InputStream;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 import java.io.IOException;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10 import java.io.File;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 import java.io.FileInputStream;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 import java.sql.Connection;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15 import java.sql.SQLException;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 import org.apache.log4j.Logger;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 import org.w3c.dom.Document;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20 import org.w3c.dom.Node;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22 import org.hibernate.Session;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 import org.hibernate.jdbc.Work;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26 import de.intevation.artifacts.common.utils.Config;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27 import de.intevation.artifacts.common.utils.XMLUtils;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29 import de.intevation.flys.artifacts.FLYSArtifact;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 import de.intevation.flys.backend.SessionHolder;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33 import de.intevation.artifactdatabase.data.StateData;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 import de.intevation.flys.artifacts.datacage.templating.Builder;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37 public class Recommendations
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38 {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39 private static Logger log = Logger.getLogger(Recommendations.class);
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40
1030
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
41 private static final boolean DEVELOPMENT_MODE =
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
42 Boolean.getBoolean("flys.datacage.recommendations.development");
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
43
1046
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
44 public static final String XPATH_TEMPLATE =
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
45 "/artifact-database/metadata/template/text()";
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
46
1046
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
47 public static final String DEFAULT_TEMPLATE_PATH =
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
48 "${artifacts.config.dir}/meta-data.xml";
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50 private static Recommendations INSTANCE;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
51
1030
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
52 public static class BuilderProvider
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
53 {
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
54 protected Builder builder;
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
55
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
56 public BuilderProvider() {
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
57 }
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
58
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
59 public BuilderProvider(Builder builder) {
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
60 this.builder = builder;
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
61 }
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
62
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
63 public Builder getBuilder() {
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
64 return builder;
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
65 }
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
66 } // class BuilderProvider
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
67
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
68 public static class FileBuilderProvider
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
69 extends BuilderProvider
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
70 {
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
71 protected File file;
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
72 protected long lastModified;
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
73
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
74 public FileBuilderProvider() {
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
75 }
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
76
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
77 public FileBuilderProvider(File file) {
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
78 this.file = file;
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
79 lastModified = Long.MIN_VALUE;
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
80 }
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
81
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
82 @Override
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
83 public synchronized Builder getBuilder() {
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
84 long modified = file.lastModified();
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
85 if (modified > lastModified) {
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
86 lastModified = modified;
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
87 try {
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
88 Document template = loadTemplate(file);
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
89 builder = new Builder(template);
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
90 }
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
91 catch (IOException ioe) {
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
92 log.error(ioe);
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
93 }
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
94 }
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
95 return builder;
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
96 }
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
97
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
98 public BuilderProvider toStaticProvider() {
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
99 return new BuilderProvider(builder);
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
100 }
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
101 } // class BuilderProvider
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
102
1046
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
103 protected BuilderProvider builderProvider;
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
104
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
105 public Recommendations() {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
106 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
107
1046
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
108 public Recommendations(BuilderProvider builderProvider) {
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
109 this.builderProvider = builderProvider;
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
110 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
111
1046
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
112 public Builder getBuilder() {
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
113 return builderProvider.getBuilder();
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
114 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
115
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
116 protected static void artifactToParameters(
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
117 FLYSArtifact artifact,
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
118 Map<String, Object> parameters
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
119 ) {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
120 parameters.put("current-state-id", artifact.getCurrentStateId());
1018
d42fa223be48 Datacage: added first user specific config for cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1015
diff changeset
121 parameters.put("artifact-id", artifact.identifier());
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
122
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
123 for (StateData sd: artifact.getAllData()) {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
124 Object value = sd.getValue();
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
125 if (value == null) {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
126 continue;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
127 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
128 String key = sd.getName().replace('.', '-');
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
129 parameters.put(key, value);
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
130 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
131 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
132
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
133 public void recommend(
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
134 FLYSArtifact artifact,
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
135 String userId,
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
136 String [] outs,
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
137 Map<String, Object> extraParameters,
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
138 Node result
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
139 ) {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
140 Map<String, Object> parameters = new HashMap<String, Object>();
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
141
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
142 if (extraParameters != null) {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
143 parameters.putAll(extraParameters);
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
144 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
145
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
146 if (userId != null) {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
147 parameters.put("user-id", userId);
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
148 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
149
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
150 if (artifact != null) {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
151 artifactToParameters(artifact, parameters);
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
152 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
153
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
154 parameters.put("artifact-outs", outs);
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
155
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
156 parameters.put("parameters", parameters);
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
157
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
158 recommend(parameters, userId, result);
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
159 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
160
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
161 public void recommend(
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
162 Map<String, Object> parameters,
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
163 String userId,
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
164 Node result
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
165 ) {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
166 recommend(parameters, userId, result, SessionHolder.HOLDER.get());
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
167 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
168
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
169 public void recommend(
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
170 final Map<String, Object> parameters,
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
171 final String userId,
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
172 final Node result,
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
173 Session session
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
174 ) {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
175 session.doWork(new Work() {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
176 @Override
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
177 public void execute(Connection systemConnection)
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
178 throws SQLException
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
179 {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
180 List<Builder.NamedConnection> connections =
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
181 new ArrayList<Builder.NamedConnection>(2);
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
182
1046
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
183 Connection userConnection = userId != null
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
184 ? DBConfig
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
185 .getInstance()
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
186 .getDBConnection()
1046
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
187 .getDataSource()
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
188 .getConnection()
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
189 : null;
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
190
1046
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
191 try {
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
192 if (userConnection != null) {
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
193 connections.add(new Builder.NamedConnection(
1022
930a9ce24294 Datacage: Fixed caching issue leading to incorrect results.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1018
diff changeset
194 Builder.CONNECTION_USER, userConnection, false));
1046
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
195 }
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
196
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
197 connections.add(new Builder.NamedConnection(
1022
930a9ce24294 Datacage: Fixed caching issue leading to incorrect results.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1018
diff changeset
198 Builder.CONNECTION_SYSTEM, systemConnection, true));
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
199
1046
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
200 getBuilder().build(connections, result, parameters);
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
201 }
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
202 finally {
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
203 if (userConnection != null) {
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
204 userConnection.close();
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
205 }
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
206 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
207 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
208 });
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
209 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
210
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
211 public static synchronized Recommendations getInstance() {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
212 if (INSTANCE == null) {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
213 INSTANCE = createRecommendations();
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
214 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
215 return INSTANCE;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
216 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
217
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
218 protected static Document loadTemplate(File file) throws IOException {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
219 InputStream in = null;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
220
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
221 try {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
222 in = new FileInputStream(file);
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
223
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
224 Document template = XMLUtils.parseDocument(in);
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
225
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
226 if (template == null) {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
227 throw new IOException("cannot load template");
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
228 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
229 return template;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
230 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
231 finally {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
232 if (in != null) {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
233 try {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
234 in.close();
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
235 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
236 catch (IOException ioe) {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
237 log.error(ioe);
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
238 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
239 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
240 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
241 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
242
1046
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
243 public static Recommendations createRecommendations(File file) {
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
244 log.debug("Recommendations.createBuilder");
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
245
1046
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
246 if (!file.isFile() || !file.canRead()) {
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
247 log.error("Cannot open template file '" + file + "'");
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
248 return null;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
249 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
250
1046
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
251 FileBuilderProvider fbp = new FileBuilderProvider(file);
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
252
1046
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
253 if (fbp.getBuilder() == null) {
1030
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
254 log.error("failed loading builder");
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
255 return null;
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
256 }
1030
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
257
1046
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
258 BuilderProvider bp = DEVELOPMENT_MODE
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
259 ? fbp
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
260 : fbp.toStaticProvider();
1030
c586b6220f35 Datacage: Added a development mode for recommendations
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1029
diff changeset
261
1046
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
262 return new Recommendations(bp);
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
263 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
264
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
265 protected static Recommendations createRecommendations() {
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
266 log.debug("Recommendations.createRecommendations");
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
267
1046
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
268 String path = Config.getStringXPath(XPATH_TEMPLATE);
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
269
1046
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
270 if (path == null) {
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
271 path = DEFAULT_TEMPLATE_PATH;
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
272 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
273
1046
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
274 path = Config.replaceConfigDir(path);
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
275
1046
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
276 log.info("Meta data template: " + path);
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
277
0a5eff5511b1 Fixed flys/issue262: Unified user and system datacage template
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1030
diff changeset
278 return createRecommendations(new File(path));
1015
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
279 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
280 }
9a1a3080ad98 Bring user specific meta data service to life.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
281 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org