use of org.simpleframework.xml.core.Persister in project openmeetings by apache.
the class BackupExport method exportContacts.
/*
* ##################### User Contacts
*/
private void exportContacts(ZipOutputStream zos, ProgressHolder progressHolder) throws Exception {
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
registry.bind(User.class, UserConverter.class);
writeList(serializer, zos, "userContacts.xml", "usercontacts", userContactDao.get());
progressHolder.setProgress(60);
}
use of org.simpleframework.xml.core.Persister in project openmeetings by apache.
the class BackupExport method exportMeetingMember.
/*
* ##################### Backup Meeting Members
*/
private void exportMeetingMember(ZipOutputStream zos, ProgressHolder progressHolder) throws Exception {
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
registry.bind(User.class, UserConverter.class);
registry.bind(Appointment.class, AppointmentConverter.class);
writeList(serializer, zos, "meetingmembers.xml", "meetingmembers", meetingMemberDao.getMeetingMembers());
progressHolder.setProgress(30);
}
use of org.simpleframework.xml.core.Persister in project openmeetings by apache.
the class BackupExport method getConfigSerializer.
private static Serializer getConfigSerializer(List<Configuration> list) throws Exception {
Registry registry = new Registry();
registry.bind(User.class, UserConverter.class);
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
bindDate(registry, list);
return serializer;
}
use of org.simpleframework.xml.core.Persister in project openmeetings by apache.
the class BackupExport method exportChat.
/*
* ##################### Chat
*/
private void exportChat(ZipOutputStream zos, ProgressHolder progressHolder) throws Exception {
List<ChatMessage> list = chatDao.get(0, Integer.MAX_VALUE);
Registry registry = new Registry();
registry.bind(User.class, UserConverter.class);
registry.bind(Room.class, RoomConverter.class);
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
bindDate(registry, list, ChatMessage::getSent);
writeList(serializer, zos, "chat_messages.xml", "chat_messages", list);
progressHolder.setProgress(85);
}
use of org.simpleframework.xml.core.Persister in project openmeetings by apache.
the class BackupExport method performExport.
public void performExport(File zip, boolean includeFiles, ProgressHolder progressHolder) throws Exception {
if (zip.getParentFile() != null && !zip.getParentFile().exists()) {
zip.getParentFile().mkdirs();
}
try (FileOutputStream fos = new FileOutputStream(zip);
ZipOutputStream zos = new ZipOutputStream(fos)) {
Serializer ser = new Persister();
progressHolder.setProgress(0);
/*
* ##################### Backup Groups
*/
writeList(ser, zos, "version.xml", "version", Arrays.asList(BackupVersion.get()));
progressHolder.setProgress(2);
exportGroups(zos, progressHolder);
exportUsers(zos, progressHolder);
exportRoom(zos, progressHolder);
exportRoomGroup(zos, progressHolder);
exportRoomFile(zos, progressHolder);
exportCalendar(zos, progressHolder);
exportAppointment(zos, progressHolder);
exportMeetingMember(zos, progressHolder);
exportLdap(zos, progressHolder, ser);
exportOauth(zos, progressHolder);
exportPrivateMsg(zos, progressHolder);
exportPrivateMsgFolder(zos, progressHolder, ser);
exportContacts(zos, progressHolder);
exportFile(zos, progressHolder);
exportRecording(zos, progressHolder);
exportPoll(zos, progressHolder);
exportConfig(zos, progressHolder);
exportChat(zos, progressHolder);
if (includeFiles) {
// ##################### Backup Room Files
for (File file : getUploadDir().listFiles()) {
String fName = file.getName();
if (file.isDirectory() && !IMPORT_DIR.equals(fName) && !BACKUP_DIR.equals(fName)) {
log.debug("### " + file.getName());
writeZipDir(BCKP_ROOM_FILES, file.getParentFile().toURI(), file, zos);
}
}
// ##################### Backup Recording Files
final File recDir = getStreamsHibernateDir();
writeZipDir(BCKP_RECORD_FILES, recDir.toURI(), recDir, zos);
progressHolder.setProgress(90);
final File customCss = getCustomCss();
if (customCss != null && customCss.exists() && customCss.isFile()) {
writeZip(CSS_DIR, customCss.getParentFile().toURI(), customCss, zos);
}
}
}
progressHolder.setProgress(100);
log.debug("---Done");
}
Aggregations