org.pentaho.platform.repository.solution.dbbased
Class RepositoryFile

java.lang.Object
  extended by org.pentaho.platform.repository.solution.dbbased.RepositoryFile
All Implemented Interfaces:
Comparable, IAclHolder, IAclSolutionFile, ISolutionFile, ISearchable

public class RepositoryFile
extends Object
implements ISearchable, Comparable, IAclSolutionFile, ISolutionFile


Field Summary
static char EXTENSION_CHAR
           
 
Fields inherited from interface org.pentaho.platform.api.repository.ISearchable
SEARCH_TYPE_PHRASE, SEARCH_TYPE_WORDS_AND, SEARCH_TYPE_WORDS_OR
 
Fields inherited from interface org.pentaho.platform.api.engine.IAclHolder
ACCESS_TYPE_ADMIN, ACCESS_TYPE_DELETE, ACCESS_TYPE_READ, ACCESS_TYPE_UPDATE, ACCESS_TYPE_WRITE
 
Constructor Summary
RepositoryFile()
           
RepositoryFile(String fileName, RepositoryFile parent, byte[] data)
           
RepositoryFile(String fileName, RepositoryFile parent, byte[] data, long lastModified)
           
 
Method Summary
 void addChildFile(RepositoryFile file)
           
 int compareTo(Object o)
           
 boolean containsActions()
           
 boolean equals(Object other)
           
 boolean exists()
           
 List<IPentahoAclEntry> getAccessControls()
          Returns the ACLs on the existing object.
 Set getChildrenFiles()
          Gets the set children IAclSolutionFiles from this IAclSolutionFile.
 byte[] getData()
           
 List<IPentahoAclEntry> getEffectiveAccessControls()
          Chains up to find the access controls that are in force on this object.
 String getExtension()
           
 String getFileId()
           
 String getFileName()
           
 String getFullPath()
           
 long getLastModified()
           
 RepositoryFile getParent()
           
 String getPhraseSearchQueryName()
           
 int getRevision()
           
 String[] getSearchableColumns()
           
 String getSearchableTable()
           
 String getSolution()
           
 String getSolutionPath()
           
 boolean hasExtension()
           
 int hashCode()
           
 boolean isDirectory()
           
 boolean isRoot()
           
 ISolutionFile[] listFiles()
          If this is a directory, will list all children files/directories for hierarchical navigation.
 ISolutionFile[] listFiles(IFileFilter filter)
           
 RepositoryFile[] listRepositoryFiles()
           
 void removeChildFile(RepositoryFile file)
           
 void resetAccessControls(List<IPentahoAclEntry> acls)
          Replaces existing access controls with a new list of access controls.
 ISolutionFile retrieveParent()
          NOTE: This method is named 'retrieveParent' instead of 'getParent' because the generic ISolutionFile type is not a 'Hibernate' described type and one of the base classes (RepositoryFile) will fail dependency checking.
 void setAccessControls(List<IPentahoAclEntry> acls)
          This method's purpose is to allow Hibernate to initialize the ACLs from the data-store.
 void setChildrenFiles(Set childrenFiles)
           
 void setData(byte[] data)
           
 void setLastModified(long modDate)
           
 void setParent(RepositoryFile parent)
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXTENSION_CHAR

public static final char EXTENSION_CHAR
See Also:
Constant Field Values
Constructor Detail

RepositoryFile

public RepositoryFile()

RepositoryFile

public RepositoryFile(String fileName,
                      RepositoryFile parent,
                      byte[] data)

RepositoryFile

public RepositoryFile(String fileName,
                      RepositoryFile parent,
                      byte[] data,
                      long lastModified)
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object

getAccessControls

public List<IPentahoAclEntry> getAccessControls()
Description copied from interface: IAclHolder
Returns the ACLs on the existing object. Never returns null. If you need to get the effective access controls, you may need to call getEffectiveAccessControls() which will chain up from this object if necessary to find the ACLs that control this object.

Specified by:
getAccessControls in interface IAclHolder
Returns:
List of ACLs for this object only.

setAccessControls

public void setAccessControls(List<IPentahoAclEntry> acls)
This method's purpose is to allow Hibernate to initialize the ACLs from the data-store. Application clients should likely use resetAccessControls.

Specified by:
setAccessControls in interface IAclHolder

resetAccessControls

public void resetAccessControls(List<IPentahoAclEntry> acls)
Description copied from interface: IAclHolder
Replaces existing access controls with a new list of access controls. This method should be used in favor of setting the access controls with setAccessControls when the object is being persisted.

