View Javadoc
1   // license-header java merge-point
2   //
3   // This file can be safely modified. If deleted it will be regenerated.
4   // Generated by Entity.vsl in andromda-ejb3-cartridge on 08/05/2014 14:24:56.
5   //
6   package org.andromda.timetracker.domain;
7   
8   import java.io.Serializable;
9   import java.util.Date;
10  import java.util.List;
11  import javax.persistence.Entity;
12  import javax.persistence.NamedQuery;
13  import javax.persistence.Table;
14  import javax.persistence.Transient;
15  import org.andromda.timetracker.vo.TimecardSearchCriteriaVO;
16  
17  /**
18   * Autogenerated POJO EJB3 implementation class for Timecard.
19   *
20   * Add any manual implementation within this class.  This class will NOT
21   * be overwritten with incremental changes.
22   *
23   * <p>
24   * TODO: Model Documentation for org.andromda.timetracker.domain.Timecard
25   * </p>
26   *
27   */
28  
29  @Entity
30  @Table(name = "TIMECARD")
31  // Uncomment to enable entity listener for Timecard
32  // @javax.persistence.EntityListeners({TimecardListener.class})
33  // Uncomment to enable caching for Timecard
34  // @org.hibernate.annotations.Cache(usage = org.hibernate.annotations.CacheConcurrencyStrategy.TRANSACTIONAL)
35  @NamedQuery(name = "Timecard.findAll", query = "SELECT t FROM Timecard AS t")
36  public class Timecard
37      extends TimecardEmbeddable
38      implements Comparable<Timecard>
39  {
40      /**
41       * The serial version UID of this class required for serialization.
42       */
43      private static final long serialVersionUID = 7573880213879125840L;
44  
45      // --------------- constructors -----------------
46  
47      /**
48       * Default Timecard constructor
49       */
50      public Timecard()
51      {
52          super();
53      }
54  
55      /**
56       * Implementation for the constructor with all POJO attributes except auto incremented identifiers.
57       * This method sets all POJO fields defined in this/super class to the
58       * values provided by the parameters.
59       * @param status 
60       * @param startDate 
61       * @param comments 
62       */
63      public Timecard(TimecardStatus status, Date startDate, String comments)
64      {
65          super(status, startDate, comments);
66      }
67  
68      /**
69       * Constructor with all POJO attribute values and CMR relations.
70       *
71       * @param status Value for the status property
72       * @param startDate Value for the startDate property
73       * @param comments Value for the comments property
74       * @param submitter Value for the submitter relation role
75       * @param approver Value for the approver relation role
76       */
77      public Timecard(TimecardStatus status, Date startDate, String comments, User submitter, User approver)
78      {
79          super(status, startDate, comments, submitter, approver);
80      }
81  
82      // -------------- Entity Methods -----------------
83  
84      /**
85       * @param criteria 
86       * @return null
87       */
88      @Transient
89      public static List findByCriteria(TimecardSearchCriteriaVO criteria)
90      {
91          // TODO put your implementation here.
92          return null;
93      }
94  
95      // --------------- Lifecycle callbacks -----------------
96      /**
97       * @see Comparable#compareTo
98       */
99      @Override
100     public int compareTo(Timecard o)
101     {
102         int cmp = 0;
103         if (this.getTimecardId() != null)
104         {
105             cmp = this.getTimecardId().compareTo(o.getTimecardId());
106         }
107         else
108         {
109             if (this.getStatus() != null)
110             {
111                 cmp = (cmp != 0 ? cmp : this.getStatus().compareTo(o.getStatus()));
112             }
113             if (this.getStartDate() != null)
114             {
115                 cmp = (cmp != 0 ? cmp : this.getStartDate().compareTo(o.getStartDate()));
116             }
117             if (this.getComments() != null)
118             {
119                 cmp = (cmp != 0 ? cmp : this.getComments().compareTo(o.getComments()));
120             }
121         }
122         return cmp;
123     }
124 }