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
ADefaultAliasis 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 Modifier and Type Field Description static StringMETADATA_CREATED_ATConstant for origin metadata.static StringMETADATA_EXPIRATION_DATEConstant for period metadata.static StringMETADATA_TARGETConstant for target metadata.static StringMETADATA_TYPEConstant for type metadata.static StringMETADATA_URLConstant for origin metadata.
-
Constructor Summary
Constructors Constructor Description DefaultAlias(Node node, String parentPath, DefaultAliasFactory factory)Creates aDefaultAlias.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanMoveTo(AmetysObject newParent)Test if a move can be a success or if it is impossible (e.g.DategetCreationDate()Get the creation dateDategetExpirationDate()Get the expiration dateStringgetTarget()Get the target URLAlias.TargetTypegetType()Retrieves the target type.StringgetUrl()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)voidremoveExpirationDate()Remove the expiration datevoidsetCreationDate(Date date)Set the creation datevoidsetExpirationDate(Date date)Set the expiration datevoidsetTarget(String url)Set the target URLvoidsetType(Alias.TargetType type)Set the type.voidsetUrl(String url)Set the origin URL-
Methods 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 Detail
-
METADATA_CREATED_AT
public static final String METADATA_CREATED_AT
Constant for origin metadata.- See Also:
- Constant Field Values
-
METADATA_URL
public static final String METADATA_URL
Constant for origin metadata.- See Also:
- Constant Field Values
-
METADATA_TARGET
public static final String METADATA_TARGET
Constant for target metadata.- See Also:
- Constant Field Values
-
METADATA_TYPE
public static final String METADATA_TYPE
Constant for type metadata.- See Also:
- Constant Field Values
-
METADATA_EXPIRATION_DATE
public static final String METADATA_EXPIRATION_DATE
Constant for period metadata.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultAlias
public DefaultAlias(Node node, String parentPath, DefaultAliasFactory factory)
Creates aDefaultAlias.- Parameters:
node- the node backing thisAmetysObject.parentPath- the parent path in the Ametys hierarchy.factory- theDefaultZoneItemFactorywhich creates the AmetysObject.
-
-
Method Detail
-
getUrl
public String getUrl() throws AmetysRepositoryException
Description copied from interface:AliasGet the origin URL- Specified by:
getUrlin interfaceAlias- Returns:
- the origin URL
- Throws:
AmetysRepositoryException- if an error occurs.
-
setUrl
public void setUrl(String url) throws AmetysRepositoryException
Description copied from interface:AliasSet the origin URL- Specified by:
setUrlin interfaceAlias- Parameters:
url- the origin URL- Throws:
AmetysRepositoryException- if an error occurs.
-
getTarget
public String getTarget() throws AmetysRepositoryException
Description copied from interface:AliasGet the target URL- Specified by:
getTargetin interfaceAlias- Returns:
- the target URL
- Throws:
AmetysRepositoryException- if an error occurs.
-
setTarget
public void setTarget(String url) throws AmetysRepositoryException
Description copied from interface:AliasSet the target URL- Specified by:
setTargetin interfaceAlias- Parameters:
url- the target URL- Throws:
AmetysRepositoryException- if an error occurs.
-
getExpirationDate
public Date getExpirationDate() throws AmetysRepositoryException
Description copied from interface:AliasGet the expiration date- Specified by:
getExpirationDatein interfaceAlias- Returns:
- the expiration date
- Throws:
AmetysRepositoryException- if an error occurs.
-
removeExpirationDate
public void removeExpirationDate()
Description copied from interface:AliasRemove the expiration date- Specified by:
removeExpirationDatein interfaceAlias
-
setExpirationDate
public void setExpirationDate(Date date) throws AmetysRepositoryException
Description copied from interface:AliasSet the expiration date- Specified by:
setExpirationDatein interfaceAlias- Parameters:
date- the expiration date- Throws:
AmetysRepositoryException- if an error occurs.
-
getType
public Alias.TargetType getType() throws AmetysRepositoryException
Description copied from interface:AliasRetrieves the target type.- Specified by:
getTypein interfaceAlias- Returns:
- the type.
- Throws:
AmetysRepositoryException- if an error occurs.- See Also:
Alias.TargetType
-
setType
public void setType(Alias.TargetType type) throws AmetysRepositoryException
Description copied from interface:AliasSet the type.- Specified by:
setTypein interfaceAlias- Parameters:
type- the type.- Throws:
AmetysRepositoryException- if an error occurs.- See Also:
Alias.TargetType
-
getCreationDate
public Date getCreationDate() throws AmetysRepositoryException
Description copied from interface:AliasGet the creation date- Specified by:
getCreationDatein interfaceAlias- Returns:
- the creation date
- Throws:
AmetysRepositoryException- if an error occurs.
-
setCreationDate
public void setCreationDate(Date date) throws AmetysRepositoryException
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
public void orderBefore(AmetysObject siblingObject) throws AmetysRepositoryException
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
public boolean canMoveTo(AmetysObject newParent) throws AmetysRepositoryException
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
public void moveTo(AmetysObject newParent, boolean renameIfExist) throws AmetysRepositoryException
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.
-
-