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
Fields Modifier and Type Field Description static StringPROPERTY_COLORConstant for color property.static StringPROPERTY_CONTENTConstant for title property.static StringPROPERTY_DYNAMIC_INFO_PROVIDERConstant for id of provider of dynamic information.static StringPROPERTY_INTERNAL_URLConstant for internal URL property.static StringPROPERTY_PAGEConstant for page property.static StringPROPERTY_PICTUREConstant for picture data property.static StringPROPERTY_PICTURE_ALTERNATIVEConstant for picture alternative property.static StringPROPERTY_PICTURE_GLYPHConstant for picture glyph property.static StringPROPERTY_PICTURE_IDConstant for picture id property.static StringPROPERTY_PICTURE_TYPEConstant for picture type property.static StringPROPERTY_STATUSConstant for status property.static StringPROPERTY_THEMESConstant for themes property.static StringPROPERTY_TITLEConstant for title property.static StringPROPERTY_URLConstant for URL property.static StringPROPERTY_URL_ALTERNATIVEConstant for URL alternative property.static StringPROPERTY_URLTYPEConstant for URL type property.
-
Constructor Summary
Constructors Constructor Description DefaultLink(Node node, String parentPath, DefaultLinkFactory factory)Create aDefaultLink.
-
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.StringgetAlternative()Get the link alternative.StringgetColor()Get the color.StringgetContent()Get the link content.ModifiableModelLessDataHoldergetDataHolder()Returns theDataHolderof thisAmetysObject.StringgetDynamicInformationProvider()Get the id of the provider of dynamic information.BinarygetExternalPicture()Get the picture as a binary metadata.StringgetInternalUrl()Get the internal URL.StringgetLanguage()Get the theme language.StringgetPage()Get the page.StringgetPictureAlternative()Get the picture alternative.StringgetPictureGlyph()Get the picture glyph.StringgetPictureType()Get the picture type.StringgetResourcePictureId()Get the picture resource ID.SitegetSite()Returns this object's site.StringgetSiteName()Returns this object's site name.Link.LinkStatusgetStatus()Get the status.String[]getThemes()Get the themes.StringgetTitle()Get the link title.StringgetUrl()Get the URL.Link.LinkTypegetUrlType()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 voidremovePictureMetas()Remove all picture metas (picture ID and picture binary).voidremoveTheme(String themeId)Remove theme if existvoidsetAlternative(String alternative)Set the link alternative.voidsetColor(String color)Set 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.voidsetNoPicture()Removes any picture currently assigned.voidsetPage(String page)Set 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.voidsetThemes(String[] themes)Set the themes.voidsetTitle(String title)Set 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, 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, 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
dataToSAX, getType, getValue, getValue, getValueOfType, getValueOfType, hasValue, hasValueOrEmpty, isMultiple
-
Methods inherited from interface org.ametys.plugins.repository.data.holder.ModelLessDataHolder
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 Detail
-
PROPERTY_URL
public static final String PROPERTY_URL
Constant for URL property.- See Also:
- Constant Field Values
-
PROPERTY_DYNAMIC_INFO_PROVIDER
public static final String PROPERTY_DYNAMIC_INFO_PROVIDER
Constant for id of provider of dynamic information.- See Also:
- Constant Field Values
-
PROPERTY_INTERNAL_URL
public static final String PROPERTY_INTERNAL_URL
Constant for internal URL property.- See Also:
- Constant Field Values
-
PROPERTY_URLTYPE
public static final String PROPERTY_URLTYPE
Constant for URL type property.- See Also:
- Constant Field Values
-
PROPERTY_TITLE
public static final String PROPERTY_TITLE
Constant for title property.- See Also:
- Constant Field Values
-
PROPERTY_CONTENT
public static final String PROPERTY_CONTENT
Constant for title property.- See Also:
- Constant Field Values
-
PROPERTY_URL_ALTERNATIVE
public static final String PROPERTY_URL_ALTERNATIVE
Constant for URL alternative property.- See Also:
- Constant Field Values
-
PROPERTY_PICTURE_TYPE
public static final String PROPERTY_PICTURE_TYPE
Constant for picture type property.- See Also:
- Constant Field Values
-
PROPERTY_PICTURE
public static final String PROPERTY_PICTURE
Constant for picture data property.- See Also:
- Constant Field Values
-
PROPERTY_PICTURE_ID
public static final String PROPERTY_PICTURE_ID
Constant for picture id property.- See Also:
- Constant Field Values
-
PROPERTY_PICTURE_GLYPH
public static final String PROPERTY_PICTURE_GLYPH
Constant for picture glyph property.- See Also:
- Constant Field Values
-
PROPERTY_PICTURE_ALTERNATIVE
public static final String PROPERTY_PICTURE_ALTERNATIVE
Constant for picture alternative property.- See Also:
- Constant Field Values
-
PROPERTY_THEMES
public static final String PROPERTY_THEMES
Constant for themes property.- See Also:
- Constant Field Values
-
PROPERTY_COLOR
public static final String PROPERTY_COLOR
Constant for color property.- See Also:
- Constant Field Values
-
PROPERTY_PAGE
public static final String PROPERTY_PAGE
Constant for page property.- See Also:
- Constant Field Values
-
PROPERTY_STATUS
public static final String PROPERTY_STATUS
Constant for status property.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultLink
public DefaultLink(Node node, String parentPath, DefaultLinkFactory factory)
Create aDefaultLink.- Parameters:
node- the node backing thisAmetysObject.parentPath- the parent path in the Ametys hierarchy.factory- theDefaultLinkFactorywhich creates the AmetysObject.
-
-
Method Detail
-
getUrl
public String getUrl() throws AmetysRepositoryException
Description copied from interface:LinkGet the URL.- Specified by:
getUrlin interfaceLink- Returns:
- the link URL.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setUrl
public void setUrl(Link.LinkType urlType, String url) throws AmetysRepositoryException
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
public String getInternalUrl() throws AmetysRepositoryException
Description copied from interface:LinkGet the internal URL.- Specified by:
getInternalUrlin interfaceLink- Returns:
- the link internal URL.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setInternalUrl
public void setInternalUrl(String url) throws AmetysRepositoryException
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
public Link.LinkType getUrlType() throws AmetysRepositoryException
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
public String getTitle() throws AmetysRepositoryException
Description copied from interface:LinkGet the link title.- Specified by:
getTitlein interfaceLink- Returns:
- the link title.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setTitle
public void setTitle(String title) throws AmetysRepositoryException
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
public String getContent() throws AmetysRepositoryException
Description copied from interface:LinkGet the link content.- Specified by:
getContentin interfaceLink- Returns:
- the link content.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setContent
public void setContent(String content) throws AmetysRepositoryException
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
public String getAlternative() throws AmetysRepositoryException
Description copied from interface:LinkGet the link alternative.- Specified by:
getAlternativein interfaceLink- Returns:
- the link alternative.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setAlternative
public void setAlternative(String alternative) throws AmetysRepositoryException
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
public Binary getExternalPicture() throws AmetysRepositoryException
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
public String getResourcePictureId() throws AmetysRepositoryException
Description copied from interface:LinkGet the picture resource ID.- Specified by:
getResourcePictureIdin interfaceLink- Returns:
- the resource ID.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setResourcePicture
public void setResourcePicture(String resourceId) throws AmetysRepositoryException
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
public void setNoPicture() throws AmetysRepositoryException
Description copied from interface:LinkRemoves any picture currently assigned.- Specified by:
setNoPicturein interfaceLink- Throws:
AmetysRepositoryException- if an error occurs.
-
getPictureType
public String getPictureType() throws AmetysRepositoryException
Description copied from interface:LinkGet the picture type.- Specified by:
getPictureTypein interfaceLink- Returns:
- the picture type.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setPictureType
public void setPictureType(String type) throws AmetysRepositoryException
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
public String getPictureGlyph() throws AmetysRepositoryException
Description copied from interface:LinkGet the picture glyph.- Specified by:
getPictureGlyphin interfaceLink- Returns:
- the picture glyph.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setPictureGlyph
public void setPictureGlyph(String glyph) throws AmetysRepositoryException
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
public String getPictureAlternative() throws AmetysRepositoryException
Description copied from interface:LinkGet the picture alternative.- Specified by:
getPictureAlternativein interfaceLink- Returns:
- the picture alternative.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setPictureAlternative
public void setPictureAlternative(String alternative) throws AmetysRepositoryException
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
public String[] getThemes() throws AmetysRepositoryException
Description copied from interface:LinkGet the themes.- Specified by:
getThemesin interfaceLink- Returns:
- the themes in an Array
- Throws:
AmetysRepositoryException- if an error occurs.
-
setThemes
public void setThemes(String[] themes) throws AmetysRepositoryException
Description copied from interface:LinkSet the themes.- Specified by:
setThemesin interfaceLink- Parameters:
themes- the themes to set.- Throws:
AmetysRepositoryException- if an error occurs.
-
removeTheme
public void removeTheme(String themeId) throws AmetysRepositoryException
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
public Site getSite() throws AmetysRepositoryException
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
public String getSiteName() throws AmetysRepositoryException
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
public String getLanguage()
Get the theme language.- Returns:
- the theme language.
-
removePictureMetas
protected void removePictureMetas() throws RepositoryException
Remove all picture metas (picture ID and picture binary).- Throws:
RepositoryException- 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.
-
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
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.
-
getDynamicInformationProvider
public String getDynamicInformationProvider() throws AmetysRepositoryException
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
public void setDynamicInformationProvider(String providerId) throws AmetysRepositoryException
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
public String getColor() throws AmetysRepositoryException
Description copied from interface:LinkGet the color.- Specified by:
getColorin interfaceLink- Returns:
- the color.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setColor
public void setColor(String color) throws AmetysRepositoryException
Description copied from interface:LinkSet the color.- Specified by:
setColorin interfaceLink- Parameters:
color- the color to set.- Throws:
AmetysRepositoryException- if an error occurs.
-
getPage
public String getPage() throws AmetysRepositoryException
Description copied from interface:LinkGet the page.- Specified by:
getPagein interfaceLink- Returns:
- the page.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setPage
public void setPage(String page) throws AmetysRepositoryException
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
public Link.LinkStatus getStatus() throws AmetysRepositoryException
Description copied from interface:LinkGet the status.- Specified by:
getStatusin interfaceLink- Returns:
- the status.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setStatus
public void setStatus(Link.LinkStatus status) throws AmetysRepositoryException
Description copied from interface:LinkSet the status.- Specified by:
setStatusin interfaceLink- Parameters:
status- the status to set.- Throws:
AmetysRepositoryException- if an error occurs.
-
getDataHolder
public ModifiableModelLessDataHolder getDataHolder()
Description copied from interface:DataAwareAmetysObjectReturns theDataHolderof thisAmetysObject.- Specified by:
getDataHolderin interfaceDataAwareAmetysObject- Specified by:
getDataHolderin interfaceModelLessDataAwareAmetysObject- Specified by:
getDataHolderin interfaceModifiableModelLessDataAwareAmetysObject- Returns:
- the
DataHolderof thisAmetysObject
-
-