public void performExport(File filePath, File backup_dir, boolean includeFiles) throws Exception {
if (!backup_dir.exists()) {
backup_dir.mkdirs();
}
Serializer simpleSerializer = new Persister();
/*
* ##################### Backup Organizations
*/
writeList(simpleSerializer, backup_dir, "organizations.xml",
"organisations", organisationDao.get(0, Integer.MAX_VALUE));
/*
* ##################### Backup Users
*/
exportUsers(backup_dir, usersDao.getAllBackupUsers());
/*
* ##################### Backup Room
*/
{
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
registry.bind(User.class, UserConverter.class);
registry.bind(RoomType.class, RoomTypeConverter.class);
writeList(serializer, backup_dir, "rooms.xml", "rooms", roomDao.get());
}
/*
* ##################### Backup Room Organizations
*/
{
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
registry.bind(Organisation.class, OrganisationConverter.class);
registry.bind(Room.class, RoomConverter.class);
writeList(serializer, backup_dir, "rooms_organisation.xml",
"room_organisations", roomOrganisationDao.get());
}
/*
* ##################### Backup Appointments
*/
{
List<Appointment> list = appointmentDao.getAppointments();
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
registry.bind(AppointmentCategory.class, AppointmentCategoryConverter.class);
registry.bind(User.class, UserConverter.class);
registry.bind(AppointmentReminderTyps.class, AppointmentReminderTypeConverter.class);
registry.bind(Room.class, RoomConverter.class);
if (list != null && list.size() > 0) {
registry.bind(list.get(0).getStart().getClass(), DateConverter.class);
}
writeList(serializer, backup_dir, "appointements.xml", "appointments", list);
}
/*
* ##################### Backup Meeting Members
*/
{
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, backup_dir, "meetingmembers.xml",
"meetingmembers", meetingMemberDao.getMeetingMembers());
}
/*
* ##################### LDAP Configs
*/
writeList(simpleSerializer, backup_dir, "ldapconfigs.xml",
"ldapconfigs", ldapConfigDao.get());
/*
* ##################### Cluster servers
*/
writeList(simpleSerializer, backup_dir, "servers.xml", "servers", serverDao.get(0, Integer.MAX_VALUE));
/*
* ##################### OAuth2 servers
*/
writeList(simpleSerializer, backup_dir, "oauth2servers.xml", "oauth2servers", auth2Dao.get(0, Integer.MAX_VALUE));
/*
* ##################### Private Messages
*/
{
List<PrivateMessage> list = privateMessagesDao.get(0, Integer.MAX_VALUE);
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
registry.bind(User.class, UserConverter.class);
registry.bind(Room.class, RoomConverter.class);
if (list != null && list.size() > 0) {
registry.bind(list.get(0).getInserted().getClass(), DateConverter.class);
}
writeList(serializer, backup_dir, "privateMessages.xml",
"privatemessages", list);
}
/*
* ##################### Private Message Folders
*/
writeList(simpleSerializer, backup_dir, "privateMessageFolder.xml",
"privatemessagefolders", privateMessageFolderDao.get(0, Integer.MAX_VALUE));
/*
* ##################### User Contacts
*/
{
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
registry.bind(User.class, UserConverter.class);
writeList(serializer, backup_dir, "userContacts.xml",
"usercontacts", userContactsDao.getUserContacts());
}
/*
* ##################### File-Explorer
*/
{
List<FileExplorerItem> list = fileExplorerItemDao.getFileExplorerItems();
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
if (list != null && list.size() > 0) {
registry.bind(list.get(0).getInserted().getClass(), DateConverter.class);
}
writeList(serializer, backup_dir, "fileExplorerItems.xml",
"fileExplorerItems", list);
}
/*
* ##################### Recordings
*/
{
List<FlvRecording> list = flvRecordingDao.getAllFlvRecordings();
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
if (list != null && list.size() > 0) {
registry.bind(list.get(0).getInserted().getClass(), DateConverter.class);
}
writeList(serializer, backup_dir, "flvRecordings.xml",
"flvrecordings", list);
}
/*
* ##################### Polls
*/
{
List<RoomPoll> list = pollManager.getPollListBackup();
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
registry.bind(User.class, UserConverter.class);
registry.bind(Room.class, RoomConverter.class);
registry.bind(PollType.class, PollTypeConverter.class);
if (list != null && list.size() > 0) {
registry.bind(list.get(0).getCreated().getClass(), DateConverter.class);
}
writeList(serializer, backup_dir, "roompolls.xml", "roompolls", list);
}
/*
* ##################### Config
*/
{
List<Configuration> list = configurationDao.getConfigurations(
0, Integer.MAX_VALUE, "c.configuration_id", true);
Registry registry = new Registry();
registry.bind(State.class, StateConverter.class);
registry.bind(User.class, UserConverter.class);
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
if (list != null && list.size() > 0) {
registry.bind(list.get(0).getStarttime().getClass(), DateConverter.class);
}
writeList(serializer, backup_dir, "configs.xml", "configs", list);
}
/*
* ##################### Chat
*/
{
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
registry.bind(User.class, UserConverter.class);
registry.bind(Room.class, RoomConverter.class);
List<ChatMessage> list = chatDao.get(0, Integer.MAX_VALUE);
if (list != null && list.size() > 0) {