Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/ModuleService.java @ 3642:83c0735092a3
FixA: Increase Q max about 5% if storing as AT file.
flys-artifacts/trunk@5362 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 05 Sep 2012 08:23:56 +0000 |
parents | 28be160b5870 |
children |
rev | line source |
---|---|
3630
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.services; |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
3 import java.util.List; |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
4 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
5 import org.apache.log4j.Logger; |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
6 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
7 import org.w3c.dom.Document; |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
8 import org.w3c.dom.Element; |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
9 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifacts.common.utils.XMLUtils; |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
11 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.artifacts.CallMeta; |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifacts.GlobalContext; |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.artifacts.ArtifactNamespaceContext; |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.flys.artifacts.model.Module; |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.flys.artifacts.context.FLYSContext; |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.flys.artifacts.resources.Resources; |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
18 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
19 public class ModuleService extends FLYSService { |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
20 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
21 private static final String MODULE = "module"; |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
22 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
23 private static Logger logger = Logger.getLogger(ModuleService.class); |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
24 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
25 protected Document doProcess( |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
26 Document data, |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
27 GlobalContext globalContext, |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
28 CallMeta callMeta |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
29 ) { |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
30 logger.debug("ModuleService.process"); |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
31 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
32 Document result = XMLUtils.newDocument(); |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
33 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
34 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
35 result, |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
36 ArtifactNamespaceContext.NAMESPACE_URI, |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
37 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
38 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
39 Element em = ec.create("modules"); |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
40 List<Module> modules = (List<Module>)globalContext.get(FLYSContext.MODULES); |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
41 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
42 for (Module module : modules) { |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
43 Element m = ec.create("module"); |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
44 ec.addAttr(m, "name", module.getName(), true); |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
45 String localname = Resources.getMsg(callMeta, |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
46 MODULE + "." + module.getName(), module.getName()); |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
47 ec.addAttr(m, "localname", localname, true); |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
48 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
49 if (module.isSelected()) { |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
50 ec.addAttr(m, "selected", "true", true); |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
51 } |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
52 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
53 em.appendChild(m); |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
54 } |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
55 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
56 result.appendChild(em); |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
57 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
58 return result; |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
59 } |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
60 } |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
61 |
28be160b5870
Add a module service. It's now possible to configure the modules which are
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
62 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 tw=80: |