comparison artifacts/src/main/java/org/dive4elements/river/artifacts/services/SedimentLoadInfoService.java @ 8024:963ede7b32bb

Renamed SedimentLoad to SedimentLoadLSData to make place for SedimentLoad in backend.
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 09 Jul 2014 17:33:57 +0200
parents b68798973da2
children 2c21fd1ade39
comparison
equal deleted inserted replaced
8023:f7f86f4e4c8d 8024:963ede7b32bb
16 16
17 import org.dive4elements.artifacts.ArtifactNamespaceContext; 17 import org.dive4elements.artifacts.ArtifactNamespaceContext;
18 import org.dive4elements.artifacts.CallMeta; 18 import org.dive4elements.artifacts.CallMeta;
19 import org.dive4elements.artifacts.GlobalContext; 19 import org.dive4elements.artifacts.GlobalContext;
20 import org.dive4elements.artifacts.common.utils.XMLUtils; 20 import org.dive4elements.artifacts.common.utils.XMLUtils;
21 import org.dive4elements.river.artifacts.model.minfo.SedimentLoad; 21 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadLSData;
22 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadFactory; 22 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadFactory;
23 23
24 24
25 /** Service delivering info about sediment loads. */ 25 /** Service delivering info about sediment loads. */
26 public class SedimentLoadInfoService 26 public class SedimentLoadInfoService
67 catch (NumberFormatException nfe) { 67 catch (NumberFormatException nfe) {
68 logger.warn("Invalid locations. Cannot return sediment loads."); 68 logger.warn("Invalid locations. Cannot return sediment loads.");
69 return XMLUtils.newDocument(); 69 return XMLUtils.newDocument();
70 } 70 }
71 71
72 SedimentLoad[] loads = 72 SedimentLoadLSData[] loads =
73 SedimentLoadFactory.getLoads(river, type, fromD, toD); 73 SedimentLoadFactory.getLoads(river, type, fromD, toD);
74 return buildDocument(loads); 74 return buildDocument(loads);
75 } 75 }
76 76
77 protected Document buildDocument(SedimentLoad[] loads) { 77 protected Document buildDocument(SedimentLoadLSData[] loads) {
78 Document result = XMLUtils.newDocument(); 78 Document result = XMLUtils.newDocument();
79 Element all = result.createElement("sedimentloads"); 79 Element all = result.createElement("sedimentloads");
80 for (SedimentLoad sl : loads) { 80 for (SedimentLoadLSData sl : loads) {
81 Element load = result.createElement("sedimentload"); 81 Element load = result.createElement("sedimentload");
82 load.setAttribute("description", sl.getDescription()); 82 load.setAttribute("description", sl.getDescription());
83 if (sl.isEpoch()) { 83 if (sl.isEpoch()) {
84 Calendar calendarS = Calendar.getInstance(); 84 Calendar calendarS = Calendar.getInstance();
85 calendarS.setTime(sl.getStart()); 85 calendarS.setTime(sl.getStart());

http://dive4elements.wald.intevation.org