9062
|
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
|
2 * Software engineering by |
|
3 * Björnsen Beratende Ingenieure GmbH |
|
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt |
|
5 * |
|
6 * This file is Free Software under the GNU AGPL (>=v3) |
|
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
|
8 * documentation coming with Dive4Elements River for details. |
|
9 */ |
|
10 package org.dive4elements.river.client.client.artifacthelper; |
|
11 |
|
12 import org.dive4elements.river.client.shared.model.Artifact; |
|
13 import org.dive4elements.river.client.shared.model.Data; |
|
14 import org.dive4elements.river.client.shared.model.DataList; |
|
15 |
|
16 /** |
|
17 * @author Domenico Nardi Tironi |
|
18 * |
|
19 */ |
|
20 public class ArtifactHelper { |
|
21 |
|
22 private final Artifact artifact; |
|
23 |
|
24 public ArtifactHelper(final Artifact artifact) { |
|
25 this.artifact = artifact; |
|
26 } |
|
27 |
|
28 public Data getOldDataByKey(final String keyLabel) { |
|
29 final DataList[] oldData = this.artifact.getArtifactDescription().getOldData(); |
|
30 for (final DataList dataList : oldData) { |
|
31 for (final Data data : dataList.getAll()) { |
|
32 if (data.getLabel().equals(keyLabel)) { |
|
33 return data; |
|
34 } |
|
35 } |
|
36 } |
|
37 return null; |
|
38 } |
|
39 } |