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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultAlias(javax.jcr.Node node, String parentPath, DefaultAliasFactory factory) Creates aDefaultAlias. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanMoveTo(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 URLvoidmoveTo(AmetysObject newParent, boolean renameIfExist) Move the current object as a new child of the given object.voidorderBefore(AmetysObject siblingObject) Order a node before another sibling node (or as the last node)voidRemove the expiration datevoidsetCreationDate(Date date) Set the creation datevoidsetExpirationDate(Date date) Set the expiration datevoidSet the target URLvoidsetType(Alias.TargetType type) Set the type.voidSet 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, saveChangesMethods inherited from class org.ametys.plugins.repository.AbstractAmetysObject
equals, hashCode, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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- theDefaultZoneItemFactorywhich creates the AmetysObject.
-
-
Method Details
-
getUrl
Description copied from interface:AliasGet the origin URL- Specified by:
getUrlin interfaceAlias- Returns:
- the origin URL
- Throws:
AmetysRepositoryException- if an error occurs.
-
setUrl
Description copied from interface:AliasSet the origin URL- Specified by:
setUrlin interfaceAlias- Parameters:
url- the origin URL- Throws:
AmetysRepositoryException- if an error occurs.
-
getTarget
Description copied from interface:AliasGet the target URL- Specified by:
getTargetin interfaceAlias- Returns:
- the target URL
- Throws:
AmetysRepositoryException- if an error occurs.
-
setTarget
Description copied from interface:AliasSet the target URL- Specified by:
setTargetin interfaceAlias- Parameters:
url- the target URL- Throws:
AmetysRepositoryException- if an error occurs.
-
getExpirationDate
Description copied from interface:AliasGet the expiration date- Specified by:
getExpirationDatein interfaceAlias- Returns:
- the expiration date
- Throws:
AmetysRepositoryException- if an error occurs.
-
removeExpirationDate
Description copied from interface:AliasRemove the expiration date- Specified by:
removeExpirationDatein interfaceAlias
-
setExpirationDate
Description copied from interface:AliasSet the expiration date- Specified by:
setExpirationDatein interfaceAlias- Parameters:
date- the expiration date- Throws:
AmetysRepositoryException- if an error occurs.
-
getType
Description copied from interface:AliasRetrieves the target type.- Specified by:
getTypein interfaceAlias- Returns:
- the type.
- Throws:
AmetysRepositoryException- if an error occurs.- See Also:
-
setType
Description copied from interface:AliasSet the type.- Specified by:
setTypein interfaceAlias- Parameters:
type- the type.- Throws:
AmetysRepositoryException- if an error occurs.- See Also:
-
getCreationDate
Description copied from interface:AliasGet the creation date- Specified by:
getCreationDatein interfaceAlias- Returns:
- the creation date
- Throws:
AmetysRepositoryException- if an error occurs.
-
setCreationDate
Description copied from interface:AliasSet the creation date- Specified by:
setCreationDatein interfaceAlias- Parameters:
date- the date to set- Throws:
AmetysRepositoryException- if an error occurs.
-
orderBefore
Description copied from interface:MovableAmetysObjectOrder a node before another sibling node (or as the last node)- Specified by:
orderBeforein 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:MovableAmetysObjectTest if a move can be a success or if it is impossible (e.g. due to the implementation of the target)- Specified by:
canMoveToin 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:MovableAmetysObjectMove 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:
moveToin 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.
-