comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/ReportFacet.java @ 5838:5aa05a7a34b7

Rename modules to more fitting names.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 15:23:37 +0200
parents flys-artifacts/src/main/java/org/dive4elements/river/artifacts/model/ReportFacet.java@bd047b71ab37
children 4897a58c8746
comparison
equal deleted inserted replaced
5837:d9901a08d0a6 5838:5aa05a7a34b7
1 package org.dive4elements.river.artifacts.model;
2
3 import org.dive4elements.artifacts.Artifact;
4 import org.dive4elements.artifacts.CallContext;
5
6 import org.dive4elements.artifactdatabase.state.DefaultFacet;
7 import org.dive4elements.artifactdatabase.state.Facet;
8
9 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
10
11 import org.dive4elements.river.artifacts.FLYSArtifact;
12
13
14 import org.apache.log4j.Logger;
15
16 public class ReportFacet
17 extends DefaultFacet
18 implements FacetTypes
19 {
20 private static Logger logger = Logger.getLogger(ReportFacet.class);
21
22 protected ComputeType type;
23 protected String hash;
24 protected String stateId;
25
26 public ReportFacet() {
27 this(ComputeType.ADVANCE);
28 }
29
30 public ReportFacet(ComputeType type) {
31 super(0, REPORT, "report");
32 this.type = type;
33 }
34
35
36 public ReportFacet(ComputeType type, String hash, String stateId) {
37 super(0, REPORT, "report");
38 this.type = type;
39 this.hash = hash;
40 this.stateId = stateId;
41 }
42
43 public Object getData(Artifact artifact, CallContext context) {
44 logger.debug("get report data");
45
46 FLYSArtifact flys = (FLYSArtifact)artifact;
47
48 CalculationResult cr = (CalculationResult)flys.compute(
49 context, hash, stateId, type, false);
50
51 return cr.getReport();
52 }
53
54 @Override
55 public Facet deepCopy() {
56 ReportFacet copy = new ReportFacet();
57 copy.set(this);
58 copy.type = type;
59 copy.hash = hash;
60 copy.stateId = stateId;
61 return copy;
62 }
63 }
64 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org