| |
|
| org.tigris.scarab.om.BaseAttachment org.tigris.scarab.om.Attachment
Attachment | public class Attachment extends BaseAttachment implements Persistent(Code) | | 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.
author: John McNally author: Jon S. Stevens version: $Id: Attachment.java 9977 2005-12-09 00:40:59Z hair $ |
COMMENT__PK | final public static Integer COMMENT__PK(Code) | | ObjectKey for a note/comment type attachment
|
FILE__PK | final public static Integer FILE__PK(Code) | | ObjectKey for a file type attachment
|
MODIFICATION__PK | final public static Integer MODIFICATION__PK(Code) | | ObjectKey for a reason for modification type attachment
|
URL__PK | final public static Integer URL__PK(Code) | | ObjectKey for a url type attachment
|
copy | public Attachment copy() throws TorqueException(Code) | | Makes a copy of this object.
It creates a new object filling in the simple attributes.
|
deletePhysicalAttachment | public boolean deletePhysicalAttachment() throws TorqueException, ScarabException(Code) | | Delete the attachment file on disk
true if the file was deleted, false otherwise |
doMakeURLFromData | public String doMakeURLFromData()(Code) | | This is a little method that uses getData() to make a http url
if it isn't already prefixed with "htt://"
|
getActivity | public Activity getActivity() throws TorqueException(Code) | | Retrieves the Activity in which this attachment was created.
|
getFile | public FileItem getFile()(Code) | | There is no reason to reconstruct the FileItem, always returns null.
This is not used, but required by the bean introspector used by intake.
value of file. |
getRelativePath | public String getRelativePath() throws TorqueException, ScarabException(Code) | | The path to an attachment file relative to the base file repository.
Files are saved according to:
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.
|
getRepositoryDirectory | public static String getRepositoryDirectory()(Code) | | Get the repository path info as given in the configuration. if the
path begins with a '/', it is assumed to be absolute. Otherwise
the path is constructed relative to the webapp directory.
|
getSize | public long getSize() throws TorqueException, ScarabException(Code) | | Get the attachment file size. It reads this information from the
FileSystem (this information is not saved into the database)
the number of bytes or -1 if there's some kind of problem throws: TorqueException - |
save | public void save(Connection dbCon) throws TorqueException(Code) | | Calls super.save(Connection) and also checks for a FileItem. if one
exists the file is moved to its final location.
Parameters: dbCon - a DBConnection value exception: TorqueException - if an error occurs |
setConfiguration | protected static void setConfiguration(Configuration configuration)(Code) | | |
setFile | public void setFile(FileItem v)(Code) | | Set the value of file.
Parameters: v - Value to assign to file. |
setFileName | public void setFileName(String name)(Code) | | Makes sure to only save the simple filename which is the part
following the last path separator. This is appended as the last
part of the the path returned by getRelativePath() following the
It would generally be set to original filename as given on the
client that uploaded the file. Spaces are replaced by underscores.
|
setTextFields | public void setTextFields(ScarabUser user, Issue issue, Integer typeId) throws TorqueException(Code) | | Populates fields for a text (non-file) type of attachment.
|
|
|
|