Modified: 
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/RoomOptionsDTO.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/RoomOptionsDTO.java?rev=1780097&r1=1780096&r2=1780097&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/RoomOptionsDTO.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/RoomOptionsDTO.java
 Tue Jan 24 17:38:20 2017
@@ -18,6 +18,8 @@
  */
 package org.apache.openmeetings.db.dto.room;
 
+import static org.apache.openmeetings.db.util.DtoHelper.optLong;
+
 import java.io.Serializable;
 
 import javax.xml.bind.annotation.XmlAccessType;
@@ -90,11 +92,7 @@ public class RoomOptionsDTO implements S
        public static Integer optInt(JSONObject o, String key) {
                return o.has(key) && !o.isNull(key) ? o.getInt(key) : null;
        }
-       
-       public static Long optLong(JSONObject o, String key) {
-               return o.has(key) && !o.isNull(key) ? o.getLong(key) : null;
-       }
-       
+
        public static RoomOptionsDTO fromString(String s) {
                JSONObject o = new JSONObject(s);
                RoomOptionsDTO ro = new RoomOptionsDTO();
@@ -106,7 +104,7 @@ public class RoomOptionsDTO implements S
                ro.showAudioVideoTest = o.optBoolean("showAudioVideoTest", 
false);
                return ro;
        }
-       
+
        @Override
        public String toString() {
                return new JSONObject(this).toString();

Modified: 
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/user/UserDTO.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/user/UserDTO.java?rev=1780097&r1=1780096&r2=1780097&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/user/UserDTO.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/user/UserDTO.java
 Tue Jan 24 17:38:20 2017
@@ -18,6 +18,10 @@
  */
 package org.apache.openmeetings.db.dto.user;
 
+import static org.apache.openmeetings.db.util.DtoHelper.optEnum;
+import static org.apache.openmeetings.db.util.DtoHelper.optEnumList;
+import static org.apache.openmeetings.db.util.DtoHelper.optLong;
+
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -191,30 +195,23 @@ public class UserDTO implements Serializ
                        return null;
                }
                UserDTO u = new UserDTO();
-               long id = o.optLong("id");
-               u.id = id == 0 ? null : id;
+               u.id = optLong(o, "id");
                u.login = o.optString("login");
                u.password = o.optString("password");
                u.firstname = o.optString("firstname");
                u.lastname = o.optString("lastname");
-               JSONArray rr = o.optJSONArray("rights");
-               if (rr !=  null) {
-                       for (int i = 0; i < rr.length(); ++i) {
-                               u.rights.add(Right.valueOf(rr.getString(i)));
-                       }
-               }
+               u.rights.addAll(optEnumList(Right.class, 
o.optJSONArray("rights")));
                u.languageId = o.optLong("languageId");
                JSONObject a = o.optJSONObject("address");
                if (a != null) {
-                       u.address.setId(a.optLong("id"));
+                       u.address.setId(optLong(a, "id"));
                        u.address.setCountry(a.optString("country"));
                        u.address.setEmail(a.optString("email"));
                }
                u.timeZoneId = o.optString("timeZoneId");
                u.externalId = o.optString("externalId");
                u.externalType = o.optString("externalType");
-               String t = o.optString("type", null);
-               u.type = t == null ? null : Type.valueOf(t);
+               u.type = optEnum(Type.class, o, "type");
                return u;
        }
 

Modified: 
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/user/Address.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/user/Address.java?rev=1780097&r1=1780096&r2=1780097&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/user/Address.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/user/Address.java
 Tue Jan 24 17:38:20 2017
