com.versionone.om
Class Attachment

java.lang.Object
  extended by com.versionone.om.Entity
      extended by com.versionone.om.Attachment

public class Attachment
extends Entity

Represents an attachment in the VersionOne system.


Field Summary
 
Fields inherited from class com.versionone.om.Entity
ASSET_STATE_VALUE, ASSET_VALUE, CHANGE_DATE_UTC, CONTENT_TYPE_VALUE, CONTENT_VALUE, CREATE_DATE_UTC, DELETE_OPERATION, DESCRIPTION_VALUE, FILENAME_VALUE, NAME_VALUE
 
Method Summary
 boolean canDelete()
           
 void delete()
          Deletes the attachment.
 BaseAsset getAsset()
           
 java.lang.String getContentType()
           
 java.lang.String getContentURL()
           
 java.lang.String getDescription()
           
 java.lang.String getFilename()
           
 java.lang.String getName()
           
 IListValueProperty getType()
           
 java.lang.String getURL()
           
 void readFrom(java.io.InputStream input)
          Read the attachment's content from the input stream.
 void setAsset(BaseAsset asset)
           
 void setContentType(java.lang.String contentType)
           
 void setDescription(java.lang.String description)
           
 void setFilename(java.lang.String filename)
           
 void setName(java.lang.String name)
           
 void writeTo(java.io.OutputStream output)
          Write this attachment's content to the output stream.
 
Methods inherited from class com.versionone.om.Entity
equals, get, getChangeComment, getChangeDate, getChangedBy, getCreateComment, getCreateDate, getCreatedBy, getID, getInstance, hashCode, save, save, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getURL

public java.lang.String getURL()
Returns:
URL to VersionOne Detail Page for this Attachment.

getContentURL

public java.lang.String getContentURL()
Returns:
VersionOne URL where the contents of this attachment may be downloaded from.

getAsset

public BaseAsset getAsset()
Returns:
Asset this attachment is related to.

setAsset

public void setAsset(BaseAsset asset)
Parameters:
asset - this attachment is related to.

getDescription

public java.lang.String getDescription()
Returns:
Description of this attachment.

setDescription

public void setDescription(java.lang.String description)
Parameters:
description - of this attachment.

getContentType

public java.lang.String getContentType()
Returns:
Content Type of this attachment.

setContentType

public void setContentType(java.lang.String contentType)
Parameters:
contentType - of this attachment.

getFilename

public java.lang.String getFilename()
Returns:
Filename of this attachment.

setFilename

public void setFilename(java.lang.String filename)
Parameters:
filename - Filename of this attachment.

getName

public java.lang.String getName()
Returns:
Name of this attachment.

setName

public void setName(java.lang.String name)
Parameters:
name - Name of this attachment.

getType

public IListValueProperty getType()
Returns:
Type of this attachment.

writeTo

public void writeTo(java.io.OutputStream output)
             throws ApplicationUnavailableException
Write this attachment's content to the output stream.

Parameters:
output - Stream to write the content to.
Throws:
ApplicationUnavailableException - if coping fails.

readFrom

public void readFrom(java.io.InputStream input)
              throws ApplicationUnavailableException,
                     AttachmentLengthExceededException
Read the attachment's content from the input stream. Set the ContentType and Filename properties before calling this method.

Parameters:
input - Stream to read the content from.
Throws:
ApplicationUnavailableException - if appears any problem with connection to service.
AttachmentLengthExceededException - if attachment is too long.

canDelete

public boolean canDelete()
Returns:
True if the attachment can be deleted.

delete

public void delete()
Deletes the attachment.

Throws:
java.lang.UnsupportedOperationException - The item is an invalid state for the Operation.