ALF-9456 - Finish updating the Site Importer/Exporter now that Site Config is in the normal repo rather than in AVM

(The sample team site export had already been tweaked by Kev in June to include the surf-config)


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30745 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2011-09-23 16:41:09 +00:00
parent 34850476d4
commit 28a33522fd
2 changed files with 5 additions and 48 deletions

View File

@@ -718,8 +718,6 @@
<property name="mimetypeService" ref="MimetypeService"/>
<property name="exporterService" ref="ExporterService"/>
<property name="siteService" ref="SiteService"/>
<property name="avmService" ref="AVMService"/>
<property name="avmZipExporterService" ref="avmZipExporterService"/>
<property name="authenticationContextManager" ref="Authentication"/>
</bean>

View File

@@ -35,15 +35,12 @@ import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.exporter.ACPExportPackageHandler;
import org.alfresco.repo.management.subsystems.ChildApplicationContextManager;
import org.alfresco.repo.security.authentication.RepositoryAuthenticationDao;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.repository.MimetypeService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.security.AuthorityService;
import org.alfresco.service.cmr.security.AuthorityType;
import org.alfresco.service.cmr.site.SiteInfo;
import org.alfresco.service.cmr.site.SiteService;
import org.alfresco.service.cmr.view.AVMZipExporterService;
import org.alfresco.service.cmr.view.ExporterCrawlerParameters;
import org.alfresco.service.cmr.view.ExporterService;
import org.alfresco.service.cmr.view.Location;
@@ -58,19 +55,19 @@ import org.springframework.extensions.webscripts.WebScriptRequest;
import org.springframework.extensions.webscripts.WebScriptResponse;
/**
* Exports a Site as a zip of ACPs and an AVM dump
* Exports a Site as a zip of ACPs.
*
* As of 4.0, the export no longer includes an AVM Dump, as
* the site config is now in the main site ACP.
*
* @author Nick Burch
* @since 3.5
*/
public class SiteExportGet extends AbstractWebScript
{
private static final String SITE_AVM_ROOT = "sitestore:/alfresco/site-data/";
private static final List<String> USERS_NOT_TO_EXPORT = Arrays.asList(
new String[] { "admin", "guest" });
private AVMZipExporterService avmZipExporterService;
private AVMService avmService;
private SiteService siteService;
private ExporterService exporterService;
private MimetypeService mimetypeService;
@@ -104,11 +101,8 @@ public class SiteExportGet extends AbstractWebScript
CloseIgnoringOutputStream outputForNesting =
new CloseIgnoringOutputStream(mainZip);
// Export the AVM details (dashboard etc)
mainZip.putNextEntry(new ZipEntry("AVM.zip"));
doAVMExport(site, outputForNesting);
// Export the Site's Contents
// This includes the site config such as dashboards
mainZip.putNextEntry(new ZipEntry("Contents.acp"));
doSiteACPExport(site, outputForNesting);
@@ -150,31 +144,6 @@ public class SiteExportGet extends AbstractWebScript
mainZip.close();
}
protected void doAVMExport(SiteInfo site, CloseIgnoringOutputStream writeTo) throws IOException
{
String pageRoot = SITE_AVM_ROOT + "pages/site/" + site.getShortName();
String componentRoot = SITE_AVM_ROOT + "components";
String componentMatch = "~" + site.getShortName() + "~";
// Nest the zip
ZipOutputStream zip = new ZipOutputStream(writeTo);
// First up, do the page info
avmZipExporterService.export(zip, -1, pageRoot, true);
// Now do the components
for (AVMNodeDescriptor node : avmService.getDirectoryListing(-1, componentRoot).values())
{
if (node.getName().contains(componentMatch))
{
avmZipExporterService.export(zip, node, false);
}
}
// Finish the AVM zip
zip.close();
}
protected void doSiteACPExport(SiteInfo site, CloseIgnoringOutputStream writeTo) throws IOException
{
// Build the parameters
@@ -353,16 +322,6 @@ public class SiteExportGet extends AbstractWebScript
}
}
public void setAvmZipExporterService(AVMZipExporterService avmZipExporterService)
{
this.avmZipExporterService = avmZipExporterService;
}
public void setAvmService(AVMService avmService)
{
this.avmService = avmService;
}
public void setSiteService(SiteService siteService)
{
this.siteService = siteService;