Repository: openmeetings Updated Branches: refs/heads/master 0b780b708 -> e5b3f2593
[OPENMEETINGS-1714] more issues are fixed Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/bb7015aa Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/bb7015aa Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/bb7015aa Branch: refs/heads/master Commit: bb7015aac08db705d79a6320867bd06bc4b11cb8 Parents: 0b780b7 Author: Maxim Solodovnik <[email protected]> Authored: Sat Sep 30 19:31:41 2017 +0700 Committer: Maxim Solodovnik <[email protected]> Committed: Sat Sep 30 19:31:41 2017 +0700 ---------------------------------------------------------------------- .../core/converter/BaseConverter.java | 2 +- .../core/converter/InterviewConverter.java | 2 +- .../core/converter/RecordingConverter.java | 4 +- .../db/dao/server/SOAPLoginDao.java | 10 ++-- .../backup/AppointmentConverter.java | 57 ------------------- .../AppointmentReminderTypeConverter.java | 38 ------------- .../openmeetings/backup/BackupExport.java | 10 ++++ .../openmeetings/backup/BackupImport.java | 18 +++++- .../backup/BaseFileItemConverter.java | 59 -------------------- .../openmeetings/backup/DateConverter.java | 41 -------------- .../openmeetings/backup/GroupConverter.java | 57 ------------------- .../openmeetings/backup/IntegerTransform.java | 3 +- .../openmeetings/backup/LongTransform.java | 3 +- .../backup/OmCalendarConverter.java | 57 ------------------- .../apache/openmeetings/backup/OmConverter.java | 56 ------------------- .../openmeetings/backup/PollTypeConverter.java | 38 ------------- .../backup/RecordingStatusConverter.java | 52 ----------------- .../openmeetings/backup/RoomConverter.java | 57 ------------------- .../openmeetings/backup/RoomTypeConverter.java | 38 ------------- .../backup/SalutationConverter.java | 38 ------------- .../openmeetings/backup/UserConverter.java | 57 ------------------- .../backup/converter/AppointmentConverter.java | 57 +++++++++++++++++++ .../AppointmentReminderTypeConverter.java | 38 +++++++++++++ .../backup/converter/BaseFileItemConverter.java | 59 ++++++++++++++++++++ .../backup/converter/DateConverter.java | 41 ++++++++++++++ .../backup/converter/GroupConverter.java | 57 +++++++++++++++++++ .../backup/converter/OmCalendarConverter.java | 57 +++++++++++++++++++ .../backup/converter/OmConverter.java | 56 +++++++++++++++++++ .../backup/converter/PollTypeConverter.java | 38 +++++++++++++ .../converter/RecordingStatusConverter.java | 52 +++++++++++++++++ .../backup/converter/RoomConverter.java | 57 +++++++++++++++++++ .../backup/converter/RoomTypeConverter.java | 38 +++++++++++++ .../backup/converter/SalutationConverter.java | 38 +++++++++++++ .../backup/converter/UserConverter.java | 57 +++++++++++++++++++ .../installation/ImportInitvalues.java | 2 +- .../service/calendar/caldav/iCalUtils.java | 5 +- .../openmeetings/util/CalendarPatterns.java | 2 +- .../openmeetings/util/mail/IcalHandler.java | 3 +- .../openmeetings/web/user/rooms/RoomsPanel.java | 3 +- 39 files changed, 690 insertions(+), 667 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/BaseConverter.java ---------------------------------------------------------------------- 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 0c1b084..7d2c681 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 @@ -344,7 +344,7 @@ public abstract class BaseConverter { log.debug("Trim Audio to Full Length -- Start"); if (!outputFullWav.exists()) { - throw new Exception("Audio File does not exist , could not extract the Audio correctly"); + throw new ConversionException("Audio File does not exist , could not extract the Audio correctly"); } metaData.setFullWavAudioData(hashFileFullName); http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/InterviewConverter.java ---------------------------------------------------------------------- diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/InterviewConverter.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/InterviewConverter.java index cd254ad..99d72a3 100644 --- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/InterviewConverter.java +++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/InterviewConverter.java @@ -147,7 +147,7 @@ public class InterviewConverter extends BaseConverter implements IRecordingConve final File defaultInterviewImageFile = new File(streamFolderGeneral, "default_interview_image.png"); if (!defaultInterviewImageFile.exists()) { - throw new Exception("defaultInterviewImageFile does not exist!"); + throw new ConversionException("defaultInterviewImageFile does not exist!"); } final int flvWidth = 320; http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/RecordingConverter.java ---------------------------------------------------------------------- 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 aae7980..96ff42a 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 @@ -69,11 +69,11 @@ public class RecordingConverter extends BaseConverter implements IRecordingConve RecordingMetaData screenMetaData = metaDataDao.getScreenMetaDataByRecording(r.getId()); if (screenMetaData == null) { - throw new Exception("screenMetaData is Null recordingId " + r.getId()); + throw new ConversionException("screenMetaData is Null recordingId " + r.getId()); } if (screenMetaData.getStreamStatus() == Status.NONE) { - throw new Exception("Stream has not been started, error in recording"); + throw new ConversionException("Stream has not been started, error in recording"); } if (Strings.isEmpty(r.getHash())) { r.setHash(UUID.randomUUID().toString()); http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/server/SOAPLoginDao.java ---------------------------------------------------------------------- diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/server/SOAPLoginDao.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/server/SOAPLoginDao.java index abae7f0..26780f7 100644 --- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/server/SOAPLoginDao.java +++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/server/SOAPLoginDao.java @@ -66,9 +66,8 @@ public class SOAPLoginDao { if (soapLoginId != null) { return soapLogin.getHash(); } else { - throw new Exception("Could not store SOAPLogin"); + log.error("[addSOAPLogin]: Could not store SOAPLogin"); } - } catch (Exception ex2) { log.error("[addSOAPLogin]: ", ex2); } @@ -82,14 +81,13 @@ public class SOAPLoginDao { .setParameter("hash", String.format("%%%s%%", hash)) .getResultList(); - if (sList.size() > 1) { - throw new Exception("there are more then one SOAPLogin with identical hash! " + hash); - } - if (sList.size() == 1) { return sList.get(0); } + if (sList.size() > 1) { + log.error("[get]: there are more then one SOAPLogin with identical hash! {}", hash); + } } catch (Exception ex2) { log.error("[get]: ", ex2); } http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/AppointmentConverter.java ---------------------------------------------------------------------- diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/AppointmentConverter.java b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/AppointmentConverter.java deleted file mode 100644 index 6f1e0ac..0000000 --- a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/AppointmentConverter.java +++ /dev/null @@ -1,57 +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; - -import static org.apache.openmeetings.backup.OmConverter.getLong; - -import java.util.Map; - -import org.apache.openmeetings.db.dao.calendar.AppointmentDao; -import org.apache.openmeetings.db.entity.calendar.Appointment; -import org.simpleframework.xml.stream.InputNode; -import org.simpleframework.xml.stream.OutputNode; - -public class AppointmentConverter implements OmConverter<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 = getLong(node); - 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()); - } -} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/AppointmentReminderTypeConverter.java ---------------------------------------------------------------------- diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/AppointmentReminderTypeConverter.java b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/AppointmentReminderTypeConverter.java deleted file mode 100644 index 936b4e9..0000000 --- a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/AppointmentReminderTypeConverter.java +++ /dev/null @@ -1,38 +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; - -import static org.apache.openmeetings.backup.OmConverter.getInt; - -import org.apache.openmeetings.db.entity.calendar.Appointment.Reminder; -import org.simpleframework.xml.stream.InputNode; -import org.simpleframework.xml.stream.OutputNode; - -public class AppointmentReminderTypeConverter implements OmConverter<Reminder> { - @Override - public Reminder read(InputNode node) throws Exception { - return Reminder.get(getInt(node)); - } - - @Override - public void write(OutputNode node, Reminder value) throws Exception { - node.setData(true); - node.setValue(value == null ? "0" : String.valueOf(value.getId())); - } -} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java ---------------------------------------------------------------------- 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 aa50b83..b7a083b 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 @@ -41,6 +41,16 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; 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; http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java ---------------------------------------------------------------------- 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 397b44a..d038603 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 @@ -124,6 +124,18 @@ import javax.xml.transform.stream.StreamResult; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; +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.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.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; @@ -908,7 +920,7 @@ public class BackupImport { log.debug(msg); return list; } else { - throw new Exception(msg); + throw new BackupException(msg); } } try (InputStream rootIs = new FileInputStream(xml)) { @@ -1074,7 +1086,7 @@ public class BackupImport { public List<User> readUserList(File baseDir, String fileName, String listNodeName) throws Exception { File xml = new File(baseDir, fileName); if (!xml.exists()) { - throw new Exception(fileName + " missing"); + throw new BackupException(fileName + " missing"); } return readUserList(new InputSource(xml.toURI().toASCIIString()), listNodeName); @@ -1091,7 +1103,7 @@ public class BackupImport { File xml = new File(baseDir, filename); if (!xml.exists()) { - throw new Exception(filename + " missing"); + throw new BackupException(filename + " missing"); } DocumentBuilder dBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BaseFileItemConverter.java ---------------------------------------------------------------------- diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BaseFileItemConverter.java b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BaseFileItemConverter.java deleted file mode 100644 index d7b5415..0000000 --- a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BaseFileItemConverter.java +++ /dev/null @@ -1,59 +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; - -import static org.apache.openmeetings.backup.OmConverter.getLong; - -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.stream.InputNode; -import org.simpleframework.xml.stream.OutputNode; - -public class BaseFileItemConverter implements OmConverter<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 = getLong(node); - 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()); - } -} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/DateConverter.java ---------------------------------------------------------------------- diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/DateConverter.java b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/DateConverter.java deleted file mode 100644 index 7066ce9..0000000 --- a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/DateConverter.java +++ /dev/null @@ -1,41 +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; - -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("class", "java.util.Date"); - node.setData(true); - node.setValue(value == null ? "0" : CalendarPatterns.getExportDate(value)); - } -} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/GroupConverter.java ---------------------------------------------------------------------- diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/GroupConverter.java b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/GroupConverter.java deleted file mode 100644 index 58cfe9e..0000000 --- a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/GroupConverter.java +++ /dev/null @@ -1,57 +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; - -import static org.apache.openmeetings.backup.OmConverter.getLong; - -import java.util.Map; - -import org.apache.openmeetings.db.dao.user.GroupDao; -import org.apache.openmeetings.db.entity.user.Group; -import org.simpleframework.xml.stream.InputNode; -import org.simpleframework.xml.stream.OutputNode; - -public class GroupConverter implements OmConverter<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 = getLong(node); - 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()); - } -} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/IntegerTransform.java ---------------------------------------------------------------------- diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/IntegerTransform.java b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/IntegerTransform.java index cf1cd80..51607c0 100644 --- a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/IntegerTransform.java +++ b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/IntegerTransform.java @@ -18,6 +18,7 @@ */ package org.apache.openmeetings.backup; +import org.apache.openmeetings.backup.converter.OmConverter; import org.simpleframework.xml.transform.Transform; public class IntegerTransform implements Transform<Integer> { @@ -28,6 +29,6 @@ public class IntegerTransform implements Transform<Integer> { @Override public String write(Integer value) throws Exception { - return "" + value; + return String.valueOf(value); } } http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/LongTransform.java ---------------------------------------------------------------------- diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/LongTransform.java b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/LongTransform.java index e171383..38bb369 100644 --- a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/LongTransform.java +++ b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/LongTransform.java @@ -18,6 +18,7 @@ */ package org.apache.openmeetings.backup; +import org.apache.openmeetings.backup.converter.OmConverter; import org.simpleframework.xml.transform.Transform; public class LongTransform implements Transform<Long> { @@ -28,6 +29,6 @@ public class LongTransform implements Transform<Long> { @Override public String write(Long value) throws Exception { - return "" + value; + return String.valueOf(value); } } http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/OmCalendarConverter.java ---------------------------------------------------------------------- diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/OmCalendarConverter.java b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/OmCalendarConverter.java deleted file mode 100644 index 1fdbf6f..0000000 --- a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/OmCalendarConverter.java +++ /dev/null @@ -1,57 +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; - -import static org.apache.openmeetings.backup.OmConverter.getLong; - -import java.util.Map; - -import org.apache.openmeetings.db.dao.calendar.OmCalendarDao; -import org.apache.openmeetings.db.entity.calendar.OmCalendar; -import org.simpleframework.xml.stream.InputNode; -import org.simpleframework.xml.stream.OutputNode; - -public class OmCalendarConverter implements OmConverter<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 = getLong(node); - 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())); - } -} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/OmConverter.java ---------------------------------------------------------------------- diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/OmConverter.java b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/OmConverter.java deleted file mode 100644 index 7b36f74..0000000 --- a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/OmConverter.java +++ /dev/null @@ -1,56 +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; - -import org.simpleframework.xml.convert.Converter; -import org.simpleframework.xml.stream.InputNode; - -public interface OmConverter<T> extends Converter<T> { - static long getLong(InputNode node) throws Exception { - return getLong(node.getValue()); - } - - static long getLong(String value) { - return getLong(value, 0); - } - - static long getLong(String value, long def) { - long result = def; - try { - result = Long.parseLong(value); - } catch (Exception e) { - //no op - } - return result; - } - - static int getInt(InputNode node) throws Exception { - return getInt(node.getValue(), 0); - } - - static int getInt(String value, int def) { - int result = def; - try { - result = Integer.parseInt(value); - } catch (Exception e) { - //no op - } - return result; - } -} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/PollTypeConverter.java ---------------------------------------------------------------------- diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/PollTypeConverter.java b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/PollTypeConverter.java deleted file mode 100644 index 93a7230..0000000 --- a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/PollTypeConverter.java +++ /dev/null @@ -1,38 +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; - -import static org.apache.openmeetings.backup.OmConverter.getLong; - -import org.apache.openmeetings.db.entity.room.RoomPoll; -import org.simpleframework.xml.stream.InputNode; -import org.simpleframework.xml.stream.OutputNode; - -public class PollTypeConverter implements OmConverter<RoomPoll.Type> { - @Override - public RoomPoll.Type read(InputNode node) throws Exception { - return RoomPoll.Type.get(getLong(node)); - } - - @Override - public void write(OutputNode node, RoomPoll.Type value) throws Exception { - node.setData(true); - node.setValue(value == null ? "0" : String.valueOf(value.getId())); - } -} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/RecordingStatusConverter.java ---------------------------------------------------------------------- diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/RecordingStatusConverter.java b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/RecordingStatusConverter.java deleted file mode 100644 index eee761a..0000000 --- a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/RecordingStatusConverter.java +++ /dev/null @@ -1,52 +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; - -import static org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey; - -import org.apache.openmeetings.db.entity.record.Recording; -import org.apache.openmeetings.db.entity.record.Recording.Status; -import org.red5.logging.Red5LoggerFactory; -import org.simpleframework.xml.stream.InputNode; -import org.simpleframework.xml.stream.OutputNode; -import org.slf4j.Logger; - -public class RecordingStatusConverter implements OmConverter<Recording.Status> { - private static final Logger log = Red5LoggerFactory.getLogger(RecordingStatusConverter.class, getWebAppRootKey()); - 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()); - } -} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/RoomConverter.java ---------------------------------------------------------------------- diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/RoomConverter.java b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/RoomConverter.java deleted file mode 100644 index 5b10a32..0000000 --- a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/RoomConverter.java +++ /dev/null @@ -1,57 +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; - -import static org.apache.openmeetings.backup.OmConverter.getLong; - -import java.util.Map; - -import org.apache.openmeetings.db.dao.room.RoomDao; -import org.apache.openmeetings.db.entity.room.Room; -import org.simpleframework.xml.stream.InputNode; -import org.simpleframework.xml.stream.OutputNode; - -public class RoomConverter implements OmConverter<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 = getLong(node); - 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()); - } -} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/RoomTypeConverter.java ---------------------------------------------------------------------- diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/RoomTypeConverter.java b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/RoomTypeConverter.java deleted file mode 100644 index 6162abe..0000000 --- a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/RoomTypeConverter.java +++ /dev/null @@ -1,38 +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; - -import static org.apache.openmeetings.backup.OmConverter.getInt; - -import org.apache.openmeetings.db.entity.room.Room.Type; -import org.simpleframework.xml.stream.InputNode; -import org.simpleframework.xml.stream.OutputNode; - -public class RoomTypeConverter implements OmConverter<Type> { - @Override - public Type read(InputNode node) throws Exception { - return Type.get(getInt(node)); - } - - @Override - public void write(OutputNode node, Type value) throws Exception { - node.setData(true); - node.setValue(value == null ? "0" : String.valueOf(value.getId())); - } -} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/SalutationConverter.java ---------------------------------------------------------------------- diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/SalutationConverter.java b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/SalutationConverter.java deleted file mode 100644 index aeeb087..0000000 --- a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/SalutationConverter.java +++ /dev/null @@ -1,38 +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; - -import static org.apache.openmeetings.backup.OmConverter.getInt; - -import org.apache.openmeetings.db.entity.user.User.Salutation; -import org.simpleframework.xml.stream.InputNode; -import org.simpleframework.xml.stream.OutputNode; - -public class SalutationConverter implements OmConverter<Salutation> { - @Override - public Salutation read(InputNode node) throws Exception { - return Salutation.get(getInt(node)); - } - - @Override - public void write(OutputNode node, Salutation value) throws Exception { - node.setData(true); - node.setValue(value == null ? "0" : String.valueOf(value.getId())); - } -} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/UserConverter.java ---------------------------------------------------------------------- diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/UserConverter.java b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/UserConverter.java deleted file mode 100644 index a2cf50d..0000000 --- a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/UserConverter.java +++ /dev/null @@ -1,57 +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; - -import static org.apache.openmeetings.backup.OmConverter.getLong; - -import java.util.Map; - -import org.apache.openmeetings.db.dao.user.UserDao; -import org.apache.openmeetings.db.entity.user.User; -import org.simpleframework.xml.stream.InputNode; -import org.simpleframework.xml.stream.OutputNode; - -public class UserConverter implements OmConverter<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 = getLong(node); - 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()); - } -} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/AppointmentConverter.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..9d9cdf4 --- /dev/null +++ b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/AppointmentConverter.java @@ -0,0 +1,57 @@ +/* + * 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.backup.converter.OmConverter.getLong; + +import java.util.Map; + +import org.apache.openmeetings.db.dao.calendar.AppointmentDao; +import org.apache.openmeetings.db.entity.calendar.Appointment; +import org.simpleframework.xml.stream.InputNode; +import org.simpleframework.xml.stream.OutputNode; + +public class AppointmentConverter implements OmConverter<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 = getLong(node); + 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()); + } +} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/AppointmentReminderTypeConverter.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..7c461ba --- /dev/null +++ b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/AppointmentReminderTypeConverter.java @@ -0,0 +1,38 @@ +/* + * 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.backup.converter.OmConverter.getInt; + +import org.apache.openmeetings.db.entity.calendar.Appointment.Reminder; +import org.simpleframework.xml.stream.InputNode; +import org.simpleframework.xml.stream.OutputNode; + +public class AppointmentReminderTypeConverter implements OmConverter<Reminder> { + @Override + public Reminder read(InputNode node) throws Exception { + return Reminder.get(getInt(node)); + } + + @Override + public void write(OutputNode node, Reminder value) throws Exception { + node.setData(true); + node.setValue(value == null ? "0" : String.valueOf(value.getId())); + } +} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/BaseFileItemConverter.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..d191a9b --- /dev/null +++ b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/BaseFileItemConverter.java @@ -0,0 +1,59 @@ +/* + * 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.backup.converter.OmConverter.getLong; + +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.stream.InputNode; +import org.simpleframework.xml.stream.OutputNode; + +public class BaseFileItemConverter implements OmConverter<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 = getLong(node); + 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()); + } +} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/DateConverter.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..b24e0ce --- /dev/null +++ b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/DateConverter.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.backup.converter; + +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("class", "java.util.Date"); + node.setData(true); + node.setValue(value == null ? "0" : CalendarPatterns.getExportDate(value)); + } +} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/GroupConverter.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..8bad649 --- /dev/null +++ b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/GroupConverter.java @@ -0,0 +1,57 @@ +/* + * 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.backup.converter.OmConverter.getLong; + +import java.util.Map; + +import org.apache.openmeetings.db.dao.user.GroupDao; +import org.apache.openmeetings.db.entity.user.Group; +import org.simpleframework.xml.stream.InputNode; +import org.simpleframework.xml.stream.OutputNode; + +public class GroupConverter implements OmConverter<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 = getLong(node); + 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()); + } +} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/OmCalendarConverter.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..6ef026b --- /dev/null +++ b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/OmCalendarConverter.java @@ -0,0 +1,57 @@ +/* + * 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.backup.converter.OmConverter.getLong; + +import java.util.Map; + +import org.apache.openmeetings.db.dao.calendar.OmCalendarDao; +import org.apache.openmeetings.db.entity.calendar.OmCalendar; +import org.simpleframework.xml.stream.InputNode; +import org.simpleframework.xml.stream.OutputNode; + +public class OmCalendarConverter implements OmConverter<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 = getLong(node); + 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())); + } +} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/OmConverter.java ---------------------------------------------------------------------- diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/OmConverter.java b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/OmConverter.java new file mode 100644 index 0000000..8fa168e --- /dev/null +++ b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/OmConverter.java @@ -0,0 +1,56 @@ +/* + * 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.simpleframework.xml.convert.Converter; +import org.simpleframework.xml.stream.InputNode; + +public interface OmConverter<T> extends Converter<T> { + static long getLong(InputNode node) throws Exception { + return getLong(node.getValue()); + } + + static long getLong(String value) { + return getLong(value, 0); + } + + static long getLong(String value, long def) { + long result = def; + try { + result = Long.parseLong(value); + } catch (Exception e) { + //no op + } + return result; + } + + static int getInt(InputNode node) throws Exception { + return getInt(node.getValue(), 0); + } + + static int getInt(String value, int def) { + int result = def; + try { + result = Integer.parseInt(value); + } catch (Exception e) { + //no op + } + return result; + } +} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/PollTypeConverter.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..54b2265 --- /dev/null +++ b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/PollTypeConverter.java @@ -0,0 +1,38 @@ +/* + * 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.backup.converter.OmConverter.getLong; + +import org.apache.openmeetings.db.entity.room.RoomPoll; +import org.simpleframework.xml.stream.InputNode; +import org.simpleframework.xml.stream.OutputNode; + +public class PollTypeConverter implements OmConverter<RoomPoll.Type> { + @Override + public RoomPoll.Type read(InputNode node) throws Exception { + return RoomPoll.Type.get(getLong(node)); + } + + @Override + public void write(OutputNode node, RoomPoll.Type value) throws Exception { + node.setData(true); + node.setValue(value == null ? "0" : String.valueOf(value.getId())); + } +} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/RecordingStatusConverter.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..cd20ac5 --- /dev/null +++ b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/RecordingStatusConverter.java @@ -0,0 +1,52 @@ +/* + * 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.getWebAppRootKey; + +import org.apache.openmeetings.db.entity.record.Recording; +import org.apache.openmeetings.db.entity.record.Recording.Status; +import org.red5.logging.Red5LoggerFactory; +import org.simpleframework.xml.stream.InputNode; +import org.simpleframework.xml.stream.OutputNode; +import org.slf4j.Logger; + +public class RecordingStatusConverter implements OmConverter<Recording.Status> { + private static final Logger log = Red5LoggerFactory.getLogger(RecordingStatusConverter.class, getWebAppRootKey()); + 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()); + } +} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/RoomConverter.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..7b86200 --- /dev/null +++ b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/RoomConverter.java @@ -0,0 +1,57 @@ +/* + * 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.backup.converter.OmConverter.getLong; + +import java.util.Map; + +import org.apache.openmeetings.db.dao.room.RoomDao; +import org.apache.openmeetings.db.entity.room.Room; +import org.simpleframework.xml.stream.InputNode; +import org.simpleframework.xml.stream.OutputNode; + +public class RoomConverter implements OmConverter<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 = getLong(node); + 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()); + } +} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/RoomTypeConverter.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..c451090 --- /dev/null +++ b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/RoomTypeConverter.java @@ -0,0 +1,38 @@ +/* + * 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.backup.converter.OmConverter.getInt; + +import org.apache.openmeetings.db.entity.room.Room.Type; +import org.simpleframework.xml.stream.InputNode; +import org.simpleframework.xml.stream.OutputNode; + +public class RoomTypeConverter implements OmConverter<Type> { + @Override + public Type read(InputNode node) throws Exception { + return Type.get(getInt(node)); + } + + @Override + public void write(OutputNode node, Type value) throws Exception { + node.setData(true); + node.setValue(value == null ? "0" : String.valueOf(value.getId())); + } +} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/SalutationConverter.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..ed4dc51 --- /dev/null +++ b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/SalutationConverter.java @@ -0,0 +1,38 @@ +/* + * 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.backup.converter.OmConverter.getInt; + +import org.apache.openmeetings.db.entity.user.User.Salutation; +import org.simpleframework.xml.stream.InputNode; +import org.simpleframework.xml.stream.OutputNode; + +public class SalutationConverter implements OmConverter<Salutation> { + @Override + public Salutation read(InputNode node) throws Exception { + return Salutation.get(getInt(node)); + } + + @Override + public void write(OutputNode node, Salutation value) throws Exception { + node.setData(true); + node.setValue(value == null ? "0" : String.valueOf(value.getId())); + } +} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/UserConverter.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..f465624 --- /dev/null +++ b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/UserConverter.java @@ -0,0 +1,57 @@ +/* + * 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.backup.converter.OmConverter.getLong; + +import java.util.Map; + +import org.apache.openmeetings.db.dao.user.UserDao; +import org.apache.openmeetings.db.entity.user.User; +import org.simpleframework.xml.stream.InputNode; +import org.simpleframework.xml.stream.OutputNode; + +public class UserConverter implements OmConverter<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 = getLong(node); + 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()); + } +} http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java ---------------------------------------------------------------------- diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java b/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java index a65f64d..22b03b9 100644 --- a/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java +++ b/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java @@ -413,7 +413,7 @@ public class ImportInitvalues { log.debug("Installation - User Added user-Id " + u.getId()); if (u.getId() == null) { - throw new Exception("Unable to add user"); + throw new InstallException("Unable to add user"); } } http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-service/src/main/java/org/apache/openmeetings/service/calendar/caldav/iCalUtils.java ---------------------------------------------------------------------- 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 071bd40..1570b81 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 @@ -26,6 +26,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Locale; +import java.util.NoSuchElementException; import java.util.TimeZone; import java.util.UUID; @@ -379,7 +380,7 @@ public class iCalUtils { net.fortuna.ical4j.model.TimeZone timeZone = registry.getTimeZone(tzid); if (timeZone == null) { - throw new Exception("Unable to get time zone by id provided: " + tzid); + throw new NoSuchElementException("Unable to get time zone by id provided: " + tzid); } Calendar icsCalendar = new Calendar(); @@ -480,7 +481,7 @@ public class iCalUtils { net.fortuna.ical4j.model.TimeZone timeZone = registry.getTimeZone(tzid); if (timeZone == null) { - throw new Exception("Unable to get time zone by id provided: " + tzid); + throw new NoSuchElementException("Unable to get time zone by id provided: " + tzid); } Calendar icsCalendar = new Calendar(); http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-util/src/main/java/org/apache/openmeetings/util/CalendarPatterns.java ---------------------------------------------------------------------- diff --git a/openmeetings-util/src/main/java/org/apache/openmeetings/util/CalendarPatterns.java b/openmeetings-util/src/main/java/org/apache/openmeetings/util/CalendarPatterns.java index d027c7e..fa38340 100644 --- a/openmeetings-util/src/main/java/org/apache/openmeetings/util/CalendarPatterns.java +++ b/openmeetings-util/src/main/java/org/apache/openmeetings/util/CalendarPatterns.java @@ -89,7 +89,7 @@ public class CalendarPatterns { return resultDate; } - throw new Exception("Could not parse date string " + dateString); + log.error("parseDate:: Could not parse date string {}", dateString); } catch (Exception e) { log.error("parseDate", e); } http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-util/src/main/java/org/apache/openmeetings/util/mail/IcalHandler.java ---------------------------------------------------------------------- diff --git a/openmeetings-util/src/main/java/org/apache/openmeetings/util/mail/IcalHandler.java b/openmeetings-util/src/main/java/org/apache/openmeetings/util/mail/IcalHandler.java index 7724c40..7b1216b 100644 --- a/openmeetings-util/src/main/java/org/apache/openmeetings/util/mail/IcalHandler.java +++ b/openmeetings-util/src/main/java/org/apache/openmeetings/util/mail/IcalHandler.java @@ -27,6 +27,7 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.NoSuchElementException; import java.util.UUID; import org.apache.wicket.util.string.Strings; @@ -119,7 +120,7 @@ public class IcalHandler { TimeZone timeZone = registry.getTimeZone(javaTzId); if (timeZone == null) { - throw new RuntimeException("Unable to get time zone by id provided: " + javaTzId); + throw new NoSuchElementException("Unable to get time zone by id provided: " + javaTzId); } DateTime start = new DateTime(startDate); http://git-wip-us.apache.org/repos/asf/openmeetings/blob/bb7015aa/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/rooms/RoomsPanel.java ---------------------------------------------------------------------- diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/rooms/RoomsPanel.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/rooms/RoomsPanel.java index 16ae095..4cfd6cf 100644 --- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/rooms/RoomsPanel.java +++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/rooms/RoomsPanel.java @@ -118,8 +118,7 @@ public class RoomsPanel extends UserPanel { } void updateRoomDetails(AjaxRequestTarget target) { - final List<Client> clientsInRoom = Application.getRoomClients(roomId); - clients.setDefaultModelObject(clientsInRoom); + clients.setDefaultModelObject(Application.getRoomClients(roomId)); Room room = getBean(RoomDao.class).get(roomId); roomID.setObject(room.getId()); roomName.setObject(room.getName());
