comparison gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java @ 706:2659a5b1fa1e

Added a link (and a controller) to toggle between german and english language (issue254). gnv/trunk@970 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 23 Apr 2010 07:55:05 +0000
parents af22fa5567a6
children 0441e78cd900
comparison
equal deleted inserted replaced
705:f550bd27a3f1 706:2659a5b1fa1e
13 import de.intevation.gnv.artifactdatabase.objects.InputParameter; 13 import de.intevation.gnv.artifactdatabase.objects.InputParameter;
14 14
15 import java.util.ArrayList; 15 import java.util.ArrayList;
16 import java.util.Collection; 16 import java.util.Collection;
17 import java.util.Iterator; 17 import java.util.Iterator;
18 import java.util.Locale;
18 import java.util.Map; 19 import java.util.Map;
19 20
20 import javax.servlet.http.HttpServletRequest; 21 import javax.servlet.http.HttpServletRequest;
21 import javax.servlet.http.HttpServletResponse; 22 import javax.servlet.http.HttpServletResponse;
22 23
61 HttpServletResponse response) throws Exception { 62 HttpServletResponse response) throws Exception {
62 log.debug("NextArtifactStepAction.execute"); 63 log.debug("NextArtifactStepAction.execute");
63 SessionModel sm = SessionModelFactory.getInstance() 64 SessionModel sm = SessionModelFactory.getInstance()
64 .getSessionModel(request); 65 .getSessionModel(request);
65 ArtifactDescription ad = sm.getArtifactDescription(); 66 ArtifactDescription ad = sm.getArtifactDescription();
67
68 Locale tmp = sm.getCurrentLocale();
69 Locale locale = tmp != null ? tmp : request.getLocale();
70
66 if (ad != null){ 71 if (ad != null){
67 Collection<String> inputParameter = ad.getInputParameter(); 72 Collection<String> inputParameter = ad.getInputParameter();
68 Collection<InputParameter> ips = null; 73 Collection<InputParameter> ips = null;
69 if (inputParameter != null) { 74 if (inputParameter != null) {
70 ips = new ArrayList<InputParameter>(inputParameter.size()); 75 ips = new ArrayList<InputParameter>(inputParameter.size());
75 InputParameter ip = new DefaultInputParameter(name, values); 80 InputParameter ip = new DefaultInputParameter(name, values);
76 ips.add(ip); 81 ips.add(ip);
77 } 82 }
78 } 83 }
79 ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory 84 ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory
80 .getInstance() 85 .getInstance().getArtifactDatabaseClient(locale);
81 .getArtifactDatabaseClient(getLocale(request)); 86
82 Map outs = ad.getOutputModes(); 87 Map outs = ad.getOutputModes();
83 if (outs == null || outs.isEmpty()) { 88 if (outs == null || outs.isEmpty()) {
84 // TODO: Woher kommt der zu erreichende Status; 89 // TODO: Woher kommt der zu erreichende Status;
85 String target = null; 90 String target = null;
86 if (ad.getReachableStates().size() > 1) { 91 if (ad.getReachableStates().size() > 1) {
101 target, 106 target,
102 ips 107 ips
103 ); 108 );
104 } 109 }
105 catch (ArtifactDatabaseInputException e) { 110 catch (ArtifactDatabaseInputException e) {
106 log.debug("================ CATCH ME ======================");
107 log.debug("===== ERROR MSG: " + e.getMessage());
108 log.error(e, e); 111 log.error(e, e);
109 request.setAttribute( 112 request.setAttribute(
110 CommunicationKeys.REQUEST_EXCEPTION_INPUT_ID, 113 CommunicationKeys.REQUEST_EXCEPTION_INPUT_ID,
111 e.getMessage()); 114 e.getMessage());
112 } 115 }

http://dive4elements.wald.intevation.org