@@ -36,56 +36,55 @@ import org.simpleframework.xml.Root;
 @Table(name = "address")
 @Root(name="address")
 public class Address implements IDataProviderEntity {
-
        private static final long serialVersionUID = 1L;
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        @Column(name = "id")
        private Long id;
-       
+
        @Column(name = "additionalname")
        @Element(data=true, required=false)
        private String additionalname;
-       
+
        @Lob
        @Column(name = "comment", length=2048)
        @Element(data=true, required=false)
        private String comment;
-       
+
        @Column(name = "fax")
        @Element(data=true, required=false)
        private String fax;
-       
+
        @Column(name = "inserted")
        @Element(name = "starttime",data=true, required=false)
        private Date inserted;
-       
+
        @Column(name = "country")
        @Element(name="country", data=true, required=false)
        private String country;
-       
+
        @Column(name = "street")
        @Element(data=true, required=false)
        private String street;
-       
+
        @Column(name = "town")
        @Element(data=true, required=false)
        private String town;
-       
+
        @Column(name = "updated")
        private Date updated;
-       
+
        @Column(name = "zip")
        @Element(data=true, required=false)
        private String zip;
-       
+
        @Column(name = "deleted", nullable = false)
        private boolean deleted;
 
        @Column(name = "email")
        @Element(name="mail", data=true, required=false)
        private String email;
-       
+
        @Column(name = "phone")
        @Element(data=true, required=false)
        private String phone;

Added: 
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/DtoHelper.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/DtoHelper.java?rev=1780097&view=auto
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/DtoHelper.java
 (added)
+++ 
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/DtoHelper.java
 Tue Jan 24 17:38:20 2017
@@ -0,0 +1,45 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.wicket.ajax.json.JSONArray;
+import org.apache.wicket.ajax.json.JSONObject;
+
+public class DtoHelper {
+       public static Long optLong(JSONObject o, String key) {
+               return o.has(key) && !o.isNull(key) ? o.getLong(key) : null;
+       }
+
+       public static <T extends Enum<T>> T optEnum(Class<T> clazz, JSONObject 
o, String key) {
+               return o.has(key) && !o.isNull(key) ? Enum.valueOf(clazz, 
o.getString(key)) : null;
+       }
+
+       public static <T extends Enum<T>> Collection<T> optEnumList(Class<T> 
clazz, JSONArray arr) {
+               Collection<T> l = new ArrayList<>();
+               if (arr !=  null) {
+                       for (int i = 0; i < arr.length(); ++i) {
+                               l.add(Enum.valueOf(clazz, arr.getString(i)));
+                       }
+               }
+               return l;
+       }
+}

Modified: 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java?rev=1780097&r1=1780096&r2=1780097&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
 Tue Jan 24 17:38:20 2017
@@ -486,19 +486,23 @@ public class Application extends Authent
                Room r = i.getRoom();
                User u = i.getInvitee();
                if (r != null) {
-                       boolean allowed = u.getType() != Type.contact;
-                       if (allowed) {
-                               allowed = 
getBean(MainService.class).isRoomAllowedToUser(r, u);
-                       }
-                       if (!allowed) {
-                               PageParameters pp = new PageParameters();
-                               pp.add(INVITATION_HASH, i.getHash());
-                               if (u.getLanguageId() > 0) {
-                                       pp.add("language", u.getLanguageId());
-                               }
-                               link = urlForPage(HashPage.class, pp);
-                       } else {
+                       if (r.isAppointment() && 
i.getInvitedBy().getId().equals(u.getId())) {
                                link = getRoomUrlFragment(r.getId()).getLink();
+                       } else {
+                               boolean allowed = u.getType() != Type.contact;
+                               if (allowed) {
+                                       allowed = 
getBean(MainService.class).isRoomAllowedToUser(r, u);
+                               }
+                               if (allowed) {
+                                       link = 
getRoomUrlFragment(r.getId()).getLink();
+                               } else {
+                                       PageParameters pp = new 
PageParameters();
+                                       pp.add(INVITATION_HASH, i.getHash());
+                                       if (u.getLanguageId() > 0) {
+                                               pp.add("language", 
u.getLanguageId());
+                                       }
+                                       link = urlForPage(HashPage.class, pp);
+                               }
                        }
                }
                Recording rec = i.getRecording();

Modified: 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/InvitationForm.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/InvitationForm.java?rev=1780097&r1=1780096&r2=1780097&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/InvitationForm.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/InvitationForm.java
 Tue Jan 24 17:38:20 2017
@@ -87,7 +87,7 @@ public abstract class InvitationForm ext
                add(subject, message);
                
recipients.setLabel(Model.of(Application.getString(216))).setRequired(true).add(new
 AjaxFormComponentUpdatingBehavior("change") {
                        private static final long serialVersionUID = 1L;
-                       
+
                        @Override
                        protected void onUpdate(AjaxRequestTarget target) {
                                url.setModelObject(null);
@@ -154,11 +154,11 @@ public abstract class InvitationForm ext
                i.setId(null);
                i.setUpdated(null);
                i.setUsed(false);
-               
+
                i.setPassword(CryptProvider.get().hash(i.getPassword()));
                i.setValidFrom(getDate(from.getModelObject().minusMinutes(5), 
timeZoneId.getModelObject()));
                i.setValidTo(getDate(to.getModelObject(), 
timeZoneId.getModelObject()));
-               
+
                i.setInvitee(u);
                i.setHash(UUID.randomUUID().toString());
                if (Type.contact == u.getType()) {
@@ -232,4 +232,4 @@ public abstract class InvitationForm ext
                        dialog.onSuperClick(target, button);
                }
        }
-}
\ No newline at end of file
+}

Modified: 
openmeetings/application/trunk/openmeetings-web/src/test/java/org/apache/openmeetings/test/AbstractJUnitDefaults.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/test/java/org/apache/openmeetings/test/AbstractJUnitDefaults.java?rev=1780097&r1=1780096&r2=1780097&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-web/src/test/java/org/apache/openmeetings/test/AbstractJUnitDefaults.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-web/src/test/java/org/apache/openmeetings/test/AbstractJUnitDefaults.java
 Tue Jan 24 17:38:20 2017
@@ -48,7 +48,7 @@ public abstract class AbstractJUnitDefau
        private static final String orgname = "smoketest";
        private static final String timeZone = "Europe/Berlin";
        private static final String useremail = "[email protected]";
-       
+
        @Autowired
        private AppointmentDao appointmentDao;
        @Autowired
@@ -114,7 +114,7 @@ public abstract class AbstractJUnitDefau
                if (ap.getReminder() == null) {
                        ap.setReminder(Appointment.Reminder.none);
                }
-               
+
                if (r == null) {
                        r = new Room();
                        r.setType(Room.Type.conference);
@@ -178,12 +178,15 @@ public abstract class AbstractJUnitDefau
                importInitvalues.loadAll(cfg, false);
        }
 
+       public User getContact(String uuid, Long ownerId) {
+               return userDao.getContact("email" + uuid, "firstname" + uuid, 
"lastname" + uuid, ownerId);
+       }
+
        public User createUserContact(Long ownerId) {
-               return createUserContact(UUID.randomUUID().toString(), ownerId);
+               return 
createUserContact(getContact(UUID.randomUUID().toString(), ownerId), ownerId);
        }
 
-       public User createUserContact(String uuid, Long ownerId) {
-               User user = userDao.getContact("email" + uuid, "firstname" + 
uuid, "lastname" + uuid, ownerId);
+       public User createUserContact(User user, Long ownerId) {
                user = userDao.update(user, ownerId);
                assertNotNull("Cann't add user", user);
                return user;

Modified: 
openmeetings/application/trunk/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestAppointmentAddAppointment.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestAppointmentAddAppointment.java?rev=1780097&r1=1780096&r2=1780097&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestAppointmentAddAppointment.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-web/src/test/java/org/apache/openmeetings/test/calendar/TestAppointmentAddAppointment.java
 Tue Jan 24 17:38:20 2017
@@ -19,14 +19,28 @@
 package org.apache.openmeetings.test.calendar;
 
 import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.util.ArrayList;
 import java.util.Calendar;
+import java.util.Date;
+import java.util.UUID;
 
 import org.apache.openmeetings.db.dao.calendar.AppointmentDao;
+import org.apache.openmeetings.db.dao.user.UserDao;
 import org.apache.openmeetings.db.entity.calendar.Appointment;
+import org.apache.openmeetings.db.entity.calendar.Appointment.Reminder;
+import org.apache.openmeetings.db.entity.calendar.MeetingMember;
+import org.apache.openmeetings.db.entity.room.Room;
+import org.apache.openmeetings.db.entity.user.User;
 import org.apache.openmeetings.service.calendar.AppointmentLogic;
 import org.apache.openmeetings.test.AbstractWicketTester;
+import org.apache.openmeetings.web.app.WebSession;
+import org.apache.wicket.util.string.StringValue;
 import org.junit.Test;
 import org.red5.logging.Red5LoggerFactory;
 import org.slf4j.Logger;
@@ -39,11 +53,17 @@ public class TestAppointmentAddAppointme
        private AppointmentLogic appointmentLogic;
        @Autowired
        private AppointmentDao appointmentDao;
+       @Autowired
+       private UserDao userDao;
+
+       private void setTime(Appointment a) {
+               
a.setStart(Date.from(LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant()));
+               
a.setEnd(Date.from(LocalDateTime.now().plusHours(1).atZone(ZoneId.systemDefault()).toInstant()));
+       }
 
        @Test
        public void saveAppointment() throws Exception {
-               log.debug("- 1 MeetingReminderJob.execute");
-               log.warn("- 2 MeetingReminderJob.execute");
+               log.debug("- saveAppointment");
 
                Calendar start = Calendar.getInstance();
                start.setTimeInMillis(start.getTimeInMillis() + 600000);
@@ -74,14 +94,45 @@ public class TestAppointmentAddAppointme
                                isMonthly, isYearly, remind, mmClient,
                                roomType, languageId, false, "", -1, userId);
                a = appointmentDao.update(a, userId);
-               
+
                Thread.sleep(3000);
-               
+
                appointmentLogic.doScheduledMeetingReminder();
-               
+
                Thread.sleep(3000);
-               
-               assertTrue("Saved appointment should have valid id: " + 
a.getId(), a.getId() != null && a.getId() > 0);
+
+               assertNotNull("Saved appointment should have valid id: " + 
a.getId(), a.getId());
+       }
+
+       @Test
+       public void testCreate() {
+               Appointment a = new Appointment();
+               a.setTitle("Test title");
+               setTime(a);
+               a.setReminder(Reminder.ical);
+               a.setMeetingMembers(new ArrayList<>());
+               User owner = userDao.get(1L);
+               a.setOwner(owner);
+               a.setRoom(new Room());
+               a.getRoom().setAppointment(true);
+               a.getRoom().setType(Room.Type.conference);
+               for (int i = 0; i < 3; ++i) {
+                       MeetingMember mm = new MeetingMember();
+                       mm.setUser(getContact(UUID.randomUUID().toString(), 
owner.getId()));
+                       a.getMeetingMembers().add(mm);
+               }
+               a = appointmentDao.update(a, owner.getId());
+               assertNotNull("Saved appointment should have valid id: " + 
a.getId(), a.getId());
+               assertEquals("Saved appointment should have corect count of 
guests: ", 3, a.getMeetingMembers().size());
+               for (MeetingMember mm : a.getMeetingMembers()) {
+                       assertNotNull("Saved guest should have valid id: ", 
mm.getId());
+                       assertNotNull("Saved guest should have valid 
invitation: ", mm.getInvitation());
+               }
+
+               WebSession ws = WebSession.get();
+               Appointment a1 = appointmentDao.get(a.getId());
+               ws.checkHashes(StringValue.valueOf(""), 
StringValue.valueOf(a1.getMeetingMembers().get(0).getInvitation().getHash()));
+               assertTrue("Login via secure hash should be successful", 
ws.isSignedIn());
        }
 
        private static String createClientObj(String firstname, String 
lastname, String email, String jNameTimeZone) {
@@ -94,5 +145,4 @@ public class TestAppointmentAddAppointme
                        .append(jNameTimeZone);
                return sb.toString();
        }
-
 }

Modified: 
openmeetings/application/trunk/openmeetings-web/src/test/java/org/apache/openmeetings/test/webservice/TestCalendarService.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/test/java/org/apache/openmeetings/test/webservice/TestCalendarService.java?rev=1780097&r1=1780096&r2=1780097&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-web/src/test/java/org/apache/openmeetings/test/webservice/TestCalendarService.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-web/src/test/java/org/apache/openmeetings/test/webservice/TestCalendarService.java
 Tue Jan 24 17:38:20 2017
@@ -32,6 +32,7 @@ import org.apache.openmeetings.db.dao.ro
 import org.apache.openmeetings.db.dao.user.GroupDao;
 import org.apache.openmeetings.db.dto.basic.ServiceResult;
 import org.apache.openmeetings.db.dto.calendar.AppointmentDTO;
+import org.apache.openmeetings.db.dto.calendar.MeetingMemberDTO;
 import org.apache.openmeetings.db.entity.calendar.Appointment;
 import org.apache.openmeetings.db.entity.room.Room;
 import org.apache.openmeetings.db.entity.user.GroupUser;
@@ -174,14 +175,14 @@ public class TestCalendarService extends
                JSONObject o = createAppointment()
                                .put("meetingMembers", new JSONArray()
                                                .put(new 
JSONObject().put("user", new JSONObject()
-                                                               
.put("firstname", "Jhon 1")
+                                                               
.put("firstname", "John 1")
                                                                
.put("lastname", "Doe")
-                                                               .put("Address", 
new JSONObject().put("email", "[email protected]"))
+                                                               .put("address", 
new JSONObject().put("email", "[email protected]"))
                                                                ))
                                                .put(new 
JSONObject().put("user", new JSONObject()
-                                                               
.put("firstname", "Jhon 2")
+                                                               
.put("firstname", "John 2")
                                                                
.put("lastname", "Doe")
-                                                               .put("Address", 
new JSONObject().put("email", "[email protected]"))
+                                                               .put("address", 
new JSONObject().put("email", "[email protected]"))
                                                                ))
                                                );
 
@@ -202,6 +203,9 @@ public class TestCalendarService extends
                assertNotNull("Valid DTO should be returned", dto);
                assertNotNull("DTO id should be valid", dto.getId());
                assertEquals("DTO should have 2 attendees", 2, 
dto.getMeetingMembers().size());
+               for (MeetingMemberDTO mm : dto.getMeetingMembers()) {
+                       assertNotNull("Email should be valid", 
mm.getUser().getAddress().getEmail());
+               }
 
                //try to change MM list
                JSONObject o1 = AppointmentParamConverter.json(dto)

Modified: 
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java?rev=1780097&r1=1780096&r2=1780097&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/CalendarWebService.java
 Tue Jan 24 17:38:20 2017
@@ -303,10 +303,7 @@ public class CalendarWebService {
                                throw new ServiceException("Insufficient 
permissions"); //TODO code -26
                        }
                        if (AuthLevelUtil.hasUserLevel(u.getRights())) {
-                               Appointment a = appointment.get(userDao, 
appointmentDao);
-                               if (a.getOwner() == null) {
-                                       a.setOwner(u);
-                               }
+                               Appointment a = appointment.get(userDao, 
appointmentDao, u);
                                if (a.getRoom().getId() != null) {
                                        if (a.getRoom().isAppointment()) {
                                                a.getRoom().setIspublic(false);

Modified: 
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentParamConverter.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentParamConverter.java?rev=1780097&r1=1780096&r2=1780097&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentParamConverter.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentParamConverter.java
 Tue Jan 24 17:38:20 2017
@@ -18,6 +18,8 @@
  */
 package org.apache.openmeetings.webservice.util;
 
+import static org.apache.openmeetings.db.util.DtoHelper.optEnum;
+import static org.apache.openmeetings.db.util.DtoHelper.optLong;
 import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_FULL_FORMAT;
 
 import java.util.Date;
@@ -37,8 +39,7 @@ public class AppointmentParamConverter i
        public AppointmentDTO fromString(String val) {
                JSONObject o = new JSONObject(val);
                AppointmentDTO a = new AppointmentDTO();
-               long id = o.optLong("id");
-               a.setId(id == 0 ? null : id);
+               a.setId(optLong(o, "id"));
                a.setTitle(o.optString("title"));
                a.setLocation(o.optString("location"));
                a.setOwner(UserDTO.get(o.optJSONObject("owner")));
@@ -49,8 +50,7 @@ public class AppointmentParamConverter i
                a.setInserted(DateParamConverter.get(o.optString("inserted")));
                a.setUpdated(DateParamConverter.get(o.optString("updated")));
                a.setDeleted(o.optBoolean("inserted"));
-               String r = o.optString("reminder", null);
-               a.setReminder(r == null ? null : Reminder.valueOf(r));
+               a.setReminder(optEnum(Reminder.class, o, "reminder"));
                a.setRoom(RoomDTO.get(o.optJSONObject("room")));
                a.setIcalId(o.optString("icalId"));
                JSONArray mm = o.optJSONArray("meetingMembers");


Reply via email to