Class AbstractComment
java.lang.Object
org.deltava.beans.DatabaseBean
org.deltava.beans.DatabaseBlobBean
org.deltava.beans.AbstractComment
- All Implemented Interfaces:
Serializable, Comparable<Object>, AuthoredBean, IDBean, Cacheable
- Direct Known Subclasses:
CourseComment, IssueComment, IssueComment
A bean to store comments with attachments.
- Since:
- 9.0
- Version:
- 9.0
- Author:
- Luke
- See Also:
-
Field Summary
Fields inherited from class DatabaseBlobBean
_buffer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintintReturns the Author of this bean.getBody()Returns the body text of this Comment.byte[]Returns the file buffer.Returns the creation date of this Comment.Returns the file extension.getName()Returns the name of the attachment.intReturns the parent record's database ID.intgetSize()Returns the size of the attachment.voidsetAuthorID(int id) Updates the author of this bean.voidUpdates the body text of this Comment.voidsetCreatedOn(Instant dt) Updates the creation date of this Comment.voidUpdates the name of the attachment.voidsetParentID(int id) Updates the ID of the parent record.voidsetSize(int size) Updates the size of the attachment.Methods inherited from class DatabaseBlobBean
clear, getInputStream, isLoaded, load, loadModifier and TypeMethodDescriptionvoidclear()Clears the buffer.Returns the content of the buffer.booleanisLoaded()Returns whether the buffer has been populated.voidload(byte[] buffer) Replaces the buffer data.voidload(InputStream is) Loads the contents of a stream into the buffer.Methods inherited from class DatabaseBean
cacheKey, equals, getHexID, getID, hashCode, setID, validateID, validateIDModifier and TypeMethodDescriptioncacheKey()Returns the cache key for this object.booleangetHexID()Returns the hexadecimal database ID of this object.intgetID()Returns the database ID of this object.inthashCode()voidsetID(int id) Update the database row ID of this bean.static voidvalidateID(int oldID, int newID) Validates a database ID.static voidvalidateID(int oldID, int newID, boolean allowZero) Validates a database ID.
-
Constructor Details
-
AbstractComment
public AbstractComment()
-
-
Method Details
-
getBody
-
getSize
public int getSize()Returns the size of the attachment.- Overrides:
getSizein classDatabaseBlobBean- Returns:
- the size in bytes
- See Also:
-
getBuffer
public byte[] getBuffer()Returns the file buffer.- Returns:
- the buffer
- Throws:
IllegalStateException- if not loaded
-
getExtension
Returns the file extension.- Returns:
- the extension, or the file name if none
-
getName
-
getAuthorID
public int getAuthorID()Description copied from interface:AuthoredBeanReturns the Author of this bean.- Specified by:
getAuthorIDin interfaceAuthoredBean- Returns:
- the author's database ID
- See Also:
-
getParentID
public int getParentID()Returns the parent record's database ID.- Returns:
- the ID
- See Also:
-
getCreatedOn
Returns the creation date of this Comment.- Returns:
- the date/time the Comment was created
- See Also:
-
setCreatedOn
Updates the creation date of this Comment.- Parameters:
dt- the date/time the Comment was created- See Also:
-
setBody
Updates the body text of this Comment.- Parameters:
body- the body text- See Also:
-
setName
Updates the name of the attachment.- Parameters:
name- the file name- See Also:
-
setSize
public void setSize(int size) Updates the size of the attachment.- Parameters:
size- the size in bytes- Throws:
IllegalArgumentException- if the attachment has been loaded- See Also:
-
setAuthorID
public void setAuthorID(int id) Description copied from interface:AuthoredBeanUpdates the author of this bean.- Specified by:
setAuthorIDin interfaceAuthoredBean- Parameters:
id- the author's database ID.- See Also:
-
setParentID
public void setParentID(int id) Updates the ID of the parent record.- Parameters:
id- the parent's database record- See Also:
-
compareTo
- Specified by:
compareToin interfaceComparable<Object>- Overrides:
compareToin classDatabaseBean
-