use of org.simpleframework.xml.core.Persister in project openmeetings by apache.
the class BackupExport method exportRecording.
/*
* ##################### Recordings
*/
private void exportRecording(ZipOutputStream zos, ProgressHolder progressHolder) throws Exception {
List<Recording> list = recordingDao.get();
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
bindDate(registry, list);
writeList(serializer, zos, "flvRecordings.xml", "flvrecordings", list);
progressHolder.setProgress(70);
}
use of org.simpleframework.xml.core.Persister in project openmeetings by apache.
the class BackupExport method exportPoll.
/*
* ##################### Polls
*/
private void exportPoll(ZipOutputStream zos, ProgressHolder progressHolder) throws Exception {
List<RoomPoll> list = pollManager.get();
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(RoomPoll.Type.class, PollTypeConverter.class);
bindDate(registry, list, RoomPoll::getCreated);
writeList(serializer, zos, "roompolls.xml", "roompolls", list);
progressHolder.setProgress(75);
}
use of org.simpleframework.xml.core.Persister in project openmeetings by apache.
the class BackupExport method exportOauth.
/*
* ##################### OAuth2 servers
*/
private void exportOauth(ZipOutputStream zos, ProgressHolder progressHolder) throws Exception {
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
List<OAuthServer> list = auth2Dao.get(0, Integer.MAX_VALUE);
bindDate(registry, list);
writeList(serializer, zos, "oauth2servers.xml", "oauth2servers", list);
progressHolder.setProgress(45);
}
use of org.simpleframework.xml.core.Persister in project openmeetings by apache.
the class BackupImport method importFiles.
/*
* ##################### Import File-Explorer Items
*/
private List<FileItem> importFiles(File f) throws Exception {
log.info("Private message import complete, starting file explorer item import");
List<FileItem> result = new ArrayList<>();
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
RegistryMatcher matcher = new RegistryMatcher();
Serializer ser = new Persister(strategy, matcher);
matcher.bind(Long.class, LongTransform.class);
matcher.bind(Integer.class, IntegerTransform.class);
registry.bind(Date.class, DateConverter.class);
List<FileItem> list = readList(ser, f, "fileExplorerItems.xml", "fileExplorerItems", FileItem.class);
for (FileItem file : list) {
Long fId = file.getId();
// We need to reset this as openJPA reject to store them otherwise
file.setId(null);
Long roomId = file.getRoomId();
file.setRoomId(roomMap.containsKey(roomId) ? roomMap.get(roomId) : null);
if (file.getOwnerId() != null) {
file.setOwnerId(userMap.get(file.getOwnerId()));
}
if (file.getParentId() != null && file.getParentId().longValue() <= 0L) {
file.setParentId(null);
}
if (Strings.isEmpty(file.getHash())) {
file.setHash(UUID.randomUUID().toString());
}
file = fileItemDao.update(file);
result.add(file);
fileItemMap.put(fId, file.getId());
}
return result;
}
use of org.simpleframework.xml.core.Persister in project netxms by netxms.
the class LogParser method createXml.
/**
* Create XML from configuration.
*
* @return XML document
* @throws Exception if the schema for the object is not valid
*/
public String createXml() throws Exception {
Serializer serializer = new Persister();
Writer writer = new StringWriter();
serializer.write(this, writer);
return writer.toString();
}
Aggregations