Interface ElementManagementService
-
public interface ElementManagementService
This class offers APIs to access elements on Pages, Page sections, Page models and Media items.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description Element
copyElement(Element element, String elementHolderClassName, String elementHolderUUID, int elementHolderId, String targetProperty)
Copies an element to the given element holder.Element
copyElement(Element element, PageVersion target)
Copies an element to the target page version.Element
copyElement(Element element, MediaItemArticleVersion target)
Copies an element to the target media item version.Element
copyElement(Element element, nl.gx.webmanager.cms.pagemodel.PageModel target)
Deprecated.Element
copyElementToLimbo(Element element, ElementHolder parentHolder)
Clone an element and place in the limbo area.Element
createAndInsertElement(ElementHolder wrapper, Class<? extends Element> elementType, int position, Website website)
Creates a new (empty) element and add it at the specified location to the given page version.Element
createAndInsertElement(PageVersion pageVersion, Class<? extends Element> elementType)
Creates a new (empty) element and add it as last element to the given PageVersion.Element
createAndInsertElement(PageVersion pageVersion, Class<? extends Element> elementType, int position)
Creates a new (empty) element and add it at the specified location to the given PageVersion.Element
createAndInsertElement(MediaItemVersion mediaItemVersion, Class<? extends Element> elementType)
Creates a new (empty) element and add it as last element to the given MediaItemVersion.Element
createAndInsertElement(MediaItemVersion mediaItemVersion, Class<? extends Element> elementType, int position)
Creates a new (empty) element and add it at the specified location to the given MediaItemVersion.Element
createAndInsertElement(nl.gx.webmanager.cms.pagemodel.PageModel pageModel, Class<? extends Element> elementType)
Deprecated.Element
createAndInsertElement(nl.gx.webmanager.cms.pagemodel.PageModel pageModel, Class<? extends Element> elementType, int position)
Deprecated.Element
createElementInLimbo(ElementHolder elementHolder, Class<? extends Element> elementType)
Creates an element in the limbo area.boolean
deleteElement(Element element)
Deletes the element, including all references to the element, with the given UUID.void
deleteElementFromLimbo(Element element)
Deletes an element from the limbo area.
-
-
-
Method Detail
-
createAndInsertElement
Element createAndInsertElement(PageVersion pageVersion, Class<? extends Element> elementType)
Creates a new (empty) element and add it as last element to the given PageVersion.- Parameters:
pageVersion
- The page version to which the new element must be addedelementType
- The interface of the element to create- Returns:
- The element that has been created and added to the page version
-
createAndInsertElement
Element createAndInsertElement(MediaItemVersion mediaItemVersion, Class<? extends Element> elementType)
Creates a new (empty) element and add it as last element to the given MediaItemVersion.- Parameters:
mediaItemVersion
- the MediaItemVersion to add element toelementType
- The interface of the element to create- Returns:
- The element that has been created and added to the page version
-
createAndInsertElement
@Deprecated Element createAndInsertElement(nl.gx.webmanager.cms.pagemodel.PageModel pageModel, Class<? extends Element> elementType)
Deprecated.Creates a new (empty) element and add it as last element to the given PageModel.- Parameters:
pageModel
- The page model to which the new element must be addedelementType
- The interface of the element to create- Returns:
- The element that has been created and added to the page version
-
createAndInsertElement
Element createAndInsertElement(PageVersion pageVersion, Class<? extends Element> elementType, int position)
Creates a new (empty) element and add it at the specified location to the given PageVersion. If the position is invalid this method throws an IllegalArgumentException- Parameters:
pageVersion
- The page version to which the new element must be addedelementType
- The interface of the element to createposition
- The position at which the element must be inserted, first position is 0.- Returns:
- The element that has been created and inserted into the page version
-
createAndInsertElement
Element createAndInsertElement(MediaItemVersion mediaItemVersion, Class<? extends Element> elementType, int position)
Creates a new (empty) element and add it at the specified location to the given MediaItemVersion. If the position is invalid this method throws an IllegalArgumentException- Parameters:
mediaItemVersion
- to add element toelementType
- The interface of the element to create.position
- The position at which the element must be inserted, first position is 0.- Returns:
- The element that has been created and inserted into the page version.
-
createAndInsertElement
@Deprecated Element createAndInsertElement(nl.gx.webmanager.cms.pagemodel.PageModel pageModel, Class<? extends Element> elementType, int position)
Deprecated.Creates a new (empty) element and add it at the specified location to the given PageModel. If the position is invalid this method throws an IllegalArgumentException- Parameters:
pageModel
- The page model to which the new element must be addedelementType
- The interface of the element to createposition
- The position at which the element must be inserted, first position is 0.- Returns:
- The element that has been created and inserted into the page version
-
deleteElement
boolean deleteElement(Element element)
Deletes the element, including all references to the element, with the given UUID.- Parameters:
element
- the element to delete- Returns:
true
if the element was removed successfully,false
otherwise
-
copyElement
Element copyElement(Element element, PageVersion target) throws NoAuthorizationException
Copies an element to the target page version.The user requires CREATE permission for the element's element type. Next to that the user needs UPDATE permission for the target page version.
Performed steps:
- Permissions of the current user are checked
- A
Event.Type.PRE
element event of typeElementEvent.COPY
is fired - Requested element is copied to the target page version
- A
Event.Type.POST
element event of typeElementEvent.CREATE
is fired - A
Event.Type.POST
element event of typeElementEvent.COPY
is fired
- Parameters:
element
- The element that should be copied.target
- The target page version to which the element is copied.- Returns:
- The copied element.
- Throws:
NoAuthorizationException
- If user has no rights to copy the element.
-
copyElement
Element copyElement(Element element, MediaItemArticleVersion target) throws NoAuthorizationException
Copies an element to the target media item version.The user requires CREATE permission for the element's element type. Next to that the user needs the UPDATE permission for media items.
Performed steps:
- Permissions of the current user are checked
- A
Event.Type.PRE
element event of typeElementEvent.COPY
is fired - Requested element is copied to the target media item version
- A
Event.Type.POST
element event of typeElementEvent.CREATE
is fired - A
Event.Type.POST
element event of typeElementEvent.COPY
is fired
- Parameters:
element
- The element that should be copied.target
- The target media item version to which the element is copied.- Returns:
- The copied element.
- Throws:
NoAuthorizationException
- If user has no rights to copy the element.
-
copyElement
@Deprecated Element copyElement(Element element, nl.gx.webmanager.cms.pagemodel.PageModel target) throws NoAuthorizationException
Deprecated.Copies an element to the target page model.The user requires CREATE permission for the element's element type. Next to that the user needs the UPDATE permission for page models.
Performed steps:
- Permissions of the current user are checked
- A
Event.Type.PRE
element event of typeElementEvent.COPY
is fired - Requested element is copied to the target page model
- A
Event.Type.POST
element event of typeElementEvent.CREATE
is fired - A
Event.Type.POST
element event of typeElementEvent.COPY
is fired
- Parameters:
element
- The element that should be copied.target
- The target page model that the copied element is added to.- Returns:
- The copied element.
- Throws:
NoAuthorizationException
- If user has no rights to copy the element.
-
copyElementToLimbo
Element copyElementToLimbo(Element element, ElementHolder parentHolder) throws NoAuthorizationException
Clone an element and place in the limbo area.- Parameters:
element
- The element to clone.parentHolder
- The parent element holder.- Returns:
- The new copy.
- Throws:
NoAuthorizationException
- If user has no rights to copy the element.
-
createElementInLimbo
Element createElementInLimbo(ElementHolder elementHolder, Class<? extends Element> elementType) throws NoAuthorizationException
Creates an element in the limbo area.- Parameters:
elementHolder
- The parent element holderelementType
- The type of the new element- Returns:
- The new element
- Throws:
NoAuthorizationException
- If user has no rights to copy the element.
-
deleteElementFromLimbo
void deleteElementFromLimbo(Element element)
Deletes an element from the limbo area.- Parameters:
element
- Element to delete.
-
createAndInsertElement
Element createAndInsertElement(ElementHolder wrapper, Class<? extends Element> elementType, int position, Website website)
Creates a new (empty) element and add it at the specified location to the given page version. If the position is invalid this method throws an IllegalArgumentException- Parameters:
elementHolder
- The element holderelementType
- The interface of the element to createposition
- The position at which the element must be inserted, first position is 0.website
- The website- Returns:
- The element that has been created and inserted into the page version
-
copyElement
Element copyElement(Element element, String elementHolderClassName, String elementHolderUUID, int elementHolderId, String targetProperty)
Copies an element to the given element holder.- Parameters:
element
- The source element to copy.elementHolderClassName
- The target elementHolder class name, for logging.elementHolderUUID
- The target elementHolder UUIDelementHolderId
- the element holder IDtargetProperty
- The target property path of the copied element- Returns:
- The copied element.
-
-