Package com.levigo.jadice.server.mail
Class AttachmentDirectory
- java.lang.Object
-
- com.levigo.jadice.server.mail.AttachmentDirectory
-
- All Implemented Interfaces:
Serializable
public class AttachmentDirectory extends Object implements Serializable
A directory that contains hierarchical information about the attachments of an email. Its purpose is to create an XML stream that can be embedded into the cover page of a converted email.All streams — the whole attachments overview, file containers (e.g. zip files) and single files — are all represented by a single instance of this class, but only real physical files (that means all but the whole attachment overview) also contain the reference the
StreamDescriptor
that is associated with the file eachAttachmentDirectory
object represents.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
PROPERTY_KEY
-
Constructor Summary
Constructors Constructor Description AttachmentDirectory()
Constructor for the email rootAttachmentDirectory(StreamDescriptor descriptor, int pageIndex)
Constructor for a file or a file container (e.g.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHierarchy(Stack<StreamDescriptor> stack, int pageIndex)
Add another hierarchy of "files containing files" into thisAttachmentDirectory
here.String
getFilename()
int
getPageIndex()
StreamDescriptor
getStreamDescriptor()
List<AttachmentDirectory>
getSubDirectories()
Contains an unmodifiable view of all files that are contained in the file that is represented by this object here.String
getType()
The MIME type of the file represented by this object.boolean
isEmpty()
-
-
-
Field Detail
-
PROPERTY_KEY
public static String PROPERTY_KEY
-
-
Constructor Detail
-
AttachmentDirectory
public AttachmentDirectory()
Constructor for the email root
-
AttachmentDirectory
public AttachmentDirectory(StreamDescriptor descriptor, int pageIndex)
Constructor for a file or a file container (e.g. ZIP file)- Parameters:
descriptor
- The file'sStreamDescriptor
pageIndex
- the index on which page this file is located (or-1
if counting was not possible / required)
-
-
Method Detail
-
getFilename
public String getFilename()
- Returns:
- The filename of the file represented by this object.
-
getType
public String getType()
The MIME type of the file represented by this object.- Returns:
- the MIME type of the file represented by this object
-
getStreamDescriptor
public StreamDescriptor getStreamDescriptor()
- Returns:
- The
StreamDescriptor
of the file represented by this object.
-
getPageIndex
public int getPageIndex()
- Returns:
- The index on which page this attachment is located (i.e. the sum of all 'previous'
pages + 1). Can be
-1
if attachment counting was not possible / performed.
-
getSubDirectories
public List<AttachmentDirectory> getSubDirectories()
Contains an unmodifiable view of all files that are contained in the file that is represented by this object here. (Only not empty if $this represents the root of the mail or is a file container like a ZIP file)- Returns:
- the subDirectories
-
isEmpty
public boolean isEmpty()
- Returns:
- true iff there are not files contained inside the file that is represented by this object. false iff this represents a single file.
-
addHierarchy
public void addHierarchy(Stack<StreamDescriptor> stack, int pageIndex)
Add another hierarchy of "files containing files" into thisAttachmentDirectory
here. The topmost element from the stack must also be the topmost element in the hierarchy. All sub-hierarchies (-> subfolders) will be generated automatically. If the stack contains theStreamDescriptor
that is associated with this object, all elements above in the stack will be ignored.- Parameters:
stack
- contains a path to the file to insert in the attachment hierarchypageIndex
- the index of the file to insert. Value-1
indicates that page counting either not required or not possible
-
-