|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.bibalex.daf.entities.phase.PhysicalElement org.bibalex.daf.entities.phase.FolderElement
public class FolderElement
Represents the folder definition within the physical section of a phase.
The FolderElement capabilities are not limited to parsing XML and converting it to an object.
The following are also included:
1) Count the number of the files within the folder. See getFilesCount()
.
2) Copy the folder form a given folder to another. See uploadFolder()
and downloadFolder()
.
3) Get the number of modified files after a given date. See getModifiedFilesCount()
Field Summary | |
---|---|
boolean |
create
The 'Create' property of the element. |
java.lang.String |
mode
The 'Mode' property of the element. |
java.lang.String |
name
The 'Name' property of the element. |
java.lang.String |
newName
The 'NewName' property of the element. |
private java.util.ArrayList<PhysicalElement> |
subElements
The physical elements that are contained within this FolderElement |
boolean |
toDestination
The 'ToDestination' property of the element. |
Constructor Summary | |
---|---|
FolderElement()
Creates a new instance of FolderElement. |
|
FolderElement(org.w3c.dom.Node node)
Creates a new instance of FolderElement. |
|
FolderElement(java.lang.String nodeRep)
Creates a new instance of FolderElement. |
|
FolderElement(java.lang.String name,
boolean toDestination,
java.lang.String newName,
java.lang.String mode,
boolean create)
Creates a new instance of FolderElement. |
Method Summary | |
---|---|
void |
addChild(PhysicalElement element)
Adds the given element to the list of sub-elements. |
private void |
addChildren(org.w3c.dom.Node parent)
Adds the children of the given node to the list of children of this element. |
private void |
createElementFromNode(org.w3c.dom.Node node)
Creates the folder element by supplying its XmlNode represenation. |
boolean |
downloadFolder(java.lang.String source,
java.lang.String destination,
FileHandler handler)
Downloads this folder. |
PhysicalElement[] |
getChildren()
Gets the children contained within this folder. |
int |
getFilesCount(java.lang.String folderPath,
FileHandler handler)
Gets the total number of files within the folder recursively. |
int |
getModifiedFilesCount(java.lang.String path,
FileHandler handler,
java.util.Date startDate)
Gets the number of the files modified after startDate within the given folder. |
FileElement[] |
getSubFiles()
Gets the files defined within this FolderElement. |
FolderElement[] |
getSubFolders()
Gets the folders defined within this FolderElement. |
void |
makeFilesReadOnly(java.lang.String folderPath,
FileHandler handler)
Makes the files within the folder read-only. |
void |
swapNameAndNewName()
Swaps the 'Name' with the 'NewName'. |
private java.lang.String |
tabifyString(java.lang.String in)
Adds tab to each line of the given String. |
java.lang.String |
toString()
Returns the string representation of this object. |
java.lang.String |
toXmlString()
Converts this instance to a valid XML string. |
boolean |
uploadFolder(java.lang.String source,
java.lang.String destination,
FileHandler handler)
Uploads this folder. |
Methods inherited from class org.bibalex.daf.entities.phase.PhysicalElement |
---|
createElement |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public java.lang.String name
public boolean toDestination
public java.lang.String newName
public java.lang.String mode
public boolean create
private java.util.ArrayList<PhysicalElement> subElements
Constructor Detail |
---|
public FolderElement(java.lang.String name, boolean toDestination, java.lang.String newName, java.lang.String mode, boolean create)
name
- The 'Name' property of the element.toDestination
- The 'ToDestination' property of the element.newName
- The 'NewName' property of the element.mode
- The 'Mode' property of the element.create
- The 'Create' property of the element.public FolderElement()
public FolderElement(org.w3c.dom.Node node) throws PhaseDefinitionException
node
- The Xml Node representing this element.
PhaseDefinitionException
- If the node couldn't be parsed.public FolderElement(java.lang.String nodeRep) throws PhaseDefinitionException
nodeRep
- The Xml String representing this element.
PhaseDefinitionException
- If the given String couldn't be parsed.Method Detail |
---|
private void createElementFromNode(org.w3c.dom.Node node) throws PhaseDefinitionException
node
- The Xml Node representing this element.
PhaseDefinitionException
- If the node name is not 'Folder', attributes are missing or couldn't add children.private void addChildren(org.w3c.dom.Node parent) throws PhaseDefinitionException
parent
- The parent node to traverse its children.
PhaseDefinitionException
- If a child couldn't be added.public void addChild(PhysicalElement element)
element
- The element to add.public PhysicalElement[] getChildren()
public FolderElement[] getSubFolders()
public FileElement[] getSubFiles()
public void swapNameAndNewName()
public java.lang.String toString()
toString
in class java.lang.Object
private java.lang.String tabifyString(java.lang.String in)
in
- The input string to tabify.
public java.lang.String toXmlString()
toXmlString
in class PhysicalElement
public void makeFilesReadOnly(java.lang.String folderPath, FileHandler handler)
folderPath
- The parent folder that contains this folder.handler
- The file handler used to make the files read-only.public int getFilesCount(java.lang.String folderPath, FileHandler handler)
folderPath
- The path of the folder to count the files within it.handler
- The FileHanlder used to count the files.
public boolean downloadFolder(java.lang.String source, java.lang.String destination, FileHandler handler)
source
- The parent folder that contains this folder.destination
- The parent folder that will conatin this folder.handler
- The file handler used to downlaod the folder.
public boolean uploadFolder(java.lang.String source, java.lang.String destination, FileHandler handler)
source
- The parent folder that contains this folder.destination
- The parent folder that will conatin this folder.handler
- The file handler used to downlaod the folder.
public int getModifiedFilesCount(java.lang.String path, FileHandler handler, java.util.Date startDate)
path
- The path of the folder containing the folder.handler
- The handler to get the count of folder.startDate
- The date to count the files modified after it. This parameter can be null.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |