. Import Website Content dialog removed from Web Project screen and added to Create menu in Browse Sandbox screen

- Renamed "Import Website Content" to "Bulk Import"
 - Action can be used to import an archive of content into any folder, such as a root webapp folder or a sub-folder of content
 - Action can now be used to import into a user sandbox rather than just the staging area

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4720 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2007-01-04 11:17:45 +00:00
parent 938ef3d326
commit 51ce3c21d7
6 changed files with 34 additions and 59 deletions

View File

@@ -25,7 +25,6 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.DateFormat;
import java.text.MessageFormat;
import java.util.Enumeration;
import java.util.zip.ZipException;
@@ -37,7 +36,6 @@ import javax.transaction.UserTransaction;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ApplicationModel;
import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMAppModel;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.service.ServiceRegistry;
@@ -52,9 +50,8 @@ import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.util.TempFileProvider;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.context.UIContextService;
import org.alfresco.web.bean.FileUploadBean;
import org.alfresco.web.bean.NavigationBean;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.ui.common.Utils;
import org.apache.tools.zip.ZipEntry;
@@ -78,7 +75,6 @@ public class ImportWebsiteDialog
protected FileFolderService fileFolderService;
protected ContentService contentService;
protected NavigationBean navigationBean;
protected AVMBrowseBean avmBrowseBean;
protected AVMService avmService;
protected NodeService nodeService;
@@ -100,14 +96,6 @@ public class ImportWebsiteDialog
this.fileFolderService = fileFolderService;
}
/**
* @param navigationBean The NavigationBean to set.
*/
public void setNavigationBean(NavigationBean navigationBean)
{
this.navigationBean = navigationBean;
}
/**
* @param avmBrowseBean The AVMBrowseBean to set.
*/
@@ -207,38 +195,25 @@ public class ImportWebsiteDialog
tx = Repository.getUserTransaction(context);
tx.begin();
// TODO: explicit permission check for WRITE on website node for this user
// get the AVM path that will contain the imported content
String rootPath = this.avmBrowseBean.getCurrentPath();
// import the content into the appropriate store for the website
Node website = this.navigationBean.getCurrentNode();
String storeRoot = (String)website.getProperties().get(WCMAppModel.PROP_AVMSTORE);
String webapp = this.avmBrowseBean.getWebapp();
if (storeRoot != null && webapp != null)
{
String store = AVMConstants.buildStagingStoreName(storeRoot);
if (this.avmService.getStore(store) != null)
{
// get the path to the root webapp import area of the store
String rootPath = AVMConstants.buildStoreWebappPath(store, webapp);
// 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 an import it's a good idea to snapshot the staging store
this.avmService.createSnapshot(store, "Import of file: " + this.fileName, null);
// Reload virtualisation server as required
AVMConstants.updateVServerWebapp(rootPath, true);
}
}
else
{
throw new IllegalStateException("Unable to find root store/webapp property for website!");
}
// 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
this.avmService.createSnapshot(
AVMConstants.getStoreName(rootPath),
"Import of file: " + this.fileName, null);
// Reload virtualisation server as required
AVMConstants.updateVServerWebapp(rootPath, true);
tx.commit();
UIContextService.getInstance(context).notifyBeans();
outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
catch (Throwable e)