Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ReportFacet.java @ 1046:0a5eff5511b1
Fixed flys/issue262: Unified user and system datacage template
flys-artifacts/trunk@2508 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 19 Aug 2011 09:48:13 +0000 |
parents | 960dc6328e70 |
children | b1b0a0b61845 |
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; |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 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
|
9 |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.flys.artifacts.WINFOArtifact; |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 |
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 import org.apache.log4j.Logger; |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 public class ReportFacet |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 extends DefaultFacet |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 implements FacetTypes |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 { |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 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
|
20 |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 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
|
22 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
|
23 protected String stateId; |
710
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 public ReportFacet() { |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 this(ComputeType.ADVANCE); |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 } |
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 public ReportFacet(ComputeType type) { |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 super(0, REPORT, "report"); |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 this.type = type; |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 } |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 |
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
|
34 |
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 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
|
36 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
|
37 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
|
38 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
|
39 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
|
40 } |
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 |
710
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 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
|
43 logger.debug("get report data"); |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 WINFOArtifact winfo = (WINFOArtifact)artifact; |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 CalculationResult cr = (CalculationResult)winfo.compute( |
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
|
48 context, stateId, hash, type, false); |
710
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 |
711
69c8541edcc7
Generate report facets if there are problems with the calculations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
710
diff
changeset
|
50 return cr.getReport(); |
710
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 } |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 } |
cded0924193d
Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |