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
FieldsModifier and TypeFieldDescriptionstatic final StringConstant for color property.static final StringConstant for title property.static final StringConstant for id of provider of dynamic information.static final StringConstant for internal URL property.static final StringConstant for page property.static final StringConstant for picture data property.static final StringConstant for picture alternative property.static final StringConstant for picture glyph property.static final StringConstant for picture id property.static final StringConstant for picture type property.static final StringConstant for status property.static final StringConstant for themes property.static final StringConstant for title property.static final StringConstant for URL property.static final StringConstant for URL alternative property.static final StringConstant for URL type property.Fields inherited from interface org.ametys.web.repository.SiteAwareAmetysObject
METADATA_SITE -
Constructor Summary
ConstructorsConstructorDescriptionDefaultLink(javax.jcr.Node node, String parentPath, DefaultLinkFactory factory) Create aDefaultLink. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanMoveTo(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 theDataHolderof 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.voidmoveTo(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)protected voidRemove all picture metas (picture ID and picture binary).voidremoveTheme(String themeId) Remove theme if existvoidsetAlternative(String alternative) Set the link alternative.voidSet the color.voidsetContent(String content) Set the content.voidsetDynamicInformationProvider(String providerId) Set the id of the provider of dynamic information.voidsetExternalPicture(String mimeType, String filename, InputStream stream) Set the picture from an external file.voidsetInternalUrl(String url) Set the internal URL.voidRemoves any picture currently assigned.voidSet the page.voidsetPictureAlternative(String alternative) Set the picture alternative.voidsetPictureGlyph(String glyph) Set the picture glyph.voidsetPictureType(String type) Set the picture type.voidsetResourcePicture(String resourceId) Set the picture from an explorer resource.voidsetStatus(Link.LinkStatus status) Set the status.voidSet the themes.voidSet the title.voidsetUrl(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, removeDeniedUsersMethods 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, hashCodeMethods inherited from interface org.ametys.plugins.repository.data.ametysobject.DataAwareAmetysObject
copyTo, copyTo, dataToJSON, dataToJSON, dataToSAX, dataToSAX, getDataNamesMethods inherited from interface org.ametys.plugins.repository.jcr.JCRAmetysObject
getNodeMethods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModelLessDataAwareAmetysObject
dataToJSON, dataToSAX, getModelItemTypeExtensionPoint, getType, getValue, getValue, getValueOfType, getValueOfType, hasDifferences, hasValue, hasValue, hasValueOrEmpty, isMultiple, isMultipleMethods inherited from interface org.ametys.plugins.repository.data.holder.ModelLessDataHolder
dataToJSON, dataToSAX, hasValue, hasValueOrEmptyMethods inherited from interface org.ametys.plugins.repository.ModifiableAmetysObject
needsSave, rename, revertChanges, saveChangesMethods inherited from interface org.ametys.plugins.repository.metadata.ModifiableMetadataAwareAmetysObject
getMetadataHolderMethods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModifiableModelLessDataAwareAmetysObject
getComposite, getComposite, getParentDataHolder, getRepositoryData, getRootDataHolder, removeValue, setValue, setValue, synchronizeValuesMethods inherited from interface org.ametys.plugins.repository.RemovableAmetysObject
removeMethods 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- theDefaultLinkFactorywhich creates the AmetysObject.
-
-
Method Details
-
getUrl
Description copied from interface:LinkGet the URL.- Specified by:
getUrlin interfaceLink- Returns:
- the link URL.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setUrl
Description copied from interface:LinkSet the URL.- Specified by:
setUrlin interfaceLink- Parameters:
urlType- The URL typeurl- the link URL to set.- Throws:
AmetysRepositoryException- if an error occurs.
-
getInternalUrl
Description copied from interface:LinkGet the internal URL.- Specified by:
getInternalUrlin interfaceLink- Returns:
- the link internal URL.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setInternalUrl
Description copied from interface:LinkSet the internal URL.- Specified by:
setInternalUrlin interfaceLink- Parameters:
url- the link internal URL to set.- Throws:
AmetysRepositoryException- if an error occurs.
-
getUrlType
Description copied from interface:LinkRetrieves the linked URL type.- Specified by:
getUrlTypein interfaceLink- Returns:
- the linked URL type.
- Throws:
AmetysRepositoryException- if an error occurs.
-
getTitle
Description copied from interface:LinkGet the link title.- Specified by:
getTitlein interfaceLink- Returns:
- the link title.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setTitle
Description copied from interface:LinkSet the title.- Specified by:
setTitlein interfaceLink- Parameters:
title- the link title to set.- Throws:
AmetysRepositoryException- if an error occurs.
-
getContent
Description copied from interface:LinkGet the link content.- Specified by:
getContentin interfaceLink- Returns:
- the link content.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setContent
Description copied from interface:LinkSet the content.- Specified by:
setContentin interfaceLink- Parameters:
content- the link content to set.- Throws:
AmetysRepositoryException- if an error occurs.
-
getAlternative
Description copied from interface:LinkGet the link alternative.- Specified by:
getAlternativein interfaceLink- Returns:
- the link alternative.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setAlternative
Description copied from interface:LinkSet the link alternative.- Specified by:
setAlternativein interfaceLink- Parameters:
alternative- the link alternative to set.- Throws:
AmetysRepositoryException- if an error occurs.
-
getExternalPicture
Description copied from interface:LinkGet the picture as a binary metadata.- Specified by:
getExternalPicturein 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:LinkSet the picture from an external file.- Specified by:
setExternalPicturein 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:LinkGet the picture resource ID.- Specified by:
getResourcePictureIdin interfaceLink- Returns:
- the resource ID.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setResourcePicture
Description copied from interface:LinkSet the picture from an explorer resource.- Specified by:
setResourcePicturein interfaceLink- Parameters:
resourceId- the resource ID.- Throws:
AmetysRepositoryException- if an error occurs.
-
setNoPicture
Description copied from interface:LinkRemoves any picture currently assigned.- Specified by:
setNoPicturein interfaceLink- Throws:
AmetysRepositoryException- if an error occurs.
-
getPictureType
Description copied from interface:LinkGet the picture type.- Specified by:
getPictureTypein interfaceLink- Returns:
- the picture type.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setPictureType
Description copied from interface:LinkSet the picture type.- Specified by:
setPictureTypein interfaceLink- Parameters:
type- the picture type to set.- Throws:
AmetysRepositoryException- if an error occurs.
-
getPictureGlyph
Description copied from interface:LinkGet the picture glyph.- Specified by:
getPictureGlyphin interfaceLink- Returns:
- the picture glyph.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setPictureGlyph
Description copied from interface:LinkSet the picture glyph.- Specified by:
setPictureGlyphin interfaceLink- Parameters:
glyph- the glyph picture to set.- Throws:
AmetysRepositoryException- if an error occurs.
-
getPictureAlternative
Description copied from interface:LinkGet the picture alternative.- Specified by:
getPictureAlternativein interfaceLink- Returns:
- the picture alternative.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setPictureAlternative
Description copied from interface:LinkSet the picture alternative.- Specified by:
setPictureAlternativein interfaceLink- Parameters:
alternative- the picture alternative to set.- Throws:
AmetysRepositoryException- if an error occurs.
-
getThemes
Description copied from interface:LinkGet the themes.- Specified by:
getThemesin interfaceLink- Returns:
- the themes in an Array
- Throws:
AmetysRepositoryException- if an error occurs.
-
setThemes
Description copied from interface:LinkSet the themes.- Specified by:
setThemesin interfaceLink- Parameters:
themes- the themes to set.- Throws:
AmetysRepositoryException- if an error occurs.
-
removeTheme
Description copied from interface:LinkRemove theme if exist- Specified by:
removeThemein interfaceLink- Parameters:
themeId- The id of theme to remove- Throws:
AmetysRepositoryException- if an error occurs
-
getSite
Description copied from interface:SiteAwareAmetysObjectReturns this object's site.- Specified by:
getSitein interfaceSiteAwareAmetysObject- Returns:
- this object's site
- Throws:
AmetysRepositoryException- if an error occurs.
-
getSiteName
Description copied from interface:SiteAwareAmetysObjectReturns this object's site name.- Specified by:
getSiteNamein 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: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.
-
moveTo
public void moveTo(AmetysObject newParent, boolean renameIfExist) throws AmetysRepositoryException, RepositoryIntegrityViolationException 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.
-
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.
-
getDynamicInformationProvider
Description copied from interface:LinkGet the id of the provider of dynamic information.- Specified by:
getDynamicInformationProviderin interfaceLink- Returns:
- the id of provider. Can be null.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setDynamicInformationProvider
Description copied from interface:LinkSet the id of the provider of dynamic information.- Specified by:
setDynamicInformationProviderin interfaceLink- Parameters:
providerId- the id of provider- Throws:
AmetysRepositoryException- if an error occurs.
-
getColor
Description copied from interface:LinkGet the color.- Specified by:
getColorin interfaceLink- Returns:
- the color.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setColor
Description copied from interface:LinkSet the color.- Specified by:
setColorin interfaceLink- Parameters:
color- the color to set.- Throws:
AmetysRepositoryException- if an error occurs.
-
getPage
Description copied from interface:LinkGet the page.- Specified by:
getPagein interfaceLink- Returns:
- the page.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setPage
Description copied from interface:LinkSet the page.- Specified by:
setPagein interfaceLink- Parameters:
page- the page id to set.- Throws:
AmetysRepositoryException- if an error occurs.
-
getStatus
Description copied from interface:LinkGet the status.- Specified by:
getStatusin interfaceLink- Returns:
- the status.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setStatus
Description copied from interface:LinkSet the status.- Specified by:
setStatusin interfaceLink- Parameters:
status- the status to set.- Throws:
AmetysRepositoryException- if an error occurs.
-
getDataHolder
Description copied from interface:DataAwareAmetysObjectReturns theDataHolderof thisAmetysObject.- Specified by:
getDataHolderin interfaceDataAwareAmetysObject- Specified by:
getDataHolderin interfaceModelLessDataAwareAmetysObject- Specified by:
getDataHolderin interfaceModifiableModelLessDataAwareAmetysObject- Returns:
- the
DataHolderof thisAmetysObject
-