Class DatabaseBean
java.lang.Object
org.deltava.beans.DatabaseBean
- All Implemented Interfaces:
Serializable
,Comparable<Object>
,IDBean
,Cacheable
- Direct Known Subclasses:
ACARSLogEntry
,ACARSMapEntry
,Accomplishment
,AddressValidation
,ApplicantData
,ArchivedRoute
,ArchiveMetadata
,AssignmentInfo
,BriefingPackage
,Certificate
,CertificationRequirement
,CharterRequest
,Comment
,Course
,DatabaseBlobBean
,DispatchLogEntry
,DispatchScheduleEntry
,DispatchStatistics
,EliteLifetimeStatus
,EliteStatus
,EMailDelivery
,Feedback
,Flight
,FlightEliteScore
,FlightHistoryEntry
,FlightRoute
,FrameRates
,IMAPConfiguration
,InactivityPurge
,InstructionBusy
,InstructionFlight
,InstructionSession
,IPLocation
,Issue
,Issue
,JobPosting
,LandingStatistics
,LinkedImage
,LoginAddress
,MembershipTotals
,Message
,MessageThread
,Nomination
,NominationComment
,PollOption
,PollVote
,PushEndpoint
,Resource
,Route
,Signup
,StatusUpdate
,SystemInformation
,TakeoffLanding
,Test
,ThreadNotifications
,ThreadUpdate
,TouchdownData
,TransferRequest
,UserData
,Warning
,YearlyTotal
A common abstract class for beans stored in the database with a numeric primary key.
- Since:
- 1.0
- Version:
- 11.0
- Author:
- Luke
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncacheKey()
Returns the cache key for this object.int
boolean
getHexID()
Returns the hexadecimal database ID of this object.int
getID()
Returns the database ID of this object.int
hashCode()
void
setID
(int id) Update the database row ID of this bean.static void
validateID
(int oldID, int newID) Validates a database ID.static void
validateID
(int oldID, int newID, boolean allowZero) Validates a database ID.
-
Constructor Details
-
DatabaseBean
public DatabaseBean()
-
-
Method Details
-
getID
-
getHexID
-
setID
public void setID(int id) Update the database row ID of this bean. This typically will only be called by a DAO- Parameters:
id
- The primary key of the entry in the database that corresponds to this object.- Throws:
IllegalArgumentException
- if the database ID is negativeIllegalStateException
- if we are attempting to change the database ID- See Also:
-
validateID
public static void validateID(int oldID, int newID) throws IllegalArgumentException, IllegalStateException Validates a database ID. Used to enforce database ID behavior - that the ID cannot be zero or negative, and it cannot be updated once set.- Parameters:
oldID
- the old database IDnewID
- the new database ID- Throws:
IllegalArgumentException
- if the database ID is negative or zeroIllegalStateException
- if we are attempting to change the database ID
-
validateID
public static void validateID(int oldID, int newID, boolean allowZero) throws IllegalArgumentException, IllegalStateException Validates a database ID. Used to enforce database ID behavior - that the ID cannot be zero or negative, and it cannot be updated once set.- Parameters:
oldID
- the old database IDnewID
- the new database IDallowZero
- TRUE to allow setting the ID to zero, otherwise FALSE- Throws:
IllegalArgumentException
- if the database ID is negative (or zero if allowZero is FALSE)IllegalStateException
- if we are attempting to change the database ID
-
equals
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Object>
-
cacheKey
-
hashCode
-