annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ReportFacet.java @ 4187:21f4e4b79121

Refactor GaugeDischargeCurveFacet to be able to set a facet name For adding another output of the GaugeDischargeCurveArtifact it is necessary to provide to facet instances with different names. Therefore the GaugeDischargeCurveFacet is extended to set the facet name in the constructor.
author Björn Ricks <bjoern.ricks@intevation.de>
date Fri, 19 Oct 2012 13:25:49 +0200
parents fe987587ebc9
children
rev   line source
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.model;
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import de.intevation.artifacts.Artifact;
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4 import de.intevation.artifacts.CallContext;
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6 import de.intevation.artifactdatabase.state.DefaultFacet;
1061
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
7 import de.intevation.artifactdatabase.state.Facet;
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10
2792
fe987587ebc9 Merged revisions 4539-4540,4543,4545-4546 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1117
diff changeset
11 import de.intevation.flys.artifacts.FLYSArtifact;
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 import org.apache.log4j.Logger;
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16 public class ReportFacet
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 extends DefaultFacet
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18 implements FacetTypes
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 {
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20 private static Logger logger = Logger.getLogger(ReportFacet.class);
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 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
23 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
24 protected String stateId;
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26 public ReportFacet() {
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27 this(ComputeType.ADVANCE);
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28 }
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 public ReportFacet(ComputeType type) {
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 super(0, REPORT, "report");
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32 this.type = type;
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
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
35
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
36 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
37 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
38 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
39 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
40 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
41 }
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
42
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43 public Object getData(Artifact artifact, CallContext context) {
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
44 logger.debug("get report data");
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
45
2792
fe987587ebc9 Merged revisions 4539-4540,4543,4545-4546 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1117
diff changeset
46 FLYSArtifact flys = (FLYSArtifact)artifact;
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
47
2792
fe987587ebc9 Merged revisions 4539-4540,4543,4545-4546 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1117
diff changeset
48 CalculationResult cr = (CalculationResult)flys.compute(
1117
ea80e652f033 Reordered some parameters in a FLYSArtifact method.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1061
diff changeset
49 context, hash, stateId, type, false);
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50
711
69c8541edcc7 Generate report facets if there are problems with the calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 710
diff changeset
51 return cr.getReport();
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
52 }
1061
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
53
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
54 @Override
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
55 public Facet deepCopy() {
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
56 ReportFacet copy = new ReportFacet();
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
57 copy.set(this);
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
58 copy.type = type;
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
59 copy.hash = hash;
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
60 copy.stateId = stateId;
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
61 return copy;
b1b0a0b61845 Made facets cloneable with the right type.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 929
diff changeset
62 }
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
63 }
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
64 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org