fr.paris.lutece.plugins.jcr.business
Class AbstractRepositoryFile

java.lang.Object
  extended by fr.paris.lutece.plugins.jcr.business.AbstractRepositoryFile
All Implemented Interfaces:
IRepositoryFile
Direct Known Subclasses:
JcrRepositoryFileImpl, VersionFileImpl

public abstract class AbstractRepositoryFile
extends Object
implements IRepositoryFile


Field Summary
static String NODE_TYPE_FILE
           
static String NODE_TYPE_FILE_RESOURCE
           
static String NODE_TYPE_FOLDER
           
static String PATH_SEPARATOR
           
static String RESOURCE_TYPE
           
 
Constructor Summary
AbstractRepositoryFile()
          An empty constructor
 
Method Summary
 boolean equals(Object o)
           
 boolean exists()
          Test the existence of the file
 String getAbsolutePath()
          Get the absolute path
 InputStream getContent()
          Get the content of the file, if it is a file
protected abstract  String getElementName()
           
protected  String getFormattedDate(Calendar date)
           
 String getMimeType()
          Get the Mime type associated with the file content
 String getName()
          Get the name of this file
 String getOwner()
           
 String getParentId()
          Get the parent id of this file
 String getPath()
          Get the path of this file
 String getResourceId()
          Return the resource id
 String getResourceTypeCode()
          Return the resource type
 javax.jcr.Session getSession()
           
 String getXml()
          Get the xml representation of this file
protected abstract  StringBuffer getXmlContent()
           
 int hashCode()
           
 boolean isDirectory()
          Test the type of this file
 boolean isFile()
          Test the type of this file
 boolean isLocked()
          Return true if the current file is locked
 Calendar lastModified()
          Get the date of last modification
 long length()
          Get the length of the file content
 boolean ownsLock()
          Returns if a user owns a lock
 void setAbsolutePath(String absolutePath)
           
 void setContent(InputStream content)
          Set the content of the file
 void setDirectory(boolean isDirectory)
           
 void setExists(boolean exists)
           
 void setFile(boolean isFile)
           
 void setLastModified(Calendar lastModified)
           
 void setLength(long length)
           
 void setLock(boolean bIsLocked)
          Modify lock status
 void setMimeType(String mimeType)
           
 void setName(String strName)
          Set the name of this file
 void setOwner(String strOwner)
           
 void setOwnsLock(boolean bOwnsLock)
           
 void setParentId(String strParentId)
           
 void setPath(String path)
           
 void setResourceId(String strResourceId)
           
 void setSession(javax.jcr.Session session)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PATH_SEPARATOR

public static final String PATH_SEPARATOR
See Also:
Constant Field Values

RESOURCE_TYPE

public static final String RESOURCE_TYPE
See Also:
Constant Field Values

NODE_TYPE_FOLDER

public static final String NODE_TYPE_FOLDER
See Also:
Constant Field Values

NODE_TYPE_FILE

public static final String NODE_TYPE_FILE
See Also:
Constant Field Values

NODE_TYPE_FILE_RESOURCE

public static final String NODE_TYPE_FILE_RESOURCE
See Also:
Constant Field Values
Constructor Detail

AbstractRepositoryFile

public AbstractRepositoryFile()
An empty constructor

Method Detail

exists

public boolean exists()
Description copied from interface: IRepositoryFile
Test the existence of the file

Specified by:
exists in interface IRepositoryFile
Returns:
the _bExists

setExists

public void setExists(boolean exists)
Parameters:
exists - the _bExists to set

isDirectory

public boolean isDirectory()
Description copied from interface: IRepositoryFile
Test the type of this file

Specified by:
isDirectory in interface IRepositoryFile
Returns:
the _bIsDirectory

setDirectory

public void setDirectory(boolean isDirectory)
Parameters:
isDirectory - the _bIsDirectory to set

isFile

public boolean isFile()
Description copied from interface: IRepositoryFile
Test the type of this file

Specified by:
isFile in interface IRepositoryFile
Returns:
the _bIsFile

setFile

public void setFile(boolean isFile)
Parameters:
isFile - the _bIsFile to set

getContent

public InputStream getContent()
Description copied from interface: IRepositoryFile
Get the content of the file, if it is a file

Specified by:
getContent in interface IRepositoryFile
Returns:
the _content

setContent

public void setContent(InputStream content)
Description copied from interface: IRepositoryFile
Set the content of the file

Specified by:
setContent in interface IRepositoryFile
Parameters:
content - the _content to set

getSession

public javax.jcr.Session getSession()
Returns:
the session

