public class DefaultDeleteHelper extends Object implements IDeleteHelper
IDeleteHelper
.
If user suzy
in tenant acme
deletes a file with id testFileId
and named testFile
in folder with id testFolderId
and named testFolder
then this implementation upon a
non-permanent delete will move the file such that the new absolute path and properties of the "deleted" node
will be as follows.
Trash Structure 2
Uses JCR XPath queries for iteration and filtering. File ID nodes exist to prevent same-name sibling conflicts. Original parent folder path stored in property. All delete-related properties stored in file ID node to avoid the need to checkout versioned files when they are deleted. Note that use of JCR XPath queries may require enabling features in the JCR implementation./pentaho/acme/home/suzy/.trash/pho:testFileId/testFile /pentaho/acme/home/suzy/.trash/pho:testFileId/pho:deletedDate (deleted date property) /pentaho/acme/home/suzy/.trash/pho:testFileId/pho:origName (original filename property) /pentaho/acme/home/suzy/.trash/pho:testFileId/pho:origParentFolderPath (original parent folder path property)
Trash Structure 1 (aka legacy)
Uses node iterators andNode.getNodes(String)
when filtering. File ID nodes exist to prevent
same-name sibling conflicts. Original parent folder path derived from folder ID node name. All delete-related
properties stored in file ID node to avoid the need to checkout versioned files when they are deleted.
/pentaho/acme/home/suzy/.trash/pho:testFolderId/pho:testFileId/testFile /pentaho/acme/home/suzy/.trash/pho:testFolderId/pho:testFileId/pho:deletedDate (deleted date property)
Assumptions:
By storing deleted files inside the user's home folder, the user's recycle bin is effectively private. This is desirable because a deleted file with confidential information should not be seen by anyone else except the deleting user.
Modifier and Type | Field and Description |
---|---|
static String |
JCR_ROOT_VERSION |
Constructor and Description |
---|
DefaultDeleteHelper(ILockHelper lockHelper,
IPathConversionHelper pathConversionHelper) |
Modifier and Type | Method and Description |
---|---|
void |
deleteFile(javax.jcr.Session session,
PentahoJcrConstants pentahoJcrConstants,
Serializable fileId)
Deletes a file in a way that it can be recovered.
|
List<org.pentaho.platform.api.repository2.unified.RepositoryFile> |
getAllDeletedFiles(javax.jcr.Session session,
PentahoJcrConstants pentahoJcrConstants)
Lists deleted files for all users.
|
List<org.pentaho.platform.api.repository2.unified.RepositoryFile> |
getDeletedFiles(javax.jcr.Session session,
PentahoJcrConstants pentahoJcrConstants)
Lists deleted files for this user.
|
List<org.pentaho.platform.api.repository2.unified.RepositoryFile> |
getDeletedFiles(javax.jcr.Session session,
PentahoJcrConstants pentahoJcrConstants,
String origParentFolderPath,
String filter)
Lists deleted files for this folder and user.
|
protected String |
getHomePath(org.pentaho.platform.api.mt.ITenant tenant,
String user) |
String |
getOriginalParentFolderPath(javax.jcr.Session session,
PentahoJcrConstants pentahoJcrConstants,
Serializable fileId)
Returns the absolute path of the original parent folder.
|
protected org.pentaho.platform.api.repository2.unified.RepositoryFile |
getReferrerFile(javax.jcr.Session session,
PentahoJcrConstants pentahoJcrConstants,
javax.jcr.Property referrerProperty) |
protected List<String> |
getUserList() |
protected boolean |
isAdmin() |
void |
permanentlyDeleteFile(javax.jcr.Session session,
PentahoJcrConstants pentahoJcrConstants,
Serializable fileId)
Deletes a file in a way that it cannot be recovered.
|
void |
undeleteFile(javax.jcr.Session session,
PentahoJcrConstants pentahoJcrConstants,
Serializable fileId)
Recovers a deleted file to its original location.
|
public static final String JCR_ROOT_VERSION
public DefaultDeleteHelper(ILockHelper lockHelper, IPathConversionHelper pathConversionHelper)
public void deleteFile(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId) throws javax.jcr.RepositoryException
deleteFile
in interface IDeleteHelper
javax.jcr.RepositoryException
public List<org.pentaho.platform.api.repository2.unified.RepositoryFile> getDeletedFiles(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, String origParentFolderPath, String filter) throws javax.jcr.RepositoryException
getDeletedFiles
in interface IDeleteHelper
origParentFolderPath
- path to original parent folderfilter
- filter may be a full name or a partial name with one or more wildcard characters ("*")javax.jcr.RepositoryException
public List<org.pentaho.platform.api.repository2.unified.RepositoryFile> getDeletedFiles(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants) throws javax.jcr.RepositoryException
getDeletedFiles
in interface IDeleteHelper
javax.jcr.RepositoryException
protected boolean isAdmin()
public List<org.pentaho.platform.api.repository2.unified.RepositoryFile> getAllDeletedFiles(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants) throws javax.jcr.RepositoryException
IDeleteHelper
getAllDeletedFiles
in interface IDeleteHelper
javax.jcr.RepositoryException
public void permanentlyDeleteFile(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId) throws javax.jcr.RepositoryException
permanentlyDeleteFile
in interface IDeleteHelper
javax.jcr.RepositoryException
protected org.pentaho.platform.api.repository2.unified.RepositoryFile getReferrerFile(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, javax.jcr.Property referrerProperty) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public void undeleteFile(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId) throws javax.jcr.RepositoryException
undeleteFile
in interface IDeleteHelper
javax.jcr.RepositoryException
public String getOriginalParentFolderPath(javax.jcr.Session session, PentahoJcrConstants pentahoJcrConstants, Serializable fileId) throws javax.jcr.RepositoryException
IDeleteHelper.undeleteFile(Session, PentahoJcrConstants, Serializable)
.getOriginalParentFolderPath
in interface IDeleteHelper
fileId
- file id of deleted filejavax.jcr.RepositoryException
Copyright © 2019 Hitachi Vantara. All rights reserved.