Class ContentIOManager

    • Field Detail

      • ROLE

        public static final String ROLE
        Avalon Role
    • Method Detail

      • importContent

        public Map<String,​ObjectimportContent​(String directoryPath,
                                                      String rootPageId)
                                               throws ProcessingException,
                                                      AmetysRepositoryException
        Import recursively documents contained in a directory on the server Created contents are of type 'article' and pages are also created upon successful content creation.
        Parameters:
        directoryPath - The absolute path of directory on the server
        rootPageId - The id of parent page
        Returns:
        An array containing the number of successful and unsuccessful content created.
        Throws:
        AmetysRepositoryException - If an error occurred
        ProcessingException - if an error occurs during processing.
      • importContent

        public int[] importContent​(String path,
                                   PagesContainer rootPage,
                                   UserIdentity user)
                            throws ProcessingException
        Import recursively documents contained in a directory on the server Created contents are of type 'article' and pages are also created upon successful content creation.
        Parameters:
        path - The absolute path of directory on the server
        rootPage - The parent page of the new contents
        user - The user responsible for contents import
        Returns:
        An array containing the number of successful and unsuccessful content created.
        Throws:
        ProcessingException - if an error occurs during processing.
      • importContent

        public ModifiablePage importContent​(InputStream is,
                                            String mimeType,
                                            String contentName,
                                            UserIdentity user,
                                            PagesContainer rootPage,
                                            boolean isContextExtern)
                                     throws IOException
        Import an InputStream as a content into a new page
        Parameters:
        is - The input stream to import
        mimeType - The Mime type of the input stream
        contentName - The name associated with the input stream
        user - The creator
        rootPage - The parent page of the newly created page
        isContextExtern - True if the current context is not in a site
        Returns:
        The created page or null if failed to create the page
        Throws:
        IOException - if an error occurs with the temporary file.
      • hasRight

        protected boolean hasRight​(String contentTypeId,
                                   PagesContainer page,
                                   UserIdentity user,
                                   boolean isContextExtern)
        Test if the current user has the right needed by the content type to create a content.
        Parameters:
        contentTypeId - the content type ID.
        page - the current page.
        user - The user
        isContextExtern - True if the current context is not in a site
        Returns:
        true if the user has the right needed, false otherwise.