comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/DataFacet.java @ 1160:efe1b8545f5c

Cosmetics flys-artifacts/trunk@2696 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 12 Sep 2011 09:00:08 +0000
parents 8da5f5a9ed3c
children 70ef5fdc7414
comparison
equal deleted inserted replaced
1159:fb5a7ff9feb8 1160:efe1b8545f5c
15 { 15 {
16 protected ComputeType type; 16 protected ComputeType type;
17 protected String hash; 17 protected String hash;
18 protected String stateId; 18 protected String stateId;
19 19
20
21 /** Trivial constructor. */
20 public DataFacet() { 22 public DataFacet() {
21 } 23 }
22 24
25 /**
26 * Defaults to ADVANCE Compute type.
27 * @param name Name of the facet.
28 * @param description maybe localized description of the facet.
29 */
23 public DataFacet(String name, String description) { 30 public DataFacet(String name, String description) {
24 this(name, description, ComputeType.ADVANCE); 31 this(name, description, ComputeType.ADVANCE);
25 } 32 }
26 33
27 public DataFacet(String name, String description, ComputeType type) { 34 public DataFacet(String name, String description, ComputeType type) {
51 this.type = type; 58 this.type = type;
52 this.hash = hash; 59 this.hash = hash;
53 this.stateId = stateId; 60 this.stateId = stateId;
54 } 61 }
55 62
63
64 /**
65 * Return computation result.
66 */
56 @Override 67 @Override
57 public Object getData(Artifact artifact, CallContext context) { 68 public Object getData(Artifact artifact, CallContext context) {
58 FLYSArtifact flys = (FLYSArtifact)artifact; 69 FLYSArtifact flys = (FLYSArtifact)artifact;
59 String theHash = (hash != null) ? hash : flys.hash(); 70 String theHash = (hash != null) ? hash : flys.hash();
60 71
61 return (stateId != null && stateId.length() > 0) 72 return (stateId != null && stateId.length() > 0)
62 ? flys.compute(context, theHash, stateId, type, false) 73 ? flys.compute(context, theHash, stateId, type, false)
63 : flys.compute(context, theHash, type, false); 74 : flys.compute(context, theHash, type, false);
64 } 75 }
65 76
77
78 /**
79 * Return a deep copy.
80 */
66 @Override 81 @Override
67 public Facet deepCopy() { 82 public Facet deepCopy() {
68 DataFacet copy = new DataFacet(); 83 DataFacet copy = new DataFacet();
69 copy.set(this); 84 copy.set(this);
70 copy.type = type; 85 copy.type = type;

http://dive4elements.wald.intevation.org