View Javadoc

1   package org.lsst.ccs.config;
2   
3   import org.hibernate.annotations.Immutable;
4   
5   import javax.persistence.Entity;
6   import javax.persistence.Id;
7   
8   /**
9    * instances of this class can only be created by the Configuration facade.
10   * They are "zombies" that represent an instance of Parameter descriptions that may be
11   * "dead" or "alive". When a parameter description actually "dies" the end date in the
12   * corresponding Subsystem Description Object is changed to a real date (not STILL_VALID).
13   * These objects are in a separate table in the database their ID is exactly the same as the one
14   * in the living object.
15   * @author bamade
16   */
17  // Date: 10/04/12
18  
19      @Entity
20      @Immutable // change that if EndDate is inserted (changed when object is deprecated)
21      //@Table(name="ParmDescriptionHistory")
22  class GhostParameterDescription extends ParameterDescription {
23      private static final long serialVersionUID = -9140905063378188378L;
24      @Id
25      private long id ; // not generated
26  
27      ///////////////////// CONSTRUCTORS
28  
29  
30      GhostParameterDescription() {
31      }
32  
33      protected GhostParameterDescription(AParameterDescription other) {
34          super(other);
35          //post verification
36          if (0L == this.getId()) {
37              throw new IllegalArgumentException(
38                      "Ghost can be created only from a registered Parameter Description (with generated id)") ;
39          }
40      }
41  
42      ///////////////////////////// ACCESSORS/MUTATORS
43      @Override
44      public long getId() {
45          return id;
46      }
47      @Override
48      protected void setId(long id) {
49          this.id = id ;
50      }
51  }