com.ibm.ram.client
Class RAMFolderArtifact

java.lang.Object
  extended by com.ibm.ram.common.data.Artifact
      extended by com.ibm.ram.common.data.FolderArtifact
          extended by com.ibm.ram.client.RAMFolderArtifact
Direct Known Subclasses:
LocalFolderArtifact

public class RAMFolderArtifact
extends FolderArtifact

Represents a Folder Artifact of an asset. A folder artifact if a collection of children Folder, File, or URL artifacts. LocalFolderArtifact is an instance of a FolderArtifact defined on the local OS. To create a subclass of RAMFolderArtifact, do not directly create a subclass. Instead, use LocalFolderArtifact.

Since:
7.1
Author:
kbauer
See Also:
LocalFolderArtifact

Field Summary
 
Fields inherited from class com.ibm.ram.common.data.Artifact
FILE_DELIM, TYPE_FILE, TYPE_FOLDER, TYPE_URL
 
Constructor Summary
  RAMFolderArtifact(java.lang.String folderName)
          Create a folder artifact to be added to a FolderArtifact of an Asset.
protected RAMFolderArtifact(java.lang.String folderPath, java.lang.String folderName)
          Creates and folder artifact with no children This is usful to create fodler artifacts
 
Method Summary
 void addArtifact(Artifact artifact)
          Add an new artifact as a child of this folder artifact.
 void addArtifact(java.lang.String relativePath, Artifact artifactimpl)
          Add an artifact relative to this folder artifact.
 Artifact[] computeArtifactsAsFlatList(IProgressMonitor monitor)
          Normalize the list of children artifacts as a flat list.
protected  java.lang.String getArtifactFullPath(java.lang.String path, java.lang.String artifactName)
           
 RAMAsset getAsset()
          Return the asset this Artifact belongs to.
 Artifact getChild(java.lang.String path)
          Returns a child artifact from a given path or null if it does not exist
 Artifact[] getChildren()
           
 long getCreationDate()
           
 java.lang.String getLabel()
           
 java.lang.String getName()
          The name of the artifact
 java.lang.String getPath()
          Returns the path to the artifact from the root.
 ArtifactReference getReference()
           
 long getSize()
          The size of the artifact.
 boolean hasChildren()
           
 boolean removeArtifact(Artifact artifact)
          Remove a child artifact.
 boolean removeArtifact(java.lang.String relativePath)
          Remove an artifact relative to this folder artifact paths should have no leading or trailing slashes
 void setAsset(RAMAsset asset)
           
 void setChildren(Artifact[] children)
           
 void setCreationDate(long creationDate)
          The date the artifact was cerated.
 void setLabel(java.lang.String label)
           
 void setName(java.lang.String name)
          The name of the artifact.
 void setPath(java.lang.String path)
          The path to the artifact.
 void setReference(ArtifactReference reference)
           
 void setSize(long size)
          The size of the artifact.
 void setType(java.lang.String type)
          The artifact type.
 
Methods inherited from class com.ibm.ram.common.data.FolderArtifact
getType
 
Methods inherited from class com.ibm.ram.common.data.Artifact
getChecksum, getMimeType, setChecksum, setMimeType, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RAMFolderArtifact

protected RAMFolderArtifact(java.lang.String folderPath,
                            java.lang.String folderName)
Creates and folder artifact with no children This is usful to create fodler artifacts

Since:
7.1

RAMFolderArtifact

public RAMFolderArtifact(java.lang.String folderName)
Create a folder artifact to be added to a FolderArtifact of an Asset. You can than add artifacts to this folder. Use new RAMFolderArtifact(null); if this artifact is going to the the root Artifact of an asset.

Since:
7.1
Method Detail

addArtifact

public void addArtifact(Artifact artifact)
                 throws RAMRuntimeException
Add an new artifact as a child of this folder artifact.

Parameters:
artifact -
Throws:
RAMRuntimeException
Since:
7.1

addArtifact

public void addArtifact(java.lang.String relativePath,
                        Artifact artifactimpl)
Add an artifact relative to this folder artifact. Paths should have no leading or trailing slashes.

Parameters:
relativePath -
artifact -
Since:
7.1

removeArtifact

public boolean removeArtifact(Artifact artifact)
Remove a child artifact.

Parameters:
artifact -
Throws:
RAMRuntimeException
Since:
7.1

removeArtifact

public boolean removeArtifact(java.lang.String relativePath)
Remove an artifact relative to this folder artifact paths should have no leading or trailing slashes

Parameters:
relativePath -
Returns:
true is artifact was found and removed
Since:
7.1

getArtifactFullPath

protected java.lang.String getArtifactFullPath(java.lang.String path,
                                               java.lang.String artifactName)

getChild

public Artifact getChild(java.lang.String path)
Returns a child artifact from a given path or null if it does not exist

Parameters:
path - use / for a delimiter. Do not include a leading or trailing slash.
Since:
7.1

getChildren

public Artifact[] getChildren()
Overrides:
getChildren in class FolderArtifact
Returns:
The list of child artifacts.

hasChildren

public boolean hasChildren()
Overrides:
hasChildren in class FolderArtifact
Returns:
true is the FolderArtifact has child artifacts.

computeArtifactsAsFlatList

public Artifact[] computeArtifactsAsFlatList(IProgressMonitor monitor)
Normalize the list of children artifacts as a flat list.

Parameters:
monitor -
Returns:
Since:
7.1

getPath

public java.lang.String getPath()
Description copied from class: Artifact
Returns the path to the artifact from the root. Path of the root artifact is null. All other path are relative to the artifact root.

Overrides:
getPath in class Artifact

setPath

public void setPath(java.lang.String path)
Description copied from class: Artifact
The path to the artifact. Path of the root artifact is null. All other path are relative to the artifact root.

Overrides:
setPath in class Artifact

getAsset

public RAMAsset getAsset()
Return the asset this Artifact belongs to.

Returns:
the asset
Since:
7.1

setAsset

public void setAsset(RAMAsset asset)

getName

public java.lang.String getName()
Description copied from class: Artifact
The name of the artifact

Overrides:
getName in class Artifact

setName

public void setName(java.lang.String name)
Description copied from class: Artifact
The name of the artifact.

Overrides:
setName in class Artifact

getCreationDate

public long getCreationDate()
Overrides:
getCreationDate in class Artifact
Returns:
Returns the creationDate.

getSize

public long getSize()
Description copied from class: Artifact
The size of the artifact.

Overrides:
getSize in class Artifact

setChildren

public void setChildren(Artifact[] children)
Overrides:
setChildren in class FolderArtifact
Parameters:
children - The list of child artifacts.

getLabel

public java.lang.String getLabel()
Overrides:
getLabel in class Artifact
Returns:
Returns the label.

getReference

public ArtifactReference getReference()
Overrides:
getReference in class Artifact
Returns:
Returns the reference.

setCreationDate

public void setCreationDate(long creationDate)
Description copied from class: Artifact
The date the artifact was cerated.

Overrides:
setCreationDate in class Artifact

setLabel

public void setLabel(java.lang.String label)
Overrides:
setLabel in class Artifact
Parameters:
label - The label to set.

setReference

public void setReference(ArtifactReference reference)
Overrides:
setReference in class Artifact
Parameters:
reference - The reference to set.

setSize

public void setSize(long size)
Description copied from class: Artifact
The size of the artifact.

Overrides:
setSize in class Artifact

setType

public void setType(java.lang.String type)
Description copied from class: Artifact
The artifact type.

Overrides:
setType in class Artifact
See Also:
Artifact.TYPE_FILE, Artifact.TYPE_FOLDER, Artifact.TYPE_URL