setSession

public void setSession(javax.jcr.Session session)
Parameters:
session - the _session to set

getAbsolutePath

public String getAbsolutePath()
Description copied from interface: IRepositoryFile
Get the absolute path

Specified by:
getAbsolutePath in interface IRepositoryFile
Returns:
the _strAbsolutePath

setAbsolutePath

public void setAbsolutePath(String absolutePath)
Parameters:
absolutePath - the _strAbsolutePath to set

getMimeType

public String getMimeType()
Description copied from interface: IRepositoryFile
Get the Mime type associated with the file content

Specified by:
getMimeType in interface IRepositoryFile
Returns:
the _strMimeType

setMimeType

public void setMimeType(String mimeType)
Parameters:
mimeType - the _strMimeType to set

setPath

public void setPath(String path)
Parameters:
path - the _strPath to set

getPath

public String getPath()
Description copied from interface: IRepositoryFile
Get the path of this file

Specified by:
getPath in interface IRepositoryFile
Returns:
the path
See Also:
IRepositoryFile.getPath()

getName

public String getName()
Description copied from interface: IRepositoryFile
Get the name of this file

Specified by:
getName in interface IRepositoryFile
Returns:
the name
See Also:
IRepositoryFile.getName()

lastModified

public Calendar lastModified()
Description copied from interface: IRepositoryFile
Get the date of last modification

Specified by:
lastModified in interface IRepositoryFile
Returns:
the last modified date
See Also:
IRepositoryFile.lastModified()

length

public long length()
Description copied from interface: IRepositoryFile
Get the length of the file content

Specified by:
length in interface IRepositoryFile
Returns:
the file size
See Also:
IRepositoryFile.length()

setLength

public void setLength(long length)
Parameters:
length - the file size

getResourceId

public String getResourceId()
Description copied from interface: IRepositoryFile
Return the resource id

Specified by:
getResourceId in interface IRepositoryFile
Returns:
the resource ID
See Also:
RBACResource.getResourceId()

setResourceId

public void setResourceId(String strResourceId)
Parameters:
strResourceId - the resource ID

getResourceTypeCode

public String getResourceTypeCode()
Description copied from interface: IRepositoryFile
Return the resource type

Specified by:
getResourceTypeCode in interface IRepositoryFile
Returns:
the resource type code
See Also:
RBACResource.getResourceTypeCode()

equals

public boolean equals(Object o)
Overrides:
equals in class Object
Parameters:
o - the object to compare
Returns:
true has same path or same reference as o
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object
Returns:
custom String representation
See Also:
Object.toString()

getXml

public String getXml()
Description copied from interface: IRepositoryFile
Get the xml representation of this file

Specified by:
getXml in interface IRepositoryFile
Returns:
xml representation
See Also:
IRepositoryFile.getXml()

getXmlContent

protected abstract StringBuffer getXmlContent()

setLastModified

public void setLastModified(Calendar lastModified)
Parameters:
lastModified - the date of last modification

getFormattedDate

protected String getFormattedDate(Calendar date)
Parameters:
date - the date to format
Returns:
a formatted date

setName

public void setName(String strName)
Description copied from interface: IRepositoryFile
Set the name of this file

Specified by:
setName in interface IRepositoryFile
Parameters:
strName - the name of the file
See Also:
IRepositoryFile.setName(java.lang.String)

getParentId

public String getParentId()
Description copied from interface: IRepositoryFile
Get the parent id of this file

Specified by:
getParentId in interface IRepositoryFile
Returns:
the parent id or null if it has no parents

setParentId

public void setParentId(String strParentId)

getElementName

protected abstract String getElementName()

isLocked

public boolean isLocked()
Description copied from interface: IRepositoryFile
Return true if the current file is locked

Specified by:
isLocked in interface IRepositoryFile
Returns:
true if the node is locked

setLock

public void setLock(boolean bIsLocked)
Description copied from interface: IRepositoryFile
Modify lock status

Specified by:
setLock in interface IRepositoryFile
Parameters:
bIsLocked - true to set a lock, false otherwise

getOwner

public String getOwner()
Returns:
the _strOwner

setOwner

public void setOwner(String strOwner)
Parameters:
strOwner - the _strOwner to set

ownsLock

public boolean ownsLock()
Description copied from interface: IRepositoryFile
Returns if a user owns a lock

Specified by:
ownsLock in interface IRepositoryFile
Returns:
true if current user owns a lock on this file

setOwnsLock

public void setOwnsLock(boolean bOwnsLock)


Copyright © 2014 Mairie de Paris. All Rights Reserved.