Class DefaultLink
java.lang.Object
org.ametys.plugins.repository.AbstractAmetysObject
org.ametys.plugins.repository.jcr.SimpleAmetysObject<F>
org.ametys.plugins.repository.jcr.DefaultTraversableAmetysObject<DefaultLinkFactory>
org.ametys.plugins.linkdirectory.repository.DefaultLink
- All Implemented Interfaces:
Link
,ACLAmetysObject
,AmetysObject
,DataAwareAmetysObject
,ModelLessDataAwareAmetysObject
,ModifiableModelLessDataAwareAmetysObject
,DataHolder
,ModelLessDataHolder
,ModifiableDataHolder
,ModifiableModelLessDataHolder
,JCRAmetysObject
,JCRTraversableAmetysObject
,MetadataAwareAmetysObject
,ModifiableMetadataAwareAmetysObject
,ModifiableACLAmetysObject
,ModifiableAmetysObject
,ModifiableTraversableAmetysObject
,MovableAmetysObject
,RemovableAmetysObject
,TraversableAmetysObject
,SiteAwareAmetysObject
public class DefaultLink
extends DefaultTraversableAmetysObject<DefaultLinkFactory>
implements Link, SiteAwareAmetysObject, MovableAmetysObject, ModifiableModelLessDataAwareAmetysObject
Repository implementation of a directory link.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ametys.plugins.linkdirectory.Link
Link.LinkStatus, Link.LinkType
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Constant for color property.static final String
Constant for title property.static final String
Constant for id of provider of dynamic information.static final String
Constant for internal URL property.static final String
Constant for page property.static final String
Constant for picture data property.static final String
Constant for picture alternative property.static final String
Constant for picture glyph property.static final String
Constant for picture id property.static final String
Constant for picture type property.static final String
Constant for status property.static final String
Constant for themes property.static final String
Constant for title property.static final String
Constant for URL property.static final String
Constant for URL alternative property.static final String
Constant for URL type property.Fields inherited from interface org.ametys.web.repository.SiteAwareAmetysObject
METADATA_SITE
-
Constructor Summary
ConstructorDescriptionDefaultLink
(javax.jcr.Node node, String parentPath, DefaultLinkFactory factory) Create aDefaultLink
. -
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 link alternative.getColor()
Get the color.Get the link content.Returns theDataHolder
of thisAmetysObject
.Get the id of the provider of dynamic information.Get the picture as a binary metadata.Get the internal URL.Get the theme language.getPage()
Get the page.Get the picture alternative.Get the picture glyph.Get the picture type.Get the picture resource ID.getSite()
Returns this object's site.Returns this object's site name.Get the status.String[]
Get the themes.getTitle()
Get the link title.getUrl()
Get the URL.Retrieves the linked URL type.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
Remove all picture metas (picture ID and picture binary).void
removeTheme
(String themeId) Remove theme if existvoid
setAlternative
(String alternative) Set the link alternative.void
Set the color.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
setInternalUrl
(String url) Set the internal URL.void
Removes any picture currently assigned.void
Set the page.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
setStatus
(Link.LinkStatus status) Set the status.void
Set the themes.void
Set the title.void
setUrl
(Link.LinkType urlType, String url) Set the URL.Methods inherited from class org.ametys.plugins.repository.jcr.DefaultTraversableAmetysObject
addAllowedGroups, addAllowedProfilesForAnonymous, addAllowedProfilesForAnyConnectedUser, addAllowedUsers, addDeniedGroups, addDeniedProfilesForAnonymous, addDeniedProfilesForAnyConnectedUser, addDeniedUsers, createChild, disallowInheritance, getChild, getChildren, getProfilesForAnonymousAndAnyConnectedUser, getProfilesForGroups, getProfilesForUsers, hasChild, isInheritanceDisallowed, removeAllowedGroups, removeAllowedGroups, removeAllowedProfilesForAnonymous, removeAllowedProfilesForAnyConnectedUser, removeAllowedUsers, removeAllowedUsers, removeDeniedGroups, removeDeniedGroups, removeDeniedProfilesForAnonymous, removeDeniedProfilesForAnyConnectedUser, removeDeniedUsers, removeDeniedUsers
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
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.DataAwareAmetysObject
copyTo, copyTo, dataToJSON, dataToJSON, dataToSAX, dataToSAX, getDataNames
Methods inherited from interface org.ametys.plugins.repository.jcr.JCRAmetysObject
getNode
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModelLessDataAwareAmetysObject
dataToJSON, dataToSAX, getModelItemTypeExtensionPoint, getType, getValue, getValue, getValueOfType, getValueOfType, hasDifferences, hasValue, hasValue, hasValueOrEmpty, isMultiple, isMultiple
Methods inherited from interface org.ametys.plugins.repository.data.holder.ModelLessDataHolder
dataToJSON, dataToSAX, hasValue, hasValueOrEmpty
Methods inherited from interface org.ametys.plugins.repository.ModifiableAmetysObject
needsSave, rename, revertChanges, saveChanges
Methods inherited from interface org.ametys.plugins.repository.metadata.ModifiableMetadataAwareAmetysObject
getMetadataHolder
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModifiableModelLessDataAwareAmetysObject
getComposite, getComposite, getParentDataHolder, getRepositoryData, getRootDataHolder, removeValue, setValue, setValue, synchronizeValues
Methods inherited from interface org.ametys.plugins.repository.RemovableAmetysObject
remove
Methods inherited from interface org.ametys.plugins.repository.TraversableAmetysObject
getChildAt, getChildPosition
-
Field Details
-
PROPERTY_URL
Constant for URL property.- See Also:
-
PROPERTY_DYNAMIC_INFO_PROVIDER
Constant for id of provider of dynamic information.- See Also:
-
PROPERTY_INTERNAL_URL
Constant for internal URL property.- See Also:
-
PROPERTY_URLTYPE
Constant for URL type property.- See Also:
-
PROPERTY_TITLE
Constant for title property.- See Also:
-
PROPERTY_CONTENT
Constant for title property.- See Also:
-
PROPERTY_URL_ALTERNATIVE
Constant for URL alternative property.- See Also:
-
PROPERTY_PICTURE_TYPE
Constant for picture type property.- See Also:
-
PROPERTY_PICTURE
Constant for picture data property.- See Also:
-
PROPERTY_PICTURE_ID
Constant for picture id property.- See Also:
-
PROPERTY_PICTURE_GLYPH
Constant for picture glyph property.- See Also:
-
PROPERTY_PICTURE_ALTERNATIVE
Constant for picture alternative property.- See Also:
-
PROPERTY_THEMES
Constant for themes property.- See Also:
-
PROPERTY_COLOR
Constant for color property.- See Also:
-
PROPERTY_PAGE
Constant for page property.- See Also:
-
PROPERTY_STATUS
Constant for status property.- See Also:
-
-
Constructor Details
-
DefaultLink
Create aDefaultLink
.- Parameters:
node
- the node backing thisAmetysObject
.parentPath
- the parent path in the Ametys hierarchy.factory
- theDefaultLinkFactory
which creates the AmetysObject.
-
-
Method Details
-
getUrl
Description copied from interface:Link
Get the URL.- Specified by:
getUrl
in interfaceLink
- Returns:
- the link URL.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setUrl
Description copied from interface:Link
Set the URL.- Specified by:
setUrl
in interfaceLink
- Parameters:
urlType
- The URL typeurl
- the link URL to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getInternalUrl
Description copied from interface:Link
Get the internal URL.- Specified by:
getInternalUrl
in interfaceLink
- Returns:
- the link internal URL.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setInternalUrl
Description copied from interface:Link
Set the internal URL.- Specified by:
setInternalUrl
in interfaceLink
- Parameters:
url
- the link internal URL to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getUrlType
Description copied from interface:Link
Retrieves the linked URL type.- Specified by:
getUrlType
in interfaceLink
- Returns:
- the linked URL type.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getTitle
Description copied from interface:Link
Get the link title.- Specified by:
getTitle
in interfaceLink
- Returns:
- the link title.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setTitle
Description copied from interface:Link
Set the title.- Specified by:
setTitle
in interfaceLink
- Parameters:
title
- the link title to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getContent
Description copied from interface:Link
Get the link content.- Specified by:
getContent
in interfaceLink
- Returns:
- the link content.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setContent
Description copied from interface:Link
Set the content.- Specified by:
setContent
in interfaceLink
- Parameters:
content
- the link content to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getAlternative
Description copied from interface:Link
Get the link alternative.- Specified by:
getAlternative
in interfaceLink
- Returns:
- the link alternative.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setAlternative
Description copied from interface:Link
Set the link alternative.- Specified by:
setAlternative
in interfaceLink
- Parameters:
alternative
- the link alternative to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getExternalPicture
Description copied from interface:Link
Get the picture as a binary metadata.- Specified by:
getExternalPicture
in interfaceLink
- Returns:
- the picture as a binary metadata.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setExternalPicture
public void setExternalPicture(String mimeType, String filename, InputStream stream) throws AmetysRepositoryException Description copied from interface:Link
Set the picture from an external file.- Specified by:
setExternalPicture
in interfaceLink
- Parameters:
mimeType
- the file MIME type.filename
- the file name.stream
- an input stream on the file bytes.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getResourcePictureId
Description copied from interface:Link
Get the picture resource ID.- Specified by:
getResourcePictureId
in interfaceLink
- Returns:
- the resource ID.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setResourcePicture
Description copied from interface:Link
Set the picture from an explorer resource.- Specified by:
setResourcePicture
in interfaceLink
- Parameters:
resourceId
- the resource ID.- Throws:
AmetysRepositoryException
- if an error occurs.
-
setNoPicture
Description copied from interface:Link
Removes any picture currently assigned.- Specified by:
setNoPicture
in interfaceLink
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getPictureType
Description copied from interface:Link
Get the picture type.- Specified by:
getPictureType
in interfaceLink
- Returns:
- the picture type.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setPictureType
Description copied from interface:Link
Set the picture type.- Specified by:
setPictureType
in interfaceLink
- Parameters:
type
- the picture type to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getPictureGlyph
Description copied from interface:Link
Get the picture glyph.- Specified by:
getPictureGlyph
in interfaceLink
- Returns:
- the picture glyph.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setPictureGlyph
Description copied from interface:Link
Set the picture glyph.- Specified by:
setPictureGlyph
in interfaceLink
- Parameters:
glyph
- the glyph picture to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getPictureAlternative
Description copied from interface:Link
Get the picture alternative.- Specified by:
getPictureAlternative
in interfaceLink
- Returns:
- the picture alternative.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setPictureAlternative
Description copied from interface:Link
Set the picture alternative.- Specified by:
setPictureAlternative
in interfaceLink
- Parameters:
alternative
- the picture alternative to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getThemes
Description copied from interface:Link
Get the themes.- Specified by:
getThemes
in interfaceLink
- Returns:
- the themes in an Array
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setThemes
Description copied from interface:Link
Set the themes.- Specified by:
setThemes
in interfaceLink
- Parameters:
themes
- the themes to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
removeTheme
Description copied from interface:Link
Remove theme if exist- Specified by:
removeTheme
in interfaceLink
- Parameters:
themeId
- The id of theme to remove- Throws:
AmetysRepositoryException
- if an error occurs
-
getSite
Description copied from interface:SiteAwareAmetysObject
Returns this object's site.- Specified by:
getSite
in interfaceSiteAwareAmetysObject
- Returns:
- this object's site
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getSiteName
Description copied from interface:SiteAwareAmetysObject
Returns this object's site name.- Specified by:
getSiteName
in interfaceSiteAwareAmetysObject
- Returns:
- this object's site name.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getLanguage
Get the theme language.- Returns:
- the theme language.
-
removePictureMetas
Remove all picture metas (picture ID and picture binary).- Throws:
javax.jcr.RepositoryException
- 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.
-
moveTo
public void moveTo(AmetysObject newParent, boolean renameIfExist) throws AmetysRepositoryException, RepositoryIntegrityViolationException 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.
-
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.
-
getDynamicInformationProvider
Description copied from interface:Link
Get the id of the provider of dynamic information.- Specified by:
getDynamicInformationProvider
in interfaceLink
- Returns:
- the id of provider. Can be null.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setDynamicInformationProvider
Description copied from interface:Link
Set the id of the provider of dynamic information.- Specified by:
setDynamicInformationProvider
in interfaceLink
- Parameters:
providerId
- the id of provider- Throws:
AmetysRepositoryException
- if an error occurs.
-
getColor
Description copied from interface:Link
Get the color.- Specified by:
getColor
in interfaceLink
- Returns:
- the color.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setColor
Description copied from interface:Link
Set the color.- Specified by:
setColor
in interfaceLink
- Parameters:
color
- the color to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getPage
Description copied from interface:Link
Get the page.- Specified by:
getPage
in interfaceLink
- Returns:
- the page.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setPage
Description copied from interface:Link
Set the page.- Specified by:
setPage
in interfaceLink
- Parameters:
page
- the page id to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getStatus
Description copied from interface:Link
Get the status.- Specified by:
getStatus
in interfaceLink
- Returns:
- the status.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setStatus
Description copied from interface:Link
Set the status.- Specified by:
setStatus
in interfaceLink
- Parameters:
status
- the status to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getDataHolder
Description copied from interface:DataAwareAmetysObject
Returns theDataHolder
of thisAmetysObject
.- Specified by:
getDataHolder
in interfaceDataAwareAmetysObject
- Specified by:
getDataHolder
in interfaceModelLessDataAwareAmetysObject
- Specified by:
getDataHolder
in interfaceModifiableModelLessDataAwareAmetysObject
- Returns:
- the
DataHolder
of thisAmetysObject
-