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 05d832e [OPENMEETINGS-2177] more work on import
05d832e is described below
commit 05d832e2b3c07024139f78fede6f00b707093179
Author: Maxim Solodovnik <[email protected]>
AuthorDate: Tue Mar 3 23:40:21 2020 +0700
[OPENMEETINGS-2177] more work on import
---
.../org/apache/openmeetings/db/bind/Constants.java | 4 +
.../db/bind/adapter/AppointmentAdapter.java | 39 +++++++++
.../bind/adapter/AppointmentReminderAdapter.java | 41 ++++++++++
.../db/bind/adapter/OauthMapAdapter.java | 7 +-
.../db/bind/adapter/OmCalendarAdapter.java | 39 +++++++++
.../db/dao/calendar/AppointmentDao.java | 29 ++++++-
.../db/dao/calendar/MeetingMemberDao.java | 2 +-
.../db/dao/calendar/OmCalendarDao.java | 35 +++++++-
.../db/entity/calendar/Appointment.java | 94 +++++++++++++++-------
.../db/entity/calendar/MeetingMember.java | 28 +++++--
.../db/entity/calendar/OmCalendar.java | 2 +-
.../org/apache/openmeetings/db/util/XmlHelper.java | 53 ++++++++++++
.../apache/openmeetings/backup/BackupExport.java | 2 +-
.../apache/openmeetings/backup/BackupImport.java | 47 +++++------
.../cli/ConnectionPropertiesPatcher.java | 13 +--
.../service/calendar/caldav/IcalUtils.java | 4 +-
.../service/quartz/scheduler/AtomReader.java | 11 +--
.../service/room/InvitationManager.java | 4 +-
.../org/apache/openmeetings/util/XmlExport.java | 6 +-
.../web/user/calendar/AppointmentDialog.java | 2 +-
.../web/user/calendar/CalendarPanel.java | 2 +-
.../apache/openmeetings/AbstractJUnitDefaults.java | 2 +-
.../org/apache/openmeetings/backup/TestImport.java | 11 ---
.../openmeetings/backup/TestImportCalendar.java | 63 +++++++++++++++
.../apache/openmeetings/backup/TestImportOld.java | 4 +-
.../calendar/TestAppointmentAddAppointment.java | 4 +-
.../openmeetings/backup/calendar/appointements.xml | 58 +++++++++++++
.../backup/calendar/meetingmembers.xml | 35 ++++++++
.../backup/calendar/skip/appointements.xml | 90 +++++++++++++++++++++
29 files changed, 617 insertions(+), 114 deletions(-)
diff --git
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/bind/Constants.java
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/bind/Constants.java
index 76f0e8f..6001863 100644
---
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/bind/Constants.java
+++
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/bind/Constants.java
@@ -39,4 +39,8 @@ public class Constants {
public static final String CHAT_NODE = "ChatMessage";
public static final String CALENDAR_LIST_NODE = "calendars";
public static final String CALENDAR_NODE = "calendar";
+ public static final String APPOINTMENT_LIST_NODE = "appointments";
+ public static final String APPOINTMENT_NODE = "appointment";
+ public static final String MMEMBER_LIST_NODE = "meetingmembers";
+ public static final String MMEMBER_NODE = "meetingmember";
}
diff --git
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/bind/adapter/AppointmentAdapter.java
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/bind/adapter/AppointmentAdapter.java
new file mode 100644
index 0000000..7791dff
--- /dev/null
+++
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/bind/adapter/AppointmentAdapter.java
@@ -0,0 +1,39 @@
+/*
+ * 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.db.bind.adapter;
+
+import java.util.Map;
+
+import org.apache.openmeetings.db.dao.calendar.AppointmentDao;
+import org.apache.openmeetings.db.entity.calendar.Appointment;
+
+public class AppointmentAdapter extends EntityAdapter<Appointment> {
+ public AppointmentAdapter() {
+ super();
+ }
+
+ public AppointmentAdapter(AppointmentDao dao, Map<Long, Long> idMap) {
+ super(dao, idMap);
+ }
+
+ @Override
+ protected Appointment newEntity() {
+ return new Appointment();
+ }
+}
diff --git
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/bind/adapter/AppointmentReminderAdapter.java
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/bind/adapter/AppointmentReminderAdapter.java
new file mode 100644
index 0000000..e573cf4
--- /dev/null
+++
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/bind/adapter/AppointmentReminderAdapter.java
@@ -0,0 +1,41 @@
+/*
+ * 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.db.bind.adapter;
+
+import static org.apache.commons.lang3.math.NumberUtils.toInt;
+import static org.apache.openmeetings.db.bind.adapter.CDATAAdapter.CDATA_BEGIN;
+import static org.apache.openmeetings.db.bind.adapter.CDATAAdapter.CDATA_END;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+import org.apache.openmeetings.db.entity.calendar.Appointment;
+import org.apache.wicket.util.string.Strings;
+
+public class AppointmentReminderAdapter extends XmlAdapter<String,
Appointment.Reminder> {
+
+ @Override
+ public String marshal(Appointment.Reminder v) throws Exception {
+ return CDATA_BEGIN + v.getId() + CDATA_END;
+ }
+
+ @Override
+ public Appointment.Reminder unmarshal(String v) throws Exception {
+ return Strings.isEmpty(v) ? null :
Appointment.Reminder.get(toInt(v));
+ }
+}
diff --git
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/bind/adapter/OauthMapAdapter.java
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/bind/adapter/OauthMapAdapter.java
index 479bf2c..f5cd0fc 100644
---
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/bind/adapter/OauthMapAdapter.java
+++
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/bind/adapter/OauthMapAdapter.java
@@ -23,10 +23,9 @@ import java.util.Map;
import java.util.Map.Entry;
import javax.xml.bind.annotation.adapters.XmlAdapter;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.openmeetings.db.dto.user.OAuthUser;
+import org.apache.openmeetings.db.util.XmlHelper;
import org.apache.wicket.util.string.Strings;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -37,9 +36,7 @@ public class OauthMapAdapter extends XmlAdapter<Object,
Map<String, String>> {
@Override
public Object marshal(Map<String, String> v) throws Exception {
- DocumentBuilderFactory dbf =
DocumentBuilderFactory.newInstance();
- DocumentBuilder db = dbf.newDocumentBuilder();
- Document document = db.newDocument();
+ Document document = XmlHelper.createBuilder().newDocument();
Element root = document.createElement("mapping");
document.appendChild(root);
diff --git
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/bind/adapter/OmCalendarAdapter.java
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/bind/adapter/OmCalendarAdapter.java
new file mode 100644
index 0000000..5bcbb69
--- /dev/null
+++
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/bind/adapter/OmCalendarAdapter.java
@@ -0,0 +1,39 @@
+/*
+ * 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.db.bind.adapter;
+
+import java.util.Map;
+
+import org.apache.openmeetings.db.dao.calendar.OmCalendarDao;
+import org.apache.openmeetings.db.entity.calendar.OmCalendar;
+
+public class OmCalendarAdapter extends EntityAdapter<OmCalendar> {
+ public OmCalendarAdapter() {
+ super();
+ }
+
+ public OmCalendarAdapter(OmCalendarDao dao, Map<Long, Long> idMap) {
+ super(dao, idMap);
+ }
+
+ @Override
+ protected OmCalendar newEntity() {
+ return new OmCalendar();
+ }
+}
diff --git
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java
index fc41111..0783070 100644
---
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java
+++
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java
@@ -18,6 +18,7 @@
*/
package org.apache.openmeetings.db.dao.calendar;
+import static org.apache.openmeetings.db.util.DaoHelper.UNSUPPORTED;
import static
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_CALENDAR_ROOM_CAPACITY;
import static org.apache.openmeetings.util.OpenmeetingsVariables.PARAM_USER_ID;
@@ -33,6 +34,7 @@ import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import javax.persistence.TypedQuery;
+import org.apache.openmeetings.db.dao.IDataProviderDao;
import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
import org.apache.openmeetings.db.dao.room.IInvitationManager;
import org.apache.openmeetings.db.dao.room.RoomDao;
@@ -49,7 +51,7 @@ import
org.springframework.transaction.annotation.Transactional;
@Repository
@Transactional
-public class AppointmentDao {
+public class AppointmentDao implements IDataProviderDao<Appointment>{
private static final Logger log =
LoggerFactory.getLogger(AppointmentDao.class);
private static final String PARAM_START = "start";
private static final String PARAM_CALID = "calId";
@@ -68,6 +70,7 @@ public class AppointmentDao {
* insert, update, delete, select
*/
//
-----------------------------------------------------------------------------------------------
+ @Override
public Appointment get(Long id) {
List<Appointment> list =
em.createNamedQuery("getAppointmentById", Appointment.class)
.setParameter("id", id).getResultList();
@@ -84,6 +87,7 @@ public class AppointmentDao {
return em.createNamedQuery("getAppointments",
Appointment.class).getResultList();
}
+ @Override
public Appointment update(Appointment a, Long userId) {
return update(a, userId, true);
}
@@ -142,6 +146,7 @@ public class AppointmentDao {
//
----------------------------------------------------------------------------------------------------------
+ @Override
public void delete(Appointment a, Long userId) {
if (a == null || a.getId() == null) {
return;
@@ -178,7 +183,7 @@ public class AppointmentDao {
public List<Appointment> getInRange(Calendar start, Calendar end) {
TypedQuery<Appointment> q =
em.createNamedQuery("appointmentsInRangeRemind", Appointment.class);
- q.setParameter("none", Reminder.none);
+ q.setParameter("none", Reminder.NONE);
q.setParameter(PARAM_START, start.getTime());
q.setParameter("end", end.getTime());
return q.getResultList();
@@ -265,4 +270,24 @@ public class AppointmentDao {
.setParameter(PARAM_CALID, calId)
.executeUpdate();
}
+
+ @Override
+ public List<Appointment> get(long start, long count) {
+ throw UNSUPPORTED;
+ }
+
+ @Override
+ public List<Appointment> get(String search, long start, long count,
String order) {
+ throw UNSUPPORTED;
+ }
+
+ @Override
+ public long count() {
+ throw UNSUPPORTED;
+ }
+
+ @Override
+ public long count(String search) {
+ throw UNSUPPORTED;
+ }
}
diff --git
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/MeetingMemberDao.java
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/MeetingMemberDao.java
index 4bfa453..56569cd 100644
---
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/MeetingMemberDao.java
+++
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/MeetingMemberDao.java
@@ -44,7 +44,7 @@ public class MeetingMemberDao {
return list.size() == 1 ? list.get(0) : null;
}
- public List<MeetingMember> getMeetingMembers() {
+ public List<MeetingMember> get() {
return em.createNamedQuery("getMeetingMembers",
MeetingMember.class).getResultList();
}
diff --git
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/OmCalendarDao.java
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/OmCalendarDao.java
index 837debb..687d95f 100644
---
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/OmCalendarDao.java
+++
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/OmCalendarDao.java
@@ -18,6 +18,7 @@
*/
package org.apache.openmeetings.db.dao.calendar;
+import static org.apache.openmeetings.db.util.DaoHelper.UNSUPPORTED;
import static org.apache.openmeetings.util.OpenmeetingsVariables.PARAM_USER_ID;
import java.util.Date;
@@ -26,6 +27,7 @@ import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
+import org.apache.openmeetings.db.dao.IDataProviderDao;
import org.apache.openmeetings.db.entity.calendar.OmCalendar;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@@ -33,7 +35,7 @@ import
org.springframework.transaction.annotation.Transactional;
@Repository
@Transactional
-public class OmCalendarDao {
+public class OmCalendarDao implements IDataProviderDao<OmCalendar> {
@PersistenceContext
private EntityManager em;
@Autowired
@@ -49,6 +51,7 @@ public class OmCalendarDao {
* @param calId Calendar ID of the Calendar to return.
* @return Returns the Calendar if found, else returns null
*/
+ @Override
public OmCalendar get(Long calId) {
List<OmCalendar> list = em.createNamedQuery("getCalendarbyId",
OmCalendar.class)
.setParameter("calId", calId).getResultList();
@@ -110,4 +113,34 @@ public class OmCalendarDao {
//Cascades the Appointment Updates as well.
update(c);
}
+
+ @Override
+ public List<OmCalendar> get(long start, long count) {
+ throw UNSUPPORTED;
+ }
+
+ @Override
+ public List<OmCalendar> get(String search, long start, long count,
String order) {
+ throw UNSUPPORTED;
+ }
+
+ @Override
+ public long count() {
+ throw UNSUPPORTED;
+ }
+
+ @Override
+ public long count(String search) {
+ throw UNSUPPORTED;
+ }
+
+ @Override
+ public OmCalendar update(OmCalendar entity, Long userId) {
+ throw UNSUPPORTED;
+ }
+
+ @Override
+ public void delete(OmCalendar entity, Long userId) {
+ throw UNSUPPORTED;
+ }
}
diff --git
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/calendar/Appointment.java
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/calendar/Appointment.java
index 0c22c0c..7a0fe50 100644
---
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/calendar/Appointment.java
+++
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/calendar/Appointment.java
@@ -18,6 +18,8 @@
*/
package org.apache.openmeetings.db.entity.calendar;
+import static org.apache.openmeetings.db.bind.Constants.APPOINTMENT_NODE;
+
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@@ -39,13 +41,23 @@ import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.apache.openjpa.persistence.jdbc.ForeignKey;
+import org.apache.openmeetings.db.bind.adapter.AppointmentReminderAdapter;
+import org.apache.openmeetings.db.bind.adapter.BooleanAdapter;
+import org.apache.openmeetings.db.bind.adapter.CDATAAdapter;
+import org.apache.openmeetings.db.bind.adapter.DateAdapter;
+import org.apache.openmeetings.db.bind.adapter.LongAdapter;
+import org.apache.openmeetings.db.bind.adapter.OmCalendarAdapter;
+import org.apache.openmeetings.db.bind.adapter.RoomAdapter;
+import org.apache.openmeetings.db.bind.adapter.UserAdapter;
import org.apache.openmeetings.db.entity.HistoricalEntity;
import org.apache.openmeetings.db.entity.room.Room;
import org.apache.openmeetings.db.entity.user.User;
-import org.simpleframework.xml.Element;
-import org.simpleframework.xml.Root;
@Entity
@Table(name = "appointment", indexes = {
@@ -117,7 +129,7 @@ import org.simpleframework.xml.Root;
query = "SELECT a.href FROM Appointment a WHERE a.deleted = FALSE AND
a.calendar.id = :calId ORDER BY a.id")
@NamedQuery(name = "deleteAppointmentsbyCalendar",
query = "UPDATE Appointment a SET a.deleted = true WHERE a.calendar.id
= :calId")
-@Root(name = "appointment")
+@XmlRootElement(name = APPOINTMENT_NODE)
public class Appointment extends HistoricalEntity {
private static final long serialVersionUID = 1L;
public static final int REMINDER_NONE_ID = 1;
@@ -125,7 +137,9 @@ public class Appointment extends HistoricalEntity {
public static final int REMINDER_ICAL_ID = 3;
public enum Reminder {
- none(REMINDER_NONE_ID), email(REMINDER_EMAIL_ID),
ical(REMINDER_ICAL_ID);
+ NONE(REMINDER_NONE_ID)
+ , EMAIL(REMINDER_EMAIL_ID)
+ , ICAL(REMINDER_ICAL_ID);
private int id;
@@ -146,13 +160,13 @@ public class Appointment extends HistoricalEntity {
}
public static Reminder get(int type) {
- Reminder r = Reminder.none;
+ Reminder r = Reminder.NONE;
switch (type) {
case REMINDER_EMAIL_ID:
- r = Reminder.email;
+ r = Reminder.EMAIL;
break;
case REMINDER_ICAL_ID:
- r = Reminder.ical;
+ r = Reminder.ICAL;
break;
default:
// no-op
@@ -164,102 +178,126 @@ public class Appointment extends HistoricalEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
- @Element(name = "appointmentId", data = true)
+ @XmlElement(name = "appointmentId")
+ @XmlJavaTypeAdapter(LongAdapter.class)
private Long id;
@Column(name = "title")
- @Element(name = "appointmentName", data = true, required = false)
+ @XmlElement(name = "appointmentName", required = false)
+ @XmlJavaTypeAdapter(CDATAAdapter.class)
private String title;
@Column(name = "location")
- @Element(name = "appointmentLocation", data = true, required = false)
+ @XmlElement(name = "appointmentLocation", required = false)
+ @XmlJavaTypeAdapter(CDATAAdapter.class)
private String location;
@Column(name = "app_start") // Oracle fails in case 'start' is used as
column name
- @Element(name = "appointmentStarttime", data = true)
+ @XmlElement(name = "appointmentStarttime")
+ @XmlJavaTypeAdapter(DateAdapter.class)
private Date start;
@Column(name = "app_end") // renamed to be in sync with 'app_start'
- @Element(name = "appointmentEndtime", data = true)
+ @XmlElement(name = "appointmentEndtime")
+ @XmlJavaTypeAdapter(DateAdapter.class)
private Date end;
@Lob
@Column(name = "description", length = 2048)
- @Element(name = "appointmentDescription", data = true, required = false)
+ @XmlElement(name = "appointmentDescription", required = false)
+ @XmlJavaTypeAdapter(CDATAAdapter.class)
private String description;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "user_id", nullable = true)
@ForeignKey(enabled = true)
- @Element(name = "users_id", data = true, required = false)
+ @XmlElement(name = "users_id", required = false)
+ @XmlJavaTypeAdapter(UserAdapter.class)
private User owner;
@Column(name = "reminder")
@Enumerated(EnumType.STRING)
- @Element(name = "typId", data = true, required = false)
- private Reminder reminder = Reminder.none;
+ @XmlElement(name = "typId", required = false)
+ @XmlJavaTypeAdapter(AppointmentReminderAdapter.class)
+ private Reminder reminder = Reminder.NONE;
@Column(name = "isdaily")
- @Element(data = true, required = false)
+ @XmlElement(name = "isDaily", required = false)
+ @XmlJavaTypeAdapter(BooleanAdapter.class)
private Boolean isDaily;
@Column(name = "isweekly")
- @Element(data = true, required = false)
+ @XmlElement(name = "isWeekly", required = false)
+ @XmlJavaTypeAdapter(BooleanAdapter.class)
private Boolean isWeekly;
@Column(name = "ismonthly")
- @Element(data = true, required = false)
+ @XmlElement(name = "isMonthly", required = false)
+ @XmlJavaTypeAdapter(BooleanAdapter.class)
private Boolean isMonthly;
@Column(name = "isyearly")
- @Element(data = true, required = false)
+ @XmlElement(name = "isYearly", required = false)
+ @XmlJavaTypeAdapter(BooleanAdapter.class)
private Boolean isYearly;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "room_id", nullable = true)
@ForeignKey(enabled = true)
- @Element(name = "room_id", data = true, required = false)
+ @XmlElement(name = "room_id", required = false)
+ @XmlJavaTypeAdapter(RoomAdapter.class)
private Room room;
@Column(name = "icalId")
- @Element(data = true, required = false)
+ @XmlElement(name = "icalId", required = false)
+ @XmlJavaTypeAdapter(CDATAAdapter.class)
private String icalId;
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL,
orphanRemoval = true)
@JoinColumn(name = "appointment_id")
+ @XmlTransient
private List<MeetingMember> meetingMembers;
@Column(name = "language_id")
- @Element(name = "language_id", data = true, required = false)
+ @XmlElement(name = "language_id", required = false)
+ @XmlJavaTypeAdapter(LongAdapter.class)
private Long languageId;
@Column(name = "is_password_protected", nullable = false)
- @Element(name = "isPasswordProtected", data = true, required = false)
+ @XmlElement(name = "isPasswordProtected", required = false)
+ @XmlJavaTypeAdapter(value = BooleanAdapter.class, type = boolean.class)
private boolean passwordProtected;
@Column(name = "password")
- @Element(data = true, required = false)
+ @XmlElement(name = "icalId", required = false)
+ @XmlJavaTypeAdapter(CDATAAdapter.class)
private String password;
@Column(name = "is_connected_event", nullable = false)
+ @XmlElement(name = "connectedEvent", required = false)
+ @XmlJavaTypeAdapter(value = BooleanAdapter.class, type = boolean.class)
private boolean connectedEvent;
@Column(name = "is_reminder_email_send", nullable = false)
+ @XmlTransient
private boolean reminderEmailSend;
//Calendar Specific fields.
@ManyToOne()
@JoinColumn(name = "calendar_id", nullable = true)
@ForeignKey(enabled = true)
- @Element(name = "calendar_id", data = true, required = false)
+ @XmlElement(name = "calendar_id", required = false)
+ @XmlJavaTypeAdapter(OmCalendarAdapter.class)
private OmCalendar calendar;
@Column(name = "href")
- @Element(data = true, required = false)
+ @XmlElement(name = "href", required = false)
+ @XmlJavaTypeAdapter(CDATAAdapter.class)
private String href;
@Column(name = "etag")
- @Element(data = true, required = false)
+ @XmlElement(name = "etag", required = false)
+ @XmlJavaTypeAdapter(CDATAAdapter.class)
private String etag;
diff --git
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/calendar/MeetingMember.java
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/calendar/MeetingMember.java
index 2413e8c..b01c919 100644
---
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/calendar/MeetingMember.java
+++
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/calendar/MeetingMember.java
@@ -18,6 +18,8 @@
*/
package org.apache.openmeetings.db.entity.calendar;
+import static org.apache.openmeetings.db.bind.Constants.MMEMBER_NODE;
+
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -30,13 +32,19 @@ import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.apache.openjpa.persistence.jdbc.ForeignKey;
+import org.apache.openmeetings.db.bind.adapter.AppointmentAdapter;
+import org.apache.openmeetings.db.bind.adapter.CDATAAdapter;
+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.room.Invitation;
import org.apache.openmeetings.db.entity.user.User;
-import org.simpleframework.xml.Element;
-import org.simpleframework.xml.Root;
@Entity
@Table(name = "meeting_member")
@@ -45,37 +53,43 @@ import org.simpleframework.xml.Root;
@NamedQuery(name="getMeetingMembers", query="SELECT mm FROM MeetingMember mm
ORDER BY mm.id")
@NamedQuery(name="getMeetingMemberIdsByAppointment"
, query="SELECT mm.id FROM MeetingMember mm WHERE mm.deleted =
false AND mm.appointment.id = :id")
-@Root(name = "meetingmember")
+@XmlRootElement(name = MMEMBER_NODE)
public class MeetingMember extends HistoricalEntity {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
- @Element(name = "meetingMemberId", data = true)
+ @XmlElement(name = "meetingMemberId")
+ @XmlJavaTypeAdapter(LongAdapter.class)
private Long id;
@ManyToOne(fetch = FetchType.EAGER, cascade = {CascadeType.MERGE,
CascadeType.PERSIST})
@JoinColumn(name = "user_id", nullable = true)
@ForeignKey(enabled = true)
- @Element(name = "userid", data = true, required = false)
+ @XmlElement(name = "userid", required = false)
+ @XmlJavaTypeAdapter(UserAdapter.class)
private User user;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "appointment_id", nullable = true)
@ForeignKey(enabled = true)
- @Element(data = true, required = false)
+ @XmlElement(name = "appointment", required = false)
+ @XmlJavaTypeAdapter(AppointmentAdapter.class)
private Appointment appointment;
@Column(name = "appointment_status")
- @Element(data = true, required = false)
+ @XmlElement(name = "appointmentStatus", required = false)
+ @XmlJavaTypeAdapter(CDATAAdapter.class)
private String appointmentStatus; // status of the appointment denial,
acceptance, wait.
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinColumn(name = "invitation_id", nullable = true)
@ForeignKey(enabled = true)
+ @XmlTransient
private Invitation invitation;
@Column(name = "is_connected_event", nullable = false)
+ @XmlTransient
private boolean connectedEvent;
@Override
diff --git
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/calendar/OmCalendar.java
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/calendar/OmCalendar.java
index dc6f7a2..95fbe59 100644
---
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/calendar/OmCalendar.java
+++
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/calendar/OmCalendar.java
@@ -73,7 +73,7 @@ public class OmCalendar extends HistoricalEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
- @XmlElement(name = "id", required = false)
+ @XmlElement(name = "id")
@XmlJavaTypeAdapter(LongAdapter.class)
private Long id;
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
new file mode 100644
index 0000000..38b3b94
--- /dev/null
+++
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/XmlHelper.java
@@ -0,0 +1,53 @@
+/*
+ * 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.db.util;
+
+import static javax.xml.stream.XMLInputFactory.IS_NAMESPACE_AWARE;
+import static javax.xml.stream.XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES;
+import static javax.xml.stream.XMLInputFactory.IS_VALIDATING;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLInputFactory;
+
+public class XmlHelper {
+ private XmlHelper() {
+ //no access
+ }
+
+ public static DocumentBuilder createBuilder() throws
ParserConfigurationException {
+ DocumentBuilderFactory dbFactory =
DocumentBuilderFactory.newInstance();
+
dbFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl",
true);
+
dbFactory.setFeature("http://xml.org/sax/features/external-general-entities",
false);
+
dbFactory.setFeature("http://xml.org/sax/features/external-parameter-entities",
false);
+
dbFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",
false);
+ dbFactory.setXIncludeAware(false);
+ dbFactory.setExpandEntityReferences(false);
+ 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);
+ return inputFactory;
+ }
+}
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 14172ac..d59f496 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
@@ -358,7 +358,7 @@ public class BackupExport {
registry.bind(Appointment.class, AppointmentConverter.class);
writeList(serializer, zos, "meetingmembers.xml",
- "meetingmembers",
meetingMemberDao.getMeetingMembers());
+ "meetingmembers", meetingMemberDao.get());
}
/*
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 ab0df5f..e7ee2f6 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
@@ -19,6 +19,8 @@
package org.apache.openmeetings.backup;
import static java.util.UUID.randomUUID;
+import static org.apache.openmeetings.db.bind.Constants.APPOINTMENT_LIST_NODE;
+import static org.apache.openmeetings.db.bind.Constants.APPOINTMENT_NODE;
import static org.apache.openmeetings.db.bind.Constants.CALENDAR_LIST_NODE;
import static org.apache.openmeetings.db.bind.Constants.CALENDAR_NODE;
import static org.apache.openmeetings.db.bind.Constants.CFG_LIST_NODE;
@@ -27,6 +29,8 @@ import static
org.apache.openmeetings.db.bind.Constants.CHAT_LIST_NODE;
import static org.apache.openmeetings.db.bind.Constants.CHAT_NODE;
import static org.apache.openmeetings.db.bind.Constants.GROUP_LIST_NODE;
import static org.apache.openmeetings.db.bind.Constants.GROUP_NODE;
+import static org.apache.openmeetings.db.bind.Constants.MMEMBER_LIST_NODE;
+import static org.apache.openmeetings.db.bind.Constants.MMEMBER_NODE;
import static org.apache.openmeetings.db.bind.Constants.OAUTH_LIST_NODE;
import static org.apache.openmeetings.db.bind.Constants.OAUTH_NODE;
import static org.apache.openmeetings.db.bind.Constants.ROOM_GRP_LIST_NODE;
@@ -149,18 +153,17 @@ import javax.xml.transform.stream.StreamSource;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.text.WordUtils;
-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.OmCalendarConverter;
import org.apache.openmeetings.backup.converter.PollTypeConverter;
import org.apache.openmeetings.backup.converter.RecordingStatusConverter;
import org.apache.openmeetings.backup.converter.RoomConverter;
import org.apache.openmeetings.backup.converter.UserConverter;
import org.apache.openmeetings.backup.converter.WbConverter;
import org.apache.openmeetings.core.converter.DocumentConverter;
+import org.apache.openmeetings.db.bind.adapter.AppointmentAdapter;
import org.apache.openmeetings.db.bind.adapter.GroupAdapter;
+import org.apache.openmeetings.db.bind.adapter.OmCalendarAdapter;
import org.apache.openmeetings.db.bind.adapter.RoomAdapter;
import org.apache.openmeetings.db.bind.adapter.UserAdapter;
import org.apache.openmeetings.db.dao.basic.ChatDao;
@@ -205,6 +208,7 @@ import
org.apache.openmeetings.db.entity.user.PrivateMessageFolder;
import org.apache.openmeetings.db.entity.user.User;
import org.apache.openmeetings.db.entity.user.UserContact;
import org.apache.openmeetings.db.util.AuthLevelUtil;
+import org.apache.openmeetings.db.util.XmlHelper;
import org.apache.openmeetings.util.CalendarPatterns;
import org.apache.openmeetings.util.OmFileHelper;
import org.apache.openmeetings.util.StoredFile;
@@ -749,21 +753,18 @@ public class BackupImport {
}
/*
- * ##################### Import Appointements
+ * ##################### Import Appointments
*/
- private void importAppointments(File base) throws Exception {
+ void importAppointments(File base) throws Exception {
log.info("Calendar import complete, starting appointement
import");
- Registry registry = new Registry();
- Strategy strategy = new RegistryStrategy(registry);
- Serializer serializer = new Persister(strategy);
-
- registry.bind(User.class, new UserConverter(userDao, userMap));
- registry.bind(Appointment.Reminder.class,
AppointmentReminderTypeConverter.class);
- registry.bind(Room.class, new RoomConverter(roomDao, roomMap));
- registry.bind(Date.class, DateConverter.class);
- registry.bind(OmCalendar.class, new
OmCalendarConverter(calendarDao, calendarMap));
+ Class<Appointment> eClazz = Appointment.class;
+ JAXBContext jc = JAXBContext.newInstance(eClazz);
+ Unmarshaller unmarshaller = jc.createUnmarshaller();
+ unmarshaller.setAdapter(new UserAdapter(userDao, userMap));
+ unmarshaller.setAdapter(new RoomAdapter(roomDao, roomMap));
+ unmarshaller.setAdapter(new OmCalendarAdapter(calendarDao,
calendarMap));
- readList(null, base, "appointements.xml", "appointments",
"appointment", Appointment.class, a -> {
+ readList(unmarshaller, base, "appointements.xml",
APPOINTMENT_LIST_NODE, APPOINTMENT_NODE, eClazz, a -> {
Long appId = a.getId();
// We need to reset this as openJPA reject to store
them otherwise
@@ -789,15 +790,15 @@ public class BackupImport {
*
* Reminder Invitations will be NOT send!
*/
- private void importMeetingMembers(File base) throws Exception {
+ void importMeetingMembers(File base) throws Exception {
log.info("Appointement import complete, starting meeting
members import");
- Registry registry = new Registry();
- Strategy strategy = new RegistryStrategy(registry);
- Serializer ser = new Persister(strategy);
+ Class<MeetingMember> eClazz = MeetingMember.class;
+ JAXBContext jc = JAXBContext.newInstance(eClazz);
+ Unmarshaller unmarshaller = jc.createUnmarshaller();
+ unmarshaller.setAdapter(new UserAdapter(userDao, userMap));
+ unmarshaller.setAdapter(new AppointmentAdapter(appointmentDao,
appointmentMap));
- registry.bind(User.class, new UserConverter(userDao, userMap));
- registry.bind(Appointment.class, new
AppointmentConverter(appointmentDao, appointmentMap));
- readList(null, base, "meetingmembers.xml", "meetingmembers",
"meetingmember", MeetingMember.class, ma -> {
+ readList(unmarshaller, base, "meetingmembers.xml",
MMEMBER_LIST_NODE, MMEMBER_NODE, eClazz, ma -> {
ma.setId(null);
meetingMemberDao.update(ma);
});
@@ -1113,7 +1114,7 @@ public class BackupImport {
JAXBContext jc = JAXBContext.newInstance(clazz);
unmarshaller = jc.createUnmarshaller();
}
- XMLInputFactory xif = XMLInputFactory.newFactory();
+ XMLInputFactory xif = XmlHelper.createFactory();
StreamSource xmlSource = new StreamSource(xml);
XMLStreamReader xsr =
xif.createXMLStreamReader(xmlSource);
boolean listNodeFound = false;
diff --git
a/openmeetings-install/src/main/java/org/apache/openmeetings/cli/ConnectionPropertiesPatcher.java
b/openmeetings-install/src/main/java/org/apache/openmeetings/cli/ConnectionPropertiesPatcher.java
index 8568bbc..ad5b05e 100644
---
a/openmeetings-install/src/main/java/org/apache/openmeetings/cli/ConnectionPropertiesPatcher.java
+++
b/openmeetings-install/src/main/java/org/apache/openmeetings/cli/ConnectionPropertiesPatcher.java
@@ -21,8 +21,6 @@ package org.apache.openmeetings.cli;
import java.io.File;
import javax.xml.XMLConstants;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
@@ -33,6 +31,7 @@ import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathFactory;
import org.apache.commons.lang3.StringUtils;
+import org.apache.openmeetings.db.util.XmlHelper;
import org.apache.openmeetings.util.ConnectionProperties;
import org.apache.openmeetings.util.ConnectionProperties.DbType;
import org.apache.openmeetings.util.OmFileHelper;
@@ -86,15 +85,7 @@ public abstract class ConnectionPropertiesPatcher {
}
private static Document getDocument(File xml) throws Exception {
- DocumentBuilderFactory dbFactory =
DocumentBuilderFactory.newInstance();
-
dbFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl",
true);
-
dbFactory.setFeature("http://xml.org/sax/features/external-general-entities",
false);
-
dbFactory.setFeature("http://xml.org/sax/features/external-parameter-entities",
false);
-
dbFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",
false);
- dbFactory.setXIncludeAware(false);
- dbFactory.setExpandEntityReferences(false);
- DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
- return dBuilder.parse(xml);
+ return XmlHelper.createBuilder().parse(xml);
}
private static Attr getConnectionProperties(Document doc) throws
Exception {
diff --git
a/openmeetings-service/src/main/java/org/apache/openmeetings/service/calendar/caldav/IcalUtils.java
b/openmeetings-service/src/main/java/org/apache/openmeetings/service/calendar/caldav/IcalUtils.java
index 14b3b84..b881a43 100644
---
a/openmeetings-service/src/main/java/org/apache/openmeetings/service/calendar/caldav/IcalUtils.java
+++
b/openmeetings-service/src/main/java/org/apache/openmeetings/service/calendar/caldav/IcalUtils.java
@@ -103,7 +103,7 @@ public class IcalUtils {
a.setCalendar(omCalendar);
a.setOwner(omCalendar.getOwner());
a.setRoom(createDefaultRoom());
- a.setReminder(Appointment.Reminder.none);
+ a.setReminder(Appointment.Reminder.NONE);
return this.parseCalendartoAppointment(a, calendar, etag);
}
@@ -125,7 +125,7 @@ public class IcalUtils {
a.setOwner(owner);
a.setDeleted(false);
a.setRoom(createDefaultRoom());
- a.setReminder(Appointment.Reminder.none);
+ a.setReminder(Appointment.Reminder.NONE);
a = addVEventPropertiestoAppointment(a, event);
appointments.add(a);
}
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 25eecaf..238a064 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
@@ -18,9 +18,6 @@
*/
package org.apache.openmeetings.service.quartz.scheduler;
-import static javax.xml.stream.XMLInputFactory.IS_NAMESPACE_AWARE;
-import static javax.xml.stream.XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES;
-import static javax.xml.stream.XMLInputFactory.IS_VALIDATING;
import static
org.apache.openmeetings.core.rss.LoadAtomRssFeed.getFeedConnection;
import java.io.IOException;
@@ -40,6 +37,7 @@ import javax.xml.stream.events.EndElement;
import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
+import org.apache.openmeetings.db.util.XmlHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,13 +50,8 @@ 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;
+ private static final XMLInputFactory inputFactory =
XmlHelper.createFactory();
static {
- inputFactory = XMLInputFactory.newInstance();
- inputFactory.setProperty(IS_REPLACING_ENTITY_REFERENCES, false);
- inputFactory.setProperty(IS_VALIDATING, false);
- inputFactory.setProperty(IS_NAMESPACE_AWARE, false);
-
add("item")
.add(new Field("title"))
.add(new Field("link"))
diff --git
a/openmeetings-service/src/main/java/org/apache/openmeetings/service/room/InvitationManager.java
b/openmeetings-service/src/main/java/org/apache/openmeetings/service/room/InvitationManager.java
index 6539334..93a224f 100644
---
a/openmeetings-service/src/main/java/org/apache/openmeetings/service/room/InvitationManager.java
+++
b/openmeetings-service/src/main/java/org/apache/openmeetings/service/room/InvitationManager.java
@@ -162,7 +162,7 @@ public class InvitationManager implements
IInvitationManager {
log.error("Appointment doesn't have reminder set!");
return;
}
- if (Reminder.none == reminder) {
+ if (Reminder.NONE == reminder) {
log.error("MeetingMember should not have invitation!");
return;
}
@@ -174,7 +174,7 @@ public class InvitationManager implements
IInvitationManager {
, mm.getUser(), a.getRoom(),
a.isPasswordProtected(), a.getPassword()
, Valid.Period, a.getOwner(), null,
a.getStart(), a.getEnd(), a));
if (sendMail) {
- sendInvitionLink(a, mm, type, Reminder.ical ==
reminder);
+ sendInvitionLink(a, mm, type, Reminder.ICAL ==
reminder);
}
} catch (Exception e) {
log.error("Unexpected error while setting invitation",
e);
diff --git
a/openmeetings-util/src/main/java/org/apache/openmeetings/util/XmlExport.java
b/openmeetings-util/src/main/java/org/apache/openmeetings/util/XmlExport.java
index b6a31c8..19532ab 100644
---
a/openmeetings-util/src/main/java/org/apache/openmeetings/util/XmlExport.java
+++
b/openmeetings-util/src/main/java/org/apache/openmeetings/util/XmlExport.java
@@ -39,7 +39,7 @@ import org.dom4j.io.XMLWriter;
*
*/
public class XmlExport {
- public static final String FILE_COMMENT = ""
+ public static final String LICENSE = ""
+ "\n"
+ " Licensed to the Apache Software Foundation (ASF)
under one\n"
+ " or more contributor license agreements. See the
NOTICE file\n"
@@ -57,7 +57,9 @@ public class XmlExport {
+ " KIND, either express or implied. See the License
for the\n"
+ " specific language governing permissions and
limitations\n"
+ " under the License.\n"
- + "\n"
+ + "\n";
+ public static final String FILE_COMMENT = ""
+ + LICENSE
+ "\n"
+ "###############################################\n"
+ "This File is auto-generated by the LanguageEditor\n"
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 b7445ac..fc66212 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
@@ -320,7 +320,7 @@ public class AppointmentDialog extends Modal<Appointment> {
Appointment a = getModelObject();
if (a.getReminder() == null) {
- a.setReminder(Reminder.none);
+ a.setReminder(Reminder.NONE);
}
if (a.getRoom() == null) {
a.setRoom(createAppRoom());
diff --git
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/calendar/CalendarPanel.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/calendar/CalendarPanel.java
index 3137711..559cbe9 100644
---
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/calendar/CalendarPanel.java
+++
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/calendar/CalendarPanel.java
@@ -400,7 +400,7 @@ public class CalendarPanel extends UserBasePanel {
private Appointment getDefault() {
Appointment a = new Appointment();
- a.setReminder(Reminder.ical);
+ a.setReminder(Reminder.ICAL);
a.setOwner(userDao.get(getUserId()));
a.setTitle(getString("1444"));
log.debug(" -- getDefault -- Current model {}", a);
diff --git
a/openmeetings-web/src/test/java/org/apache/openmeetings/AbstractJUnitDefaults.java
b/openmeetings-web/src/test/java/org/apache/openmeetings/AbstractJUnitDefaults.java
index 31248ad..9d1599d 100644
---
a/openmeetings-web/src/test/java/org/apache/openmeetings/AbstractJUnitDefaults.java
+++
b/openmeetings-web/src/test/java/org/apache/openmeetings/AbstractJUnitDefaults.java
@@ -130,7 +130,7 @@ public abstract class AbstractJUnitDefaults extends
AbstractSpringTest {
ap.setConnectedEvent(false);
if (ap.getReminder() == null) {
- ap.setReminder(Appointment.Reminder.none);
+ ap.setReminder(Appointment.Reminder.NONE);
}
if (r == null) {
diff --git
a/openmeetings-web/src/test/java/org/apache/openmeetings/backup/TestImport.java
b/openmeetings-web/src/test/java/org/apache/openmeetings/backup/TestImport.java
index 561a81a..e202355 100644
---
a/openmeetings-web/src/test/java/org/apache/openmeetings/backup/TestImport.java
+++
b/openmeetings-web/src/test/java/org/apache/openmeetings/backup/TestImport.java
@@ -24,7 +24,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.File;
import org.apache.openmeetings.db.dao.basic.ChatDao;
-import org.apache.openmeetings.db.dao.calendar.OmCalendarDao;
import org.apache.openmeetings.db.dao.server.LdapConfigDao;
import org.apache.openmeetings.db.dao.server.OAuth2Dao;
import org.apache.openmeetings.db.entity.basic.Configuration;
@@ -39,8 +38,6 @@ public class TestImport extends AbstractTestImport {
private OAuth2Dao oauthDao;
@Autowired
private ChatDao chatDao;
- @Autowired
- private OmCalendarDao calendarDao;
@Test
public void importVersionNE() throws Exception {
@@ -103,12 +100,4 @@ public class TestImport extends AbstractTestImport {
backupImport.importChat(chats.getParentFile());
assertEquals(chatCount + 3, chatDao.get(0,
Integer.MAX_VALUE).size(), "Chat messages should be added");
}
-
- @Test
- public void importCalendars() throws Exception {
- long calCount = calendarDao.get().size();
- File cals = new
File(getClass().getClassLoader().getResource("org/apache/openmeetings/backup/calendar/calendars.xml").toURI());
- backupImport.importCalendars(cals.getParentFile());
- assertEquals(calCount + 1, calendarDao.get().size(), "Calendars
should be added");
- }
}
diff --git
a/openmeetings-web/src/test/java/org/apache/openmeetings/backup/TestImportCalendar.java
b/openmeetings-web/src/test/java/org/apache/openmeetings/backup/TestImportCalendar.java
new file mode 100644
index 0000000..934d433
--- /dev/null
+++
b/openmeetings-web/src/test/java/org/apache/openmeetings/backup/TestImportCalendar.java
@@ -0,0 +1,63 @@
+/*
+ * 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;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.io.File;
+
+import org.apache.openmeetings.db.dao.calendar.MeetingMemberDao;
+import org.apache.openmeetings.db.dao.calendar.OmCalendarDao;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class TestImportCalendar extends AbstractTestImport {
+ @Autowired
+ private OmCalendarDao calendarDao;
+ @Autowired
+ private MeetingMemberDao meetingMemberDao;
+
+ @Test
+ public void importCalendars() throws Exception {
+ long calCount = calendarDao.get().size();
+ File cals = new
File(getClass().getClassLoader().getResource("org/apache/openmeetings/backup/calendar/calendars.xml").toURI());
+ backupImport.importCalendars(cals.getParentFile());
+ assertEquals(calCount + 1, calendarDao.get().size(), "Calendars
should be added");
+ }
+
+ @Test
+ public void importAppointmentsSkip() throws Exception {
+ long appCount = appointmentDao.get().size();
+ File apps = new
File(getClass().getClassLoader().getResource("org/apache/openmeetings/backup/calendar/skip/appointements.xml").toURI());
+ backupImport.importAppointments(apps.getParentFile());
+ assertEquals(appCount, appointmentDao.get().size(), "No
Appointments should be added");
+ }
+
+ @Test
+ public void importAppointments() throws Exception {
+ long appCount = appointmentDao.get().size();
+ File apps = new
File(getClass().getClassLoader().getResource("org/apache/openmeetings/backup/calendar/appointements.xml").toURI());
+ backupImport.importAppointments(apps.getParentFile());
+ assertEquals(appCount + 2, appointmentDao.get().size(),
"Appointments should be added");
+
+ long mmCount = meetingMemberDao.get().size();
+ backupImport.importMeetingMembers(apps.getParentFile());
+ assertEquals(mmCount + 1, meetingMemberDao.get().size(),
"Meeting members should be added");
+ }
+}
diff --git
a/openmeetings-web/src/test/java/org/apache/openmeetings/backup/TestImportOld.java
b/openmeetings-web/src/test/java/org/apache/openmeetings/backup/TestImportOld.java
index 47d4cae..e102b87 100644
---
a/openmeetings-web/src/test/java/org/apache/openmeetings/backup/TestImportOld.java
+++
b/openmeetings-web/src/test/java/org/apache/openmeetings/backup/TestImportOld.java
@@ -27,7 +27,6 @@ import java.io.InputStream;
import org.apache.openmeetings.db.dao.calendar.MeetingMemberDao;
import org.apache.openmeetings.db.dao.room.RoomDao;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,7 +41,6 @@ public class TestImportOld extends AbstractTestImport {
private MeetingMemberDao meetingMemberDao;
@Test
- @Disabled
public void importOldVersions() {
String backupsDir = System.getProperty("backups.dir", ".");
File backupsHome = new File(backupsDir);
@@ -66,7 +64,7 @@ public class TestImportOld extends AbstractTestImport {
long newRoomCount = roomDao.count();
long newRoomGroupCount =
roomDao.getGroups().size();
long newApptCount = appointmentDao.get().size();
- long newMeetingMembersCount =
meetingMemberDao.getMeetingMembers().size();
+ long newMeetingMembersCount =
meetingMemberDao.get().size();
assertTrue(newGroupCount > groupCount, "Zero
groups were imported from " + name);
assertTrue(newUserCount > userCount, "Zero
users were imported from " + name);
assertTrue(newRoomCount > roomCount, "Zero
rooms were imported from " + name);
diff --git
a/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestAppointmentAddAppointment.java
b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestAppointmentAddAppointment.java
index 53f41ec..c86609a 100644
---
a/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestAppointmentAddAppointment.java
+++
b/openmeetings-web/src/test/java/org/apache/openmeetings/calendar/TestAppointmentAddAppointment.java
@@ -96,7 +96,7 @@ public class TestAppointmentAddAppointment extends
AbstractWicketTester {
Boolean isMonthly = false;
Boolean isDaily = false;
Boolean isWeekly = false;
- String remind = Appointment.Reminder.ical.name();
+ String remind = Appointment.Reminder.ICAL.name();
Boolean isYearly = false;
String[] mmClient = new String[1];
for (int i = 0; i < 1; i++) {
@@ -150,7 +150,7 @@ public class TestAppointmentAddAppointment extends
AbstractWicketTester {
Appointment a = new Appointment();
a.setTitle("Test title");
setTime(a);
- a.setReminder(Reminder.ical);
+ a.setReminder(Reminder.ICAL);
a.setMeetingMembers(new ArrayList<>());
User owner = userDao.get(1L);
a.setOwner(owner);
diff --git
a/openmeetings-web/src/test/resources/org/apache/openmeetings/backup/calendar/appointements.xml
b/openmeetings-web/src/test/resources/org/apache/openmeetings/backup/calendar/appointements.xml
new file mode 100644
index 0000000..770dd65
--- /dev/null
+++
b/openmeetings-web/src/test/resources/org/apache/openmeetings/backup/calendar/appointements.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+
+-->
+<!-- ###############################################
+This File is auto-generated by the Backup Tool
+you should use the BackupPanel to modify or change this file
+see http://openmeetings.apache.org/Upgrade.html for Details
+###############################################
+ --><root>
+ <appointments>
+ <appointment>
+ <appointmentId><![CDATA[1]]></appointmentId>
+ <appointmentName><![CDATA[Test]]></appointmentName>
+
<appointmentLocation><![CDATA[aaaaaaaaaaaaaaaaaaaaaaa]]></appointmentLocation>
+ <appointmentStarttime
class="java.util.Date"><![CDATA[1502681580000]]></appointmentStarttime>
+ <appointmentEndtime
class="java.util.Date"><![CDATA[1502685180000]]></appointmentEndtime>
+ <users_id><![CDATA[1]]></users_id>
+ <inserted class="java.util.Date"><![CDATA[1502681643711]]></inserted>
+ <updated class="java.util.Date"><![CDATA[1502681724847]]></updated>
+ <deleted><![CDATA[false]]></deleted>
+ <typId><![CDATA[3]]></typId>
+ <room_id><![CDATA[1]]></room_id>
+ <icalId><![CDATA[6fa6bdd3-b731-44be-a60b-fd09155fe27e]]></icalId>
+ <isPasswordProtected><![CDATA[true]]></isPasswordProtected>
+ <password><![CDATA[111111111111111]]></password>
+ </appointment>
+ <appointment>
+ <appointmentId><![CDATA[2]]></appointmentId>
+ <appointmentName><![CDATA[test]]></appointmentName>
+ <appointmentStarttime
class="java.util.Date"><![CDATA[1502681640000]]></appointmentStarttime>
+ <appointmentEndtime
class="java.util.Date"><![CDATA[1502685240000]]></appointmentEndtime>
+ <appointmentDescription><![CDATA[test
message<br>]]></appointmentDescription>
+ <users_id><![CDATA[1]]></users_id>
+ <inserted class="java.util.Date"><![CDATA[1502681683111]]></inserted>
+ <deleted><![CDATA[false]]></deleted>
+ <typId><![CDATA[1]]></typId>
+ <room_id><![CDATA[2]]></room_id>
+ <isPasswordProtected><![CDATA[false]]></isPasswordProtected>
+ </appointment>
+ </appointments>
+</root>
diff --git
a/openmeetings-web/src/test/resources/org/apache/openmeetings/backup/calendar/meetingmembers.xml
b/openmeetings-web/src/test/resources/org/apache/openmeetings/backup/calendar/meetingmembers.xml
new file mode 100644
index 0000000..e5efb96
--- /dev/null
+++
b/openmeetings-web/src/test/resources/org/apache/openmeetings/backup/calendar/meetingmembers.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+
+-->
+<!-- ###############################################
+This File is auto-generated by the Backup Tool
+you should use the BackupPanel to modify or change this file
+see http://openmeetings.apache.org/Upgrade.html for Details
+###############################################
+ --><root>
+ <meetingmembers>
+ <meetingmember>
+ <deleted><![CDATA[false]]></deleted>
+ <meetingMemberId><![CDATA[1]]></meetingMemberId>
+ <userid><![CDATA[1]]></userid>
+ <appointment><![CDATA[1]]></appointment>
+ </meetingmember>
+ </meetingmembers>
+</root>
diff --git
a/openmeetings-web/src/test/resources/org/apache/openmeetings/backup/calendar/skip/appointements.xml
b/openmeetings-web/src/test/resources/org/apache/openmeetings/backup/calendar/skip/appointements.xml
new file mode 100644
index 0000000..987df4a
--- /dev/null
+++
b/openmeetings-web/src/test/resources/org/apache/openmeetings/backup/calendar/skip/appointements.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+
+-->
+<!-- ###############################################
+This File is auto-generated by the Backup Tool
+you should use the BackupPanel to modify or change this file
+see http://openmeetings.apache.org/Upgrade.html for Details
+###############################################
+ --><root>
+ <appointments>
+ <appointment>
+ <appointmentId><![CDATA[1]]></appointmentId>
+ <appointmentName><![CDATA[Test1]]></appointmentName>
+
<appointmentLocation><![CDATA[aaaaaaaaaaaaaaaaaaaaaaa]]></appointmentLocation>
+ <appointmentStarttime
class="java.util.Date"><![CDATA[1502681580000]]></appointmentStarttime>
+ <appointmentEndtime
class="java.util.Date"><![CDATA[1502685180000]]></appointmentEndtime>
+ <users_id><![CDATA[1]]></users_id>
+ <inserted class="java.util.Date"><![CDATA[1502681643711]]></inserted>
+ <updated class="java.util.Date"><![CDATA[1502681724847]]></updated>
+ <deleted><![CDATA[false]]></deleted>
+ <typId><![CDATA[3]]></typId>
+ <icalId><![CDATA[6fa6bdd3-b731-44be-a60b-fd09155fe27e]]></icalId>
+ <isPasswordProtected><![CDATA[true]]></isPasswordProtected>
+ <password><![CDATA[111111111111111]]></password>
+ </appointment>
+ <appointment>
+ <appointmentId><![CDATA[2]]></appointmentId>
+ <appointmentName><![CDATA[Test2]]></appointmentName>
+
<appointmentLocation><![CDATA[aaaaaaaaaaaaaaaaaaaaaaa]]></appointmentLocation>
+ <appointmentStarttime
class="java.util.Date"><![CDATA[1502681580000]]></appointmentStarttime>
+ <appointmentEndtime
class="java.util.Date"><![CDATA[1502685180000]]></appointmentEndtime>
+ <users_id><![CDATA[1]]></users_id>
+ <inserted class="java.util.Date"><![CDATA[1502681643711]]></inserted>
+ <updated class="java.util.Date"><![CDATA[1502681724847]]></updated>
+ <deleted><![CDATA[false]]></deleted>
+ <typId><![CDATA[3]]></typId>
+ <room_id><![CDATA[-1]]></room_id>
+ <icalId><![CDATA[6fa6bdd3-b731-44be-a60b-fd09155fe27e]]></icalId>
+ <isPasswordProtected><![CDATA[true]]></isPasswordProtected>
+ <password><![CDATA[111111111111111]]></password>
+ </appointment>
+ <appointment>
+ <appointmentId><![CDATA[3]]></appointmentId>
+ <appointmentName><![CDATA[Test3]]></appointmentName>
+
<appointmentLocation><![CDATA[aaaaaaaaaaaaaaaaaaaaaaa]]></appointmentLocation>
+ <appointmentEndtime
class="java.util.Date"><![CDATA[1502685180000]]></appointmentEndtime>
+ <users_id><![CDATA[1]]></users_id>
+ <inserted class="java.util.Date"><![CDATA[1502681643711]]></inserted>
+ <updated class="java.util.Date"><![CDATA[1502681724847]]></updated>
+ <deleted><![CDATA[false]]></deleted>
+ <typId><![CDATA[3]]></typId>
+ <room_id><![CDATA[1]]></room_id>
+ <icalId><![CDATA[6fa6bdd3-b731-44be-a60b-fd09155fe27e]]></icalId>
+ <isPasswordProtected><![CDATA[true]]></isPasswordProtected>
+ <password><![CDATA[111111111111111]]></password>
+ </appointment>
+ <appointment>
+ <appointmentId><![CDATA[4]]></appointmentId>
+ <appointmentName><![CDATA[Test4]]></appointmentName>
+
<appointmentLocation><![CDATA[aaaaaaaaaaaaaaaaaaaaaaa]]></appointmentLocation>
+ <appointmentStarttime
class="java.util.Date"><![CDATA[1502681580000]]></appointmentStarttime>
+ <users_id><![CDATA[1]]></users_id>
+ <inserted class="java.util.Date"><![CDATA[1502681643711]]></inserted>
+ <updated class="java.util.Date"><![CDATA[1502681724847]]></updated>
+ <deleted><![CDATA[false]]></deleted>
+ <typId><![CDATA[3]]></typId>
+ <room_id><![CDATA[1]]></room_id>
+ <icalId><![CDATA[6fa6bdd3-b731-44be-a60b-fd09155fe27e]]></icalId>
+ <isPasswordProtected><![CDATA[true]]></isPasswordProtected>
+ <password><![CDATA[111111111111111]]></password>
+ </appointment>
+ </appointments>
+</root>