Interface ElementManagementService


  • public interface ElementManagementService
    This class offers APIs to access elements on Pages, Page sections, Page models and Media items.
    • 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 added
        elementType - 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 to
        elementType - 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 added
        elementType - 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 added
        elementType - 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

        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 to
        elementType - 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 added
        elementType - 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
      • 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 type ElementEvent.COPY is fired
        • Requested element is copied to the target page version
        • A Event.Type.POST element event of type ElementEvent.CREATE is fired
        • A Event.Type.POST element event of type ElementEvent.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 type ElementEvent.COPY is fired
        • Requested element is copied to the target media item version
        • A Event.Type.POST element event of type ElementEvent.CREATE is fired
        • A Event.Type.POST element event of type ElementEvent.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 type ElementEvent.COPY is fired
        • Requested element is copied to the target page model
        • A Event.Type.POST element event of type ElementEvent.CREATE is fired
        • A Event.Type.POST element event of type ElementEvent.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.
      • 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 holder
        elementType - The interface of the element to create
        position - 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 UUID
        elementHolderId - the element holder ID
        targetProperty - The target property path of the copied element
        Returns:
        The copied element.