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:
Derek Hulley
2007-11-13 01:15:58 +00:00
parent 224a6b2fb8
commit 83919a08f1
3 changed files with 102 additions and 70 deletions

View File

@@ -1118,6 +1118,7 @@ task_done_resubmit_all=Task Done & Re-Submit All
title_import_content=Web Project Bulk Import title_import_content=Web Project Bulk Import
import_website_content_title=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_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_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_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? 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?

View File

@@ -45,6 +45,7 @@ import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.executer.ImporterActionExecuter; import org.alfresco.repo.action.executer.ImporterActionExecuter;
import org.alfresco.repo.avm.AVMNodeConverter; import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.domain.PropertyValue; import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.service.ServiceRegistry; import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.avm.AVMService; import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition; 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.FileUploadBean;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.ui.common.Utils; 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; import org.apache.tools.zip.ZipFile;
/** /**
@@ -75,10 +78,12 @@ import org.apache.tools.zip.ZipFile;
public class ImportWebsiteDialog public class ImportWebsiteDialog
{ {
private static final int BUFFER_SIZE = 16384; private static final int BUFFER_SIZE = 16384;
private static Log logger = LogFactory.getLog(ImportWebsiteDialog.class);
protected File file; protected File file;
protected String fileName; protected String fileName;
protected boolean isFinished = false; protected boolean isFinished = false;
protected boolean highByteZip = false;
protected FileFolderService fileFolderService; protected FileFolderService fileFolderService;
protected ContentService contentService; 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() public boolean getFinishButtonDisabled()
{ {
return (this.fileName == null || this.fileName.length() == 0); return (this.fileName == null || this.fileName.length() == 0);
@@ -199,22 +220,27 @@ public class ImportWebsiteDialog
try try
{ {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
tx = Repository.getUserTransaction(context); RetryingTransactionHelper.RetryingTransactionCallback<String> cb =
tx.begin(); new RetryingTransactionHelper.RetryingTransactionCallback<String>()
{
public String execute()
{
// get the AVM path that will contain the imported content // get the AVM path that will contain the imported content
String rootPath = this.avmBrowseBean.getCurrentPath(); String rootPath = avmBrowseBean.getCurrentPath();
// convert the AVM path to a NodeRef so we can use the NodeService to perform import // convert the AVM path to a NodeRef so we can use the NodeService to perform import
NodeRef importRef = AVMNodeConverter.ToNodeRef(-1, rootPath); NodeRef importRef = AVMNodeConverter.ToNodeRef(-1, rootPath);
processZipImport(this.file, importRef); processZipImport(file, importRef);
// After a bulk import it's a good idea to snapshot the store // After a bulk import it's a good idea to snapshot the store
this.avmService.createSnapshot( avmService.createSnapshot(
AVMUtil.getStoreName(rootPath), AVMUtil.getStoreName(rootPath),
"Import of file: " + this.fileName, null); "Import of file: " + fileName, null);
tx.commit(); return rootPath;
}
};
String rootPath = Repository.getRetryingTransactionHelper(context).doInTransaction(cb);
// Reload virtualisation server as required // Reload virtualisation server as required
AVMUtil.updateVServerWebapp(rootPath, true); AVMUtil.updateVServerWebapp(rootPath, true);
@@ -225,8 +251,6 @@ public class ImportWebsiteDialog
} }
catch (Throwable e) catch (Throwable e)
{ {
// rollback the transaction
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
Utils.addErrorMessage(MessageFormat.format( Utils.addErrorMessage(MessageFormat.format(
Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC),
e.getMessage()), e); e.getMessage()), e);
@@ -299,7 +323,7 @@ public class ImportWebsiteDialog
{ {
// NOTE: This encoding allows us to workaround bug: // NOTE: This encoding allows us to workaround bug:
// http://bugs.sun.com/bugdatabase/view_bug.do;:WuuT?bug_id=4820807 // 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(); File alfTempDir = TempFileProvider.getTempDir();
// build a temp dir name based on the name of the file we are importing // 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"); File tempDir = new File(alfTempDir.getPath() + File.separatorChar + file.getName() + "_unpack");

View File

@@ -177,8 +177,15 @@
</div> </div>
</td> </td>
</tr> </tr>
<tr><td colspan="2" class="paddingRow"></td></tr>
<tr>
<td colspan="2">
<h:selectBooleanCheckbox id="chkHighByte" value="#{ImportWebsiteDialog.highByteZip}" />&nbsp;
<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> </table>
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %> <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %>
</td> </td>