mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.1 to HEAD
6975: Fix for WCM-883 - ZIP files with non-ascii characters, now gives the user an option for the encoding of the ZIP filenames 6978: Fixed test for 2.1 bean names. 6981: Fixes test failure. 6982: Integrity exception message carries full failure details. 6983: Added upgrade script for SQL Server. 6988: Replaced UserTransaction with RetryingTransactionHelper. 6989: Added org.hibernate.ObjectNotFoundException RetryingTransactionHelper. 6996: Added updated support for datetime tokens in the lucene index 7001: FIx for AR-1806 7015: Added missing post-create index script for QName columns on alf_child_assoc. 7022: Merged V2.0 to V2.1: 7013: Fixed primary child node status query git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7371 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1118,6 +1118,7 @@ task_done_resubmit_all=Task Done & Re-Submit All
|
||||
title_import_content=Web Project Bulk Import
|
||||
import_website_content_title=Bulk Import
|
||||
import_website_content_desc=Use this dialog to import an archive of content into the web project.
|
||||
import_high_byte_zip_file=ZIP file contains high-byte filename characters such as Japanese, Chinese or Korean.
|
||||
delete_avm_file_info=To remove this file from the sandbox, click OK.
|
||||
delete_avm_file_confirm=Are you sure you want to remove \"{0}\" from the sandbox?
|
||||
delete_form_instance_data_confirm=Are you sure you want to remove \"{0}\" and its {1} associated {1,choice,0#renditions|1#rendition|1<renditions} from the sandbox?
|
||||
|
@@ -45,6 +45,7 @@ import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.action.executer.ImporterActionExecuter;
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
@@ -62,6 +63,8 @@ import org.alfresco.web.app.context.UIContextService;
|
||||
import org.alfresco.web.bean.FileUploadBean;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.tools.zip.ZipFile;
|
||||
|
||||
/**
|
||||
@@ -75,10 +78,12 @@ import org.apache.tools.zip.ZipFile;
|
||||
public class ImportWebsiteDialog
|
||||
{
|
||||
private static final int BUFFER_SIZE = 16384;
|
||||
private static Log logger = LogFactory.getLog(ImportWebsiteDialog.class);
|
||||
|
||||
protected File file;
|
||||
protected String fileName;
|
||||
protected boolean isFinished = false;
|
||||
protected boolean highByteZip = false;
|
||||
|
||||
protected FileFolderService fileFolderService;
|
||||
protected ContentService contentService;
|
||||
@@ -163,6 +168,22 @@ public class ImportWebsiteDialog
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the highByteZip encoding switch
|
||||
*/
|
||||
public boolean isHighByteZip()
|
||||
{
|
||||
return this.highByteZip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param highByteZip the encoding switch for high-byte ZIP filenames to set
|
||||
*/
|
||||
public void setHighByteZip(boolean highByteZip)
|
||||
{
|
||||
this.highByteZip = highByteZip;
|
||||
}
|
||||
|
||||
public boolean getFinishButtonDisabled()
|
||||
{
|
||||
return (this.fileName == null || this.fileName.length() == 0);
|
||||
@@ -199,22 +220,27 @@ public class ImportWebsiteDialog
|
||||
try
|
||||
{
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
tx = Repository.getUserTransaction(context);
|
||||
tx.begin();
|
||||
RetryingTransactionHelper.RetryingTransactionCallback<String> cb =
|
||||
new RetryingTransactionHelper.RetryingTransactionCallback<String>()
|
||||
{
|
||||
public String execute()
|
||||
{
|
||||
// get the AVM path that will contain the imported content
|
||||
String rootPath = avmBrowseBean.getCurrentPath();
|
||||
|
||||
// get the AVM path that will contain the imported content
|
||||
String rootPath = this.avmBrowseBean.getCurrentPath();
|
||||
// convert the AVM path to a NodeRef so we can use the NodeService to perform import
|
||||
NodeRef importRef = AVMNodeConverter.ToNodeRef(-1, rootPath);
|
||||
processZipImport(file, importRef);
|
||||
|
||||
// convert the AVM path to a NodeRef so we can use the NodeService to perform import
|
||||
NodeRef importRef = AVMNodeConverter.ToNodeRef(-1, rootPath);
|
||||
processZipImport(this.file, importRef);
|
||||
// After a bulk import it's a good idea to snapshot the store
|
||||
avmService.createSnapshot(
|
||||
AVMUtil.getStoreName(rootPath),
|
||||
"Import of file: " + fileName, null);
|
||||
|
||||
// After a bulk import it's a good idea to snapshot the store
|
||||
this.avmService.createSnapshot(
|
||||
AVMUtil.getStoreName(rootPath),
|
||||
"Import of file: " + this.fileName, null);
|
||||
|
||||
tx.commit();
|
||||
return rootPath;
|
||||
}
|
||||
};
|
||||
String rootPath = Repository.getRetryingTransactionHelper(context).doInTransaction(cb);
|
||||
|
||||
// Reload virtualisation server as required
|
||||
AVMUtil.updateVServerWebapp(rootPath, true);
|
||||
@@ -225,8 +251,6 @@ public class ImportWebsiteDialog
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
// rollback the transaction
|
||||
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
|
||||
Utils.addErrorMessage(MessageFormat.format(
|
||||
Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC),
|
||||
e.getMessage()), e);
|
||||
@@ -299,7 +323,7 @@ public class ImportWebsiteDialog
|
||||
{
|
||||
// NOTE: This encoding allows us to workaround bug:
|
||||
// http://bugs.sun.com/bugdatabase/view_bug.do;:WuuT?bug_id=4820807
|
||||
ZipFile zipFile = new ZipFile(file, "Cp437");
|
||||
ZipFile zipFile = new ZipFile(file, this.highByteZip ? "Cp437" : null);
|
||||
File alfTempDir = TempFileProvider.getTempDir();
|
||||
// build a temp dir name based on the name of the file we are importing
|
||||
File tempDir = new File(alfTempDir.getPath() + File.separatorChar + file.getName() + "_unpack");
|
||||
|
@@ -177,8 +177,15 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan="2" class="paddingRow"></td></tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h:selectBooleanCheckbox id="chkHighByte" value="#{ImportWebsiteDialog.highByteZip}" />
|
||||
<span style="vertical-align:20%"><h:outputText id="msgHighByte" value="#{msg.import_high_byte_zip_file}"/></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan="2" class="paddingRow"></td></tr>
|
||||
<% } %>
|
||||
|
||||
</table>
|
||||
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %>
|
||||
</td>
|
||||
|
Reference in New Issue
Block a user