cancel
Showing results for 
Search instead for 
Did you mean: 

How to extract zip contents which is already extracted

harishns
Champ in-the-making
Champ in-the-making
Hi,
I am facing one issue while importing of the zip file.
I have set a rule to import zip file in to one space and found zip file extracted properly for the first time, after that I have added few more files to that zip and want to update the zip file, if I do that through UI, the zip file is not extracting, application is throwing following error

[org.alfresco.web.ui.common.Utils] Failed to run Actions due to error: 08080003 Failed to process ZIP file.
org.alfresco.error.AlfrescoRuntimeException: 08080003 Failed to process ZIP file.
at org.alfresco.repo.action.executer.ImporterActionExecuter.importDirectory(ImporterActionExecuter.java:310)
at org.alfresco.repo.action.executer.ImporterActionExecuter.executeImpl(ImporterActionExecuter.java:221)
at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:127)
at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:711)
at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:648)
at org.alfresco.repo.action.ActionServiceImpl.executeAction(ActionServiceImpl.java:510)


at java.lang.Thread.run(Thread.java:595)
Caused by: org.alfresco.service.cmr.model.FileExistsException: Existing file or folder testfolder already exists
at org.alfresco.repo.model.filefolder.FileFolderServiceImpl.createImpl(FileFolderServiceImpl.java:786)
at org.alfresco.repo.model.filefolder.FileFolderServiceImpl.create(FileFolderServiceImpl.java:735)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)

I am not able to get any replacing/updating flag to that action and in code it is calling NodeService.createNode() which is throwing DuplicateChildNameException . In java also I am not finding any flag to replace or update the existing files/folders
is there any alternatives to update existing file while extracting zip?

Any help will greatly appreciated

Harish
2 REPLIES 2

mrogers
Star Contributor
Star Contributor
The ImporterActionExecuter will not overwrite files or folders.

You could copy the ImporterActionExecuter and implement your own version of it to overwrite existing files and folders.    Or you could change it to accept another configuration parameter to specify the behaviour.

harishns
Champ in-the-making
Champ in-the-making
Hi, Thanks for your confirmation,

I am trying to modify the ImporterActionExecuter.java and not able to get any methods in NodeService.java that can replace/update a content/folder in the application.

I also found that the update action of a content in the UI is using separate bean(ContentUpdateBean.java) to update the content.

I am trying to modify the code in FileFolderServiceImpl.java

        try
        {
            assocRef = nodeService.createNode(
                    parentNodeRef,
                    ContentModel.ASSOC_CONTAINS,
                    assocQName,
                    typeQName,
                    properties);
        }
        catch (DuplicateChildNodeNameException e)
        {
            throw new FileExistsException(parentNodeRef, name);
        }

Help me in guiding any option to update/replace the content.

Harish