annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/ReportFacet.java @ 8870:c26fb37899ca

Introduced groups for modules. Modules marked with the same group-id, will be put together in the ui. Also using now the localization info from the server instead of localizing the modules again on the client side.
author gernotbelger
date Wed, 07 Feb 2018 11:59:13 +0100
parents e4606eae8ea5
children 0a5239a1e46e
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5867
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 2792
diff changeset
9 package org.dive4elements.river.artifacts.model;
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 2792
diff changeset
11 import org.dive4elements.artifacts.Artifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 2792
diff changeset
12 import org.dive4elements.artifacts.CallContext;
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 2792
diff changeset
14 import org.dive4elements.artifactdatabase.state.DefaultFacet;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 2792
diff changeset
15 import org.dive4elements.artifactdatabase.state.Facet;
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 2792
diff changeset
17 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 2792
diff changeset
18
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
19 import org.dive4elements.river.artifacts.D4EArtifact;
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22 import org.apache.log4j.Logger;
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 public class ReportFacet
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 extends DefaultFacet
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26 implements FacetTypes
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27 {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
28 private static Logger log = Logger.getLogger(ReportFacet.class);
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 protected ComputeType type;
929
960dc6328e70 Facets created by the WaterlevelState store information about state's id and artifact's hash value now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 711
diff changeset
31 protected String hash;
960dc6328e70 Facets created by the WaterlevelState store information about state's id and artifact's hash value now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 711
diff changeset
32 protected String stateId;
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 public ReportFacet() {
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 this(ComputeType.ADVANCE);
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 }
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38 public ReportFacet(ComputeType type) {
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39 super(0, REPORT, "report");
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 this.type = type;
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 }
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42
929
960dc6328e70 Facets created by the WaterlevelState store information about state's id and artifact's hash value now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 711
diff changeset
43
960dc6328e70 Facets created by the WaterlevelState store information about state's id and artifact's hash value now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 711
diff changeset
44 public ReportFacet(ComputeType type, String hash, String stateId) {
960dc6328e70 Facets created by the WaterlevelState store information about state's id and artifact's hash value now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 711
diff changeset
45 super(0, REPORT, "report");
960dc6328e70 Facets created by the WaterlevelState store information about state's id and artifact's hash value now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 711
diff changeset
46 this.type = type;
960dc6328e70 Facets created by the WaterlevelState store information about state's id and artifact's hash value now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 711
diff changeset
47 this.hash = hash;
960dc6328e70 Facets created by the WaterlevelState store information about state's id and artifact's hash value now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 711
diff changeset
48 this.stateId = stateId;
960dc6328e70 Facets created by the WaterlevelState store information about state's id and artifact's hash value now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 711
diff changeset
49 }
960dc6328e70 Facets created by the WaterlevelState store information about state's id and artifact's hash value now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 711
diff changeset
50
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
51 public Object getData(Artifact artifact, CallContext context) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
52 log.debug("get report data");
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53
5867
59ff03ff48f1 River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
54 D4EArtifact flys = (D4EArtifact)artifact;
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55
2792
fe987587ebc9 Merged revisions 4539-4540,4543,4545-4546 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1117
diff changeset
56 CalculationResult cr = (CalculationResult)flys.compute(
1117
ea80e652f033 Reordered some parameters in a FLYSArtifact method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1061
diff changeset
57 context, hash, stateId, type, false);
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
58
711
69c8541edcc7 Generate report facets if there are problems with the calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 710
diff changeset
59 return cr.getReport();
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60 }
1061
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
61
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
62 @Override
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
63 public Facet deepCopy() {
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
64 ReportFacet copy = new ReportFacet();
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
65 copy.set(this);
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
66 copy.type = type;
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
67 copy.hash = hash;
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
68 copy.stateId = stateId;
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
69 return copy;
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
70 }
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71 }
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
72 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org