public class DocumentItem
extends java.lang.Object
implements java.io.Serializable
The document item class is used to denote a file, a folder, or a link in the backend repository or file system. It provides the common attributes for the document, including name, item type, and last modified. It also contains special attributes, like link (which is a shortcut or web link if item type is link), and itemKey (which is a unique id/key used in the repository or file system).
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DOC_TYPE_DIR
The item is a folder.
|
static java.lang.String |
DOC_TYPE_FILE
The item is a file.
|
static java.lang.String |
DOC_TYPE_LINK
The item is a link, such as shortcut or web link.
|
Constructor and Description |
---|
DocumentItem()
Default Constructor.
|
DocumentItem(DocumentItem di)
Constructs a document item based on the properties passed in the existing document item.
|
DocumentItem(java.lang.String key, java.lang.String name)
Constructs a document item from a link type document item.
|
DocumentItem(java.lang.String key, java.lang.String name, long lastModified)
Constructs a document item from a folder type document item.
|
DocumentItem(java.lang.String key, java.lang.String name, long size, long lastModified)
Constructs a document item from a file type document item.
|
Modifier and Type | Method and Description |
---|---|
void |
display()
Shows the properties of document item in standard output stream.
|
java.lang.String |
getItemKey()
Retrieves the key/id of the document item.
|
java.lang.String |
getItemLink()
Retrieves the link of the link type document item.
|
long |
getLastModified()
Retrieves the last modified time of the document item.
|
java.lang.String |
getName()
Retrieves the name of the document item.
|
long |
getSize()
Retrieves the size of the document item.
|
java.lang.String |
getType()
Retrieves the type of the document item.
|
boolean |
isDirectory()
Determines if the document item is a folder.
|
boolean |
isFile()
Determines if the document item is a file.
|
boolean |
isLink()
Determines if the document item is a link.
|
void |
setItemKey(java.lang.String key)
Sets the key/id of the document item.
|
void |
setItemLink(java.lang.String link)
Sets the link of a link type document item.
|
void |
setLastModified(long time)
Sets the last modified time of the document item.
|
void |
setName(java.lang.String name)
Sets the name of the document item.
|
void |
setSize(long size)
Sets the size of the document item.
|
void |
setType(java.lang.String type)
Sets the type of the document item.
|
java.lang.String |
toString()
Returns the name of the document item.
|
public static final java.lang.String DOC_TYPE_DIR
public static final java.lang.String DOC_TYPE_FILE
public static final java.lang.String DOC_TYPE_LINK
public DocumentItem()
public DocumentItem(DocumentItem di)
di
- existing document itempublic DocumentItem(java.lang.String key, java.lang.String name)
key
- document item keyname
- document item namepublic DocumentItem(java.lang.String key, java.lang.String name, long lastModified)
key
- document item keyname
- document item namelastModified
- the last modified time, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970)public DocumentItem(java.lang.String key, java.lang.String name, long size, long lastModified)
key
- document item keyname
- document item namesize
- document item size in byteslastModified
- the last modified time, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970)public java.lang.String getName()
public java.lang.String getType()
public long getLastModified()
public long getSize()
public java.lang.String getItemLink()
public java.lang.String getItemKey()
public void setName(java.lang.String name)
name
- document item namepublic void setType(java.lang.String type)
type
- document item typepublic void setSize(long size)
size
- document item sizepublic void setLastModified(long time)
time
- last modified time of document item.public void setItemLink(java.lang.String link)
link
- link of document item.public void setItemKey(java.lang.String key)
key
- key/id of document item.public boolean isDirectory()
public boolean isFile()
public boolean isLink()
public java.lang.String toString()
toString
in class java.lang.Object
public void display()