org.silverpeas.attachment.webdav.impl
Class WebdavDocumentRepository

java.lang.Object
  extended by org.silverpeas.attachment.webdav.impl.WebdavDocumentRepository
All Implemented Interfaces:
WebdavRepository

@Named(value="webdavRepository")
public class WebdavDocumentRepository
extends Object
implements WebdavRepository


Constructor Summary
WebdavDocumentRepository()
           
 
Method Summary
protected  javax.jcr.Node addExclusiveFolder(javax.jcr.Node parent, String name)
          Adds a folder node into the repository and removes all others so that it exists only the folder named like specified.
protected  javax.jcr.Node addFile(javax.jcr.Node folder, SimpleDocument attachment)
          Add a file node into the repository
protected  javax.jcr.Node addFolder(javax.jcr.Node parent, String name)
          Add a folder node into the repository
 void createAttachmentNode(javax.jcr.Session session, SimpleDocument attachment)
          Create a new node for the specified attachment so that the file may be accessed through webdav.
 void deleteAttachmentContentNode(javax.jcr.Session session, SimpleDocument attachment, String language)
          Delete the node associated to the specified language content attachment.
 void deleteAttachmentNode(javax.jcr.Session session, SimpleDocument attachment)
          Delete the node associated to the specified attachment.
 String getContentEditionLanguage(javax.jcr.Session session, SimpleDocument attachment)
          Gets the current content edition language of the specified attachment.
 long getContentEditionSize(javax.jcr.Session session, SimpleDocument attachment)
          Gets the current content edition size of the specified attachment.
protected  javax.jcr.Node getDocumentContentLanguageNode(javax.jcr.Session session, SimpleDocument attachment, String language)
          Gets the webdav document content language node from the specified attachment.
protected  javax.jcr.Node getDocumentIdentifierNode(javax.jcr.Session session, SimpleDocument attachment)
          Gets the webdav document identifier node from the specified attachment.
 boolean isNodeLocked(javax.jcr.Session session, SimpleDocument attachment)
          Indicate if the node for the specified attachment is currently locked (for example by Office in the case of a webdav online edition).
 void moveNodeAttachment(javax.jcr.Session session, SimpleDocument attachment, String targetComponentInstanceId)
          Move the specified attachment to the specified component instance id.
 void updateAttachmentBinaryContent(javax.jcr.Session session, SimpleDocument attachment)
          Update the file content of the specified attachment without modifying its metadata.
 void updateNodeAttachment(javax.jcr.Session session, SimpleDocument attachment)
          Update the node using the SimpleDocument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebdavDocumentRepository

public WebdavDocumentRepository()
Method Detail

createAttachmentNode

public void createAttachmentNode(javax.jcr.Session session,
                                 SimpleDocument attachment)
                          throws javax.jcr.RepositoryException,
                                 IOException
Description copied from interface: WebdavRepository
Create a new node for the specified attachment so that the file may be accessed through webdav. For an attachment, it can exist in webdav one, and only one, content language of the attachment.

Specified by:
createAttachmentNode in interface WebdavRepository
Parameters:
session - the JCR session.
attachment - the attachment.
Throws:
javax.jcr.RepositoryException
IOException

updateNodeAttachment

public void updateNodeAttachment(javax.jcr.Session session,
                                 SimpleDocument attachment)
                          throws javax.jcr.RepositoryException,
                                 IOException
Description copied from interface: WebdavRepository
Update the node using the SimpleDocument. For an attachment, it can exist in webdav one, and only one, content language of the attachment.

Specified by:
updateNodeAttachment in interface WebdavRepository
Parameters:
session - the JCR session.
attachment - the attachment.
Throws:
javax.jcr.RepositoryException
IOException

moveNodeAttachment

public void moveNodeAttachment(javax.jcr.Session session,
                               SimpleDocument attachment,
                               String targetComponentInstanceId)
                        throws javax.jcr.RepositoryException,
                               IOException
Description copied from interface: WebdavRepository
Move the specified attachment to the specified component instance id.

Specified by:
moveNodeAttachment in interface WebdavRepository
Parameters:
session - the JCR session.
attachment - the attachment to move to another component instance identifier.
targetComponentInstanceId - the identifier of the target component instance.
Throws:
javax.jcr.RepositoryException
IOException

getDocumentIdentifierNode

protected javax.jcr.Node getDocumentIdentifierNode(javax.jcr.Session session,
                                                   SimpleDocument attachment)
                                            throws javax.jcr.RepositoryException
Gets the webdav document identifier node from the specified attachment.

Parameters:
session - the JCR session.
attachment - the attachment from which the webdav document identifier JCR node is searched.
Returns:
the node if found, null otherwise.
Throws:
javax.jcr.RepositoryException

getDocumentContentLanguageNode

protected javax.jcr.Node getDocumentContentLanguageNode(javax.jcr.Session session,
                                                        SimpleDocument attachment,
                                                        String language)
                                                 throws javax.jcr.RepositoryException
