Class FileNameBasedVersionedAttachmentsList
java.lang.Object
com.atlassian.jira.bc.issue.attachment.FileNameBasedVersionedAttachmentsList
- All Implemented Interfaces:
VersionedAttachmentsList
public class FileNameBasedVersionedAttachmentsList
extends Object
implements VersionedAttachmentsList
This implementation wraps a list of attachments and adds the concept of attachment 'versions' by grouping
attachments that have the same filename as versions of the same file.
It stores this 'version' information when constructed by building up a Map
with keys for every
distinct file name in the underlying List
of attachments. Then, each key's value is a
TreeSet
of attachments which have that filename.
- Since:
- v4.2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasList()
Returns the underlying list of attachments.boolean
isLatestVersion
(Attachment attachment) Determines whether the specified attachment is the latest file uploaded amongst the group of files with the same name in the underlying list.
-
Constructor Details
-
FileNameBasedVersionedAttachmentsList
-
-
Method Details
-
asList
Description copied from interface:VersionedAttachmentsList
Returns the underlying list of attachments.- Specified by:
asList
in interfaceVersionedAttachmentsList
- Returns:
- A
List
ofAttachment
.
-
isLatestVersion
Determines whether the specified attachment is the latest file uploaded amongst the group of files with the same name in the underlying list.- Specified by:
isLatestVersion
in interfaceVersionedAttachmentsList
- Parameters:
attachment
- The attachment in play. Should not be null.- Returns:
- true if this is the latest (or only) file with this name; otherwise false.
-