comparison flys-client/src/main/java/de/intevation/flys/client/server/FixingsOverviewServiceImpl.java @ 3376:653dd9d7f5d5

FixA: Introduce i18n to overview transformation. flys-client/trunk@5093 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sat, 21 Jul 2012 13:13:21 +0000
parents 96d02c6f44a2
children
comparison
equal deleted inserted replaced
3375:87c0a06743b8 3376:653dd9d7f5d5
56 @Override 56 @Override
57 public FixingsOverviewInfo generateOverview( 57 public FixingsOverviewInfo generateOverview(
58 String locale, 58 String locale,
59 String uuid, 59 String uuid,
60 String filter, 60 String filter,
61 boolean checkboxes, 61 boolean checkboxes,
62 String callback 62 String callback
63 ) 63 )
64 throws ServerException 64 throws ServerException
65 { 65 {
66 log.info("FixingsOverviewServiceImpl.doGet"); 66 log.info("FixingsOverviewServiceImpl.doGet");
67 67
98 if (debug) { 98 if (debug) {
99 log.debug("Result XML: -----------"); 99 log.debug("Result XML: -----------");
100 log.debug(XMLUtils.toString(resultDoc)); 100 log.debug(XMLUtils.toString(resultDoc));
101 } 101 }
102 102
103 FixingsOverviewInfo i = 103 FixingsOverviewInfo i = getInfo(
104 getInfo(resultDoc, uuid, checkboxes, callback); 104 locale, resultDoc, uuid, checkboxes, callback);
105 return i; 105 return i;
106 } 106 }
107 catch (ConnectionException ce) { 107 catch (ConnectionException ce) {
108 log.error(ce); 108 log.error(ce);
109 } 109 }
110 return null; 110 return null;
111 } 111 }
112 112
113 113
114 protected FixingsOverviewInfo getInfo( 114 protected FixingsOverviewInfo getInfo(
115 String locale,
115 Document doc, 116 Document doc,
116 String uuid, 117 String uuid,
117 boolean checkboxes, 118 boolean checkboxes,
118 String callback 119 String callback
119 ) { 120 ) {
121 // TODO: Find a more general solution.
122 locale = locale == null || locale.toLowerCase().startsWith("de")
123 ? "de"
124 : "en";
125
120 InputStream transform = getServletContext() 126 InputStream transform = getServletContext()
121 .getResourceAsStream(XSL_TRANSFORM); 127 .getResourceAsStream(XSL_TRANSFORM);
122 128
123 if (transform == null) { 129 if (transform == null) {
124 log.warn("transform not found"); 130 log.warn("transform not found");
126 } 132 }
127 133
128 String result = null; 134 String result = null;
129 try { 135 try {
130 XSLTransformer xformer = new XSLTransformer(); 136 XSLTransformer xformer = new XSLTransformer();
137 xformer.addParameter("locale", locale);
131 xformer.addParameter("project-uuid", uuid); 138 xformer.addParameter("project-uuid", uuid);
132 xformer.addParameter( 139 xformer.addParameter(
133 "render-checkboxes", 140 "render-checkboxes",
134 checkboxes ? Boolean.TRUE : Boolean.FALSE); 141 checkboxes ? Boolean.TRUE : Boolean.FALSE);
135 xformer.addParameter("callback", callback); 142 xformer.addParameter("callback", callback);
164 log.warn(nfe, nfe); 171 log.warn(nfe, nfe);
165 } 172 }
166 173
167 List<FixEvent> fixEvents = getFixEvents(doc); 174 List<FixEvent> fixEvents = getFixEvents(doc);
168 return new FixingsOverviewInfo( 175 return new FixingsOverviewInfo(
169 rid, 176 rid,
170 river, 177 river,
171 from, 178 from,
172 to, 179 to,
173 fixEvents, 180 fixEvents,
174 result); 181 result);
175 } 182 }
176 183
177 184
178 protected List<FixEvent> getFixEvents(Document doc) { 185 protected List<FixEvent> getFixEvents(Document doc) {
179 List<FixEvent> list = new ArrayList<FixEvent>(); 186 List<FixEvent> list = new ArrayList<FixEvent>();

http://dive4elements.wald.intevation.org