Gets the webdav document content language node from the specified attachment.

Parameters:
session - the JCR session.
attachment - the attachment from which the webdav document content language JCR node is searched.
language - the aimed content language.
Returns:
the node if found, null otherwise.
Throws:
javax.jcr.RepositoryException

deleteAttachmentNode

public void deleteAttachmentNode(javax.jcr.Session session,
                                 SimpleDocument attachment)
                          throws javax.jcr.RepositoryException
Description copied from interface: WebdavRepository
Delete the node associated to the specified attachment. All contents will be removed. If a specific content (language) must be removed, then use WebdavRepository.deleteAttachmentContentNode(Session, SimpleDocument, String) method.

Specified by:
deleteAttachmentNode in interface WebdavRepository
Parameters:
session - the JCR session.
attachment - the attachment.
Throws:
javax.jcr.RepositoryException

deleteAttachmentContentNode

public void deleteAttachmentContentNode(javax.jcr.Session session,
                                        SimpleDocument attachment,
                                        String language)
                                 throws javax.jcr.RepositoryException
Description copied from interface: WebdavRepository
Delete the node associated to the specified language content attachment.

Specified by:
deleteAttachmentContentNode in interface WebdavRepository
Parameters:
session - the JCR session.
attachment - the attachment.
language - the aimed language content to delete.
Throws:
javax.jcr.RepositoryException

isNodeLocked

public boolean isNodeLocked(javax.jcr.Session session,
                            SimpleDocument attachment)
                     throws javax.jcr.RepositoryException
Description copied from interface: WebdavRepository
Indicate if the node for the specified attachment is currently locked (for example by Office in the case of a webdav online edition).

Specified by:
isNodeLocked in interface WebdavRepository
Parameters:
session - the JCR session.
attachment - the attachment.
Returns:
true if the node is locked - false otherwise.
Throws:
javax.jcr.RepositoryException

updateAttachmentBinaryContent

public void updateAttachmentBinaryContent(javax.jcr.Session session,
                                          SimpleDocument attachment)
                                   throws javax.jcr.RepositoryException,
                                          IOException
Description copied from interface: WebdavRepository
Update the file content of the specified attachment without modifying its metadata.

Specified by:
updateAttachmentBinaryContent in interface WebdavRepository
Parameters:
session - the JCR session.
attachment - the attachment for which the file content will be updated with the ralated webdav content.
Throws:
javax.jcr.RepositoryException
IOException

addFolder

protected javax.jcr.Node addFolder(javax.jcr.Node parent,
                                   String name)
                            throws javax.jcr.RepositoryException
Add a folder node into the repository

Parameters:
parent - the parent node
name - the name of the new node
Returns:
the created node.
Throws:
javax.jcr.RepositoryException

addExclusiveFolder

protected javax.jcr.Node addExclusiveFolder(javax.jcr.Node parent,
                                            String name)
                                     throws javax.jcr.RepositoryException
Adds a folder node into the repository and removes all others so that it exists only the folder named like specified. If the folder already exists, the existing is kept and no folder is created, but potential other existing folders are removed.

Parameters:
parent - the parent node
name - the name of the new node
Returns:
the created or already existing node.
Throws:
javax.jcr.RepositoryException

addFile

protected javax.jcr.Node addFile(javax.jcr.Node folder,
                                 SimpleDocument attachment)
                          throws javax.jcr.RepositoryException,
                                 IOException
Add a file node into the repository

Parameters:
folder - the folder node containing the file node.
attachment - the attachment for the file.
Returns:
the created node.
Throws:
javax.jcr.RepositoryException
IOException

getContentEditionLanguage

public String getContentEditionLanguage(javax.jcr.Session session,
                                        SimpleDocument attachment)
                                 throws javax.jcr.RepositoryException
Description copied from interface: WebdavRepository
Gets the current content edition language of the specified attachment. If several webdav document exists (several content languages), then the one which has the highest modified date is taken into account.

Specified by:
getContentEditionLanguage in interface WebdavRepository
Parameters:
session - the JCR session.
attachment - the attachment.
Returns:
the content edition language if the specified attachment exists in the webdav repository, null otherwise.
Throws:
javax.jcr.RepositoryException

getContentEditionSize

public long getContentEditionSize(javax.jcr.Session session,
                                  SimpleDocument attachment)
                           throws javax.jcr.RepositoryException
Description copied from interface: WebdavRepository
Gets the current content edition size of the specified attachment. If several webdav document exists (several content languages), then the one which has the highest modified date is taken into account.

Specified by:
getContentEditionSize in interface WebdavRepository
Parameters:
session - the JCR session.
attachment - the attachment.
Returns:
the content edition size if the specified attachment exists in the webdav repository, -1 otherwise.
Throws:
javax.jcr.RepositoryException


Copyright © 2016 Silverpeas. All Rights Reserved.