public class ContentIOManager extends AbstractLogEnabled implements Component, Serviceable, Contextualizable
| Modifier and Type | Field and Description | 
|---|---|
private ContentImporterExtensionPoint | 
_contentImporterExtensionPoint  | 
private ContentTypeExtensionPoint | 
_contentTypeExtensionPoint  | 
private Context | 
_context  | 
private CurrentUserProvider | 
_currentUserProvider  | 
private AmetysObjectResolver | 
_resolver  | 
private RightManager | 
_rightsManager  | 
private WorkflowProvider | 
_workflowProvider  | 
static String | 
ROLE
Avalon Role 
 | 
| Constructor and Description | 
|---|
ContentIOManager()  | 
| Modifier and Type | Method and Description | 
|---|---|
private Content | 
_convertFileToContent(ContentImporter importer,
                     File file,
                     Site site,
                     Sitemap sitemap,
                     UserIdentity user,
                     Map<String,String> params)  | 
private ModifiablePage | 
_createPageAndSetContent(PagesContainer rootPage,
                        Content content,
                        Site site,
                        Sitemap sitemap,
                        Map<String,String> params,
                        File file)  | 
private int[] | 
_importFromDirectory(File dir,
                    PagesContainer rootPage,
                    UserIdentity user,
                    boolean isContextExtern)  | 
private ModifiablePage | 
_importFromFile(File file,
               PagesContainer rootPage,
               UserIdentity user,
               boolean isContextExtern)
Import a file into a new content and a new page. 
 | 
void | 
contextualize(Context context)  | 
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. 
 | 
ModifiablePage | 
importContent(InputStream is,
             String mimeType,
             String contentName,
             UserIdentity user,
             PagesContainer rootPage,
             boolean isContextExtern)
Import an InputStream as a content into a new page 
 | 
int[] | 
importContent(String path,
             PagesContainer rootPage,
             UserIdentity user)
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. 
 | 
Map<String,Object> | 
importContent(String directoryPath,
             String rootPageId)
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. 
 | 
void | 
service(ServiceManager manager)  | 
enableLogging, getLogger, setupLogger, setupLogger, setupLoggerprivate ContentImporterExtensionPoint _contentImporterExtensionPoint
private ContentTypeExtensionPoint _contentTypeExtensionPoint
private RightManager _rightsManager
private WorkflowProvider _workflowProvider
private CurrentUserProvider _currentUserProvider
private AmetysObjectResolver _resolver
public ContentIOManager()
public void contextualize(Context context) throws ContextException
contextualize in interface ContextualizableContextExceptionpublic void service(ServiceManager manager) throws ServiceException
service in interface ServiceableServiceExceptionpublic Map<String,Object> importContent(String directoryPath, String rootPageId) throws ProcessingException, AmetysRepositoryException
directoryPath - The absolute path of directory on the serverrootPageId - The id of parent pageAmetysRepositoryException - If an error occurredProcessingException - if an error occurs during processing.public int[] importContent(String path, PagesContainer rootPage, UserIdentity user) throws ProcessingException
path - The absolute path of directory on the serverrootPage - The parent page of the new contentsuser - The user responsible for contents importProcessingException - if an error occurs during processing.public ModifiablePage importContent(InputStream is, String mimeType, String contentName, UserIdentity user, PagesContainer rootPage, boolean isContextExtern) throws IOException
is - The input stream to importmimeType - The Mime type of the input streamcontentName - The name associated with the input streamuser - The creatorrootPage - The parent page of the newly created pageisContextExtern - True if the current context is not in a siteIOException - if an error occurs with the temporary file.private int[] _importFromDirectory(File dir, PagesContainer rootPage, UserIdentity user, boolean isContextExtern)
private ModifiablePage _importFromFile(File file, PagesContainer rootPage, UserIdentity user, boolean isContextExtern)
file - The file to importrootPage - The parent page of the newly created pageuser - The userisContextExtern - True if the current context is not in a siteprivate Content _convertFileToContent(ContentImporter importer, File file, Site site, Sitemap sitemap, UserIdentity user, Map<String,String> params) throws com.opensymphony.workflow.WorkflowException, AmetysRepositoryException
com.opensymphony.workflow.WorkflowExceptionAmetysRepositoryExceptionprivate ModifiablePage _createPageAndSetContent(PagesContainer rootPage, Content content, Site site, Sitemap sitemap, Map<String,String> params, File file)
protected boolean hasRight(String contentTypeId, PagesContainer page, UserIdentity user, boolean isContextExtern)
contentTypeId - the content type ID.page - the current page.user - The userisContextExtern - True if the current context is not in a site