Interface MetadataEditorHelper


  • public interface MetadataEditorHelper
    The Interface MetadataEditorHelper. The interface holds the apis to support functionalities related to metadata editor.

    Functionalities:

    1. Form selection for asset and array of assets

    2. Mimetype of asset or common mimetype for multiple assets

    3. Validate metadata for the asset(s)

    • Method Detail

      • getEditorFormResource

        Resource getEditorFormResource​(Resource... resources)
        Gets the merged metadata-editor form which qualifies for the passed Assets. It also looks for any folder specific metadata form which is applicable for the asset. Folder specific metadata is priotorized over mime type specific metadata.

        Example:

        If 2 assets are passed in the argument with mimetypes image/png and image/jpg, the merged form will contain [default form + image form]

        Parameters:
        resources - Array of asset resources for which form is to be fetched
        Returns:
        the form resource
        Throws:
        SlingException - may be thrown to convey any problem while fetching the form
        java.lang.IllegalArgumentException - if the method arguments are not compatible with the implementation details
      • getInvalidFormItems

        java.util.List<Resource> getInvalidFormItems​(Resource resource)
        Checks if the resource has valid metadata present in the merged form. It first fetches the synthetic resource form which qualifies for the resource (Asset in most scenarios). Then it checks for all the form items which are invalid. The criterion for invalidity is empty required field.
        Parameters:
        resource - The Resource for which validity of metadata is to be checked.
        Returns:
        List of form items for which metadata is invalid
        Throws:
        SlingException - may be thrown to convey any problem while fetching the form
        java.lang.IllegalArgumentException - if the method arguments are not compatible with the implementation details