Package org.ametys.web.alias
Class DefaultAlias
java.lang.Object
org.ametys.plugins.repository.AbstractAmetysObject
org.ametys.plugins.repository.jcr.SimpleAmetysObject<DefaultAliasFactory>
org.ametys.web.alias.DefaultAlias
- All Implemented Interfaces:
AmetysObject
,JCRAmetysObject
,MetadataAwareAmetysObject
,ModifiableMetadataAwareAmetysObject
,ModifiableAmetysObject
,MovableAmetysObject
,RemovableAmetysObject
,Alias
public class DefaultAlias
extends SimpleAmetysObject<DefaultAliasFactory>
implements Alias, MovableAmetysObject
A
DefaultAlias
is a URL redirection to an existing page or a module URL-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ametys.web.alias.Alias
Alias.TargetType
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDefaultAlias
(javax.jcr.Node node, String parentPath, DefaultAliasFactory factory) Creates aDefaultAlias
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canMoveTo
(AmetysObject newParent) Test if a move can be a success or if it is impossible (e.g.Get the creation dateGet the expiration dateGet the target URLgetType()
Retrieves the target type.getUrl()
Get the origin URLvoid
moveTo
(AmetysObject newParent, boolean renameIfExist) Move the current object as a new child of the given object.void
orderBefore
(AmetysObject siblingObject) Order a node before another sibling node (or as the last node)void
Remove the expiration datevoid
setCreationDate
(Date date) Set the creation datevoid
setExpirationDate
(Date date) Set the expiration datevoid
Set the target URLvoid
setType
(Alias.TargetType type) Set the type.void
Set the origin URLMethods inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObject
_getFactory, _invalidateName, _invalidateParentPath, getId, getMetadataHolder, getName, getNode, getParent, getParentPath, getPath, needsSave, remove, rename, revertChanges, saveChanges
Methods inherited from class org.ametys.plugins.repository.AbstractAmetysObject
equals, hashCode, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.ametys.plugins.repository.AmetysObject
equals, getId, getName, getParent, getParentPath, getPath, hashCode
-
Field Details
-
METADATA_CREATED_AT
Constant for origin metadata.- See Also:
-
METADATA_URL
Constant for origin metadata.- See Also:
-
METADATA_TARGET
Constant for target metadata.- See Also:
-
METADATA_TYPE
Constant for type metadata.- See Also:
-
METADATA_EXPIRATION_DATE
Constant for period metadata.- See Also:
-
-
Constructor Details
-
DefaultAlias
Creates aDefaultAlias
.- Parameters:
node
- the node backing thisAmetysObject
.parentPath
- the parent path in the Ametys hierarchy.factory
- theDefaultZoneItemFactory
which creates the AmetysObject.
-
-
Method Details
-
getUrl
Description copied from interface:Alias
Get the origin URL- Specified by:
getUrl
in interfaceAlias
- Returns:
- the origin URL
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setUrl
Description copied from interface:Alias
Set the origin URL- Specified by:
setUrl
in interfaceAlias
- Parameters:
url
- the origin URL- Throws:
AmetysRepositoryException
- if an error occurs.
-
getTarget
Description copied from interface:Alias
Get the target URL- Specified by:
getTarget
in interfaceAlias
- Returns:
- the target URL
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setTarget
Description copied from interface:Alias
Set the target URL- Specified by:
setTarget
in interfaceAlias
- Parameters:
url
- the target URL- Throws:
AmetysRepositoryException
- if an error occurs.
-
getExpirationDate
Description copied from interface:Alias
Get the expiration date- Specified by:
getExpirationDate
in interfaceAlias
- Returns:
- the expiration date
- Throws:
AmetysRepositoryException
- if an error occurs.
-
removeExpirationDate
Description copied from interface:Alias
Remove the expiration date- Specified by:
removeExpirationDate
in interfaceAlias
-
setExpirationDate
Description copied from interface:Alias
Set the expiration date- Specified by:
setExpirationDate
in interfaceAlias
- Parameters:
date
- the expiration date- Throws:
AmetysRepositoryException
- if an error occurs.
-
getType
Description copied from interface:Alias
Retrieves the target type.- Specified by:
getType
in interfaceAlias
- Returns:
- the type.
- Throws:
AmetysRepositoryException
- if an error occurs.- See Also:
-
setType
Description copied from interface:Alias
Set the type.- Specified by:
setType
in interfaceAlias
- Parameters:
type
- the type.- Throws:
AmetysRepositoryException
- if an error occurs.- See Also:
-
getCreationDate
Description copied from interface:Alias
Get the creation date- Specified by:
getCreationDate
in interfaceAlias
- Returns:
- the creation date
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setCreationDate
Description copied from interface:Alias
Set the creation date- Specified by:
setCreationDate
in interfaceAlias
- Parameters:
date
- the date to set- Throws:
AmetysRepositoryException
- if an error occurs.
-
orderBefore
Description copied from interface:MovableAmetysObject
Order a node before another sibling node (or as the last node)- Specified by:
orderBefore
in interfaceMovableAmetysObject
- Parameters:
siblingObject
- The node that will be the next sibling node of the current node. Must have the same parent as the current node. Can be null to set the current node as the last node.- Throws:
AmetysRepositoryException
- if an error occurs.
-
canMoveTo
Description copied from interface:MovableAmetysObject
Test if a move can be a success or if it is impossible (e.g. due to the implementation of the target)- Specified by:
canMoveTo
in interfaceMovableAmetysObject
- Parameters:
newParent
- See moveTo.- Returns:
- true if the move operation may succeed. If false is returned and you call moveTo anyway, you may encontered a RuntimeException (such as UnsupportedOperationException)
- Throws:
AmetysRepositoryException
- if an error occurs.
-
moveTo
Description copied from interface:MovableAmetysObject
Move the current object as a new child of the given object. This node will be the last child. You should call canMoveTo to know if this is a supported operation.- Specified by:
moveTo
in interfaceMovableAmetysObject
- Parameters:
newParent
- The new parent for the current object. Can not be null. Can not be a child of the current node. Must be a TraversableAmetyObject.renameIfExist
- true to rename moved page if a page with same name already exist- Throws:
AmetysRepositoryException
- if an error occurs.RepositoryIntegrityViolationException
- if a page with the same name already exists.
-