This is an automated email from the ASF dual-hosted git repository.
solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git
The following commit(s) were added to refs/heads/master by this push:
new b12692f [OPENMEETINGS-2177] export is converted
b12692f is described below
commit b12692f7c15085c10a62a50e9443efd0f57e0816
Author: Maxim Solodovnik <[email protected]>
AuthorDate: Thu Mar 5 18:54:32 2020 +0700
[OPENMEETINGS-2177] export is converted
---
.../openmeetings/core/converter/BaseConverter.java | 5 +-
.../core/converter/RecordingConverter.java | 3 +-
.../core/converter/VideoConverter.java | 7 +-
openmeetings-db/pom.xml | 4 -
.../db/dao/basic/ConfigurationDao.java | 5 +-
.../openmeetings/db/entity/basic/Client.java | 5 +-
.../db/entity/basic/Configuration.java | 5 +-
.../openmeetings/db/entity/room/RoomGroup.java | 2 -
.../db/entity/server/RemoteSessionObject.java | 85 +++----
.../apache/openmeetings/db/util/LocaleHelper.java | 3 +-
.../org/apache/openmeetings/db/util/XmlHelper.java | 22 +-
.../openmeetings/db/util/TestAuthLevelUtil.java | 4 +-
.../apache/openmeetings/backup/BackupExport.java | 272 ++++++---------------
.../apache/openmeetings/backup/BackupImport.java | 2 +-
.../backup/converter/AppointmentConverter.java | 58 -----
.../AppointmentReminderTypeConverter.java | 39 ---
.../backup/converter/BaseFileItemConverter.java | 60 -----
.../backup/converter/DateConverter.java | 43 ----
.../backup/converter/EnumIcaseConverter.java | 53 ----
.../backup/converter/GroupConverter.java | 58 -----
.../backup/converter/OmCalendarConverter.java | 58 -----
.../backup/converter/PollTypeConverter.java | 39 ---
.../backup/converter/RecordingStatusConverter.java | 51 ----
.../backup/converter/RoomConverter.java | 58 -----
.../backup/converter/RoomTypeConverter.java | 39 ---
.../backup/converter/SalutationConverter.java | 39 ---
.../backup/converter/UserConverter.java | 58 -----
.../openmeetings/backup/converter/WbConverter.java | 7 +-
.../openmeetings/screenshare/job/OmKeyEvent.java | 3 +-
.../service/quartz/scheduler/AtomReader.java | 2 +-
.../org/apache/openmeetings/util/StoredFile.java | 9 +-
.../web/admin/configurations/ConfigForm.java | 3 +-
.../openmeetings/web/admin/oauth/OAuthForm.java | 6 +-
.../openmeetings/web/admin/rooms/RoomForm.java | 3 +-
.../openmeetings/web/admin/users/UserForm.java | 3 +-
.../apache/openmeetings/web/app/Application.java | 3 +-
.../apache/openmeetings/web/app/WebSession.java | 13 +-
.../openmeetings/web/common/GeneralUserForm.java | 3 +-
.../web/common/PagingNavigatorPanel.java | 3 +-
.../web/common/tree/OmTreeProvider.java | 3 +-
.../web/pages/install/InstallWizard.java | 3 +-
.../web/room/poll/CreatePollDialog.java | 4 +-
.../web/room/poll/PollResultsDialog.java | 5 +-
.../openmeetings/web/room/poll/VoteDialog.java | 3 +-
.../openmeetings/web/room/sidebar/RoomSidebar.java | 3 +-
.../apache/openmeetings/web/room/wb/WbPanel.java | 3 +-
.../web/user/calendar/AppointmentDialog.java | 3 +-
.../apache/openmeetings/web/user/chat/Chat.java | 3 +-
.../openmeetings/web/user/chat/ChatForm.java | 6 +-
.../web/user/profile/MessagesContactsPanel.java | 5 +-
.../web/user/profile/UserSearchPanel.java | 3 +-
.../openmeetings/web/util/RoomTypeDropDown.java | 3 +-
.../org/apache/openmeetings/cli/TestAdmin.java | 3 +-
.../webservice/AbstractWebServiceTest.java | 48 ++--
.../openmeetings/webservice/UserWebService.java | 4 +-
.../webservice/util/AllowOriginProvider.java | 3 +-
pom.xml | 15 --
57 files changed, 208 insertions(+), 1047 deletions(-)
diff --git
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/BaseConverter.java
b/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/BaseConverter.java
index f968885..488ae4a 100644
---
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/BaseConverter.java
+++
b/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/BaseConverter.java
@@ -35,7 +35,6 @@ import static
org.apache.openmeetings.util.OpenmeetingsVariables.getVideoPreset;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Locale;
@@ -311,7 +310,7 @@ public abstract class BaseConverter {
}
protected List<String> addMp4OutParams(Recording r, List<String> argv,
String mp4path) {
- argv.addAll(Arrays.asList(
+ argv.addAll(List.of(
"-c:v", "h264", //
"-crf", "24",
"-vsync", "0",
@@ -331,7 +330,7 @@ public abstract class BaseConverter {
protected String convertToMp4(Recording r, List<String> inArgv,
ProcessResultList logs) throws IOException {
String mp4path = r.getFile().getCanonicalPath();
- List<String> argv = new
ArrayList<>(Arrays.asList(getPathToFFMPEG(), "-y"));
+ List<String> argv = new ArrayList<>(List.of(getPathToFFMPEG(),
"-y"));
argv.addAll(inArgv);
logs.add(ProcessHelper.executeScript("generate MP4",
addMp4OutParams(r, argv, mp4path).toArray(new String[]{})));
return mp4path;
diff --git
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/RecordingConverter.java
b/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/RecordingConverter.java
index f1e8691..df792f3 100644
---
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/RecordingConverter.java
+++
b/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/RecordingConverter.java
@@ -24,7 +24,6 @@ import static
org.apache.openmeetings.util.OmFileHelper.getRecordingChunk;
import java.io.File;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import org.apache.openmeetings.db.entity.record.Recording;
@@ -101,7 +100,7 @@ public class RecordingConverter extends BaseConverter
implements IRecordingConve
r.setWidth(flvWidth);
r.setHeight(flvHeight);
- String mp4path = convertToMp4(r, Arrays.asList(
+ String mp4path = convertToMp4(r, List.of(
"-itsoffset",
formatMillis(diff(screenChunk.getStart(), r.getRecordStart())),
"-i", inputScreenFullFlv, "-i",
wav.getCanonicalPath()
), logs);
diff --git
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/VideoConverter.java
b/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/VideoConverter.java
index 741be97..08fae35 100644
---
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/VideoConverter.java
+++
b/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/VideoConverter.java
@@ -26,7 +26,6 @@ import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.function.DoubleConsumer;
@@ -60,14 +59,14 @@ public class VideoConverter extends BaseConverter {
input = Files.move(mp4.toPath(), tmp,
REPLACE_EXISTING).toFile().getCanonicalPath();
}
progress.ifPresent(theProgress ->
theProgress.accept(STEP));
- List<String> args = new
ArrayList<>(Arrays.asList(getPathToFFMPEG(), "-y"));
+ List<String> args = new
ArrayList<>(List.of(getPathToFFMPEG(), "-y"));
if (sf.isAudio()) {
// need to add background image, it should be
jpg since black on transparent will be invisible
- args.addAll(Arrays.asList("-loop", "1"//
+ args.addAll(List.of("-loop", "1"//
, "-framerate", "24"//
, "-i", new
File(getCssImagesDir(), "audio.jpg").getCanonicalPath()));
}
- args.addAll(Arrays.asList("-i", input //
+ args.addAll(List.of("-i", input //
, "-c:v", "h264" //
, "-c:a", "aac" //
, "-pix_fmt", "yuv420p"));
diff --git a/openmeetings-db/pom.xml b/openmeetings-db/pom.xml
index 318a957..0e60739 100644
--- a/openmeetings-db/pom.xml
+++ b/openmeetings-db/pom.xml
@@ -73,10 +73,6 @@
<version>${spring.version}</version>
</dependency>
<dependency>
- <groupId>org.simpleframework</groupId>
- <artifactId>simple-xml</artifactId>
- </dependency>
- <dependency>
<groupId>org.asteriskjava</groupId>
<artifactId>asterisk-java</artifactId>
<version>${asterisk-java.version}</version>
diff --git
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java
index 24bffe9..4da99d0 100644
---
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java
+++
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java
@@ -97,7 +97,6 @@ import static
org.apache.openmeetings.util.OpenmeetingsVariables.setxFrameOption
import java.net.UnknownHostException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
@@ -186,7 +185,7 @@ public class ConfigurationDao implements
IDataProviderDao<Configuration> {
List<Configuration> result = new ArrayList<>();
for (String key : keys) { //iteration is necessary to fill list
with all values
List<Configuration> r =
em.createNamedQuery("getConfigurationsByKeys", Configuration.class)
- .setParameter("keys",
Arrays.asList(key))
+ .setParameter("keys", List.of(key))
.getResultList();
result.add(r.isEmpty() ? null : r.get(0));
}
@@ -561,7 +560,7 @@ public class ConfigurationDao implements
IDataProviderDao<Configuration> {
}
private static JSONObject getHotkey(String value) {
- List<String> partList = Arrays.asList(value.split("\\+"));
+ List<String> partList = List.of(value.split("\\+"));
Set<String> parts = new HashSet<>(partList);
return new JSONObject()
.put("alt", parts.contains("Alt"))
diff --git
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java
index c2302ef..bf28cf1 100644
---
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java
+++
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java
@@ -22,7 +22,6 @@ import static java.util.UUID.randomUUID;
import java.io.Serializable;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@@ -140,7 +139,7 @@ public class Client implements IDataProviderEntity,
IWsClient {
}
public Client allow(Right... inRights) {
- allow(Arrays.asList(inRights));
+ allow(List.of(inRights));
return this;
}
@@ -464,7 +463,7 @@ public class Client implements IDataProviderEntity,
IWsClient {
if (activities == null || activities.length == 0) {
setActivities();
} else {
- sactivities.addAll(Arrays.asList(activities));
+ sactivities.addAll(List.of(activities));
}
if (StreamType.SCREEN == type) {
this.swidth = 800;
diff --git
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Configuration.java
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Configuration.java
index 727b1de..360c5e8 100644
---
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Configuration.java
+++
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Configuration.java
@@ -46,7 +46,6 @@ import org.apache.openmeetings.db.bind.adapter.LongAdapter;
import org.apache.openmeetings.db.bind.adapter.UserAdapter;
import org.apache.openmeetings.db.entity.HistoricalEntity;
import org.apache.openmeetings.db.entity.user.User;
-import org.simpleframework.xml.Element;
@Entity
@NamedQuery(name = "forceGetConfigurationByKey", query = "SELECT c FROM
Configuration c WHERE c.key LIKE :key")
@@ -95,12 +94,12 @@ public class Configuration extends HistoricalEntity {
@Lob
@Column(name = "comment", length = 2048)
- @Element(data = true, required = false)
+ @XmlElement(name = "comment", required = false)
@XmlJavaTypeAdapter(CDATAAdapter.class)
private String comment;
@Column(name = "fromVersion")
- @Element(data = true, required = false)
+ @XmlElement(name = "fromVersion", required = false)
@XmlJavaTypeAdapter(CDATAAdapter.class)
private String fromVersion;
diff --git
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/RoomGroup.java
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/RoomGroup.java
index 6a919f5..495979f 100644
---
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/RoomGroup.java
+++
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/RoomGroup.java
@@ -42,12 +42,10 @@ import org.apache.openmeetings.db.bind.adapter.LongAdapter;
import org.apache.openmeetings.db.bind.adapter.RoomAdapter;
import org.apache.openmeetings.db.entity.IDataProviderEntity;
import org.apache.openmeetings.db.entity.user.Group;
-import org.simpleframework.xml.Root;
@Entity
@NamedQuery(name = "getAllRoomGroups", query = "SELECT rg FROM RoomGroup rg
ORDER BY rg.id")
@Table(name = "room_group")
-@Root(name="room_organisation")
@XmlRootElement(name = ROOM_GRP_NODE)
@XmlAccessorType(XmlAccessType.FIELD)
public class RoomGroup implements IDataProviderEntity {
diff --git
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/server/RemoteSessionObject.java
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/server/RemoteSessionObject.java
index b8935b9..a2508cc 100644
---
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/server/RemoteSessionObject.java
+++
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/server/RemoteSessionObject.java
@@ -18,40 +18,23 @@
*/
package org.apache.openmeetings.db.entity.server;
-import java.io.StringReader;
-import java.io.StringWriter;
-
-import org.simpleframework.xml.Element;
-import org.simpleframework.xml.Root;
-import org.simpleframework.xml.Serializer;
-import org.simpleframework.xml.core.Persister;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import com.github.openjson.JSONObject;
/**
- * This Class is marshaled as an XML-Object and stored as a String in the DB to
+ * This Class is marshaled as JSON-Object and stored as a String in the DB to
* make it more easy to extend it
*
* @author sebastianwagner
*
*/
-@Root
public class RemoteSessionObject {
- private static final Logger log =
LoggerFactory.getLogger(RemoteSessionObject.class);
- @Element(required = false)
private String username;
- @Element(required = false)
private String firstname;
- @Element(required = false)
private String lastname;
- @Element(required = false)
private String pictureUrl;
- @Element(required = false)
private String email;
- @Element
- private String externalUserId;
- @Element
- private String externalUserType;
+ private String externalId;
+ private String externalType;
public RemoteSessionObject() {
// def constructor
@@ -72,22 +55,22 @@ public class RemoteSessionObject {
* - picture url
* @param email
* - email
- * @param externalUserId
+ * @param externalId
* - external user id
- * @param externalUserType
+ * @param externalType
* - external user type
*
* 06.09.2009 17:05:48 sebastianwagner
*/
public RemoteSessionObject(String username, String firstname, String
lastname, String pictureUrl, String email,
- String externalUserId, String externalUserType) {
+ String externalId, String externalType) {
this.username = username;
this.firstname = firstname;
this.lastname = lastname;
this.pictureUrl = pictureUrl;
this.email = email;
- this.externalUserId = externalUserId;
- this.externalUserType = externalUserType;
+ this.externalId = externalId;
+ this.externalType = externalType;
}
public String getUsername() {
@@ -130,47 +113,37 @@ public class RemoteSessionObject {
this.email = email;
}
- public String getExternalUserId() {
- return externalUserId;
- }
-
- public void setExternalUserId(String externalUserId) {
- this.externalUserId = externalUserId;
+ public String getExternalId() {
+ return externalId;
}
- public String getExternalUserType() {
- return externalUserType;
+ public void setExternalId(String externalUserId) {
+ this.externalId = externalUserId;
}
- public void setExternalUserType(String externalUserType) {
- this.externalUserType = externalUserType;
+ public String getExternalType() {
+ return externalType;
}
- public String toXml() {
- StringWriter sw = new StringWriter();
- try {
- Serializer serializer = new Persister();
- serializer.write(this, sw);
- } catch (Exception e) {
- log.error("Unexpected error while storing object to
XML: " + this, e);
- }
- return sw.toString();
+ public void setExternalType(String externalType) {
+ this.externalType = externalType;
}
- public static RemoteSessionObject fromXml(String xml) {
- Serializer serializer = new Persister();
- try {
- return serializer.read(RemoteSessionObject.class, new
StringReader(xml));
- } catch (Exception e) {
- log.error("Unexpected error while restoring object from
XML: " + xml, e);
- }
- return null;
+ public static RemoteSessionObject fromString(String s) {
+ JSONObject o = new JSONObject(s);
+ RemoteSessionObject ro = new RemoteSessionObject();
+ ro.username = o.optString("username");
+ ro.firstname = o.optString("firstname");
+ ro.lastname = o.optString("lastname");
+ ro.pictureUrl = o.optString("pictureUrl");
+ ro.email = o.optString("email");
+ ro.externalId = o.getString("externalId");
+ ro.externalType = o.getString("externalType");
+ return ro;
}
@Override
public String toString() {
- return "RemoteSessionObject [username=" + username + ",
firstname=" + firstname + ", lastname=" + lastname
- + ", pictureUrl=" + pictureUrl + ", email=" +
email + ", externalUserId=" + externalUserId
- + ", externalUserType=" + externalUserType +
"]";
+ return new JSONObject(this).toString();
}
}
diff --git
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/LocaleHelper.java
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/LocaleHelper.java
index 01483f9..1b65e24 100644
---
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/LocaleHelper.java
+++
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/LocaleHelper.java
@@ -18,7 +18,6 @@
*/
package org.apache.openmeetings.db.util;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
@@ -35,7 +34,7 @@ public class LocaleHelper {
private LocaleHelper() {}
public static List<String> getCountries() {
- return Arrays.asList(Locale.getISOCountries());
+ return List.of(Locale.getISOCountries());
}
public static String getCountryName(String code, Locale l) {
diff --git
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/XmlHelper.java
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/XmlHelper.java
index 61b59d7..d4dd5b2 100644
---
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/XmlHelper.java
+++
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/XmlHelper.java
@@ -28,6 +28,7 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
public class XmlHelper {
private XmlHelper() {
@@ -45,13 +46,18 @@ public class XmlHelper {
return dbFactory.newDocumentBuilder();
}
- public static XMLInputFactory createFactory() {
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- inputFactory.setProperty(IS_REPLACING_ENTITY_REFERENCES, false);
- inputFactory.setProperty(IS_VALIDATING, false);
- inputFactory.setProperty(IS_NAMESPACE_AWARE, false);
- inputFactory.setProperty(IS_SUPPORTING_EXTERNAL_ENTITIES,
false);
- inputFactory.setProperty(SUPPORT_DTD, false);
- return inputFactory;
+ public static XMLInputFactory createInputFactory() {
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+ factory.setProperty(IS_REPLACING_ENTITY_REFERENCES, false);
+ factory.setProperty(IS_VALIDATING, false);
+ factory.setProperty(IS_NAMESPACE_AWARE, false);
+ factory.setProperty(IS_SUPPORTING_EXTERNAL_ENTITIES, false);
+ factory.setProperty(SUPPORT_DTD, false);
+ return factory;
+ }
+
+ public static XMLOutputFactory createOutputFactory() {
+ XMLOutputFactory factory = XMLOutputFactory.newInstance();
+ return factory;
}
}
diff --git
a/openmeetings-db/src/test/java/org/apache/openmeetings/db/util/TestAuthLevelUtil.java
b/openmeetings-db/src/test/java/org/apache/openmeetings/db/util/TestAuthLevelUtil.java
index f47f8a3..76cb868 100644
---
a/openmeetings-db/src/test/java/org/apache/openmeetings/db/util/TestAuthLevelUtil.java
+++
b/openmeetings-db/src/test/java/org/apache/openmeetings/db/util/TestAuthLevelUtil.java
@@ -22,8 +22,6 @@ import static
org.apache.openmeetings.db.util.AuthLevelUtil.getRoomRight;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import java.util.Arrays;
-import java.util.HashSet;
import java.util.Set;
import org.apache.openmeetings.db.entity.calendar.Appointment;
@@ -40,7 +38,7 @@ public class TestAuthLevelUtil {
@Test
public void testAdmin() {
User u = new User();
- u.setRights(new HashSet<>(Arrays.asList(User.Right.ADMIN)));
+ u.setRights(Set.of(User.Right.ADMIN));
Set<Room.Right> rights = getRoomRight(u, new Room(), null, 0);
assertEquals(1, rights.size(), "Result should NOT be empty");
assertTrue(rights.contains(Room.Right.SUPER_MODERATOR), "Result
should be super moderator");
diff --git
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
index d59f496..0b9483c 100644
---
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
+++
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
@@ -18,7 +18,25 @@
*/
package org.apache.openmeetings.backup;
-import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.apache.openmeetings.db.bind.Constants.APPOINTMENT_LIST_NODE;
+import static org.apache.openmeetings.db.bind.Constants.CALENDAR_LIST_NODE;
+import static org.apache.openmeetings.db.bind.Constants.CFG_LIST_NODE;
+import static org.apache.openmeetings.db.bind.Constants.CHAT_LIST_NODE;
+import static org.apache.openmeetings.db.bind.Constants.CONTACT_LIST_NODE;
+import static org.apache.openmeetings.db.bind.Constants.FILE_LIST_NODE;
+import static org.apache.openmeetings.db.bind.Constants.GROUP_LIST_NODE;
+import static org.apache.openmeetings.db.bind.Constants.LDAP_LIST_NODE;
+import static org.apache.openmeetings.db.bind.Constants.MMEMBER_LIST_NODE;
+import static org.apache.openmeetings.db.bind.Constants.MSG_FOLDER_LIST_NODE;
+import static org.apache.openmeetings.db.bind.Constants.MSG_LIST_NODE;
+import static org.apache.openmeetings.db.bind.Constants.OAUTH_LIST_NODE;
+import static org.apache.openmeetings.db.bind.Constants.POLL_LIST_NODE;
+import static org.apache.openmeetings.db.bind.Constants.RECORDING_LIST_NODE;
+import static org.apache.openmeetings.db.bind.Constants.ROOM_FILE_LIST_NODE;
+import static org.apache.openmeetings.db.bind.Constants.ROOM_GRP_LIST_NODE;
+import static org.apache.openmeetings.db.bind.Constants.ROOM_LIST_NODE;
+import static org.apache.openmeetings.db.bind.Constants.USER_LIST_NODE;
+import static org.apache.openmeetings.db.bind.Constants.VERSION_LIST_NODE;
import static org.apache.openmeetings.util.OmFileHelper.BACKUP_DIR;
import static org.apache.openmeetings.util.OmFileHelper.BCKP_RECORD_FILES;
import static org.apache.openmeetings.util.OmFileHelper.BCKP_ROOM_FILES;
@@ -33,28 +51,20 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
-import java.io.OutputStreamWriter;
+import java.io.Writer;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
-import java.util.Arrays;
import java.util.List;
-import java.util.function.Function;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.stream.XMLStreamWriter;
+
import org.apache.commons.io.FileUtils;
-import org.apache.openmeetings.backup.converter.AppointmentConverter;
-import
org.apache.openmeetings.backup.converter.AppointmentReminderTypeConverter;
-import org.apache.openmeetings.backup.converter.BaseFileItemConverter;
-import org.apache.openmeetings.backup.converter.DateConverter;
-import org.apache.openmeetings.backup.converter.GroupConverter;
-import org.apache.openmeetings.backup.converter.PollTypeConverter;
-import org.apache.openmeetings.backup.converter.RoomConverter;
-import org.apache.openmeetings.backup.converter.RoomTypeConverter;
-import org.apache.openmeetings.backup.converter.SalutationConverter;
-import org.apache.openmeetings.backup.converter.UserConverter;
import org.apache.openmeetings.db.dao.basic.ChatDao;
import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
import org.apache.openmeetings.db.dao.calendar.AppointmentDao;
@@ -71,7 +81,6 @@ import org.apache.openmeetings.db.dao.user.PrivateMessageDao;
import org.apache.openmeetings.db.dao.user.PrivateMessageFolderDao;
import org.apache.openmeetings.db.dao.user.UserContactDao;
import org.apache.openmeetings.db.dao.user.UserDao;
-import org.apache.openmeetings.db.entity.HistoricalEntity;
import org.apache.openmeetings.db.entity.basic.ChatMessage;
import org.apache.openmeetings.db.entity.basic.Configuration;
import org.apache.openmeetings.db.entity.calendar.Appointment;
@@ -85,22 +94,16 @@ import org.apache.openmeetings.db.entity.server.OAuthServer;
import org.apache.openmeetings.db.entity.user.Group;
import org.apache.openmeetings.db.entity.user.PrivateMessage;
import org.apache.openmeetings.db.entity.user.User;
-import org.apache.openmeetings.db.entity.user.User.Salutation;
+import org.apache.openmeetings.db.util.XmlHelper;
import org.apache.openmeetings.installation.ImportInitvalues;
import org.apache.openmeetings.installation.InstallationConfig;
-import org.simpleframework.xml.Serializer;
-import org.simpleframework.xml.convert.Registry;
-import org.simpleframework.xml.convert.RegistryStrategy;
-import org.simpleframework.xml.core.Persister;
-import org.simpleframework.xml.strategy.Strategy;
-import org.simpleframework.xml.stream.Format;
-import org.simpleframework.xml.stream.NodeBuilder;
-import org.simpleframework.xml.stream.OutputNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import com.sun.xml.bind.marshaller.CharacterEscapeHandler;
+
/**
*
* @author sebastianwagner
@@ -154,13 +157,11 @@ public class BackupExport {
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()));
+ writeList(zos, "version.xml", VERSION_LIST_NODE,
List.of(BackupVersion.get()));
progressHolder.setProgress(2);
exportGroups(zos);
progressHolder.setProgress(5);
@@ -178,13 +179,13 @@ public class BackupExport {
progressHolder.setProgress(25);
exportMeetingMember(zos);
progressHolder.setProgress(30);
- exportLdap(zos, ser);
+ exportLdap(zos);
progressHolder.setProgress(35);
exportOauth(zos);
progressHolder.setProgress(45);
exportPrivateMsg(zos);
progressHolder.setProgress(50);
- exportPrivateMsgFolder(zos, ser);
+ exportPrivateMsgFolder(zos);
progressHolder.setProgress(55);
exportContacts(zos);
progressHolder.setProgress(60);
@@ -228,91 +229,42 @@ public class BackupExport {
}
}
- private static <T extends HistoricalEntity> void bindDate(Registry
registry, List<T> list) throws Exception {
- bindDate(registry, list, HistoricalEntity::getInserted);
- }
-
- private static <T> void bindDate(Registry registry, List<T> list,
Function<T, ?> func) throws Exception {
- if (list != null) {
- for (T e : list) {
- Object d = func.apply(e);
- if (d != null) {
- Class<?> dateClass = d.getClass();
- registry.bind(dateClass,
DateConverter.class);
- break;
- }
- }
- }
- }
/*
* ##################### Backup Groups
*/
private void exportGroups(ZipOutputStream zos) throws Exception {
- Registry registry = new Registry();
- Strategy strategy = new RegistryStrategy(registry);
- Serializer ser = new Persister(strategy);
List<Group> list = groupDao.get(0, Integer.MAX_VALUE);
- bindDate(registry, list);
- writeList(ser, zos, "organizations.xml", "organisations", list);
+ writeList(zos, "organizations.xml", GROUP_LIST_NODE, list);
}
/*
* ##################### Backup Users
*/
private void exportUsers(ZipOutputStream zos) throws Exception {
- Registry registry = new Registry();
- Strategy strategy = new RegistryStrategy(registry);
- Serializer ser = new Persister(strategy);
-
- registry.bind(Group.class, GroupConverter.class);
- registry.bind(Salutation.class, SalutationConverter.class);
List<User> list = userDao.getAllBackupUsers();
- bindDate(registry, list);
-
- writeList(ser, zos, "users.xml", "users", list);
+ writeList(zos, "users.xml", USER_LIST_NODE, list);
}
/*
* ##################### Backup Room
*/
private void exportRoom(ZipOutputStream zos) throws Exception {
- Registry registry = new Registry();
- Strategy strategy = new RegistryStrategy(registry);
- Serializer serializer = new Persister(strategy);
-
- registry.bind(User.class, UserConverter.class);
- registry.bind(Room.Type.class, RoomTypeConverter.class);
List<Room> list = roomDao.get();
- bindDate(registry, list);
- writeList(serializer, zos, "rooms.xml", "rooms", list);
+ writeList(zos, "rooms.xml", ROOM_LIST_NODE, list);
}
/*
* ##################### Backup Room Groups
*/
private void exportRoomGroup(ZipOutputStream zos) throws Exception {
- Registry registry = new Registry();
- Strategy strategy = new RegistryStrategy(registry);
- Serializer serializer = new Persister(strategy);
-
- registry.bind(Group.class, GroupConverter.class);
- registry.bind(Room.class, RoomConverter.class);
-
- writeList(serializer, zos, "rooms_organisation.xml",
"room_organisations", roomDao.getGroups());
+ writeList(zos, "rooms_organisation.xml", ROOM_GRP_LIST_NODE,
roomDao.getGroups());
}
/*
* ##################### Backup Room Files
*/
private void exportRoomFile(ZipOutputStream zos) throws Exception {
- Registry registry = new Registry();
- Strategy strategy = new RegistryStrategy(registry);
- Serializer serializer = new Persister(strategy);
-
- registry.bind(FileItem.class, BaseFileItemConverter.class);
- registry.bind(Recording.class, BaseFileItemConverter.class);
-
- writeList(serializer, zos, "roomFiles.xml", "RoomFiles",
roomDao.getFiles());
+ writeList(zos, "roomFiles.xml", ROOM_FILE_LIST_NODE,
roomDao.getFiles());
}
/*
@@ -320,13 +272,7 @@ public class BackupExport {
*/
private void exportCalendar(ZipOutputStream zos) throws Exception {
List<OmCalendar> list = calendarDao.get();
- Registry registry = new Registry();
- Strategy strategy = new RegistryStrategy(registry);
- Serializer serializer = new Persister(strategy);
- registry.bind(User.class, UserConverter.class);
- bindDate(registry, list);
-
- writeList(serializer, zos, "calendars.xml", "calendars", list);
+ writeList(zos, "calendars.xml", CALENDAR_LIST_NODE, list);
}
/*
@@ -334,54 +280,34 @@ public class BackupExport {
*/
private void exportAppointment(ZipOutputStream zos) throws Exception {
List<Appointment> list = appointmentDao.get();
- Registry registry = new Registry();
- Strategy strategy = new RegistryStrategy(registry);
- Serializer serializer = new Persister(strategy);
-
- registry.bind(User.class, UserConverter.class);
- registry.bind(Appointment.Reminder.class,
AppointmentReminderTypeConverter.class);
- registry.bind(Room.class, RoomConverter.class);
- bindDate(registry, list);
-
- writeList(serializer, zos, "appointements.xml", "appointments",
list);
+ writeList(zos, "appointements.xml", APPOINTMENT_LIST_NODE,
list);
}
/*
* ##################### Backup Meeting Members
*/
private void exportMeetingMember(ZipOutputStream zos) 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.get());
+ writeList(zos, "meetingmembers.xml",
+ MMEMBER_LIST_NODE, meetingMemberDao.get());
}
/*
* ##################### LDAP Configs
*/
- private void exportLdap(ZipOutputStream zos, Serializer ser) throws
Exception {
+ private void exportLdap(ZipOutputStream zos) throws Exception {
List<LdapConfig> ldapList = ldapConfigDao.get();
if (!ldapList.isEmpty()) {
ldapList.remove(0);
}
- writeList(ser, zos, "ldapconfigs.xml", "ldapconfigs", ldapList);
+ writeList(zos, "ldapconfigs.xml", LDAP_LIST_NODE, ldapList);
}
/*
* ##################### OAuth2 servers
*/
private void exportOauth(ZipOutputStream zos) 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);
+ writeList(zos, "oauth2servers.xml", OAUTH_LIST_NODE, list);
}
/*
@@ -389,35 +315,22 @@ public class BackupExport {
*/
private void exportPrivateMsg(ZipOutputStream zos) throws Exception {
List<PrivateMessage> list = privateMessageDao.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);
- bindDate(registry, list, PrivateMessage::getInserted);
- writeList(serializer, zos, "privateMessages.xml",
"privatemessages", list);
+ writeList(zos, "privateMessages.xml", MSG_LIST_NODE, list);
}
/*
* ##################### Private Message Folders
*/
- private void exportPrivateMsgFolder(ZipOutputStream zos, Serializer
ser) throws Exception {
- writeList(ser, zos, "privateMessageFolder.xml",
- "privatemessagefolders",
privateMessageFolderDao.get(0, Integer.MAX_VALUE));
+ private void exportPrivateMsgFolder(ZipOutputStream zos) throws
Exception {
+ writeList(zos, "privateMessageFolder.xml",
+ MSG_FOLDER_LIST_NODE,
privateMessageFolderDao.get(0, Integer.MAX_VALUE));
}
/*
* ##################### User Contacts
*/
private void exportContacts(ZipOutputStream zos) 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());
+ writeList(zos, "userContacts.xml", CONTACT_LIST_NODE,
userContactDao.get());
}
/*
@@ -425,12 +338,7 @@ public class BackupExport {
*/
private void exportFile(ZipOutputStream zos) throws Exception {
List<FileItem> list = fileItemDao.get();
- Registry registry = new Registry();
- Strategy strategy = new RegistryStrategy(registry);
- Serializer serializer = new Persister(strategy);
-
- bindDate(registry, list);
- writeList(serializer, zos, "fileExplorerItems.xml",
"fileExplorerItems", list);
+ writeList(zos, "fileExplorerItems.xml", FILE_LIST_NODE, list);
}
/*
@@ -438,12 +346,7 @@ public class BackupExport {
*/
private void exportRecording(ZipOutputStream zos) 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);
+ writeList(zos, "flvRecordings.xml", RECORDING_LIST_NODE, list);
}
/*
@@ -451,15 +354,7 @@ public class BackupExport {
*/
private void exportPoll(ZipOutputStream zos) 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);
+ writeList(zos, "roompolls.xml", POLL_LIST_NODE, list);
}
/*
@@ -467,9 +362,7 @@ public class BackupExport {
*/
private void exportConfig(ZipOutputStream zos) throws Exception {
List<Configuration> list = configurationDao.get(0,
Integer.MAX_VALUE);
- Serializer serializer = getConfigSerializer(list);
-
- writeList(serializer, zos, "configs.xml", "configs", list);
+ writeList(zos, "configs.xml", CFG_LIST_NODE, list);
}
/*
@@ -477,57 +370,53 @@ public class BackupExport {
*/
private void exportChat(ZipOutputStream zos) 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);
+ writeList(zos, "chat_messages.xml", CHAT_LIST_NODE, list);
}
- 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;
- }
-
- private static <T> ByteArrayOutputStream stream(Serializer ser, String
listElement, List<T> list) throws Exception {
+ private static <T> ByteArrayOutputStream stream(String listElement,
List<T> list) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream(10 *
1024); //10K
- writeList(ser, baos, listElement, list);
+ writeList(baos, listElement, list);
return baos;
}
- private static <T> void writeList(Serializer ser, ZipOutputStream zos,
String fileName, String listElement, List<T> list) throws Exception {
+ private static <T> void writeList(ZipOutputStream zos, String fileName,
String listElement, List<T> list) throws Exception {
ZipEntry e = new ZipEntry(fileName);
zos.putNextEntry(e);
- ByteArrayOutputStream baos = stream(ser, listElement, list);
+ ByteArrayOutputStream baos = stream(listElement, list);
zos.write(baos.toByteArray());
zos.closeEntry();
}
- private static <T> void writeList(Serializer ser, OutputStream os,
String listElement, List<T> list) throws Exception {
- Format format = new Format("<?xml version=\"1.0\"
encoding=\"UTF-8\"?>");
- OutputNode doc = NodeBuilder.write(new OutputStreamWriter(os,
UTF_8), format);
- OutputNode root = doc.getChild("root");
- root.setComment(BACKUP_COMMENT);
- OutputNode listNode = root.getChild(listElement);
-
- if (list != null) {
+ private static <T> void writeList(OutputStream os, String listElement,
List<T> list) throws Exception {
+ XMLStreamWriter writer =
XmlHelper.createOutputFactory().createXMLStreamWriter(os);
+ writer.writeStartDocument();
+ writer.writeComment(BACKUP_COMMENT);
+ writer.writeStartElement("root");
+ writer.writeStartElement(listElement);
+
+ if (list != null && !list.isEmpty()) {
+ @SuppressWarnings("unchecked")
+ Class<T> eClazz = (Class<T>)list.get(0).getClass();
+ JAXBContext jc = JAXBContext.newInstance(eClazz);
+ Marshaller marshaller = jc.createMarshaller();
+
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
+
marshaller.setProperty(CharacterEscapeHandler.class.getName(), new
CharacterEscapeHandler() {
+ @Override
+ public void escape(char[] ac, int i, int j,
boolean flag, Writer writer) throws IOException {
+ writer.write(ac, i, j);
+ }
+ });
for (T t : list) {
try {
- ser.write(t, listNode);
+ marshaller.marshal(t, writer);
} catch (Exception e) {
log.debug("Exception While writing node
of type: " + t.getClass(), e);
}
}
}
- root.commit();
+ writer.writeEndElement();
+ writer.writeEndElement();
}
private static void writeZip(String prefix, URI base, File file,
ZipOutputStream zos) throws IOException {
@@ -558,8 +447,7 @@ public class BackupExport {
*/
public static void main(String[] args) throws Exception {
List<Configuration> list = ImportInitvalues.initialCfgs(new
InstallationConfig());
- Serializer ser = getConfigSerializer(list);
- ByteArrayOutputStream baos = stream(ser, "configs", list);
+ ByteArrayOutputStream baos = stream("configs", list);
File f = new File(args[0]);
if (!f.exists() && !f.getParentFile().exists()) {
f.getParentFile().mkdirs();
diff --git
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
index 645a134..761a8e5 100644
---
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
+++
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
@@ -1090,7 +1090,7 @@ public class BackupImport {
JAXBContext jc = JAXBContext.newInstance(clazz);
unmarshaller = jc.createUnmarshaller();
}
- XMLInputFactory xif = XmlHelper.createFactory();
+ XMLInputFactory xif = XmlHelper.createInputFactory();
StreamSource xmlSource = new StreamSource(xml);
XMLStreamReader xsr =
xif.createXMLStreamReader(xmlSource);
boolean listNodeFound = false;
diff --git
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/AppointmentConverter.java
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/AppointmentConverter.java
deleted file mode 100644
index 2ba97a5..0000000
---
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/AppointmentConverter.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.backup.converter;
-
-import static org.apache.commons.lang3.math.NumberUtils.toLong;
-
-import java.util.Map;
-
-import org.apache.openmeetings.db.dao.calendar.AppointmentDao;
-import org.apache.openmeetings.db.entity.calendar.Appointment;
-import org.simpleframework.xml.convert.Converter;
-import org.simpleframework.xml.stream.InputNode;
-import org.simpleframework.xml.stream.OutputNode;
-
-public class AppointmentConverter implements Converter<Appointment> {
- private AppointmentDao appointmentDao;
- private Map<Long, Long> idMap;
-
- public AppointmentConverter() {
- //default constructor is for export
- }
-
- public AppointmentConverter(AppointmentDao appointmentDao, Map<Long,
Long> idMap) {
- this.appointmentDao = appointmentDao;
- this.idMap = idMap;
- }
-
- @Override
- public Appointment read(InputNode node) throws Exception {
- long oldId = toLong(node.getValue());
- Long newId = idMap.containsKey(oldId) ? idMap.get(oldId) :
oldId;
-
- Appointment a = appointmentDao.getAny(newId);
- return a == null ? new Appointment() : a;
- }
-
- @Override
- public void write(OutputNode node, Appointment value) throws Exception {
- node.setData(true);
- node.setValue(value == null ? "0" : "" + value.getId());
- }
-}
diff --git
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/AppointmentReminderTypeConverter.java
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/AppointmentReminderTypeConverter.java
deleted file mode 100644
index e96de4d..0000000
---
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/AppointmentReminderTypeConverter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.backup.converter;
-
-import static org.apache.commons.lang3.math.NumberUtils.toInt;
-
-import org.apache.openmeetings.db.entity.calendar.Appointment.Reminder;
-import org.simpleframework.xml.convert.Converter;
-import org.simpleframework.xml.stream.InputNode;
-import org.simpleframework.xml.stream.OutputNode;
-
-public class AppointmentReminderTypeConverter implements Converter<Reminder> {
- @Override
- public Reminder read(InputNode node) throws Exception {
- return Reminder.get(toInt(node.getValue()));
- }
-
- @Override
- public void write(OutputNode node, Reminder value) throws Exception {
- node.setData(true);
- node.setValue(value == null ? "0" :
String.valueOf(value.getId()));
- }
-}
diff --git
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/BaseFileItemConverter.java
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/BaseFileItemConverter.java
deleted file mode 100644
index 5e2be4d..0000000
---
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/BaseFileItemConverter.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.backup.converter;
-
-import static org.apache.commons.lang3.math.NumberUtils.toLong;
-
-import java.util.Map;
-
-import org.apache.openmeetings.db.dao.file.FileItemDao;
-import org.apache.openmeetings.db.entity.file.BaseFileItem;
-import org.apache.openmeetings.db.entity.file.FileItem;
-import org.simpleframework.xml.convert.Converter;
-import org.simpleframework.xml.stream.InputNode;
-import org.simpleframework.xml.stream.OutputNode;
-
-public class BaseFileItemConverter implements Converter<BaseFileItem> {
- private FileItemDao fileDao;
- private Map<Long, Long> idMap;
-
- public BaseFileItemConverter() {
- //default constructor is for export
- }
-
- public BaseFileItemConverter(FileItemDao fileDao, Map<Long, Long>
idMap) {
- this.fileDao = fileDao;
- this.idMap = idMap;
- }
-
- @Override
- public BaseFileItem read(InputNode node) throws Exception {
- long oldId = toLong(node.getValue());
- long newId = idMap.containsKey(oldId) ? idMap.get(oldId) :
oldId;
-
- BaseFileItem r = fileDao.get(newId);
- return r == null ? new FileItem() : r;
- }
-
- @Override
- public void write(OutputNode node, BaseFileItem value) throws Exception
{
- node.setData(true);
- node.getAttributes().forEach(name ->
node.getAttributes().remove(name));
- node.setValue(value == null ? "0" : "" + value.getId());
- }
-}
diff --git
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/DateConverter.java
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/DateConverter.java
deleted file mode 100644
index a7d352b..0000000
---
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/DateConverter.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.backup.converter;
-
-import static org.apache.openmeetings.util.OpenmeetingsVariables.ATTR_CLASS;
-
-import java.util.Date;
-
-import org.apache.openmeetings.util.CalendarPatterns;
-import org.simpleframework.xml.convert.Converter;
-import org.simpleframework.xml.stream.InputNode;
-import org.simpleframework.xml.stream.OutputNode;
-
-public class DateConverter implements Converter<Date> {
- @Override
- public Date read(InputNode node) throws Exception {
- String val = node.getValue();
- return val == null || "null".equals(val) ? new Date() :
CalendarPatterns.parseImportDate(val);
- }
-
- @Override
- public void write(OutputNode node, Date value) throws Exception {
- node.setAttribute(ATTR_CLASS, "java.util.Date");
- node.setData(true);
- node.setValue(value == null ? "0" :
CalendarPatterns.getExportDate(value));
- }
-}
diff --git
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/EnumIcaseConverter.java
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/EnumIcaseConverter.java
deleted file mode 100644
index 9549562..0000000
---
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/EnumIcaseConverter.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.backup.converter;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-import org.apache.openmeetings.db.entity.basic.Configuration;
-import org.simpleframework.xml.convert.Converter;
-import org.simpleframework.xml.stream.InputNode;
-import org.simpleframework.xml.stream.OutputNode;
-
-public class EnumIcaseConverter implements Converter<Configuration.Type> {
- private Map<String, Configuration.Type> icaseMap = new HashMap<>();
-
- public EnumIcaseConverter() {
- //default constructor is for export
- }
-
- public EnumIcaseConverter(Configuration.Type[] values) {
- Arrays.stream(values).forEach(t ->
icaseMap.put(t.name().toUpperCase(Locale.ROOT), t));
- }
-
- @Override
- public Configuration.Type read(InputNode node) throws Exception {
- String name = node.getValue();
- return name == null ? null :
icaseMap.get(name.toUpperCase(Locale.ROOT));
- }
-
- @Override
- public void write(OutputNode node, Configuration.Type value) throws
Exception {
- node.setData(true);
- node.setValue(String.valueOf(value == null ? null :
value.name()));
- }
-}
diff --git
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/GroupConverter.java
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/GroupConverter.java
deleted file mode 100644
index 3cb0b67..0000000
---
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/GroupConverter.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.backup.converter;
-
-import static org.apache.commons.lang3.math.NumberUtils.toLong;
-
-import java.util.Map;
-
-import org.apache.openmeetings.db.dao.user.GroupDao;
-import org.apache.openmeetings.db.entity.user.Group;
-import org.simpleframework.xml.convert.Converter;
-import org.simpleframework.xml.stream.InputNode;
-import org.simpleframework.xml.stream.OutputNode;
-
-public class GroupConverter implements Converter<Group> {
- private GroupDao groupDao;
- private Map<Long, Long> idMap;
-
- public GroupConverter() {
- //default constructor is for export
- }
-
- public GroupConverter(GroupDao groupDao, Map<Long, Long> idMap) {
- this.groupDao = groupDao;
- this.idMap = idMap;
- }
-
- @Override
- public Group read(InputNode node) throws Exception {
- long oldId = toLong(node.getValue());
- long newId = idMap.containsKey(oldId) ? idMap.get(oldId) :
oldId;
-
- Group o = groupDao.get(newId);
- return o == null ? new Group() : o;
- }
-
- @Override
- public void write(OutputNode node, Group value) throws Exception {
- node.setData(true);
- node.setValue(value == null ? "0" : "" + value.getId());
- }
-}
diff --git
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/OmCalendarConverter.java
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/OmCalendarConverter.java
deleted file mode 100644
index 14db40e..0000000
---
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/OmCalendarConverter.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.backup.converter;
-
-import static org.apache.commons.lang3.math.NumberUtils.toLong;
-
-import java.util.Map;
-
-import org.apache.openmeetings.db.dao.calendar.OmCalendarDao;
-import org.apache.openmeetings.db.entity.calendar.OmCalendar;
-import org.simpleframework.xml.convert.Converter;
-import org.simpleframework.xml.stream.InputNode;
-import org.simpleframework.xml.stream.OutputNode;
-
-public class OmCalendarConverter implements Converter<OmCalendar> {
- private OmCalendarDao calendarDao;
- private Map<Long, Long> idMap;
-
- public OmCalendarConverter() {
- //default constructor is for export
- }
-
- public OmCalendarConverter(OmCalendarDao calendarDao, Map<Long, Long>
idMap) {
- this.calendarDao = calendarDao;
- this.idMap = idMap;
- }
-
- @Override
- public OmCalendar read(InputNode node) throws Exception {
- long oldId = toLong(node.getValue());
- Long newId = idMap.containsKey(oldId) ? idMap.get(oldId) :
oldId;
-
- OmCalendar c = calendarDao.get(newId);
- return c == null ? new OmCalendar() : c;
- }
-
- @Override
- public void write(OutputNode node, OmCalendar value) throws Exception {
- node.setData(true);
- node.setValue(value == null ? "0" :
String.valueOf(value.getId()));
- }
-}
diff --git
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/PollTypeConverter.java
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/PollTypeConverter.java
deleted file mode 100644
index 8d3c926..0000000
---
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/PollTypeConverter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.backup.converter;
-
-import static org.apache.commons.lang3.math.NumberUtils.toLong;
-
-import org.apache.openmeetings.db.entity.room.RoomPoll;
-import org.simpleframework.xml.convert.Converter;
-import org.simpleframework.xml.stream.InputNode;
-import org.simpleframework.xml.stream.OutputNode;
-
-public class PollTypeConverter implements Converter<RoomPoll.Type> {
- @Override
- public RoomPoll.Type read(InputNode node) throws Exception {
- return RoomPoll.Type.get(toLong(node.getValue()));
- }
-
- @Override
- public void write(OutputNode node, RoomPoll.Type value) throws
Exception {
- node.setData(true);
- node.setValue(value == null ? "0" :
String.valueOf(value.getId()));
- }
-}
diff --git
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/RecordingStatusConverter.java
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/RecordingStatusConverter.java
deleted file mode 100644
index e974f44..0000000
---
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/RecordingStatusConverter.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.backup.converter;
-
-import org.apache.openmeetings.db.entity.record.Recording;
-import org.apache.openmeetings.db.entity.record.Recording.Status;
-import org.simpleframework.xml.convert.Converter;
-import org.simpleframework.xml.stream.InputNode;
-import org.simpleframework.xml.stream.OutputNode;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RecordingStatusConverter implements Converter<Recording.Status> {
- private static final Logger log =
LoggerFactory.getLogger(RecordingStatusConverter.class);
- private static final String PROCESSING = "PROCESSING";
-
- @Override
- public Recording.Status read(InputNode node) throws Exception {
- Recording.Status result = null;
- String val = node.getValue();
- try {
- result = Recording.Status.valueOf(val);
- } catch (Exception e) {
- log.warn("Failed to read recording status out of {}",
val);
- result = PROCESSING.equals(val) ? Status.CONVERTING :
Status.NONE;
- }
- return result;
- }
-
- @Override
- public void write(OutputNode node, Recording.Status value) throws
Exception {
- node.setData(true);
- node.setValue(value == null ? Status.NONE.name() :
value.name());
- }
-}
diff --git
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/RoomConverter.java
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/RoomConverter.java
deleted file mode 100644
index 282de3f..0000000
---
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/RoomConverter.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.backup.converter;
-
-import static org.apache.commons.lang3.math.NumberUtils.toLong;
-
-import java.util.Map;
-
-import org.apache.openmeetings.db.dao.room.RoomDao;
-import org.apache.openmeetings.db.entity.room.Room;
-import org.simpleframework.xml.convert.Converter;
-import org.simpleframework.xml.stream.InputNode;
-import org.simpleframework.xml.stream.OutputNode;
-
-public class RoomConverter implements Converter<Room> {
- private RoomDao roomDao;
- private Map<Long, Long> idMap;
-
- public RoomConverter() {
- //default constructor is for export
- }
-
- public RoomConverter(RoomDao roomDao, Map<Long, Long> idMap) {
- this.roomDao = roomDao;
- this.idMap = idMap;
- }
-
- @Override
- public Room read(InputNode node) throws Exception {
- long oldId = toLong(node.getValue());
- long newId = idMap.containsKey(oldId) ? idMap.get(oldId) :
oldId;
-
- Room r = roomDao.get(newId);
- return r == null ? new Room() : r;
- }
-
- @Override
- public void write(OutputNode node, Room value) throws Exception {
- node.setData(true);
- node.setValue(value == null ? "0" : "" + value.getId());
- }
-}
diff --git
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/RoomTypeConverter.java
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/RoomTypeConverter.java
deleted file mode 100644
index 22511a5..0000000
---
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/RoomTypeConverter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.backup.converter;
-
-import static org.apache.commons.lang3.math.NumberUtils.toInt;
-
-import org.apache.openmeetings.db.entity.room.Room.Type;
-import org.simpleframework.xml.convert.Converter;
-import org.simpleframework.xml.stream.InputNode;
-import org.simpleframework.xml.stream.OutputNode;
-
-public class RoomTypeConverter implements Converter<Type> {
- @Override
- public Type read(InputNode node) throws Exception {
- return Type.get(toInt(node.getValue()));
- }
-
- @Override
- public void write(OutputNode node, Type value) throws Exception {
- node.setData(true);
- node.setValue(value == null ? "0" :
String.valueOf(value.getId()));
- }
-}
diff --git
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/SalutationConverter.java
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/SalutationConverter.java
deleted file mode 100644
index 02d0af6..0000000
---
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/SalutationConverter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.backup.converter;
-
-import static org.apache.commons.lang3.math.NumberUtils.toInt;
-
-import org.apache.openmeetings.db.entity.user.User.Salutation;
-import org.simpleframework.xml.convert.Converter;
-import org.simpleframework.xml.stream.InputNode;
-import org.simpleframework.xml.stream.OutputNode;
-
-public class SalutationConverter implements Converter<Salutation> {
- @Override
- public Salutation read(InputNode node) throws Exception {
- return Salutation.get(toInt(node.getValue()));
- }
-
- @Override
- public void write(OutputNode node, Salutation value) throws Exception {
- node.setData(true);
- node.setValue(value == null ? "0" :
String.valueOf(value.getId()));
- }
-}
diff --git
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/UserConverter.java
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/UserConverter.java
deleted file mode 100644
index 5ba6741..0000000
---
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/UserConverter.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License") + you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openmeetings.backup.converter;
-
-import static org.apache.commons.lang3.math.NumberUtils.toLong;
-
-import java.util.Map;
-
-import org.apache.openmeetings.db.dao.user.UserDao;
-import org.apache.openmeetings.db.entity.user.User;
-import org.simpleframework.xml.convert.Converter;
-import org.simpleframework.xml.stream.InputNode;
-import org.simpleframework.xml.stream.OutputNode;
-
-public class UserConverter implements Converter<User> {
- private UserDao userDao;
- private Map<Long, Long> idMap;
-
- public UserConverter() {
- //default constructor is for export
- }
-
- public UserConverter(UserDao userDao, Map<Long, Long> idMap) {
- this.userDao = userDao;
- this.idMap = idMap;
- }
-
- @Override
- public User read(InputNode node) throws Exception {
- long oldId = toLong(node.getValue());
- Long newId = idMap.containsKey(oldId) ? idMap.get(oldId) :
oldId;
-
- User u = userDao.get(newId);
- return u == null ? new User() : u;
- }
-
- @Override
- public void write(OutputNode node, User value) throws Exception {
- node.setData(true);
- node.setValue(value == null ? "0" : "" + value.getId());
- }
-}
diff --git
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/WbConverter.java
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/WbConverter.java
index a6cf301..0ab1da6 100644
---
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/WbConverter.java
+++
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/WbConverter.java
@@ -34,7 +34,6 @@ import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -131,11 +130,11 @@ public class WbConverter {
JSONArray path = new JSONArray();
for (List<?> point : points) {
if (path.length() == 0) {
- path.put(new JSONArray(Arrays.asList("M",
getInt(point, 1), getInt(point, 2))));
+ path.put(new JSONArray(List.of("M",
getInt(point, 1), getInt(point, 2))));
} else if (path.length() == points.size() - 1) {
- path.put(new JSONArray(Arrays.asList("L",
getInt(point, 3), getInt(point, 4))));
+ path.put(new JSONArray(List.of("L",
getInt(point, 3), getInt(point, 4))));
} else {
- path.put(new JSONArray(Arrays.asList("Q"
+ path.put(new JSONArray(List.of("Q"
, getInt(point, 1),
getInt(point, 2)
, getInt(point, 3),
getInt(point, 4))));
}
diff --git
a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/job/OmKeyEvent.java
b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/job/OmKeyEvent.java
index 9745e58..92de537 100644
---
a/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/job/OmKeyEvent.java
+++
b/openmeetings-screenshare/src/main/java/org/apache/openmeetings/screenshare/job/OmKeyEvent.java
@@ -27,7 +27,6 @@ import static org.slf4j.LoggerFactory.getLogger;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -46,7 +45,7 @@ public class OmKeyEvent {
private static final Logger log = getLogger(OmKeyEvent.class);
private static final Map<Integer, Integer> KEY_MAP = new HashMap<>();
private static final Map<Character, Integer> CHAR_MAP = new HashMap<>();
- private static final List<Character> UMLAUT_LIST = Arrays.asList('ß',
'ö', 'Ö', 'ä', 'Ä', 'ü', 'Ü');
+ private static final List<Character> UMLAUT_LIST = List.of('ß', 'ö',
'Ö', 'ä', 'Ä', 'ü', 'Ü');
private static final Set<Character> UMLAUTS =
Collections.unmodifiableSet(UMLAUT_LIST.stream().collect(Collectors.toSet()));
private static final Set<Character> UNPRINTABLE =
Collections.unmodifiableSet(Stream.concat(UMLAUT_LIST.stream(),
Stream.of('§')).collect(Collectors.toSet()));
static {
diff --git
a/openmeetings-service/src/main/java/org/apache/openmeetings/service/quartz/scheduler/AtomReader.java
b/openmeetings-service/src/main/java/org/apache/openmeetings/service/quartz/scheduler/AtomReader.java
index 238a064..0513a95 100644
---
a/openmeetings-service/src/main/java/org/apache/openmeetings/service/quartz/scheduler/AtomReader.java
+++
b/openmeetings-service/src/main/java/org/apache/openmeetings/service/quartz/scheduler/AtomReader.java
@@ -50,7 +50,7 @@ public class AtomReader {
private static final String ATTR_PUBLISHED = "published";
private static final int MAX_ITEM_COUNT = 5;
private static final Map<String, Spec> specs = new HashMap<>();
- private static final XMLInputFactory inputFactory =
XmlHelper.createFactory();
+ private static final XMLInputFactory inputFactory =
XmlHelper.createInputFactory();
static {
add("item")
.add(new Field("title"))
diff --git
a/openmeetings-util/src/main/java/org/apache/openmeetings/util/StoredFile.java
b/openmeetings-util/src/main/java/org/apache/openmeetings/util/StoredFile.java
index a6b019c..7ad48f3 100644
---
a/openmeetings-util/src/main/java/org/apache/openmeetings/util/StoredFile.java
+++
b/openmeetings-util/src/main/java/org/apache/openmeetings/util/StoredFile.java
@@ -28,7 +28,6 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Locale;
@@ -50,14 +49,14 @@ public class StoredFile {
private static final String MIME_IMAGE = "image";
private static final String MIME_TEXT = "text";
private static final String MIME_APP = "application";
- private static final Set<MediaType> CONVERT_TYPES = new
HashSet<>(Arrays.asList(
+ private static final Set<MediaType> CONVERT_TYPES = Set.of(
application("x-tika-msoffice"),
application("x-tika-ooxml"), application("msword")
- , application("vnd.wordperfect"), application("rtf")));
+ , application("vnd.wordperfect"), application("rtf"));
private static final MediaType MIME_PNG =
MediaType.parse(PNG_MIME_TYPE);
- private static final Set<MediaType> PDF_TYPES = new
HashSet<>(Arrays.asList(application("pdf"), application("postscript")));
+ private static final Set<MediaType> PDF_TYPES =
Set.of(application("pdf"), application("postscript"));
private static final Set<MediaType> CHART_TYPES = new HashSet<>();
- private static final Set<MediaType> AS_IS_TYPES = new
HashSet<>(Arrays.asList(MIME_PNG));
+ private static final Set<MediaType> AS_IS_TYPES = Set.of(MIME_PNG);
private static final String ACCEPT_STRING;
private static TikaConfig tika;
static {
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/configurations/ConfigForm.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/configurations/ConfigForm.java
index 34eb05c..e4f70f3 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/configurations/ConfigForm.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/configurations/ConfigForm.java
@@ -18,7 +18,6 @@
*/
package org.apache.openmeetings.web.admin.configurations;
-import java.util.Arrays;
import java.util.List;
import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
@@ -114,7 +113,7 @@ public class ConfigForm extends
AdminBaseForm<Configuration> {
add(new TextArea<String>("comment"));
update(null);
- add(new DropDownChoice<>("type", Arrays.asList(Type.values()),
new IChoiceRenderer<Type>() {
+ add(new DropDownChoice<>("type", List.of(Type.values()), new
IChoiceRenderer<Type>() {
private static final long serialVersionUID = 1L;
@Override
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/oauth/OAuthForm.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/oauth/OAuthForm.java
index d1e3728..691a0dc 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/oauth/OAuthForm.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/oauth/OAuthForm.java
@@ -24,7 +24,7 @@ import static
org.apache.openmeetings.web.pages.auth.SignInPage.getRedirectUri;
import java.util.AbstractMap.SimpleEntry;
import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -105,11 +105,11 @@ public class OAuthForm extends AdminBaseForm<OAuthServer>
{
add(new RequiredTextField<String>("clientSecret").setLabel(new
ResourceModel("1577")));
add(redirectUriText = (TextField<String>) new
TextField<>("redirectUri", Model.of("")).setLabel(new ResourceModel("1587")));
add(new RequiredTextField<String>("requestKeyUrl").setLabel(new
ResourceModel("1578")));
- add(new DropDownChoice<>("requestTokenMethod",
Arrays.asList(RequestTokenMethod.values()), new
ChoiceRenderer<RequestTokenMethod>("name", "name")));
+ add(new DropDownChoice<>("requestTokenMethod",
List.of(RequestTokenMethod.values()), new
ChoiceRenderer<RequestTokenMethod>("name", "name")));
add(new
RequiredTextField<String>("requestTokenUrl").setLabel(new
ResourceModel("1579")));
add(new
RequiredTextField<String>("requestTokenAttributes").setLabel(new
ResourceModel("1586")));
add(new
RequiredTextField<String>("requestInfoUrl").setLabel(new
ResourceModel("1580")));
- add(new DropDownChoice<>("requestInfoMethod",
Arrays.asList(RequestInfoMethod.values()), new
ChoiceRenderer<RequestInfoMethod>("name", "name")));
+ add(new DropDownChoice<>("requestInfoMethod",
List.of(RequestInfoMethod.values()), new
ChoiceRenderer<RequestInfoMethod>("name", "name")));
Form<Void> mappingForm = new Form<>("mappingForm");
final TextField<String> omAttr = new TextField<>("omAttr",
Model.of(""));
final TextField<String> oauthAttr = new
TextField<>("oauthAttr", Model.of(""));
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/rooms/RoomForm.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/rooms/RoomForm.java
index a830799..36c5c93 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/rooms/RoomForm.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/rooms/RoomForm.java
@@ -26,7 +26,6 @@ import static
org.apache.openmeetings.web.app.WebSession.getUserId;
import static
org.apache.openmeetings.web.common.confirmation.ConfirmableAjaxBorder.newOkCancelDangerConfirm;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -87,7 +86,7 @@ import
de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesome5I
public class RoomForm extends AdminBaseForm<Room> {
private static final long serialVersionUID = 1L;
- private static final List<Long> DROPDOWN_NUMBER_OF_PARTICIPANTS =
Arrays.asList(2L, 4L, 6L, 8L, 10L, 12L, 14L, 16L, 20L, 25L, 32L, 50L,
+ private static final List<Long> DROPDOWN_NUMBER_OF_PARTICIPANTS =
List.of(2L, 4L, 6L, 8L, 10L, 12L, 14L, 16L, 20L, 25L, 32L, 50L,
100L, 150L, 200L, 500L, 1000L);
private final WebMarkupContainer roomList;
private final TextField<String> pin = new TextField<>("pin");
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/users/UserForm.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/users/UserForm.java
index fd9d56e..98f4261 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/users/UserForm.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/admin/users/UserForm.java
@@ -30,7 +30,6 @@ import static
org.apache.openmeetings.web.app.WebSession.getUserId;
import static
org.apache.wicket.validation.validator.StringValidator.minimumLength;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -122,7 +121,7 @@ public class UserForm extends AdminBaseForm<User> {
login.setLabel(new ResourceModel("108"));
mainContainer.add(login.add(minimumLength(getMinLoginLength())));
- mainContainer.add(new DropDownChoice<>("type",
Arrays.asList(Type.values())).add(new OnChangeAjaxBehavior() {
+ mainContainer.add(new DropDownChoice<>("type",
List.of(Type.values())).add(new OnChangeAjaxBehavior() {
private static final long serialVersionUID = 1L;
@Override
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
index 09ae0fd..25063a3 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
@@ -36,7 +36,6 @@ import java.io.File;
import java.net.UnknownHostException;
import java.text.MessageFormat;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
@@ -163,7 +162,7 @@ public class Application extends
AuthenticatedWebApplication implements IApplica
private static final Set<String> STRINGS_WITH_APP = new HashSet<>();
private static String appName;
static {
- STRINGS_WITH_APP.addAll(Arrays.asList("499", "500", "506",
"511", "512", "513", "517", "532", "622", "widget.start.desc"
+ STRINGS_WITH_APP.addAll(List.of("499", "500", "506", "511",
"512", "513", "517", "532", "622", "widget.start.desc"
, "909", "952", "978", "981", "984", "989",
"990", "999", "1151", "1155", "1157", "1158", "1194"));
}
public static final String HASH_MAPPING = "/hash";
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WebSession.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WebSession.java
index 24b3680..2e35c5d 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WebSession.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WebSession.java
@@ -30,7 +30,6 @@ import static
org.apache.openmeetings.web.app.Application.getDashboardContext;
import static org.apache.openmeetings.web.app.Application.isInvaldSession;
import static org.apache.openmeetings.web.app.Application.removeInvalidSession;
-import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
@@ -93,7 +92,7 @@ public class WebSession extends
AbstractAuthenticatedWebSession implements IWebS
private static final long serialVersionUID = 1L;
private static final Logger log =
LoggerFactory.getLogger(WebSession.class);
public static final int MILLIS_IN_MINUTE = 60000;
- public static final List<String> AVAILABLE_TIMEZONES =
Collections.unmodifiableList(Arrays.asList(TimeZone.getAvailableIDs()));
+ public static final List<String> AVAILABLE_TIMEZONES =
Collections.unmodifiableList(List.of(TimeZone.getAvailableIDs()));
public static final Set<String> AVAILABLE_TIMEZONE_SET =
Collections.unmodifiableSet(new LinkedHashSet<>(AVAILABLE_TIMEZONES));
public static final String WICKET_ROOM_ID = "wicketroomid";
private Long userId = null;
@@ -232,17 +231,17 @@ public class WebSession extends
AbstractAuthenticatedWebSession implements IWebS
if (!soapLogin.isUsed() ||
soapLogin.getAllowSameURLMultipleTimes()) {
Sessiondata sd =
sessionDao.check(soapLogin.getSessionHash());
if (sd.getXml() != null) {
- RemoteSessionObject remoteUser =
RemoteSessionObject.fromXml(sd.getXml());
- if (remoteUser != null &&
!Strings.isEmpty(remoteUser.getExternalUserId())) {
- User user =
userDao.getExternalUser(remoteUser.getExternalUserId(),
remoteUser.getExternalUserType());
+ RemoteSessionObject remoteUser =
RemoteSessionObject.fromString(sd.getXml());
+ if (remoteUser != null &&
!Strings.isEmpty(remoteUser.getExternalId())) {
+ User user =
userDao.getExternalUser(remoteUser.getExternalId(),
remoteUser.getExternalType());
if (user == null) {
user = getNewUserInstance(null);
user.setFirstname(remoteUser.getFirstname());
user.setLastname(remoteUser.getLastname());
user.setLogin(remoteUser.getUsername());
user.setType(Type.EXTERNAL);
-
user.setExternalId(remoteUser.getExternalUserId());
-
user.addGroup(groupDao.getExternal(remoteUser.getExternalUserType()));
+
user.setExternalId(remoteUser.getExternalId());
+
user.addGroup(groupDao.getExternal(remoteUser.getExternalType()));
user.getRights().clear();
user.getRights().add(Right.ROOM);
user.getAddress().setEmail(remoteUser.getEmail());
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/GeneralUserForm.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/GeneralUserForm.java
index 83ebf20..474f882 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/GeneralUserForm.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/GeneralUserForm.java
@@ -26,7 +26,6 @@ import static
org.apache.openmeetings.web.app.WebSession.getUserId;
import java.time.LocalDate;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import org.apache.openmeetings.db.dao.user.GroupDao;
@@ -76,7 +75,7 @@ public class GeneralUserForm extends Form<User> {
email.setLabel(new ResourceModel("119"));
email.add(RfcCompliantEmailAddressValidator.getInstance());
add(new DropDownChoice<>("salutation"
- , Arrays.asList(Salutation.values())
+ , List.of(Salutation.values())
, new ChoiceRenderer<Salutation>() {
private static final long
serialVersionUID = 1L;
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/PagingNavigatorPanel.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/PagingNavigatorPanel.java
index 8a01bf7..e0bce8e 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/PagingNavigatorPanel.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/PagingNavigatorPanel.java
@@ -18,7 +18,6 @@
*/
package org.apache.openmeetings.web.common;
-import java.util.Arrays;
import java.util.List;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -36,7 +35,7 @@ public abstract class PagingNavigatorPanel extends Panel {
private final List<Integer> numbers;
public PagingNavigatorPanel(String id, final DataView<?> dataView) {
- this(id, dataView, Arrays.asList(10, 25, 50, 75, 100, 200), 50);
+ this(id, dataView, List.of(10, 25, 50, 75, 100, 200), 50);
}
public PagingNavigatorPanel(String id, final DataView<?> dataView,
List<Integer> numbers, int entitiesPerPage) {
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/OmTreeProvider.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/OmTreeProvider.java
index e8e9351..3bf8814 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/OmTreeProvider.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/OmTreeProvider.java
@@ -23,7 +23,6 @@ import static
org.apache.openmeetings.web.app.WebSession.getRights;
import static org.apache.openmeetings.web.app.WebSession.getUserId;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@@ -45,7 +44,7 @@ import org.apache.wicket.spring.injection.annot.SpringBean;
public class OmTreeProvider implements ITreeProvider<BaseFileItem> {
private static final long serialVersionUID = 1L;
- private static final List<Type> VIDEO_TYPES =
Arrays.asList(Type.FOLDER, Type.VIDEO);
+ private static final List<Type> VIDEO_TYPES = List.of(Type.FOLDER,
Type.VIDEO);
public static final String RECORDINGS_MY = "recordings-my";
public static final String RECORDINGS_PUBLIC = "recordings-public";
public static final String RECORDINGS_GROUP = "recordings-group-%s";
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/install/InstallWizard.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/install/InstallWizard.java
index c0e512d..d6c5480 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/install/InstallWizard.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/install/InstallWizard.java
@@ -34,7 +34,6 @@ import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.time.Duration;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -210,7 +209,7 @@ public class InstallWizard extends
AbstractWizard<InstallationConfig> {
private final TextField<String> pass = new
TextField<>("password");
private final Form<ConnectionProperties> form = new
Form<>("form", new CompoundPropertyModel<>(getProps(null))) {
private static final long serialVersionUID = 1L;
- private final DropDownChoice<DbType> db = new
DropDownChoice<>("dbType", Arrays.asList(DbType.values()), new
ChoiceRenderer<DbType>() {
+ private final DropDownChoice<DbType> db = new
DropDownChoice<>("dbType", List.of(DbType.values()), new
ChoiceRenderer<DbType>() {
private static final long serialVersionUID = 1L;
@Override
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/poll/CreatePollDialog.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/poll/CreatePollDialog.java
index 28f7d8b..9608457 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/poll/CreatePollDialog.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/poll/CreatePollDialog.java
@@ -21,7 +21,7 @@ package org.apache.openmeetings.web.room.poll;
import static org.apache.openmeetings.core.util.WebSocketHelper.sendRoom;
import static org.apache.openmeetings.web.app.WebSession.getUserId;
-import java.util.Arrays;
+import java.util.List;
import org.apache.openmeetings.db.dao.room.PollDao;
import org.apache.openmeetings.db.dao.room.RoomDao;
@@ -117,7 +117,7 @@ public class CreatePollDialog extends Modal<RoomPoll> {
protected void onInitialize() {
add(new RequiredTextField<String>("name").setLabel(new
ResourceModel("1410")));
add(new TextArea<String>("question"));
- add(new DropDownChoice<>("type",
Arrays.asList(RoomPoll.Type.values())
+ add(new DropDownChoice<>("type",
List.of(RoomPoll.Type.values())
, new ChoiceRenderer<RoomPoll.Type>() {
private static final long
serialVersionUID = 1L;
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/poll/PollResultsDialog.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/poll/PollResultsDialog.java
index 34bba93..98664ee 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/poll/PollResultsDialog.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/poll/PollResultsDialog.java
@@ -23,7 +23,6 @@ import static
org.apache.openmeetings.web.app.WebSession.getUserId;
import static
org.apache.openmeetings.web.common.confirmation.ConfirmableAjaxBorder.newOkCancelDangerConfirm;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import org.apache.openmeetings.db.dao.room.PollDao;
@@ -257,7 +256,7 @@ public class PollResultsDialog extends Modal<RoomPoll> {
private BarChart<Integer> barChart(RoomPoll p) {
String[] ticks = getTicks(p);
BarChart<Integer> barChart = new BarChart<>(null);
- barChart.addValue(Arrays.asList(getValues(p)));
+ barChart.addValue(List.of(getValues(p)));
barChart.getSeriesDefaults()
.setRendererOptions(new
RendererOptions().setHighlightMouseDown(true).setShowDataLabels(true)
@@ -346,7 +345,7 @@ public class PollResultsDialog extends Modal<RoomPoll> {
chartSimple = getString("1414");
chartPie = getString("1415");
add(name, question, count);
- chartType = new DropDownChoice<>("chartType",
Model.of(chartSimple), Arrays.asList(chartSimple, chartPie));
+ chartType = new DropDownChoice<>("chartType",
Model.of(chartSimple), List.of(chartSimple, chartPie));
add(chartType.add(new
AjaxFormComponentUpdatingBehavior("change") {
private static final long serialVersionUID = 1L;
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/poll/VoteDialog.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/poll/VoteDialog.java
index cbf3685..cceb622 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/poll/VoteDialog.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/poll/VoteDialog.java
@@ -21,7 +21,6 @@ package org.apache.openmeetings.web.room.poll;
import static org.apache.openmeetings.core.util.WebSocketHelper.sendRoom;
import static org.apache.openmeetings.web.app.WebSession.getUserId;
-import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -59,7 +58,7 @@ import
de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
*/
public class VoteDialog extends Modal<RoomPollAnswer> {
private static final long serialVersionUID = 1L;
- private static final List<Integer> answers = Arrays.asList(1, 2, 3, 4,
5, 6, 7, 8, 9, 10);
+ private static final List<Integer> answers = List.of(1, 2, 3, 4, 5, 6,
7, 8, 9, 10);
private PollAnswerForm form;
private final NotificationPanel feedback = new
NotificationPanel("feedback");
private final IModel<String> user = Model.of((String)null);
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomSidebar.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomSidebar.java
index 9de0b08..1d771c9 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomSidebar.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomSidebar.java
@@ -23,7 +23,6 @@ import static
org.apache.openmeetings.web.app.Application.kickUser;
import static
org.apache.openmeetings.web.util.CallbackFunctionHelper.getNamedFunction;
import static org.apache.wicket.ajax.attributes.CallbackParameter.explicit;
-import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
@@ -94,7 +93,7 @@ public class RoomSidebar extends Panel {
Client self = room.getClient();
List<Client> list;
if (!self.hasRight(Room.Right.MODERATOR) &&
room.getRoom().isHidden(RoomElement.USER_COUNT)) {
- list = Arrays.asList(self);
+ list = List.of(self);
} else {
list = cm.listByRoom(room.getRoom().getId());
list.sort(Comparator.<Client,
Integer>comparing(c -> {
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
index 4d9b78f..f55dcb7 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
@@ -41,7 +41,6 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
-import java.util.Arrays;
import java.util.Deque;
import java.util.HashMap;
import java.util.LinkedList;
@@ -156,7 +155,7 @@ public class WbPanel extends AbstractWbPanel {
setVisible(false);
} else {
add(new ListView<>("clipart"
- ,
Arrays.asList(OmFileHelper.getPublicClipartsDir().list())
+ ,
List.of(OmFileHelper.getPublicClipartsDir().list())
.stream()
.sorted()
.collect(Collectors.toList()))
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/calendar/AppointmentDialog.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/calendar/AppointmentDialog.java
index fc66212..b46f0a0 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/calendar/AppointmentDialog.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/calendar/AppointmentDialog.java
@@ -27,7 +27,6 @@ import static
org.apache.openmeetings.web.util.CalendarWebHelper.getDateTime;
import java.time.LocalDateTime;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -427,7 +426,7 @@ public class AppointmentDialog extends Modal<Appointment> {
//Advanced
add(new DropDownChoice<>(
"reminder"
- , Arrays.asList(Reminder.values())
+ , List.of(Reminder.values())
, new IChoiceRenderer<Reminder>() {
private static final long
serialVersionUID = 1L;
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/chat/Chat.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/chat/Chat.java
index bbc612e..9195d8d 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/chat/Chat.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/chat/Chat.java
@@ -30,7 +30,6 @@ import static
org.apache.wicket.ajax.attributes.CallbackParameter.explicit;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -82,7 +81,7 @@ public class Chat extends Panel {
if (m.isNeedModeration() &&
isModerator(cm, getUserId(), roomId)) {
m.setNeedModeration(false);
chatDao.update(m);
- ChatWebSocketHelper.sendRoom(m,
getMessage(Arrays.asList(m)).put("mode", "accept"));
+ ChatWebSocketHelper.sendRoom(m,
getMessage(List.of(m)).put("mode", "accept"));
} else {
log.error("It seems like we are
being hacked!!!!");
}
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/chat/ChatForm.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/chat/ChatForm.java
index 28eb5b8..91f4102 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/chat/ChatForm.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/chat/ChatForm.java
@@ -24,8 +24,8 @@ import static
org.apache.openmeetings.core.util.ChatWebSocketHelper.ID_USER_PREF
import static org.apache.openmeetings.web.app.WebSession.getUserId;
import static org.apache.openmeetings.web.room.RoomPanel.isModerator;
-import java.util.Arrays;
import java.util.Date;
+import java.util.List;
import java.util.function.BooleanSupplier;
import java.util.function.Predicate;
@@ -132,12 +132,12 @@ public class ChatForm extends Form<Void> {
return;
}
chatDao.update(m);
- JSONObject msg =
getChat().getMessage(Arrays.asList(m));
+ JSONObject msg =
getChat().getMessage(List.of(m));
if (m.getToRoom() != null) {
ChatWebSocketHelper.sendRoom(m,
msg);
} else if (m.getToUser() != null) {
ChatWebSocketHelper.sendUser(getUserId(), m, msg);
- msg =
Chat.getMessage(m.getToUser(), Arrays.asList(m));
+ msg =
Chat.getMessage(m.getToUser(), List.of(m));
ChatWebSocketHelper.sendUser(m.getToUser().getId(), m, msg);
} else {
ChatWebSocketHelper.sendAll(m,
msg);
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/MessagesContactsPanel.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/MessagesContactsPanel.java
index 757d4d7..5cc1fb9 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/MessagesContactsPanel.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/MessagesContactsPanel.java
@@ -28,7 +28,6 @@ import static
org.apache.openmeetings.web.common.confirmation.ConfirmableAjaxBor
import static
org.apache.openmeetings.web.util.CallbackFunctionHelper.addOnClick;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -119,7 +118,7 @@ public class MessagesContactsPanel extends UserBasePanel {
private final Button unreadBtn = new Button("unreadBtn");
private final DropDownChoice<String> selectDropDown = new
DropDownChoice<>(
"msgSelect", Model.of(SELECT_CHOOSE)
- , Arrays.asList(SELECT_CHOOSE, SELECT_ALL, SELECT_NONE,
SELECT_UNREAD, SELECT_READ)
+ , List.of(SELECT_CHOOSE, SELECT_ALL, SELECT_NONE,
SELECT_UNREAD, SELECT_READ)
, new ChoiceRenderer<String>() {
private static final long serialVersionUID = 1L;
@@ -135,7 +134,7 @@ public class MessagesContactsPanel extends UserBasePanel {
});
private PrivateMessageFolder NOT_MOVE_FOLDER = new
PrivateMessageFolder();
private final DropDownChoice<PrivateMessageFolder> moveDropDown = new
DropDownChoice<>("msgMove", Model.of(NOT_MOVE_FOLDER)
- , Arrays.asList(NOT_MOVE_FOLDER)
+ , List.of(NOT_MOVE_FOLDER)
, new ChoiceRenderer<PrivateMessageFolder>() {
private static final long serialVersionUID = 1L;
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/UserSearchPanel.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/UserSearchPanel.java
index 558af70..5d6566c 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/UserSearchPanel.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/UserSearchPanel.java
@@ -24,7 +24,6 @@ import static
org.apache.openmeetings.web.app.WebSession.getUserId;
import static
org.apache.openmeetings.web.util.CallbackFunctionHelper.addOnClick;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@@ -55,7 +54,7 @@ import
de.agilecoders.wicket.core.markup.html.bootstrap.button.Buttons;
public class UserSearchPanel extends UserBasePanel {
private static final long serialVersionUID = 1L;
- private static final List<Integer> itemsPerPage = Arrays.asList(10, 25,
50, 75, 100, 200, 500, 1000, 2500, 5000);
+ private static final List<Integer> itemsPerPage = List.of(10, 25, 50,
75, 100, 200, 500, 1000, 2500, 5000);
private final TextField<String> text = new TextField<>("text",
Model.of(""));
private final TextField<String> search = new TextField<>("search",
Model.of(""));
private final TextField<String> offer = new TextField<>("offer",
Model.of(""));
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/util/RoomTypeDropDown.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/util/RoomTypeDropDown.java
index ae169d9..e8d721e 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/util/RoomTypeDropDown.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/util/RoomTypeDropDown.java
@@ -18,7 +18,6 @@
*/
package org.apache.openmeetings.web.util;
-import java.util.Arrays;
import java.util.List;
import org.apache.openmeetings.db.entity.room.Room.Type;
@@ -31,7 +30,7 @@ public class RoomTypeDropDown extends DropDownChoice<Type> {
public RoomTypeDropDown(String id) {
super(id);
- setChoices(Arrays.asList(Type.values()));
+ setChoices(List.of(Type.values()));
setChoiceRenderer(new IChoiceRenderer<Type>() {
private static final long serialVersionUID = 1L;
diff --git
a/openmeetings-web/src/test/java/org/apache/openmeetings/cli/TestAdmin.java
b/openmeetings-web/src/test/java/org/apache/openmeetings/cli/TestAdmin.java
index cb3a773..22397f2 100644
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/cli/TestAdmin.java
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/cli/TestAdmin.java
@@ -39,7 +39,6 @@ import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.nio.file.Files;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.UUID;
@@ -109,7 +108,7 @@ public class TestAdmin {
}
private static void performInstall(Admin admin, String... args) throws
Exception {
- List<String> params = new ArrayList<>(Arrays.asList("-i"
+ List<String> params = new ArrayList<>(List.of("-i"
, "-tz", "Europe/Berlin"
, "-email", email
, "-group", group
diff --git
a/openmeetings-web/src/test/java/org/apache/openmeetings/webservice/AbstractWebServiceTest.java
b/openmeetings-web/src/test/java/org/apache/openmeetings/webservice/AbstractWebServiceTest.java
index f1f2140..615c464 100644
---
a/openmeetings-web/src/test/java/org/apache/openmeetings/webservice/AbstractWebServiceTest.java
+++
b/openmeetings-web/src/test/java/org/apache/openmeetings/webservice/AbstractWebServiceTest.java
@@ -18,6 +18,29 @@
*/
package org.apache.openmeetings.webservice;
+import static java.util.UUID.randomUUID;
+import static javax.ws.rs.core.MediaType.APPLICATION_FORM_URLENCODED;
+import static org.apache.openmeetings.AbstractJUnitDefaults.createPass;
+import static org.apache.openmeetings.AbstractJUnitDefaults.ensureSchema;
+import static org.apache.openmeetings.AbstractJUnitDefaults.soapUsername;
+import static org.apache.openmeetings.AbstractJUnitDefaults.userpass;
+import static
org.apache.openmeetings.db.util.ApplicationHelper.ensureApplication;
+import static org.apache.openmeetings.util.OmFileHelper.getOmHome;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.InetAddress;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ws.rs.core.Form;
+import javax.ws.rs.core.MediaType;
+
import org.apache.catalina.LifecycleState;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Tomcat;
@@ -39,29 +62,6 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
-import javax.ws.rs.core.Form;
-import javax.ws.rs.core.MediaType;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.InetAddress;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import static java.util.UUID.randomUUID;
-import static javax.ws.rs.core.MediaType.APPLICATION_FORM_URLENCODED;
-import static org.apache.openmeetings.AbstractJUnitDefaults.createPass;
-import static org.apache.openmeetings.AbstractJUnitDefaults.ensureSchema;
-import static org.apache.openmeetings.AbstractJUnitDefaults.soapUsername;
-import static org.apache.openmeetings.AbstractJUnitDefaults.userpass;
-import static
org.apache.openmeetings.db.util.ApplicationHelper.ensureApplication;
-import static org.apache.openmeetings.util.OmFileHelper.getOmHome;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
public class AbstractWebServiceTest {
private static Tomcat tomcat;
private static final String HOST = "localhost";
@@ -78,7 +78,7 @@ public class AbstractWebServiceTest {
}
public static WebClient getClient(String url) {
- WebClient c = WebClient.create(url, Arrays.asList(new
AppointmentMessageBodyReader()))
+ WebClient c = WebClient.create(url, List.of(new
AppointmentMessageBodyReader()))
.accept("application/json").type("application/json");
HTTPClientPolicy p =
WebClient.getConfig(c).getHttpConduit().getClient();
p.setConnectionTimeout(TIMEOUT);
diff --git
a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java
b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java
index 3f9f4bc..65ca5e2 100644
---
a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java
+++
b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/UserWebService.java
@@ -307,9 +307,9 @@ public class UserWebService extends BaseWebService {
log.debug(remoteSessionObject.toString());
- String xmlString = remoteSessionObject.toXml();
+ String xmlString = remoteSessionObject.toString();
- log.debug("xmlString {}", xmlString);
+ log.debug("jsonString {}", xmlString);
String hash = soapDao.addSOAPLogin(sid,
options.getRoomId(),
options.isModerator(),
options.isShowAudioVideoTest(), options.isAllowSameURLMultipleTimes(),
diff --git
a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AllowOriginProvider.java
b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AllowOriginProvider.java
index f238102..ed632f8 100644
---
a/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AllowOriginProvider.java
+++
b/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AllowOriginProvider.java
@@ -20,7 +20,6 @@ package org.apache.openmeetings.webservice.util;
import static
org.apache.openmeetings.util.OpenmeetingsVariables.getRestAllowOrigin;
-import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@@ -45,7 +44,7 @@ public class AllowOriginProvider extends
AbstractOutDatabindingInterceptor {
headers = new
TreeMap<>(String.CASE_INSENSITIVE_ORDER);
outMessage.put(Message.PROTOCOL_HEADERS,
headers);
}
- headers.put("Access-Control-Allow-Origin",
Arrays.asList(allowOrigin));
+ headers.put("Access-Control-Allow-Origin",
List.of(allowOrigin));
}
}
}
diff --git a/pom.xml b/pom.xml
index be815c8..17ea926 100644
--- a/pom.xml
+++ b/pom.xml
@@ -542,21 +542,6 @@
<version>${cxf.version}</version>
</dependency>
<dependency>
- <groupId>org.simpleframework</groupId>
- <artifactId>simple-xml</artifactId>
- <version>${simple-xml.version}</version>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
-
<artifactId>stax-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xpp3</groupId>
- <artifactId>xpp3</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
<version>${jettison.version}</version>