EMMA Coverage Report (generated Sun May 02 20:42:29 CEST 2010)
[all classes][hu.netmind.beankeeper.object.impl]

COVERAGE SUMMARY FOR SOURCE FILE [PersistenceMetaDataImpl.java]

nameclass, %method, %block, %line, %
PersistenceMetaDataImpl.java100% (1/1)75%  (12/16)46%  (42/91)69%  (18/26)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PersistenceMetaDataImpl100% (1/1)75%  (12/16)46%  (42/91)69%  (18/26)
getCreationDate (): Date 0%   (0/1)0%   (0/12)0%   (0/3)
getRegistrationSerial (): Long 0%   (0/1)0%   (0/3)0%   (0/1)
getRemoveDate (): Date 0%   (0/1)0%   (0/12)0%   (0/3)
toString (): String 0%   (0/1)0%   (0/22)0%   (0/1)
PersistenceMetaDataImpl (): void 100% (1/1)100% (3/3)100% (1/1)
getLastCurrentSerial (): Long 100% (1/1)100% (3/3)100% (1/1)
getObjectClass (): Class 100% (1/1)100% (3/3)100% (1/1)
getPersistenceEnd (): Long 100% (1/1)100% (3/3)100% (1/1)
getPersistenceId (): Long 100% (1/1)100% (3/3)100% (1/1)
getPersistenceStart (): Long 100% (1/1)100% (3/3)100% (1/1)
setLastCurrentSerial (Long): void 100% (1/1)100% (4/4)100% (2/2)
setObjectClass (Class): void 100% (1/1)100% (4/4)100% (2/2)
setPersistenceEnd (Long): void 100% (1/1)100% (4/4)100% (2/2)
setPersistenceId (Long): void 100% (1/1)100% (4/4)100% (2/2)
setPersistenceStart (Long): void 100% (1/1)100% (4/4)100% (2/2)
setRegistrationSerial (Long): void 100% (1/1)100% (4/4)100% (2/2)

1/**
2 * Copyright (C) 2008 NetMind Consulting Bt.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 3 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17 */
18 
19package hu.netmind.beankeeper.object.impl;
20 
21import java.io.Serializable;
22import java.util.Date;
23import hu.netmind.beankeeper.object.PersistenceMetaData;
24import hu.netmind.beankeeper.serial.Serial;
25 
26/**
27 * An object of this class represents all persistence related information
28 * about an object, which BeanKeeper is aware of.
29 * @author Brautigam Robert
30 * @version CVS Revision: $Revision$
31 */
32public class PersistenceMetaDataImpl implements PersistenceMetaData
33{
34   private Long persistenceId;
35   private Long persistenceStart;
36   private Long persistenceEnd;
37   private Long registrationSerial;
38   private Long lastCurrentSerial;
39   private Class objectClass;
40 
41   public String toString()
42   {
43      return "[Meta: "+objectClass+":"+persistenceId+" at "+registrationSerial+"]";
44   }
45 
46   /**
47    * Get the creation date of <strong>this version</strong>
48    * of the object. If the object is not yet saved, this
49    * value is null. Only committed creation dates are given.
50    * If the object is saved in a transaction, but the
51    * transaction did not yet commit, then this date will reflect
52    * the last committed creation date of the object (before
53    * the transaction).<br>
54    * Selecting the object later with this date will give
55    * the same version only if this version of the object
56    * lived at least 1 millisecond (it was not deleted
57    * or superseded in that time). If it didn't, then the next
58    * version of the object is selected which lived at least
59    * 1 millisecond.
60    */
61   public Date getCreationDate()
62   {
63      if ( getPersistenceStart() == null )
64         return null;
65      return new Serial(getPersistenceStart()).getDate();
66   }
67 
68   /**
69    * Get the deletion date of <strong>this version</strong>
70    * of the object. If the object was not yet saved, then
71    * this value is null. If the object was not yet deleted,
72    * but it exists in the database, then this date is an extremal
73    * big date. Selecting the object on this date
74    * will select the next version of the object which lived at least
75    * 1 millisecond.
76    */
77   public Date getRemoveDate()
78   {
79      if ( getPersistenceEnd() == null )
80         return null;
81      return new Serial(getPersistenceEnd()).getDate();
82   }
83 
84   /**
85    * Get the persistence id of the object. This id is
86    * available to non-existent objects too, and it does
87    * not ever change. Not if the object does not exist
88    * yet, and not if a new version is saved or the object
89    * is deleted.
90    */
91   public Long getPersistenceId()
92   {
93      return persistenceId;
94   }
95 
96   void setPersistenceId(Long persistenceId)
97   {
98      this.persistenceId=persistenceId;
99   }
100 
101   /**
102    * Get the creation serial number of this version. This is
103    * a unique number based on dates. All versions will have different
104    * serial numbers.
105    */
106   public Long getPersistenceStart()
107   {
108      return persistenceStart;
109   }
110   void setPersistenceStart(Long persistenceStart)
111   {
112      this.persistenceStart=persistenceStart;
113   }
114 
115   /**
116    * Get the end serial. If the object is not deleted, then
117    * this is Long.MAX_VALUE.
118    */
119   public Long getPersistenceEnd()
120   {
121      return persistenceEnd;
122   }
123   void setPersistenceEnd(Long persistenceEnd)
124   {
125      this.persistenceEnd=persistenceEnd;
126   }
127 
128   public Long getRegistrationSerial()
129   {
130      return registrationSerial;
131   }
132   void setRegistrationSerial(Long registrationSerial)
133   {
134      this.registrationSerial=registrationSerial;
135   }
136 
137   public Class getObjectClass()
138   {
139      return objectClass;
140   }
141 
142   void setObjectClass(Class objectClass)
143   {
144      this.objectClass=objectClass;
145   }
146 
147   public Long getLastCurrentSerial()
148   {
149      return lastCurrentSerial;
150   }
151   void setLastCurrentSerial(Long lastCurrentSerial)
152   {
153      this.lastCurrentSerial=lastCurrentSerial;
154   }
155 
156}
157 
158 

[all classes][hu.netmind.beankeeper.object.impl]
EMMA 2.0.5312debian (C) Vladimir Roubtsov