exportSites(outputStream, params, l);
}
public void exportSites(OutputStream outputStream, Map<String, Object> params, List<JahiaSite> sites)
throws JahiaException, RepositoryException, IOException, SAXException, JDOMException {
ZipOutputStream zout = new ZipOutputStream(outputStream);
ZipEntry anEntry = new ZipEntry(EXPORT_PROPERTIES);
zout.putNextEntry(anEntry);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(zout));
bw.write("JahiaRelease = " + Jahia.getReleaseNumber() + "\n");
bw.write("Patch = " + Jahia.getPatchNumber() + "\n");
bw.write("BuildNumber = " + Jahia.getBuildNumber() + "\n");
bw.write("ExportDate = " + new SimpleDateFormat(ImportExportService.DATE_FORMAT).format(new Date()) + "\n");
bw.flush();
// Add system site for export
boolean systemFound = false;
for (JahiaSite jahiaSite : sites) {
if (jahiaSite.getSiteKey().equals("systemsite")) {
systemFound = true;
break;
}
}
if (!systemFound) {
anEntry = new ZipEntry("systemsite.zip");
zout.putNextEntry(anEntry);
exportSystemSite(zout, params);
}
for (JahiaSite jahiaSite : sites) {
anEntry = new ZipEntry(jahiaSite.getSiteKey() + ".zip");
zout.putNextEntry(anEntry);
exportSite(jahiaSite, zout, params);
}
JCRSessionWrapper session = jcrStoreService.getSessionFactory().getCurrentUserSession();
// export shared files -->
Set<JCRNodeWrapper> files = new HashSet<JCRNodeWrapper>();
try {
files.add(session.getNode("/users"));
} catch (RepositoryException e) {
e.printStackTrace();
throw new IOException(e.getMessage());
}
zout.putNextEntry(new ZipEntry("users.zip"));
ZipOutputStream zzout = new ZipOutputStream(zout);
Set<String> tti = new HashSet<String>();
tti.add(Constants.JAHIANT_VIRTUALSITE);
try {
exportNodesWithBinaries(session.getRootNode(), files, zzout, tti, params);
} catch (Exception e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
zzout.finish();
zout.finish();
}