org.exoplatform.clouddrive.ecms.symlink
Class CloudFileSymlink

java.lang.Object
  extended by org.exoplatform.clouddrive.ecms.symlink.CloudFileSymlink

public class CloudFileSymlink
extends Object

Support of Cloud Drive files moving and copying in ECMS. If not a cloud file then this helper return false and the caller code should apply default logic for the file.
Code parts of this class based on original PasteManageComponent and MoveNodeManageComponent (state of ECMS 4.0.4).
Created by The eXo Platform SAS.

Version:
$Id: CloudFileSymlink.java 00000 May 12, 2014 pnedonosko $
Author:
Peter Nedonosko

Field Summary
protected  javax.jcr.Node destNode
           
protected  String destPath
           
protected  String destWorkspace
           
protected  javax.jcr.Node link
           
protected  boolean move
           
protected  Set<javax.jcr.Node> srcNodes
          Set of source nodes for the operation.
protected  org.exoplatform.ecm.webui.component.explorer.UIJCRExplorer uiExplorer
           
 
Constructor Summary
CloudFileSymlink(org.exoplatform.ecm.webui.component.explorer.UIJCRExplorer uiExplorer)
           
 
Method Summary
 CloudFileSymlink addSource(javax.jcr.Node srcNode)
          Add source file (target file).
 CloudFileSymlink addSource(String srcInfo)
          Add source file path (path to target file).
 CloudFileSymlink addSource(String srcWorkspace, String srcPath)
          Add source file by its wokrspace name and path.
 boolean create()
          Create links in destination folder for all added source files.
protected  boolean create(javax.jcr.Node srcNode)
           
 javax.jcr.Node getDestinationNode()
          Node of already set destination or null if not yet set.
 String getDestinationWorkspace()
          Workspace of already set destination or null if not yet set.
 String getDestonationPath()
          Path of already set destination or null if not yet set.
 javax.jcr.Node getLink()
          Return symlink-node created by create() method if it returned true.
protected  javax.jcr.Node getNodeByInfo(String pathInfo)
           
protected  javax.jcr.Node getNodeByPath(String workspace, String path)
           
 CloudFileSymlink move()
          Link behaviour as instead of "move" operation.
 CloudFileSymlink setDestination(javax.jcr.Node destNode)
          Set link destination node.
 CloudFileSymlink setDestination(String destInfo)
          Set path of link destination.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

uiExplorer

protected final org.exoplatform.ecm.webui.component.explorer.UIJCRExplorer uiExplorer

srcNodes

protected final Set<javax.jcr.Node> srcNodes
Set of source nodes for the operation. We rely on proper implementation of Node's hash code and equality to avoid duplicates.


destWorkspace

protected String destWorkspace

destPath

protected String destPath

destNode

protected javax.jcr.Node destNode

link

protected javax.jcr.Node link

move

protected boolean move
Constructor Detail

CloudFileSymlink

public CloudFileSymlink(org.exoplatform.ecm.webui.component.explorer.UIJCRExplorer uiExplorer)
Method Detail

addSource

public CloudFileSymlink addSource(javax.jcr.Node srcNode)
Add source file (target file).

Parameters:
srcNode - Node
Returns:

addSource

public CloudFileSymlink addSource(String srcInfo)
                           throws Exception
Add source file path (path to target file).

Parameters:
srcInfo - String in format of portal request ObjectId, see UIWorkingArea.FILE_EXPLORER_URL_SYNTAX
Returns:
Throws:
Exception - if cannot find node by given path

addSource

public CloudFileSymlink addSource(String srcWorkspace,
                                  String srcPath)
                           throws Exception
Add source file by its wokrspace name and path.

Parameters:
srcWorkspace - String
srcPath - String
Returns:
Throws:
Exception

setDestination

public CloudFileSymlink setDestination(javax.jcr.Node destNode)
                                throws Exception
Set link destination node.

Parameters:
destNode - Node
Returns:
Throws:
Exception

setDestination

public CloudFileSymlink setDestination(String destInfo)
                                throws Exception
Set path of link destination.

Parameters:
destInfo - String in format of portal request ObjectId, see UIWorkingArea.FILE_EXPLORER_URL_SYNTAX
Returns:
Throws:
Exception - if cannot find node by given path or cannot read its metadata

move

public CloudFileSymlink move()
Link behaviour as instead of "move" operation. Behaviour of "copy" by default.

Returns:

getLink

public javax.jcr.Node getLink()
Return symlink-node created by create() method if it returned true. This method has sense only after calling the mentioned method, otherwise this method returns null.

Returns:
the link Node or null if link not yet created or creation wasn't successful.

getDestinationWorkspace

public String getDestinationWorkspace()
Workspace of already set destination or null if not yet set.

Returns:
the destWorkspace String

getDestonationPath

public String getDestonationPath()
Path of already set destination or null if not yet set.

Returns:
the destPath String

getDestinationNode

public javax.jcr.Node getDestinationNode()
Node of already set destination or null if not yet set.

Returns:
the destNode Node

create

public boolean create()
               throws CloudFileSymlinkException,
                      Exception
Create links in destination folder for all added source files. Note that this method doesn't save the session of destination node - this should be done by the caller code to persist the changes.

Returns:
true if at least one, but all added, link(s) created successfully, false otherwise. If nothing added return false also.
Throws:
CloudFileSymlinkException - if link cannot be created logical, this exception will contain detailed message and a internationalized text for WebUI application.
Exception

create

protected boolean create(javax.jcr.Node srcNode)
                  throws CloudFileSymlinkException,
                         Exception
Throws:
CloudFileSymlinkException
Exception

getNodeByInfo

protected javax.jcr.Node getNodeByInfo(String pathInfo)
                                throws Exception
Throws:
Exception

getNodeByPath

protected javax.jcr.Node getNodeByPath(String workspace,
                                       String path)
                                throws Exception
Throws:
Exception


Copyright © 2003–2014 eXo Platform SAS. All rights reserved.