Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/ModuleServiceImpl.java @ 3524:2c306a3dacef
Use xml namespace for XPath query to get the accout name attribute.
flys-client/trunk@5323 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Bjoern Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Fri, 31 Aug 2012 08:29:07 +0000 |
parents | f9ef72f4c6d5 |
children | 72d2ec6a471e |
rev | line source |
---|---|
3515
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server; |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2 |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
3 import java.util.ArrayList; |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
4 import java.util.List; |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
5 |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
6 import org.apache.log4j.Logger; |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
7 |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.flys.client.client.FLYSConstants; |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.flys.client.client.services.ModuleService; |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.flys.client.server.auth.User; |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.flys.client.shared.model.DefaultModule; |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.flys.client.shared.model.Module; |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
13 |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
14 public class ModuleServiceImpl |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
15 extends RemoteServiceServlet |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
16 implements ModuleService |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
17 { |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
18 private static final Logger logger = |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
19 Logger.getLogger(ModuleServiceImpl.class); |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
20 |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
21 /** Constant value for the WINFO plugin.*/ |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
22 public static final String FIELD_PLUGIN_WINFO = "winfo"; |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
23 |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
24 /** Constant value for the MINFO plugin.*/ |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
25 public static final String FIELD_PLUGIN_MINFO = "minfo"; |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
26 |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
27 /** Constant value for the MAP plugin.*/ |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
28 public static final String FIELD_PLUGIN_MAP = "new_map"; |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
29 |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
30 /** Constant value for the CHART plugin.*/ |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
31 public static final String FIELD_PLUGIN_CHART = "new_chart"; |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
32 |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
33 /** Constant value for the FIX plugin.*/ |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
34 public static final String FIELD_PLUGIN_FIX = "fixanalysis"; |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
35 |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
36 @Override |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
37 public Module[] list(String locale) { |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
38 User user = this.getUser(); |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
39 |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
40 //TODO load modules from artifactserver |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
41 Module[] available = { |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
42 new DefaultModule(FIELD_PLUGIN_WINFO, "WINFO"), |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
43 new DefaultModule(FIELD_PLUGIN_MINFO, "MINFO"), |
3517
40ddd713d9fd
Hardcode German module translations temporarily
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3515
diff
changeset
|
44 new DefaultModule(FIELD_PLUGIN_CHART, "Neues Diargamm"), |
3519
f9ef72f4c6d5
Fix typo: add missing ,
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3517
diff
changeset
|
45 new DefaultModule(FIELD_PLUGIN_FIX, "Fixierungsanalyse"), |
3517
40ddd713d9fd
Hardcode German module translations temporarily
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3515
diff
changeset
|
46 new DefaultModule(FIELD_PLUGIN_MAP, "Neue Karte"), |
3515
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
47 }; |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
48 |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
49 List<Module> modules = new ArrayList<Module>(available.length); |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
50 for(Module module : available) { |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
51 if (user == null || user.canUseFeature("module:" + module.getName())) { |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
52 modules.add(module); |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
53 } |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
54 } |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
55 return modules.toArray(new Module[modules.size()]); |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
56 } |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
57 } |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
58 |
70c0942156ad
Add service to list available modules for a user
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
59 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 tw=80 : |