public class DefaultLink extends DefaultTraversableAmetysObject<DefaultLinkFactory> implements Link, SiteAwareAmetysObject, MovableAmetysObject
Link.LinkType
Modifier and Type | Field and Description |
---|---|
static String |
NODE_NAME_GRANTED_GROUP
Constant for granted-group node.
|
static String |
NODE_NAME_GRANTED_GROUPS
Constant for granted-groups node.
|
static String |
NODE_NAME_GRANTED_USER
Constant for granted-users node.
|
static String |
NODE_NAME_GRANTED_USERS
Constant for granted-users node.
|
static String |
PROPERTY_CONTENT
Constant for title property.
|
static String |
PROPERTY_DYNAMIC_INFO_PROVIDER
Constant for id of provider of dynamic information.
|
static String |
PROPERTY_GRANT_ANY_USER
Constant for grant-any-user property.
|
static String |
PROPERTY_INTERNAL_URL
Constant for internal URL property.
|
static String |
PROPERTY_PICTURE
Constant for picture data property.
|
static String |
PROPERTY_PICTURE_ALTERNATIVE
Constant for picture alternative property.
|
static String |
PROPERTY_PICTURE_GLYPH
Constant for picture glyph property.
|
static String |
PROPERTY_PICTURE_ID
Constant for picture id property.
|
static String |
PROPERTY_PICTURE_TYPE
Constant for picture type property.
|
static String |
PROPERTY_THEMES
Constant for themes property.
|
static String |
PROPERTY_TITLE
Constant for title property.
|
static String |
PROPERTY_URL
Constant for URL property.
|
static String |
PROPERTY_URL_ALTERNATIVE
Constant for URL alternative property.
|
static String |
PROPERTY_URLTYPE
Constant for URL type property.
|
Constructor and Description |
---|
DefaultLink(Node node,
String parentPath,
DefaultLinkFactory factory)
Create a
DefaultLink . |
Modifier and Type | Method and Description |
---|---|
private String[] |
_getListFromMetadataName(String metadataName)
Retrieves the list of values corresponding to the metadata name passed as
parameter
|
private void |
_setListWithMetadataName(String[] list,
String metadataName)
Sets the list of values to the node corresponding to the metadata name
passed as a parameter
|
boolean |
canMoveTo(AmetysObject newParent)
Test if a move can be a success or if it is impossible (e.g.
|
String |
getAlternative()
Get the link alternative.
|
String |
getContent()
Get the link content.
|
String |
getDynamicInformationProvider()
Get the id of the provider of dynamic information.
|
BinaryMetadata |
getExternalPicture()
Get the picture as a binary metadata.
|
GroupIdentity[] |
getGrantedGroups()
Get the list of granted groups
|
protected Node |
getGrantedGroupsRootNode()
Get the root node for granted users
|
UserIdentity[] |
getGrantedUsers()
Get the list of granted users
|
protected Node |
getGrantedUsersRootNode()
Get the root node for granted users
|
String |
getInternalUrl()
Get the internal URL.
|
String |
getLanguage()
Get the theme language.
|
String |
getPictureAlternative()
Get the picture alternative.
|
String |
getPictureGlyph()
Get the picture glyph.
|
String |
getPictureType()
Get the picture type.
|
String |
getResourcePictureId()
Get the picture resource ID.
|
Site |
getSite()
Returns this object's site.
|
String |
getSiteName()
Returns this object's site name.
|
String[] |
getThemes()
Get the themes.
|
String |
getTitle()
Get the link title.
|
String |
getUrl()
Get the URL.
|
Link.LinkType |
getUrlType()
Retrieves the linked URL type.
|
boolean |
isAllowedAnyUser()
Is any connected user allowed ?
|
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)
|
protected void |
removePictureMetas()
Remove all picture metas (picture ID and picture binary).
|
void |
removeTheme(String themeId)
Remove theme if exist
|
void |
setAlternative(String alternative)
Set the link alternative.
|
void |
setContent(String content)
Set the content.
|
void |
setDynamicInformationProvider(String providerId)
Set the id of the provider of dynamic information.
|
void |
setExternalPicture(String mimeType,
String filename,
InputStream stream)
Set the picture from an external file.
|
void |
setGrantAnyUser(boolean grantAnyUser)
Determines if any connected user will be granted access to this link,
depending on the parameter's value
|
void |
setGrantedGroups(GroupIdentity[] grantedGroups)
Set the list of granted groups
|
void |
setGrantedUsers(UserIdentity[] grantedUsers)
Set the list of granted users
|
void |
setInternalUrl(String url)
Set the internal URL.
|
void |
setNoPicture()
Removes any picture currently assigned.
|
void |
setPictureAlternative(String alternative)
Set the picture alternative.
|
void |
setPictureGlyph(String glyph)
Set the picture glyph.
|
void |
setPictureType(String type)
Set the picture type.
|
void |
setResourcePicture(String resourceId)
Set the picture from an explorer resource.
|
void |
setThemes(String[] themes)
Set the themes.
|
void |
setTitle(String title)
Set the title.
|
void |
setUrl(Link.LinkType urlType,
String url)
Set the URL.
|
addAllowedGroups, addAllowedProfilesForAnonymous, addAllowedProfilesForAnyConnectedUser, addAllowedUsers, addDeniedGroups, addDeniedProfilesForAnonymous, addDeniedProfilesForAnyConnectedUser, addDeniedUsers, createChild, getAllowedGroups, getAllowedProfilesForAnonymous, getAllowedProfilesForAnyConnectedUser, getAllowedProfilesForGroups, getAllowedProfilesForUser, getAllowedProfilesForUsers, getAllowedUsers, getChild, getChildren, getDeniedGroups, getDeniedProfilesForAnonymous, getDeniedProfilesForAnyConnectedUser, getDeniedProfilesForGroups, getDeniedProfilesForUser, getDeniedProfilesForUsers, getDeniedUsers, hasChild, removeAllowedGroups, removeAllowedGroups, removeAllowedProfilesForAnonymous, removeAllowedProfilesForAnyConnectedUser, removeAllowedUsers, removeAllowedUsers, removeDeniedGroups, removeDeniedGroups, removeDeniedProfilesForAnonymous, removeDeniedProfilesForAnyConnectedUser, removeDeniedUsers, removeDeniedUsers
_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
getNode
getMetadataHolder
needsSave, rename, revertChanges, saveChanges
remove
getChildAt, getChildPosition
public static final String PROPERTY_URL
public static final String PROPERTY_DYNAMIC_INFO_PROVIDER
public static final String PROPERTY_INTERNAL_URL
public static final String PROPERTY_URLTYPE
public static final String PROPERTY_TITLE
public static final String PROPERTY_CONTENT
public static final String PROPERTY_URL_ALTERNATIVE
public static final String PROPERTY_PICTURE_TYPE
public static final String PROPERTY_PICTURE
public static final String PROPERTY_PICTURE_ID
public static final String PROPERTY_PICTURE_GLYPH
public static final String PROPERTY_PICTURE_ALTERNATIVE
public static final String PROPERTY_THEMES
public static final String PROPERTY_GRANT_ANY_USER
public static final String NODE_NAME_GRANTED_USERS
public static final String NODE_NAME_GRANTED_USER
public static final String NODE_NAME_GRANTED_GROUPS
public static final String NODE_NAME_GRANTED_GROUP
public DefaultLink(Node node, String parentPath, DefaultLinkFactory factory)
DefaultLink
.node
- the node backing this AmetysObject
.parentPath
- the parent path in the Ametys hierarchy.factory
- the DefaultLinkFactory
which creates the
AmetysObject.public String getUrl() throws AmetysRepositoryException
Link
getUrl
in interface Link
AmetysRepositoryException
- if an error occurs.public void setUrl(Link.LinkType urlType, String url) throws AmetysRepositoryException
Link
setUrl
in interface Link
urlType
- The URL typeurl
- the link URL to set.AmetysRepositoryException
- if an error occurs.public String getInternalUrl() throws AmetysRepositoryException
Link
getInternalUrl
in interface Link
AmetysRepositoryException
- if an error occurs.public void setInternalUrl(String url) throws AmetysRepositoryException
Link
setInternalUrl
in interface Link
url
- the link internal URL to set.AmetysRepositoryException
- if an error occurs.public Link.LinkType getUrlType() throws AmetysRepositoryException
Link
getUrlType
in interface Link
AmetysRepositoryException
- if an error occurs.public String getTitle() throws AmetysRepositoryException
Link
getTitle
in interface Link
AmetysRepositoryException
- if an error occurs.public void setTitle(String title) throws AmetysRepositoryException
Link
setTitle
in interface Link
title
- the link title to set.AmetysRepositoryException
- if an error occurs.public String getContent() throws AmetysRepositoryException
Link
getContent
in interface Link
AmetysRepositoryException
- if an error occurs.public void setContent(String content) throws AmetysRepositoryException
Link
setContent
in interface Link
content
- the link content to set.AmetysRepositoryException
- if an error occurs.public String getAlternative() throws AmetysRepositoryException
Link
getAlternative
in interface Link
AmetysRepositoryException
- if an error occurs.public void setAlternative(String alternative) throws AmetysRepositoryException
Link
setAlternative
in interface Link
alternative
- the link alternative to set.AmetysRepositoryException
- if an error occurs.public BinaryMetadata getExternalPicture() throws AmetysRepositoryException
Link
getExternalPicture
in interface Link
AmetysRepositoryException
- if an error occurs.public void setExternalPicture(String mimeType, String filename, InputStream stream) throws AmetysRepositoryException
Link
setExternalPicture
in interface Link
mimeType
- the file MIME type.filename
- the file name.stream
- an input stream on the file bytes.AmetysRepositoryException
- if an error occurs.public String getResourcePictureId() throws AmetysRepositoryException
Link
getResourcePictureId
in interface Link
AmetysRepositoryException
- if an error occurs.public void setResourcePicture(String resourceId) throws AmetysRepositoryException
Link
setResourcePicture
in interface Link
resourceId
- the resource ID.AmetysRepositoryException
- if an error occurs.public void setNoPicture() throws AmetysRepositoryException
Link
setNoPicture
in interface Link
AmetysRepositoryException
- if an error occurs.public String getPictureType() throws AmetysRepositoryException
Link
getPictureType
in interface Link
AmetysRepositoryException
- if an error occurs.public void setPictureType(String type) throws AmetysRepositoryException
Link
setPictureType
in interface Link
type
- the picture type to set.AmetysRepositoryException
- if an error occurs.public String getPictureGlyph() throws AmetysRepositoryException
Link
getPictureGlyph
in interface Link
AmetysRepositoryException
- if an error occurs.public void setPictureGlyph(String glyph) throws AmetysRepositoryException
Link
setPictureGlyph
in interface Link
glyph
- the glyph picture to set.AmetysRepositoryException
- if an error occurs.public String getPictureAlternative() throws AmetysRepositoryException
Link
getPictureAlternative
in interface Link
AmetysRepositoryException
- if an error occurs.public void setPictureAlternative(String alternative) throws AmetysRepositoryException
Link
setPictureAlternative
in interface Link
alternative
- the picture alternative to set.AmetysRepositoryException
- if an error occurs.public String[] getThemes() throws AmetysRepositoryException
Link
getThemes
in interface Link
AmetysRepositoryException
- if an error occurs.public void setThemes(String[] themes) throws AmetysRepositoryException
Link
setThemes
in interface Link
themes
- the themes to set.AmetysRepositoryException
- if an error occurs.public void removeTheme(String themeId) throws AmetysRepositoryException
Link
removeTheme
in interface Link
themeId
- The id of theme to removeAmetysRepositoryException
- if an error occurspublic UserIdentity[] getGrantedUsers() throws AmetysRepositoryException
Link
getGrantedUsers
in interface Link
AmetysRepositoryException
- if an error occurspublic void setGrantedUsers(UserIdentity[] grantedUsers) throws AmetysRepositoryException
Link
setGrantedUsers
in interface Link
grantedUsers
- the users who will have access to this linkAmetysRepositoryException
- if an error occursprotected Node getGrantedUsersRootNode() throws RepositoryException
RepositoryException
- if an error occurredpublic GroupIdentity[] getGrantedGroups() throws AmetysRepositoryException
Link
getGrantedGroups
in interface Link
AmetysRepositoryException
- if an error occurspublic void setGrantedGroups(GroupIdentity[] grantedGroups) throws AmetysRepositoryException
Link
setGrantedGroups
in interface Link
grantedGroups
- the groups who will have access to this linkAmetysRepositoryException
- if an exception occursprotected Node getGrantedGroupsRootNode() throws RepositoryException
RepositoryException
- if an error occurredpublic boolean isAllowedAnyUser() throws AmetysRepositoryException
Link
isAllowedAnyUser
in interface Link
AmetysRepositoryException
- if an exceptions occurspublic void setGrantAnyUser(boolean grantAnyUser) throws AmetysRepositoryException
Link
setGrantAnyUser
in interface Link
grantAnyUser
- "true" to allow any connected user, "false" otherwiseAmetysRepositoryException
- if a an exception occurs while
exploring the repositorypublic Site getSite() throws AmetysRepositoryException
SiteAwareAmetysObject
getSite
in interface SiteAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public String getSiteName() throws AmetysRepositoryException
SiteAwareAmetysObject
getSiteName
in interface SiteAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public String getLanguage()
protected void removePictureMetas() throws RepositoryException
RepositoryException
- 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 void moveTo(AmetysObject newParent, boolean renameIfExist) throws AmetysRepositoryException, RepositoryIntegrityViolationException
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.public boolean canMoveTo(AmetysObject newParent) throws AmetysRepositoryException
MovableAmetysObject
canMoveTo
in interface MovableAmetysObject
newParent
- See moveTo.AmetysRepositoryException
- if an error occurs.private String[] _getListFromMetadataName(String metadataName)
metadataName
- the name of the metadata to retrieveprivate void _setListWithMetadataName(String[] list, String metadataName)
list
- the list of value to be setmetadataName
- the name of the metadatapublic String getDynamicInformationProvider() throws AmetysRepositoryException
Link
getDynamicInformationProvider
in interface Link
AmetysRepositoryException
- if an error occurs.public void setDynamicInformationProvider(String providerId) throws AmetysRepositoryException
Link
setDynamicInformationProvider
in interface Link
providerId
- the id of providerAmetysRepositoryException
- if an error occurs.