org.entityfs.cap.symlink.util
Class SymbolicLinks

java.lang.Object
  extended by org.entityfs.cap.symlink.util.SymbolicLinks

public final class SymbolicLinks
extends Object

This utility class contains static methods for working with SymbolicLink entities.

The methods in this class will use the locking strategy for utility classes described in EntityLock.

Since:
1.0
Author:
Karl Gustafsson
See Also:
SymbolicLink, DCSymbolicLinkUtil
In_jar:
entityfs-symlink

Method Summary
static EntityView getTarget(SymbolicLinkView sl)
          Get the entity referenced by the symbolic link.
static EntityLocation<?> getTargetLocation(SymbolicLinkView sl)
          Get the target location for the symbolic link.
static EntityView getTargetOrNull(SymbolicLinkView sl)
          Get the entity referenced by the symbolic link, or null if there is no an entity in the location referenced by the symbolic link.
static boolean targetExists(SymbolicLinkView sl)
          Check if there is an entity in the symbolic link's target location.
static EntityView unroll(SymbolicLinkView sl)
          See EntityAcceptingEntities.unroll(org.entityfs.EntityAcceptingEntityView) .
static EntityView unrollOrNull(SymbolicLinkView sl)
          See EntityAcceptingEntities.unrollOrNull(org.entityfs.EntityAcceptingEntityView) .
static boolean unrollTargetExists(SymbolicLinkView sl)
          See EntityAcceptingEntities.unrollTargetExists(org.entityfs.EntityAcceptingEntityView) .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getTargetLocation

public static EntityLocation<?> getTargetLocation(SymbolicLinkView sl)
Get the target location for the symbolic link.

Entity locks that this method will acquire (temporarily):

Parameters:
sl - The symbolic link.
Returns:
The target location for the symbolic link.
See Also:
SymbolicLinkView.getTargetLocation()

getTarget

public static EntityView getTarget(SymbolicLinkView sl)
                            throws EntityNotFoundException
Get the entity referenced by the symbolic link. See getTargetOrNull(SymbolicLinkView).

Parameters:
sl - The symbolic link
Returns:
The entity referenced by the symbolic link.
Throws:
EntityNotFoundException - If there is no entity in the location referenced by the symbolic link.

getTargetOrNull

public static EntityView getTargetOrNull(SymbolicLinkView sl)
Get the entity referenced by the symbolic link, or null if there is no an entity in the location referenced by the symbolic link.

If this method is called with a symbolic link view argument, and the referenced entity is ViewCapable, a view of the referenced entity with the same filters as the argument has, is returned.

Entity locks that this method will acquire (temporarily):

Parameters:
sl - The symbolic link.
Returns:
The entity referenced by the symbolic link, or null if there is no entity in the symbolic link target location.

targetExists

public static boolean targetExists(SymbolicLinkView sl)
Check if there is an entity in the symbolic link's target location. See getTargetOrNull(SymbolicLinkView).

Returns:
true if there is an entity in the symbolic link target location, false otherwise.

unroll

public static EntityView unroll(SymbolicLinkView sl)
                         throws EntityNotFoundException,
                                CircularReferenceException
See EntityAcceptingEntities.unroll(org.entityfs.EntityAcceptingEntityView) .

Parameters:
sl - The symbolic link to unroll.
Returns:
The referenced entity. The entity is not a symbolic link.
Throws:
EntityNotFoundException - If there is no entity in the location referenced by the last symbolic link in the chain.
CircularReferenceException - If there is a circular reference in the symbolic link chain.

unrollOrNull

public static EntityView unrollOrNull(SymbolicLinkView sl)
                               throws CircularReferenceException
See EntityAcceptingEntities.unrollOrNull(org.entityfs.EntityAcceptingEntityView) .

Parameters:
sl - The symbolic link to unroll.
Returns:
The referenced entity. The entity is not a symbolic link.
Throws:
CircularReferenceException - If there is a circular reference in the symbolic link chain.

unrollTargetExists

public static boolean unrollTargetExists(SymbolicLinkView sl)
                                  throws CircularReferenceException
See EntityAcceptingEntities.unrollTargetExists(org.entityfs.EntityAcceptingEntityView) .

Parameters:
sl - The symbolic link to investigate.
Returns:
true if the symbolic link can be unrolled to another entity.
Throws:
CircularReferenceException - If there is a circular reference somewhere in the chain of symbolic links.