|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.torque.om.BaseObject
org.tigris.scarab.om.BaseAttachment
org.tigris.scarab.om.Attachment
Attachments contain data associated with an issue. It used to be that an issue could have multiple attachments of a given type but only one value for a given Attribute. Attributes are now multi-valued, so the difference is blurred in some cases. A comment given as a reason for a modification to attribute values is considered an Attachment. Notes and urls are also considered attachments, though these two could probably be implemented as attributes (with some ui redesign). The obvious form of attachment is a file uploaded and associated with an issue, such as a screenshot showing an error or a patch.
| Field Summary | |
static java.lang.Integer |
COMMENT__PK
ObjectKey for a note/comment type attachment |
static java.lang.Integer |
FILE__PK
ObjectKey for a file type attachment |
static java.lang.Integer |
MODIFICATION__PK
ObjectKey for a reason for modification type attachment |
static java.lang.Integer |
URL__PK
ObjectKey for a url type attachment |
| Fields inherited from class org.tigris.scarab.om.BaseAttachment |
collActivitys, collActivitySets |
| Fields inherited from class org.apache.torque.om.BaseObject |
NEW_ID |
| Constructor Summary | |
Attachment()
|
|
| Method Summary | |
Attachment |
copy()
Makes a copy of this object. |
void |
copyFileFromTo(java.lang.String from,
java.lang.String path)
|
void |
copyFileTo(java.lang.String path)
|
boolean |
deletePhysicalAttachment()
Delete the attachment file on disk |
java.lang.String |
doMakeURLFromData()
This is a little method that uses getData() to make a http url if it isn't already prefixed with "htt://" |
Activity |
getActivity()
Retrieves the Activity in which this attachment was created. |
org.apache.commons.fileupload.FileItem |
getFile()
There is no reason to reconstruct the FileItem, always returns null. |
java.lang.String |
getFullPath()
|
java.lang.String |
getRelativePath()
The path to an attachment file relative to the base file repository. |
static java.lang.String |
getRepositoryDirectory()
Get the repository path info as given in the configuration. |
long |
getSize()
Get the attachment file size. |
void |
save(java.sql.Connection dbCon)
Calls super.save(Connection) and also checks for a FileItem. |
protected static void |
setConfiguration(org.apache.commons.configuration.Configuration configuration)
|
void |
setFile(org.apache.commons.fileupload.FileItem v)
Set the value of file. |
void |
setFileName(java.lang.String name)
Makes sure to only save the simple filename which is the part following the last path separator. |
void |
setTextFields(ScarabUser user,
Issue issue,
java.lang.Integer typeId)
Populates fields for a text (non-file) type of attachment. |
| Methods inherited from class org.apache.torque.om.BaseObject |
equals, equals, getLog, hashCode, isModified, isNew, resetModified, setModified, setNew, setPrimaryKey |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.apache.torque.om.Persistent |
getPrimaryKey, isModified, isNew, save, save, setModified, setNew, setPrimaryKey, setPrimaryKey |
| Field Detail |
public static final java.lang.Integer FILE__PK
public static final java.lang.Integer COMMENT__PK
public static final java.lang.Integer URL__PK
public static final java.lang.Integer MODIFICATION__PK
| Constructor Detail |
public Attachment()
| Method Detail |
public void setFileName(java.lang.String name)
setFileName in class BaseAttachmentname - new valuepublic org.apache.commons.fileupload.FileItem getFile()
public void setFile(org.apache.commons.fileupload.FileItem v)
v - Value to assign to file.
public void setTextFields(ScarabUser user,
Issue issue,
java.lang.Integer typeId)
throws org.apache.torque.TorqueException
org.apache.torque.TorqueExceptionpublic java.lang.String doMakeURLFromData()
public void save(java.sql.Connection dbCon)
throws org.apache.torque.TorqueException
save in interface org.apache.torque.om.Persistentsave in class BaseAttachmentdbCon - a DBConnection value
org.apache.torque.TorqueException - if an error occurs
public boolean deletePhysicalAttachment()
throws org.apache.torque.TorqueException,
ScarabException
org.apache.torque.TorqueException
ScarabException
public java.lang.String getRelativePath()
throws org.apache.torque.TorqueException,
ScarabException
moduleId/(issue_IdCount/1000)/issueID_attID_filename
where moduleId and attId are primary keys of the related module and
this attachment. issueID is the unique id generally used to specify
the issue within the ui. issue_IdCount is the numerical suffix of
the unique id. So if the pk of module PACS is 201 and this attachment
pk is 123 the path would be: 201/0/PACS5_123_diff.txt or if the issue
count were higher: 201/2/PACS2115_123_diff.txt. The first two
directories are used to keep the number of files per directory
reasonable while the issue unique id and the final textual filename
allow someone browsing the file system to be better able to pick
out relevant files.
org.apache.torque.TorqueException
ScarabException
public java.lang.String getFullPath()
throws org.apache.torque.TorqueException,
ScarabException
getRelativePath(), returns null getRelativePath() does.
org.apache.torque.TorqueException
ScarabExceptionpublic static java.lang.String getRepositoryDirectory()
protected static void setConfiguration(org.apache.commons.configuration.Configuration configuration)
public void copyFileTo(java.lang.String path)
throws org.apache.torque.TorqueException,
ScarabException,
java.io.FileNotFoundException,
java.io.IOException
org.apache.torque.TorqueException
ScarabException
java.io.FileNotFoundException
java.io.IOException
public long getSize()
throws org.apache.torque.TorqueException,
ScarabException
org.apache.torque.TorqueException
ScarabException
public void copyFileFromTo(java.lang.String from,
java.lang.String path)
throws org.apache.torque.TorqueException,
java.io.FileNotFoundException,
java.io.IOException
org.apache.torque.TorqueException
java.io.FileNotFoundException
java.io.IOException
public Attachment copy()
throws org.apache.torque.TorqueException
copy in class BaseAttachmentorg.apache.torque.TorqueException
public Activity getActivity()
throws org.apache.torque.TorqueException
org.apache.torque.TorqueException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||