public class DefaultAlias extends SimpleAmetysObject<DefaultAliasFactory> implements Alias, MovableAmetysObject
DefaultAlias
is a URL redirection to an existing page or a module URLAlias.TargetType
Modifier and Type | Field and Description |
---|---|
static String |
METADATA_CREATED_AT
Constant for origin metadata.
|
static String |
METADATA_EXPIRATION_DATE
Constant for period metadata.
|
static String |
METADATA_TARGET
Constant for target metadata.
|
static String |
METADATA_TYPE
Constant for type metadata.
|
static String |
METADATA_URL
Constant for origin metadata.
|
Constructor and Description |
---|
DefaultAlias(Node node,
String parentPath,
DefaultAliasFactory factory)
Creates a
DefaultAlias . |
Modifier and Type | Method and Description |
---|---|
boolean |
canMoveTo(AmetysObject newParent)
Test if a move can be a success or if it is impossible (e.g.
|
Date |
getCreationDate()
Get the creation date
|
Date |
getExpirationDate()
Get the expiration date
|
String |
getTarget()
Get the target URL
|
Alias.TargetType |
getType()
Retrieves the target type.
|
String |
getUrl()
Get the origin URL
|
void |
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 |
removeExpirationDate()
Remove the expiration date
|
void |
setCreationDate(Date date)
Set the creation date
|
void |
setExpirationDate(Date date)
Set the expiration date
|
void |
setTarget(String url)
Set the target URL
|
void |
setType(Alias.TargetType type)
Set the type.
|
void |
setUrl(String url)
Set the origin URL
|
_getFactory, _invalidateName, _invalidateParentPath, getId, getMetadataHolder, getName, getNode, getParent, getParentPath, getPath, needsSave, remove, rename, revertChanges, saveChanges
equals, hashCode, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
equals, getId, getName, getParent, getParentPath, getPath, hashCode
public static final String METADATA_CREATED_AT
public static final String METADATA_URL
public static final String METADATA_TARGET
public static final String METADATA_TYPE
public static final String METADATA_EXPIRATION_DATE
public DefaultAlias(Node node, String parentPath, DefaultAliasFactory factory)
DefaultAlias
.node
- the node backing this AmetysObject
.parentPath
- the parent path in the Ametys hierarchy.factory
- the DefaultZoneItemFactory
which creates the AmetysObject.public String getUrl() throws AmetysRepositoryException
Alias
getUrl
in interface Alias
AmetysRepositoryException
- if an error occurs.public void setUrl(String url) throws AmetysRepositoryException
Alias
setUrl
in interface Alias
url
- the origin URLAmetysRepositoryException
- if an error occurs.public String getTarget() throws AmetysRepositoryException
Alias
getTarget
in interface Alias
AmetysRepositoryException
- if an error occurs.public void setTarget(String url) throws AmetysRepositoryException
Alias
setTarget
in interface Alias
url
- the target URLAmetysRepositoryException
- if an error occurs.public Date getExpirationDate() throws AmetysRepositoryException
Alias
getExpirationDate
in interface Alias
AmetysRepositoryException
- if an error occurs.public void removeExpirationDate()
Alias
removeExpirationDate
in interface Alias
public void setExpirationDate(Date date) throws AmetysRepositoryException
Alias
setExpirationDate
in interface Alias
date
- the expiration dateAmetysRepositoryException
- if an error occurs.public Alias.TargetType getType() throws AmetysRepositoryException
Alias
getType
in interface Alias
AmetysRepositoryException
- if an error occurs.Alias.TargetType
public void setType(Alias.TargetType type) throws AmetysRepositoryException
Alias
setType
in interface Alias
type
- the type.AmetysRepositoryException
- if an error occurs.Alias.TargetType
public Date getCreationDate() throws AmetysRepositoryException
Alias
getCreationDate
in interface Alias
AmetysRepositoryException
- if an error occurs.public void setCreationDate(Date date) throws AmetysRepositoryException
Alias
setCreationDate
in interface Alias
date
- the date to setAmetysRepositoryException
- if an error occurs.public void orderBefore(AmetysObject siblingObject) throws AmetysRepositoryException
MovableAmetysObject
orderBefore
in interface MovableAmetysObject
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.AmetysRepositoryException
- if an error occurs.public boolean canMoveTo(AmetysObject newParent) throws AmetysRepositoryException
MovableAmetysObject
canMoveTo
in interface MovableAmetysObject
newParent
- See moveTo.AmetysRepositoryException
- if an error occurs.public void moveTo(AmetysObject newParent, boolean renameIfExist) throws AmetysRepositoryException
MovableAmetysObject
moveTo
in interface MovableAmetysObject
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 existAmetysRepositoryException
- if an error occurs.RepositoryIntegrityViolationException
- if a page with the same name already exists.