Specified by:
resetAccessControls in interface IAclHolder

getRevision

public int getRevision()

getFileId

public String getFileId()

getSolution

public String getSolution()
Specified by:
getSolution in interface ISolutionFile
Returns:
Name of the solution this file/directory is contained within

getSolutionPath

public String getSolutionPath()
Specified by:
getSolutionPath in interface ISolutionFile
Returns:
path within the solution to the file/directory.

getFileName

public String getFileName()
Specified by:
getFileName in interface ISolutionFile
Returns:
The name of the file/directory

getFullPath

public String getFullPath()
Specified by:
getFullPath in interface ISolutionFile
Returns:
fully qualified path to this file/directory

setParent

public void setParent(RepositoryFile parent)

getParent

public RepositoryFile getParent()

retrieveParent

public ISolutionFile retrieveParent()
Description copied from interface: ISolutionFile
NOTE: This method is named 'retrieveParent' instead of 'getParent' because the generic ISolutionFile type is not a 'Hibernate' described type and one of the base classes (RepositoryFile) will fail dependency checking.

Specified by:
retrieveParent in interface ISolutionFile
Returns:
The parent file for this ISolutionFile

getSearchableColumns

public String[] getSearchableColumns()
Specified by:
getSearchableColumns in interface ISearchable
Returns:
Returns an array of the char/varchar columns that can be searched.

getSearchableTable

public String getSearchableTable()
Specified by:
getSearchableTable in interface ISearchable
Returns:
Returns the name of the hibernated object which will be used in the search.

getPhraseSearchQueryName

public String getPhraseSearchQueryName()
Specified by:
getPhraseSearchQueryName in interface ISearchable
Returns:
Returns the fully-package-qualified name of a named query in the Hibernate Schema that supports a full-text search of all searchable columns. The parameter name for the search term in the query must be :searchTerm or the query will fail.

isDirectory

public boolean isDirectory()
Specified by:
isDirectory in interface ISolutionFile
Returns:
true if the ISolutionFile points to a directory.

getChildrenFiles

public Set getChildrenFiles()
Description copied from interface: IAclSolutionFile
Gets the set children IAclSolutionFiles from this IAclSolutionFile. Each child must be an instance of IAclSolutionFile.

Specified by:
getChildrenFiles in interface IAclSolutionFile
Returns:
Returns the childrenResources.

setChildrenFiles

public void setChildrenFiles(Set childrenFiles)
Parameters:
childrenResources - The childrenResources to set.

addChildFile

public void addChildFile(RepositoryFile file)

removeChildFile

public void removeChildFile(RepositoryFile file)

getData

public byte[] getData()
Specified by:
getData in interface ISolutionFile
Returns:
Returns the data.

setData

public void setData(byte[] data)
Parameters:
data - The data to set.

listFiles

public ISolutionFile[] listFiles(IFileFilter filter)
Specified by:
listFiles in interface ISolutionFile

listFiles

public ISolutionFile[] listFiles()
Description copied from interface: ISolutionFile
If this is a directory, will list all children files/directories for hierarchical navigation.

Specified by:
listFiles in interface ISolutionFile

listRepositoryFiles

public RepositoryFile[] listRepositoryFiles()

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

getLastModified

public long getLastModified()
Specified by:
getLastModified in interface ISolutionFile
Returns:
Returns the modDate.

setLastModified

public void setLastModified(long modDate)
Parameters:
modDate - The modDate to set.

containsActions

public boolean containsActions()

isRoot

public boolean isRoot()
Specified by:
isRoot in interface ISolutionFile
Returns:
true if this is the root solution folder NOTE: This will always return false for a filebased solution

hasExtension

public boolean hasExtension()
Returns:
a boolean indicating if this file has an extension

getExtension

public String getExtension()
Specified by:
getExtension in interface ISolutionFile
Returns:
the extension (including the . seperator) of this file

exists

public boolean exists()
Specified by:
exists in interface ISolutionFile

getEffectiveAccessControls

public List<IPentahoAclEntry> getEffectiveAccessControls()
Chains up to find the access controls that are in force on this object. Could end up chaining all the way to the root.

Note that (1) defining no access control entries of your own and (2) removing all of your access control entries is indistiguishable in the current design. In #1, we chain up because we inherit. But in #2, it might be expected that by explicitly removing all access control entries, the chaining up ends. That is not the case in the current design.

Specified by:
getEffectiveAccessControls in interface IAclHolder
Returns:
List containing all the AclEntry objects