Class ContentIOManager

java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.plugins.webcontentio.ContentIOManager
All Implemented Interfaces:
Component, Contextualizable, LogEnabled, Serviceable

Manager for importing contents
  • Field Details

    • ROLE

      public static final String ROLE
      Avalon Role
  • Constructor Details

  • Method Details

    • contextualize

      public void contextualize(Context context) throws ContextException
      Specified by:
      contextualize in interface Contextualizable
      Throws:
      ContextException
    • service

      public void service(ServiceManager manager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • importContent

      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.