|
Jive Forums API (5.5.20.2-oracle) Developer Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jivesoftware.forum.database.DbAttachment
public class DbAttachment
Database implementation of the Attachment interface. Attachment data can be stored in one of two ways:
Field Summary | |
---|---|
protected static java.lang.String |
INSERT_ATTACHMENT_DATA
|
protected static java.lang.String |
INSERT_ATTACHMENT_DATA_ORACLE
|
Constructor Summary | |
---|---|
DbAttachment()
Constructor for internal use only. |
|
DbAttachment(int objectType,
long objectID,
java.lang.String name,
java.lang.String contentType,
java.io.InputStream data)
|
|
DbAttachment(long attachmentID)
Loads an existing Attachment object. |
|
DbAttachment(long attachmentID,
java.sql.Connection con)
Loads an existing Attachment object. |
Method Summary | |
---|---|
protected void |
delete(java.sql.Connection con)
Deletes the attachment. |
void |
deleteProperty(java.lang.String name)
Deletes an extended property. |
int |
getCachedSize()
Returns the approximate size of the Object in bytes. |
java.lang.String |
getContentType()
Returns the content type of the attachment. |
java.util.Date |
getCreationDate()
Returns the date the attachment was created. |
java.io.InputStream |
getData()
Returns a InputStream for the binary contents of the
attachment. |
long |
getID()
Returns the unique ID of the attachment. |
java.util.Date |
getModificationDate()
Returns the date the attachment was last modified. |
java.lang.String |
getName()
Returns the name of the attachment. |
long |
getObjectID()
Returns the objectID associated with this attachment, or -1 if not associated with a specific object. |
int |
getObjectType()
Returns the object type associated with this attachment. |
java.util.Collection |
getProperties(java.lang.String parentName)
Return all immediate children property values of a parent property as an unmodifiable Collection of String values. |
java.lang.String |
getProperty(java.lang.String name)
Returns an extended property of the attachment. |
java.util.Iterator |
getPropertyNames()
Returns an Iterator for the names of the extended properties. |
long |
getSize()
Returns the size of the attachment in bytes. |
void |
readExternal(java.io.DataInput in)
|
void |
setName(java.lang.String name)
Sets the name of the attachment. |
static void |
setObjectID(long attachmentID,
long objectID,
java.sql.Connection con)
Sets the objectID associated with an attachmentID. |
void |
setProperty(java.lang.String name,
java.lang.String value)
Sets an extended property of the attachment. |
void |
writeExternal(java.io.DataOutput out)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String INSERT_ATTACHMENT_DATA
protected static final java.lang.String INSERT_ATTACHMENT_DATA_ORACLE
Constructor Detail |
---|
public DbAttachment(long attachmentID) throws AttachmentNotFoundException
attachmentID
- the ID of the attachment to load.
AttachmentNotFoundException
- if loading the specified attachment
fails.public DbAttachment(long attachmentID, java.sql.Connection con) throws AttachmentNotFoundException
attachmentID
- the ID of the attachment to load.con
- the database connection to use to load the attachment
AttachmentNotFoundException
- if loading the specified attachment
fails.public DbAttachment(int objectType, long objectID, java.lang.String name, java.lang.String contentType, java.io.InputStream data) throws AttachmentException
AttachmentException
public DbAttachment()
Method Detail |
---|
public long getID()
Attachment
getID
in interface Attachment
public java.lang.String getName()
Attachment
getName
in interface Attachment
public void setName(java.lang.String name) throws UnauthorizedException
Attachment
setName
in interface Attachment
name
- the new name of the attachment.
UnauthorizedException
- if not allowed to modify the attachmentpublic long getSize()
Attachment
getSize
in interface Attachment
public java.lang.String getContentType()
Attachment
getContentType
in interface Attachment
public java.util.Date getCreationDate()
Attachment
getCreationDate
in interface Attachment
public java.util.Date getModificationDate()
Attachment
getModificationDate
in interface Attachment
public java.io.InputStream getData() throws java.io.IOException
Attachment
InputStream
for the binary contents of the
attachment. The stream should be closed after reading the attachment
is completed. The InputStream will already be buffered, so there is no
advantage to using additional buffering.
getData
in interface Attachment
java.io.IOException
- if an error occurs reading the attachment from storage.public java.lang.String getProperty(java.lang.String name)
Attachment
getProperty
in interface Attachment
name
- the name of the property to get.
public java.util.Collection getProperties(java.lang.String parentName)
Attachment
getProperties
in interface Attachment
parentName
- the name of the parent property to return the children for.
public void setProperty(java.lang.String name, java.lang.String value)
Attachment
If the property referenced by name
already exists, its
value will be updated.
setProperty
in interface Attachment
name
- the name of the property to set.value
- the new value for the property.public void deleteProperty(java.lang.String name)
Attachment
name
does not exist, this method will do nothing.
deleteProperty
in interface Attachment
name
- the name of the property to delete.public java.util.Iterator getPropertyNames()
Attachment
getPropertyNames
in interface Attachment
public int getCachedSize()
Cacheable
getCachedSize
in interface Cacheable
public void readExternal(java.io.DataInput in) throws java.io.IOException
readExternal
in interface com.tangosol.io.ExternalizableLite
java.io.IOException
public void writeExternal(java.io.DataOutput out) throws java.io.IOException
writeExternal
in interface com.tangosol.io.ExternalizableLite
java.io.IOException
public int getObjectType()
public long getObjectID()
public static void setObjectID(long attachmentID, long objectID, java.sql.Connection con) throws java.sql.SQLException
attachmentID
- the attachmentID.objectID
- the object ID.con
- the database connection.
java.sql.SQLException
protected void delete(java.sql.Connection con) throws java.sql.SQLException
java.sql.SQLException
|
Jive Forums Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |