Author: solomax
Date: Thu Jan 19 14:45:20 2017
New Revision: 1779468

URL: http://svn.apache.org/viewvc?rev=1779468&view=rev
Log:
[OPENMEETINGS-1535] range method is fixed

Added:
    
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/
    
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentParamConverter.java
    
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/CalendarParamConverter.java
    
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/DateParamConverter.java
    
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/OmParamConverterProvider.java
    
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/
    
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentParamConverter.java
    
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/CalendarParamConverter.java
    
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/DateParamConverter.java
    
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/OmParamConverterProvider.java
    
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/
    
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentParamConverter.java
    
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/CalendarParamConverter.java
    
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/DateParamConverter.java
    
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/OmParamConverterProvider.java
Modified:
    
openmeetings/application/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java
    
openmeetings/application/branches/3.1.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/CalendarPatterns.java
    
openmeetings/application/branches/3.1.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WebSession.java
    
openmeetings/application/branches/3.1.x/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml
    
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java
    
openmeetings/application/branches/3.2.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/CalendarPatterns.java
    
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WebSession.java
    
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml
    
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java
    
openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/CalendarPatterns.java
    
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WebSession.java
    
openmeetings/application/trunk/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml

Modified: 
openmeetings/application/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java?rev=1779468&r1=1779467&r2=1779468&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java
 (original)
+++ 
openmeetings/application/branches/3.1.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java
 Thu Jan 19 14:45:20 2017
@@ -18,10 +18,7 @@
  */
 package org.apache.openmeetings.db.dto.calendar;
 
-import static org.apache.openmeetings.util.CalendarPatterns.ISO8601_FORMAT;
-
 import java.io.Serializable;
-import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
@@ -39,7 +36,6 @@ import org.apache.openmeetings.db.dto.us
 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.wicket.ajax.json.JSONArray;
 import org.apache.wicket.ajax.json.JSONObject;
 
 @XmlRootElement
@@ -284,53 +280,8 @@ public class AppointmentDTO implements S
                this.password = password;
        }
 
-       private static Date optDate(JSONObject o, String prop) throws 
ParseException {
-               return ISO8601_FORMAT.parse(o.optString(prop));
-       }
-
-       private static Calendar optCal(AppointmentDTO a, JSONObject o, String 
prop) throws ParseException {
-               Calendar c = 
Calendar.getInstance(TimeZone.getTimeZone(a.owner.getTimeZoneId()));
-               c.setTime(ISO8601_FORMAT.parse(o.optString(prop)));
-               return c;
-       }
-
-       public static AppointmentDTO fromString(String s) throws ParseException 
{
-               JSONObject o = new JSONObject(s);
-               AppointmentDTO a = new AppointmentDTO();
-               a.id = o.optLong("id");
-               a.title = o.optString("title");
-               a.location = o.optString("location");
-               a.owner = UserDTO.get(o.optJSONObject("owner"));
-               a.start = optCal(a, o, "start");
-               a.end = optCal(a, o, "end");
-               a.description = o.optString("description");
-               a.inserted = optDate(o, "inserted");
-               a.updated = optDate(o, "updated");
-               a.deleted = o.optBoolean("inserted");
-               a.reminder = Reminder.valueOf(o.optString("reminder"));
-               a.room = RoomDTO.get(o.optJSONObject("room"));
-               a.icalId = o.optString("icalId");
-               JSONArray mm = o.optJSONArray("meetingMembers");
-               if (mm != null) {
-                       for (int i = 0; i < mm.length(); ++i) {
-                               
a.meetingMembers.add(MeetingMemberDTO.get(mm.getJSONObject(i)));
-                       }
-               }
-               a.languageId = o.optLong("languageId");
-               a.password = o.optString("password");
-               a.passwordProtected = o.optBoolean("passwordProtected");
-               a.connectedEvent = o.optBoolean("connectedEvent");
-               a.reminderEmailSend = o.optBoolean("reminderEmailSend");
-               return a;
-       }
-
        @Override
        public String toString() {
-               return new JSONObject(this)
-                       .put("start", ISO8601_FORMAT.format(start))
-                       .put("end", ISO8601_FORMAT.format(end))
-                       .put("inserted", ISO8601_FORMAT.format(inserted))
-                       .put("updated", ISO8601_FORMAT.format(updated))
-                       .toString();
+               return new JSONObject(this).toString();
        }
 }

Modified: 
openmeetings/application/branches/3.1.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/CalendarPatterns.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/CalendarPatterns.java?rev=1779468&r1=1779467&r2=1779468&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.1.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/CalendarPatterns.java
 (original)
+++ 
openmeetings/application/branches/3.1.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/CalendarPatterns.java
 Thu Jan 19 14:45:20 2017
@@ -41,9 +41,13 @@ public class CalendarPatterns {
        public static final FastDateFormat dateFormat__yyyyMMddHHmmss = 
FastDateFormat.getInstance("yyyy.MM.dd HH:mm:ss");
        public static final FastDateFormat STREAM_DATE_FORMAT = 
FastDateFormat.getInstance("yyyy_MM_dd_HH_mm_ss");
        public static final String FULL_DF_PATTERN = "dd.MM.yyyy HH:mm:ss z 
(Z)";
-       public static final String ISO8601_FORMAT_STRING = 
"yyyy-MM-dd'T'HH:mm:ssZ";
+       public static final String ISO8601_FULL_FORMAT_STRING = 
"yyyy-MM-dd'T'HH:mm:ssZ";
+       public static final String ISO8601_DATETIME_FORMAT_STRING = 
"yyyy-MM-dd'T'HH:mm:ss";
+       public static final String ISO8601_DATE_FORMAT_STRING = "yyyy-MM-dd";
        public static final FastDateFormat FULL_DATE_FORMAT = 
FastDateFormat.getInstance(FULL_DF_PATTERN);
-       public static final FastDateFormat ISO8601_FORMAT = 
FastDateFormat.getInstance(ISO8601_FORMAT_STRING);
+       public static final FastDateFormat ISO8601_FULL_FORMAT = 
FastDateFormat.getInstance(ISO8601_FULL_FORMAT_STRING);
+       public static final FastDateFormat ISO8601_DATETIME_FORMAT = 
FastDateFormat.getInstance(ISO8601_DATETIME_FORMAT_STRING);
+       public static final FastDateFormat ISO8601_DATE_FORMAT = 
FastDateFormat.getInstance(ISO8601_DATE_FORMAT_STRING);
 
        public static String getDateByMiliSeconds(Date t) {
                return dateFormat__yyyyMMddHHmmss.format(t);

Modified: 
openmeetings/application/branches/3.1.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WebSession.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WebSession.java?rev=1779468&r1=1779467&r2=1779468&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.1.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WebSession.java
 (original)
+++ 
openmeetings/application/branches/3.1.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WebSession.java
 Thu Jan 19 14:45:20 2017
@@ -19,7 +19,7 @@
 package org.apache.openmeetings.web.app;
 
 import static java.text.DateFormat.SHORT;
-import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_FORMAT_STRING;
+import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_FULL_FORMAT_STRING;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DASHBOARD_SHOW_MYROOMS_KEY;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DASHBOARD_SHOW_RSS_KEY;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DEFAULT_LANG_KEY;
@@ -311,7 +311,7 @@ public class WebSession extends Abstract
                languageId = u.getLanguageId();
                externalType = u.getExternalType();
                tz = getBean(TimezoneUtil.class).getTimeZone(u);
-               ISO8601FORMAT = 
FastDateFormat.getInstance(ISO8601_FORMAT_STRING, tz);
+               ISO8601FORMAT = 
FastDateFormat.getInstance(ISO8601_FULL_FORMAT_STRING, tz);
                setLocale(getLocale(u));
                sdf = FastDateFormat.getDateTimeInstance(SHORT, SHORT, 
getLocale());
        }

Modified: 
openmeetings/application/branches/3.1.x/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml?rev=1779468&r1=1779467&r2=1779468&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.1.x/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml
 (original)
+++ 
openmeetings/application/branches/3.1.x/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml
 Thu Jan 19 14:45:20 2017
@@ -283,6 +283,9 @@
                        <ref bean="userWebService"/>
                        <ref bean="netTestWebService"/> <!-- JaxRs only -->
                </jaxrs:serviceBeans>
+               <jaxrs:providers>
+                       <bean id="omParamProvider" 
class="org.apache.openmeetings.webservice.util.OmParamConverterProvider"/>
+               </jaxrs:providers>
        </jaxrs:server>
        <jaxws:endpoint id="calendarServiceWS" address="/CalendarService" 
implementor="#calendarWebService"/>
        <jaxws:endpoint id="errorServiceWS" address="/ErrorService" 
implementor="#errorWebService" />

Added: 
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentParamConverter.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentParamConverter.java?rev=1779468&view=auto
==============================================================================
--- 
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentParamConverter.java
 (added)
+++ 
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentParamConverter.java
 Thu Jan 19 14:45:20 2017
@@ -0,0 +1,74 @@
+/*
+ * 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.webservice.util;
+
+import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_FULL_FORMAT;
+
+import javax.ws.rs.ext.ParamConverter;
+
+import org.apache.openmeetings.db.dto.calendar.AppointmentDTO;
+import org.apache.openmeetings.db.dto.calendar.MeetingMemberDTO;
+import org.apache.openmeetings.db.dto.room.RoomDTO;
+import org.apache.openmeetings.db.dto.user.UserDTO;
+import org.apache.openmeetings.db.entity.calendar.Appointment.Reminder;
+import org.apache.wicket.ajax.json.JSONArray;
+import org.apache.wicket.ajax.json.JSONObject;
+
+public class AppointmentParamConverter implements 
ParamConverter<AppointmentDTO> {
+       @Override
+       public AppointmentDTO fromString(String val) {
+               JSONObject o = new JSONObject(val);
+               AppointmentDTO a = new AppointmentDTO();
+               a.setId(o.optLong("id"));
+               a.setTitle(o.optString("title"));
+               a.setLocation(o.optString("location"));
+               a.setOwner(UserDTO.get(o.optJSONObject("owner")));
+               a.setStart(CalendarParamConverter.get(o.optString("start"), 
a.getOwner().getTimeZoneId()));
+               a.setEnd(CalendarParamConverter.get(o.optString("end"), 
a.getOwner().getTimeZoneId()));
+               a.setDescription(o.optString("description"));
+               a.setInserted(DateParamConverter.get(o.optString("inserted")));
+               a.setInserted(DateParamConverter.get(o.optString("updated")));
+               a.setDeleted(o.optBoolean("inserted"));
+               a.setReminder(Reminder.valueOf(o.optString("reminder")));
+               a.setRoom(RoomDTO.get(o.optJSONObject("room")));
+               a.setIcalId(o.optString("icalId"));
+               JSONArray mm = o.optJSONArray("meetingMembers");
+               if (mm != null) {
+                       for (int i = 0; i < mm.length(); ++i) {
+                               
a.getMeetingMembers().add(MeetingMemberDTO.get(mm.getJSONObject(i)));
+                       }
+               }
+               a.setLanguageId(o.optLong("languageId"));
+               a.setPassword(o.optString("password"));
+               a.setPasswordProtected(o.optBoolean("passwordProtected"));
+               a.setConnectedEvent(o.optBoolean("connectedEvent"));
+               a.setReminderEmailSend(o.optBoolean("reminderEmailSend"));
+               return a;
+       }
+
+       @Override
+       public String toString(AppointmentDTO val) {
+               return new JSONObject(this)
+                               .put("start", 
ISO8601_FULL_FORMAT.format(val.getStart()))
+                               .put("end", 
ISO8601_FULL_FORMAT.format(val.getEnd()))
+                               .put("inserted", 
ISO8601_FULL_FORMAT.format(val.getInserted()))
+                               .put("updated", 
ISO8601_FULL_FORMAT.format(val.getUpdated()))
+                               .toString();
+       }
+}

Added: 
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/CalendarParamConverter.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/CalendarParamConverter.java?rev=1779468&view=auto
==============================================================================
--- 
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/CalendarParamConverter.java
 (added)
+++ 
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/CalendarParamConverter.java
 Thu Jan 19 14:45:20 2017
@@ -0,0 +1,46 @@
+/*
+ * 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.webservice.util;
+
+import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_FULL_FORMAT;
+
+import java.util.Calendar;
+import java.util.TimeZone;
+
+import javax.ws.rs.ext.ParamConverter;
+
+public class CalendarParamConverter implements ParamConverter<Calendar> {
+       public static Calendar get(String val, String tzId) {
+               Calendar c = Calendar.getInstance(TimeZone.getTimeZone(tzId));
+               c.setTime(DateParamConverter.get(val));
+               return c;
+       }
+
+       @Override
+       public Calendar fromString(String val) {
+               Calendar c = Calendar.getInstance();
+               c.setTime(DateParamConverter.get(val));
+               return c;
+       }
+
+       @Override
+       public String toString(Calendar val) {
+               return ISO8601_FULL_FORMAT.format(val);
+       }
+}

Added: 
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/DateParamConverter.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/DateParamConverter.java?rev=1779468&view=auto
==============================================================================
--- 
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/DateParamConverter.java
 (added)
+++ 
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/DateParamConverter.java
 Thu Jan 19 14:45:20 2017
@@ -0,0 +1,55 @@
+/*
+ * 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.webservice.util;
+
+import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_DATETIME_FORMAT;
+import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_DATE_FORMAT;
+import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_FULL_FORMAT;
+
+import java.text.ParseException;
+import java.util.Date;
+
+import javax.ws.rs.ext.ParamConverter;
+
+import org.apache.commons.lang3.time.FastDateFormat;
+
+public class DateParamConverter implements ParamConverter<Date> {
+       private final static FastDateFormat[] formats = new FastDateFormat[] { 
ISO8601_FULL_FORMAT, ISO8601_DATETIME_FORMAT, ISO8601_DATE_FORMAT };
+
+       static Date get(String val) {
+               for (FastDateFormat df : formats) {
+                       try {
+                               return df.parse(val);
+                       } catch (ParseException e) {
+                               // no-op
+                       }
+               }
+               throw new IllegalArgumentException("Unparsable format");
+       }
+
+       @Override
+       public Date fromString(String val) {
+               return get(val);
+       }
+
+       @Override
+       public String toString(Date val) {
+               return ISO8601_FULL_FORMAT.format(val);
+       }
+}

Added: 
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/OmParamConverterProvider.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/OmParamConverterProvider.java?rev=1779468&view=auto
==============================================================================
--- 
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/OmParamConverterProvider.java
 (added)
+++ 
openmeetings/application/branches/3.1.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/OmParamConverterProvider.java
 Thu Jan 19 14:45: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.webservice.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Calendar;
+import java.util.Date;
+
+import javax.ws.rs.ext.ParamConverter;
+import javax.ws.rs.ext.ParamConverterProvider;
+
+import org.apache.openmeetings.db.dto.calendar.AppointmentDTO;
+
+public class OmParamConverterProvider implements ParamConverterProvider {
+
+       @SuppressWarnings("unchecked")
+       @Override
+       public <T> ParamConverter<T> getConverter(Class<T> rawType, Type 
genericType, Annotation[] annotations) {
+               if (Calendar.class.isAssignableFrom(rawType)) {
+                       return (ParamConverter<T>)new CalendarParamConverter();
+               } else if (Date.class.isAssignableFrom(rawType)) {
+                       return (ParamConverter<T>)new DateParamConverter();
+               } else if (AppointmentDTO.class.isAssignableFrom(rawType)) {
+                       return (ParamConverter<T>)new DateParamConverter();
+               }
+               return null;
+       }
+}

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java?rev=1779468&r1=1779467&r2=1779468&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java
 Thu Jan 19 14:45:20 2017
@@ -18,10 +18,7 @@
  */
 package org.apache.openmeetings.db.dto.calendar;
 
-import static org.apache.openmeetings.util.CalendarPatterns.ISO8601_FORMAT;
-
 import java.io.Serializable;
-import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
@@ -39,7 +36,6 @@ import org.apache.openmeetings.db.dto.us
 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.wicket.ajax.json.JSONArray;
 import org.apache.wicket.ajax.json.JSONObject;
 
 @XmlRootElement
@@ -284,53 +280,8 @@ public class AppointmentDTO implements S
                this.password = password;
        }
 
-       private static Date optDate(JSONObject o, String prop) throws 
ParseException {
-               return ISO8601_FORMAT.parse(o.optString(prop));
-       }
-
-       private static Calendar optCal(AppointmentDTO a, JSONObject o, String 
prop) throws ParseException {
-               Calendar c = 
Calendar.getInstance(TimeZone.getTimeZone(a.owner.getTimeZoneId()));
-               c.setTime(ISO8601_FORMAT.parse(o.optString(prop)));
-               return c;
-       }
-
-       public static AppointmentDTO fromString(String s) throws ParseException 
{
-               JSONObject o = new JSONObject(s);
-               AppointmentDTO a = new AppointmentDTO();
-               a.id = o.optLong("id");
-               a.title = o.optString("title");
-               a.location = o.optString("location");
-               a.owner = UserDTO.get(o.optJSONObject("owner"));
-               a.start = optCal(a, o, "start");
-               a.end = optCal(a, o, "end");
-               a.description = o.optString("description");
-               a.inserted = optDate(o, "inserted");
-               a.updated = optDate(o, "updated");
-               a.deleted = o.optBoolean("inserted");
-               a.reminder = Reminder.valueOf(o.optString("reminder"));
-               a.room = RoomDTO.get(o.optJSONObject("room"));
-               a.icalId = o.optString("icalId");
-               JSONArray mm = o.optJSONArray("meetingMembers");
-               if (mm != null) {
-                       for (int i = 0; i < mm.length(); ++i) {
-                               
a.meetingMembers.add(MeetingMemberDTO.get(mm.getJSONObject(i)));
-                       }
-               }
-               a.languageId = o.optLong("languageId");
-               a.password = o.optString("password");
-               a.passwordProtected = o.optBoolean("passwordProtected");
-               a.connectedEvent = o.optBoolean("connectedEvent");
-               a.reminderEmailSend = o.optBoolean("reminderEmailSend");
-               return a;
-       }
-
        @Override
        public String toString() {
-               return new JSONObject(this)
-                       .put("start", ISO8601_FORMAT.format(start))
-                       .put("end", ISO8601_FORMAT.format(end))
-                       .put("inserted", ISO8601_FORMAT.format(inserted))
-                       .put("updated", ISO8601_FORMAT.format(updated))
-                       .toString();
+               return new JSONObject(this).toString();
        }
 }

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/CalendarPatterns.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/CalendarPatterns.java?rev=1779468&r1=1779467&r2=1779468&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/CalendarPatterns.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/CalendarPatterns.java
 Thu Jan 19 14:45:20 2017
@@ -41,9 +41,13 @@ public class CalendarPatterns {
        public static final FastDateFormat dateFormat__yyyyMMddHHmmss = 
FastDateFormat.getInstance("yyyy.MM.dd HH:mm:ss");
        public static final FastDateFormat STREAM_DATE_FORMAT = 
FastDateFormat.getInstance("yyyy_MM_dd_HH_mm_ss");
        public static final String FULL_DF_PATTERN = "dd.MM.yyyy HH:mm:ss z 
(Z)";
-       public static final String ISO8601_FORMAT_STRING = 
"yyyy-MM-dd'T'HH:mm:ssZ";
+       public static final String ISO8601_FULL_FORMAT_STRING = 
"yyyy-MM-dd'T'HH:mm:ssZ";
+       public static final String ISO8601_DATETIME_FORMAT_STRING = 
"yyyy-MM-dd'T'HH:mm:ss";
+       public static final String ISO8601_DATE_FORMAT_STRING = "yyyy-MM-dd";
        public static final FastDateFormat FULL_DATE_FORMAT = 
FastDateFormat.getInstance(FULL_DF_PATTERN);
-       public static final FastDateFormat ISO8601_FORMAT = 
FastDateFormat.getInstance(ISO8601_FORMAT_STRING);
+       public static final FastDateFormat ISO8601_FULL_FORMAT = 
FastDateFormat.getInstance(ISO8601_FULL_FORMAT_STRING);
+       public static final FastDateFormat ISO8601_DATETIME_FORMAT = 
FastDateFormat.getInstance(ISO8601_DATETIME_FORMAT_STRING);
+       public static final FastDateFormat ISO8601_DATE_FORMAT = 
FastDateFormat.getInstance(ISO8601_DATE_FORMAT_STRING);
 
        public static String getDateByMiliSeconds(Date t) {
                return dateFormat__yyyyMMddHHmmss.format(t);

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WebSession.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WebSession.java?rev=1779468&r1=1779467&r2=1779468&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WebSession.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WebSession.java
 Thu Jan 19 14:45:20 2017
@@ -19,7 +19,7 @@
 package org.apache.openmeetings.web.app;
 
 import static java.text.DateFormat.SHORT;
-import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_FORMAT_STRING;
+import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_FULL_FORMAT_STRING;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DASHBOARD_SHOW_MYROOMS_KEY;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DASHBOARD_SHOW_RSS_KEY;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DEFAULT_LANG_KEY;
@@ -321,11 +321,11 @@ public class WebSession extends Abstract
                languageId = u.getLanguageId();
                externalType = u.getExternalType();
                tz = getBean(TimezoneUtil.class).getTimeZone(u);
-               ISO8601FORMAT = 
FastDateFormat.getInstance(ISO8601_FORMAT_STRING, tz);
+               ISO8601FORMAT = 
FastDateFormat.getInstance(ISO8601_FULL_FORMAT_STRING, tz);
                setLocale(getLocale(u));
                sdf = FastDateFormat.getDateTimeInstance(SHORT, SHORT, 
getLocale());
        }
-       
+
        public boolean signIn(String login, String password, Type type, Long 
domainId) {
                try {
                        User u = null;
@@ -354,7 +354,7 @@ public class WebSession extends Abstract
                }
                return false;
        }
-       
+
        public boolean signIn(User u) {
                if (u == null) {
                        return false;
@@ -362,20 +362,20 @@ public class WebSession extends Abstract
                setUser(u, null);
                return true;
        }
-       
+
        public Long getLoginError() {
                return loginError;
        }
-       
+
        public static WebSession get() {
                return (WebSession)AbstractAuthenticatedWebSession.get();
        }
-       
+
        @Override
        public void setLanguage(long languageId) {
                this.languageId = languageId;
        }
-       
+
        public static long getLanguage() {
                checkIsInvalid();
                WebSession session = get();
@@ -388,7 +388,7 @@ public class WebSession extends Abstract
                }
                return session.languageId;
        }
-       
+
        public String getValidatedSid() {
                SessiondataDao sessionDao = getBean(SessiondataDao.class);
                Sessiondata sd = sessionDao.check(SID);
@@ -401,7 +401,7 @@ public class WebSession extends Abstract
                }
                return SID;
        }
-       
+
        public static String getSid() {
                return get().getValidatedSid();
        }
@@ -446,20 +446,20 @@ public class WebSession extends Abstract
        public static FastDateFormat getIsoDateFormat() {
                return get().ISO8601FORMAT;
        }
-       
+
        public static FastDateFormat getDateFormat() {
                return get().sdf;
        }
-       
+
        public static Set<Right> getRights() {
                checkIsInvalid();
                return get().rights;
        }
-       
+
        public static void setKickedByAdmin(boolean kicked) {
                get().kickedByAdmin = kicked;
        }
-       
+
        public boolean isKickedByAdmin() {
                return kickedByAdmin;
        }
@@ -472,7 +472,7 @@ public class WebSession extends Abstract
                this.area = area;
        }
 
-       
+
        public static Dashboard getDashboard() {
                Dashboard d = get().dashboard;
                if (d == null) {
@@ -481,7 +481,7 @@ public class WebSession extends Abstract
                }
                return d;
        }
-       
+
        public Locale getBrowserLocale(){
                return browserLocale;
        }
@@ -514,12 +514,12 @@ public class WebSession extends Abstract
                }
                return _zone == null ? null : _zone.getID();
        }
-       
+
        public static TimeZone getClientTimeZone() {
                String tzCode = get().getClientTZCode();
                return tzCode == null ? null : TimeZone.getTimeZone(tzCode);
        }
-       
+
        private void initDashboard() {
                DashboardContext dashboardContext = getDashboardContext();
                dashboard = 
(UserDashboard)dashboardContext.getDashboardPersister().load();
@@ -597,12 +597,12 @@ public class WebSession extends Abstract
        public long getOmLanguage() {
                return getLanguage();
        }
-       
+
        private static void checkIsInvalid() {
                if (isInvaldSession(get().getId())) {
                        setKickedByAdmin(true);
                        removeInvalidSession(get().getId());
-                       org.apache.wicket.Session session = 
(org.apache.wicket.Session)get();
+                       org.apache.wicket.Session session = get();
                        session.invalidate();
                        Application.get().restartResponseAtSignInPage();
                }

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml?rev=1779468&r1=1779467&r2=1779468&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml
 Thu Jan 19 14:45:20 2017
@@ -282,6 +282,9 @@
                        <ref bean="userWebService"/>
                        <ref bean="netTestWebService"/> <!-- JaxRs only -->
                </jaxrs:serviceBeans>
+               <jaxrs:providers>
+                       <bean id="omParamProvider" 
class="org.apache.openmeetings.webservice.util.OmParamConverterProvider"/>
+               </jaxrs:providers>
        </jaxrs:server>
        <jaxws:endpoint id="calendarServiceWS" address="/CalendarService" 
implementor="#calendarWebService"/>
        <jaxws:endpoint id="errorServiceWS" address="/ErrorService" 
implementor="#errorWebService" />

Added: 
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentParamConverter.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentParamConverter.java?rev=1779468&view=auto
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentParamConverter.java
 (added)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentParamConverter.java
 Thu Jan 19 14:45:20 2017
@@ -0,0 +1,74 @@
+/*
+ * 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.webservice.util;
+
+import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_FULL_FORMAT;
+
+import javax.ws.rs.ext.ParamConverter;
+
+import org.apache.openmeetings.db.dto.calendar.AppointmentDTO;
+import org.apache.openmeetings.db.dto.calendar.MeetingMemberDTO;
+import org.apache.openmeetings.db.dto.room.RoomDTO;
+import org.apache.openmeetings.db.dto.user.UserDTO;
+import org.apache.openmeetings.db.entity.calendar.Appointment.Reminder;
+import org.apache.wicket.ajax.json.JSONArray;
+import org.apache.wicket.ajax.json.JSONObject;
+
+public class AppointmentParamConverter implements 
ParamConverter<AppointmentDTO> {
+       @Override
+       public AppointmentDTO fromString(String val) {
+               JSONObject o = new JSONObject(val);
+               AppointmentDTO a = new AppointmentDTO();
+               a.setId(o.optLong("id"));
+               a.setTitle(o.optString("title"));
+               a.setLocation(o.optString("location"));
+               a.setOwner(UserDTO.get(o.optJSONObject("owner")));
+               a.setStart(CalendarParamConverter.get(o.optString("start"), 
a.getOwner().getTimeZoneId()));
+               a.setEnd(CalendarParamConverter.get(o.optString("end"), 
a.getOwner().getTimeZoneId()));
+               a.setDescription(o.optString("description"));
+               a.setInserted(DateParamConverter.get(o.optString("inserted")));
+               a.setInserted(DateParamConverter.get(o.optString("updated")));
+               a.setDeleted(o.optBoolean("inserted"));
+               a.setReminder(Reminder.valueOf(o.optString("reminder")));
+               a.setRoom(RoomDTO.get(o.optJSONObject("room")));
+               a.setIcalId(o.optString("icalId"));
+               JSONArray mm = o.optJSONArray("meetingMembers");
+               if (mm != null) {
+                       for (int i = 0; i < mm.length(); ++i) {
+                               
a.getMeetingMembers().add(MeetingMemberDTO.get(mm.getJSONObject(i)));
+                       }
+               }
+               a.setLanguageId(o.optLong("languageId"));
+               a.setPassword(o.optString("password"));
+               a.setPasswordProtected(o.optBoolean("passwordProtected"));
+               a.setConnectedEvent(o.optBoolean("connectedEvent"));
+               a.setReminderEmailSend(o.optBoolean("reminderEmailSend"));
+               return a;
+       }
+
+       @Override
+       public String toString(AppointmentDTO val) {
+               return new JSONObject(this)
+                               .put("start", 
ISO8601_FULL_FORMAT.format(val.getStart()))
+                               .put("end", 
ISO8601_FULL_FORMAT.format(val.getEnd()))
+                               .put("inserted", 
ISO8601_FULL_FORMAT.format(val.getInserted()))
+                               .put("updated", 
ISO8601_FULL_FORMAT.format(val.getUpdated()))
+                               .toString();
+       }
+}

Added: 
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/CalendarParamConverter.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/CalendarParamConverter.java?rev=1779468&view=auto
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/CalendarParamConverter.java
 (added)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/CalendarParamConverter.java
 Thu Jan 19 14:45:20 2017
@@ -0,0 +1,46 @@
+/*
+ * 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.webservice.util;
+
+import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_FULL_FORMAT;
+
+import java.util.Calendar;
+import java.util.TimeZone;
+
+import javax.ws.rs.ext.ParamConverter;
+
+public class CalendarParamConverter implements ParamConverter<Calendar> {
+       public static Calendar get(String val, String tzId) {
+               Calendar c = Calendar.getInstance(TimeZone.getTimeZone(tzId));
+               c.setTime(DateParamConverter.get(val));
+               return c;
+       }
+
+       @Override
+       public Calendar fromString(String val) {
+               Calendar c = Calendar.getInstance();
+               c.setTime(DateParamConverter.get(val));
+               return c;
+       }
+
+       @Override
+       public String toString(Calendar val) {
+               return ISO8601_FULL_FORMAT.format(val);
+       }
+}

Added: 
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/DateParamConverter.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/DateParamConverter.java?rev=1779468&view=auto
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/DateParamConverter.java
 (added)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/DateParamConverter.java
 Thu Jan 19 14:45:20 2017
@@ -0,0 +1,55 @@
+/*
+ * 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.webservice.util;
+
+import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_DATETIME_FORMAT;
+import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_DATE_FORMAT;
+import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_FULL_FORMAT;
+
+import java.text.ParseException;
+import java.util.Date;
+
+import javax.ws.rs.ext.ParamConverter;
+
+import org.apache.commons.lang3.time.FastDateFormat;
+
+public class DateParamConverter implements ParamConverter<Date> {
+       private final static FastDateFormat[] formats = new FastDateFormat[] { 
ISO8601_FULL_FORMAT, ISO8601_DATETIME_FORMAT, ISO8601_DATE_FORMAT };
+
+       static Date get(String val) {
+               for (FastDateFormat df : formats) {
+                       try {
+                               return df.parse(val);
+                       } catch (ParseException e) {
+                               // no-op
+                       }
+               }
+               throw new IllegalArgumentException("Unparsable format");
+       }
+
+       @Override
+       public Date fromString(String val) {
+               return get(val);
+       }
+
+       @Override
+       public String toString(Date val) {
+               return ISO8601_FULL_FORMAT.format(val);
+       }
+}

Added: 
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/OmParamConverterProvider.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/OmParamConverterProvider.java?rev=1779468&view=auto
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/OmParamConverterProvider.java
 (added)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/OmParamConverterProvider.java
 Thu Jan 19 14:45: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.webservice.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Calendar;
+import java.util.Date;
+
+import javax.ws.rs.ext.ParamConverter;
+import javax.ws.rs.ext.ParamConverterProvider;
+
+import org.apache.openmeetings.db.dto.calendar.AppointmentDTO;
+
+public class OmParamConverterProvider implements ParamConverterProvider {
+
+       @SuppressWarnings("unchecked")
+       @Override
+       public <T> ParamConverter<T> getConverter(Class<T> rawType, Type 
genericType, Annotation[] annotations) {
+               if (Calendar.class.isAssignableFrom(rawType)) {
+                       return (ParamConverter<T>)new CalendarParamConverter();
+               } else if (Date.class.isAssignableFrom(rawType)) {
+                       return (ParamConverter<T>)new DateParamConverter();
+               } else if (AppointmentDTO.class.isAssignableFrom(rawType)) {
+                       return (ParamConverter<T>)new DateParamConverter();
+               }
+               return null;
+       }
+}

Modified: 
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java?rev=1779468&r1=1779467&r2=1779468&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/calendar/AppointmentDTO.java
 Thu Jan 19 14:45:20 2017
@@ -18,10 +18,7 @@
  */
 package org.apache.openmeetings.db.dto.calendar;
 
-import static org.apache.openmeetings.util.CalendarPatterns.ISO8601_FORMAT;
-
 import java.io.Serializable;
-import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
@@ -39,7 +36,6 @@ import org.apache.openmeetings.db.dto.us
 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.wicket.ajax.json.JSONArray;
 import org.apache.wicket.ajax.json.JSONObject;
 
 @XmlRootElement
@@ -284,53 +280,8 @@ public class AppointmentDTO implements S
                this.password = password;
        }
 
-       private static Date optDate(JSONObject o, String prop) throws 
ParseException {
-               return ISO8601_FORMAT.parse(o.optString(prop));
-       }
-
-       private static Calendar optCal(AppointmentDTO a, JSONObject o, String 
prop) throws ParseException {
-               Calendar c = 
Calendar.getInstance(TimeZone.getTimeZone(a.owner.getTimeZoneId()));
-               c.setTime(ISO8601_FORMAT.parse(o.optString(prop)));
-               return c;
-       }
-
-       public static AppointmentDTO fromString(String s) throws ParseException 
{
-               JSONObject o = new JSONObject(s);
-               AppointmentDTO a = new AppointmentDTO();
-               a.id = o.optLong("id");
-               a.title = o.optString("title");
-               a.location = o.optString("location");
-               a.owner = UserDTO.get(o.optJSONObject("owner"));
-               a.start = optCal(a, o, "start");
-               a.end = optCal(a, o, "end");
-               a.description = o.optString("description");
-               a.inserted = optDate(o, "inserted");
-               a.updated = optDate(o, "updated");
-               a.deleted = o.optBoolean("inserted");
-               a.reminder = Reminder.valueOf(o.optString("reminder"));
-               a.room = RoomDTO.get(o.optJSONObject("room"));
-               a.icalId = o.optString("icalId");
-               JSONArray mm = o.optJSONArray("meetingMembers");
-               if (mm != null) {
-                       for (int i = 0; i < mm.length(); ++i) {
-                               
a.meetingMembers.add(MeetingMemberDTO.get(mm.getJSONObject(i)));
-                       }
-               }
-               a.languageId = o.optLong("languageId");
-               a.password = o.optString("password");
-               a.passwordProtected = o.optBoolean("passwordProtected");
-               a.connectedEvent = o.optBoolean("connectedEvent");
-               a.reminderEmailSend = o.optBoolean("reminderEmailSend");
-               return a;
-       }
-
        @Override
        public String toString() {
-               return new JSONObject(this)
-                       .put("start", ISO8601_FORMAT.format(start))
-                       .put("end", ISO8601_FORMAT.format(end))
-                       .put("inserted", ISO8601_FORMAT.format(inserted))
-                       .put("updated", ISO8601_FORMAT.format(updated))
-                       .toString();
+               return new JSONObject(this).toString();
        }
 }

Modified: 
openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/CalendarPatterns.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/CalendarPatterns.java?rev=1779468&r1=1779467&r2=1779468&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/CalendarPatterns.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/CalendarPatterns.java
 Thu Jan 19 14:45:20 2017
@@ -41,9 +41,13 @@ public class CalendarPatterns {
        public static final FastDateFormat dateFormat__yyyyMMddHHmmss = 
FastDateFormat.getInstance("yyyy.MM.dd HH:mm:ss");
        public static final FastDateFormat STREAM_DATE_FORMAT = 
FastDateFormat.getInstance("yyyy_MM_dd_HH_mm_ss");
        public static final String FULL_DF_PATTERN = "dd.MM.yyyy HH:mm:ss z 
(Z)";
-       public static final String ISO8601_FORMAT_STRING = 
"yyyy-MM-dd'T'HH:mm:ssZ";
+       public static final String ISO8601_FULL_FORMAT_STRING = 
"yyyy-MM-dd'T'HH:mm:ssZ";
+       public static final String ISO8601_DATETIME_FORMAT_STRING = 
"yyyy-MM-dd'T'HH:mm:ss";
+       public static final String ISO8601_DATE_FORMAT_STRING = "yyyy-MM-dd";
        public static final FastDateFormat FULL_DATE_FORMAT = 
FastDateFormat.getInstance(FULL_DF_PATTERN);
-       public static final FastDateFormat ISO8601_FORMAT = 
FastDateFormat.getInstance(ISO8601_FORMAT_STRING);
+       public static final FastDateFormat ISO8601_FULL_FORMAT = 
FastDateFormat.getInstance(ISO8601_FULL_FORMAT_STRING);
+       public static final FastDateFormat ISO8601_DATETIME_FORMAT = 
FastDateFormat.getInstance(ISO8601_DATETIME_FORMAT_STRING);
+       public static final FastDateFormat ISO8601_DATE_FORMAT = 
FastDateFormat.getInstance(ISO8601_DATE_FORMAT_STRING);
 
        public static String getDateByMiliSeconds(Date t) {
                return dateFormat__yyyyMMddHHmmss.format(t);

Modified: 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WebSession.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WebSession.java?rev=1779468&r1=1779467&r2=1779468&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WebSession.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/WebSession.java
 Thu Jan 19 14:45:20 2017
@@ -19,7 +19,7 @@
 package org.apache.openmeetings.web.app;
 
 import static java.text.DateFormat.SHORT;
-import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_FORMAT_STRING;
+import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_FULL_FORMAT_STRING;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DASHBOARD_SHOW_MYROOMS_KEY;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DASHBOARD_SHOW_RSS_KEY;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DEFAULT_LANG_KEY;
@@ -321,11 +321,11 @@ public class WebSession extends Abstract
                languageId = u.getLanguageId();
                externalType = u.getExternalType();
                tz = getBean(TimezoneUtil.class).getTimeZone(u);
-               ISO8601FORMAT = 
FastDateFormat.getInstance(ISO8601_FORMAT_STRING, tz);
+               ISO8601FORMAT = 
FastDateFormat.getInstance(ISO8601_FULL_FORMAT_STRING, tz);
                setLocale(getLocale(u));
                sdf = FastDateFormat.getDateTimeInstance(SHORT, SHORT, 
getLocale());
        }
-       
+
        public boolean signIn(String login, String password, Type type, Long 
domainId) {
                try {
                        User u = null;
@@ -354,7 +354,7 @@ public class WebSession extends Abstract
                }
                return false;
        }
-       
+
        public boolean signIn(User u) {
                if (u == null) {
                        return false;
@@ -362,20 +362,20 @@ public class WebSession extends Abstract
                setUser(u, null);
                return true;
        }
-       
+
        public Long getLoginError() {
                return loginError;
        }
-       
+
        public static WebSession get() {
                return (WebSession)AbstractAuthenticatedWebSession.get();
        }
-       
+
        @Override
        public void setLanguage(long languageId) {
                this.languageId = languageId;
        }
-       
+
        public static long getLanguage() {
                checkIsInvalid();
                WebSession session = get();
@@ -388,7 +388,7 @@ public class WebSession extends Abstract
                }
                return session.languageId;
        }
-       
+
        public String getValidatedSid() {
                SessiondataDao sessionDao = getBean(SessiondataDao.class);
                Sessiondata sd = sessionDao.check(SID);
@@ -401,7 +401,7 @@ public class WebSession extends Abstract
                }
                return SID;
        }
-       
+
        public static String getSid() {
                return get().getValidatedSid();
        }
@@ -446,20 +446,20 @@ public class WebSession extends Abstract
        public static FastDateFormat getIsoDateFormat() {
                return get().ISO8601FORMAT;
        }
-       
+
        public static FastDateFormat getDateFormat() {
                return get().sdf;
        }
-       
+
        public static Set<Right> getRights() {
                checkIsInvalid();
                return get().rights;
        }
-       
+
        public static void setKickedByAdmin(boolean kicked) {
                get().kickedByAdmin = kicked;
        }
-       
+
        public boolean isKickedByAdmin() {
                return kickedByAdmin;
        }
@@ -472,7 +472,7 @@ public class WebSession extends Abstract
                this.area = area;
        }
 
-       
+
        public static Dashboard getDashboard() {
                Dashboard d = get().dashboard;
                if (d == null) {
@@ -481,7 +481,7 @@ public class WebSession extends Abstract
                }
                return d;
        }
-       
+
        public Locale getBrowserLocale(){
                return browserLocale;
        }
@@ -514,12 +514,12 @@ public class WebSession extends Abstract
                }
                return _zone == null ? null : _zone.getID();
        }
-       
+
        public static TimeZone getClientTimeZone() {
                String tzCode = get().getClientTZCode();
                return tzCode == null ? null : TimeZone.getTimeZone(tzCode);
        }
-       
+
        private void initDashboard() {
                DashboardContext dashboardContext = getDashboardContext();
                dashboard = 
(UserDashboard)dashboardContext.getDashboardPersister().load();
@@ -597,12 +597,12 @@ public class WebSession extends Abstract
        public long getOmLanguage() {
                return getLanguage();
        }
-       
+
        private static void checkIsInvalid() {
                if (isInvaldSession(get().getId())) {
                        setKickedByAdmin(true);
                        removeInvalidSession(get().getId());
-                       org.apache.wicket.Session session = 
(org.apache.wicket.Session)get();
+                       org.apache.wicket.Session session = get();
                        session.invalidate();
                        Application.get().restartResponseAtSignInPage();
                }

Modified: 
openmeetings/application/trunk/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml?rev=1779468&r1=1779467&r2=1779468&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml
 (original)
+++ 
openmeetings/application/trunk/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml
 Thu Jan 19 14:45:20 2017
@@ -280,6 +280,9 @@
                        <ref bean="userWebService"/>
                        <ref bean="netTestWebService"/> <!-- JaxRs only -->
                </jaxrs:serviceBeans>
+               <jaxrs:providers>
+                       <bean id="omParamProvider" 
class="org.apache.openmeetings.webservice.util.OmParamConverterProvider"/>
+               </jaxrs:providers>
        </jaxrs:server>
        <jaxws:endpoint id="calendarServiceWS" address="/CalendarService" 
implementor="#calendarWebService"/>
        <jaxws:endpoint id="errorServiceWS" address="/ErrorService" 
implementor="#errorWebService" />

Added: 
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=1779468&view=auto
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentParamConverter.java
 (added)
+++ 
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/AppointmentParamConverter.java
 Thu Jan 19 14:45:20 2017
@@ -0,0 +1,74 @@
+/*
+ * 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.webservice.util;
+
+import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_FULL_FORMAT;
+
+import javax.ws.rs.ext.ParamConverter;
+
+import org.apache.openmeetings.db.dto.calendar.AppointmentDTO;
+import org.apache.openmeetings.db.dto.calendar.MeetingMemberDTO;
+import org.apache.openmeetings.db.dto.room.RoomDTO;
+import org.apache.openmeetings.db.dto.user.UserDTO;
+import org.apache.openmeetings.db.entity.calendar.Appointment.Reminder;
+import org.apache.wicket.ajax.json.JSONArray;
+import org.apache.wicket.ajax.json.JSONObject;
+
+public class AppointmentParamConverter implements 
ParamConverter<AppointmentDTO> {
+       @Override
+       public AppointmentDTO fromString(String val) {
+               JSONObject o = new JSONObject(val);
+               AppointmentDTO a = new AppointmentDTO();
+               a.setId(o.optLong("id"));
+               a.setTitle(o.optString("title"));
+               a.setLocation(o.optString("location"));
+               a.setOwner(UserDTO.get(o.optJSONObject("owner")));
+               a.setStart(CalendarParamConverter.get(o.optString("start"), 
a.getOwner().getTimeZoneId()));
+               a.setEnd(CalendarParamConverter.get(o.optString("end"), 
a.getOwner().getTimeZoneId()));
+               a.setDescription(o.optString("description"));
+               a.setInserted(DateParamConverter.get(o.optString("inserted")));
+               a.setInserted(DateParamConverter.get(o.optString("updated")));
+               a.setDeleted(o.optBoolean("inserted"));
+               a.setReminder(Reminder.valueOf(o.optString("reminder")));
+               a.setRoom(RoomDTO.get(o.optJSONObject("room")));
+               a.setIcalId(o.optString("icalId"));
+               JSONArray mm = o.optJSONArray("meetingMembers");
+               if (mm != null) {
+                       for (int i = 0; i < mm.length(); ++i) {
+                               
a.getMeetingMembers().add(MeetingMemberDTO.get(mm.getJSONObject(i)));
+                       }
+               }
+               a.setLanguageId(o.optLong("languageId"));
+               a.setPassword(o.optString("password"));
+               a.setPasswordProtected(o.optBoolean("passwordProtected"));
+               a.setConnectedEvent(o.optBoolean("connectedEvent"));
+               a.setReminderEmailSend(o.optBoolean("reminderEmailSend"));
+               return a;
+       }
+
+       @Override
+       public String toString(AppointmentDTO val) {
+               return new JSONObject(this)
+                               .put("start", 
ISO8601_FULL_FORMAT.format(val.getStart()))
+                               .put("end", 
ISO8601_FULL_FORMAT.format(val.getEnd()))
+                               .put("inserted", 
ISO8601_FULL_FORMAT.format(val.getInserted()))
+                               .put("updated", 
ISO8601_FULL_FORMAT.format(val.getUpdated()))
+                               .toString();
+       }
+}

Added: 
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/CalendarParamConverter.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/CalendarParamConverter.java?rev=1779468&view=auto
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/CalendarParamConverter.java
 (added)
+++ 
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/CalendarParamConverter.java
 Thu Jan 19 14:45:20 2017
@@ -0,0 +1,46 @@
+/*
+ * 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.webservice.util;
+
+import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_FULL_FORMAT;
+
+import java.util.Calendar;
+import java.util.TimeZone;
+
+import javax.ws.rs.ext.ParamConverter;
+
+public class CalendarParamConverter implements ParamConverter<Calendar> {
+       public static Calendar get(String val, String tzId) {
+               Calendar c = Calendar.getInstance(TimeZone.getTimeZone(tzId));
+               c.setTime(DateParamConverter.get(val));
+               return c;
+       }
+
+       @Override
+       public Calendar fromString(String val) {
+               Calendar c = Calendar.getInstance();
+               c.setTime(DateParamConverter.get(val));
+               return c;
+       }
+
+       @Override
+       public String toString(Calendar val) {
+               return ISO8601_FULL_FORMAT.format(val);
+       }
+}

Added: 
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/DateParamConverter.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/DateParamConverter.java?rev=1779468&view=auto
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/DateParamConverter.java
 (added)
+++ 
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/DateParamConverter.java
 Thu Jan 19 14:45:20 2017
@@ -0,0 +1,55 @@
+/*
+ * 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.webservice.util;
+
+import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_DATETIME_FORMAT;
+import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_DATE_FORMAT;
+import static 
org.apache.openmeetings.util.CalendarPatterns.ISO8601_FULL_FORMAT;
+
+import java.text.ParseException;
+import java.util.Date;
+
+import javax.ws.rs.ext.ParamConverter;
+
+import org.apache.commons.lang3.time.FastDateFormat;
+
+public class DateParamConverter implements ParamConverter<Date> {
+       private final static FastDateFormat[] formats = new FastDateFormat[] { 
ISO8601_FULL_FORMAT, ISO8601_DATETIME_FORMAT, ISO8601_DATE_FORMAT };
+
+       static Date get(String val) {
+               for (FastDateFormat df : formats) {
+                       try {
+                               return df.parse(val);
+                       } catch (ParseException e) {
+                               // no-op
+                       }
+               }
+               throw new IllegalArgumentException("Unparsable format");
+       }
+
+       @Override
+       public Date fromString(String val) {
+               return get(val);
+       }
+
+       @Override
+       public String toString(Date val) {
+               return ISO8601_FULL_FORMAT.format(val);
+       }
+}

Added: 
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/OmParamConverterProvider.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/OmParamConverterProvider.java?rev=1779468&view=auto
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/OmParamConverterProvider.java
 (added)
+++ 
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/util/OmParamConverterProvider.java
 Thu Jan 19 14:45: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.webservice.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Calendar;
+import java.util.Date;
+
+import javax.ws.rs.ext.ParamConverter;
+import javax.ws.rs.ext.ParamConverterProvider;
+
+import org.apache.openmeetings.db.dto.calendar.AppointmentDTO;
+
+public class OmParamConverterProvider implements ParamConverterProvider {
+
+       @SuppressWarnings("unchecked")
+       @Override
+       public <T> ParamConverter<T> getConverter(Class<T> rawType, Type 
genericType, Annotation[] annotations) {
+               if (Calendar.class.isAssignableFrom(rawType)) {
+                       return (ParamConverter<T>)new CalendarParamConverter();
+               } else if (Date.class.isAssignableFrom(rawType)) {
+                       return (ParamConverter<T>)new DateParamConverter();
+               } else if (AppointmentDTO.class.isAssignableFrom(rawType)) {
+                       return (ParamConverter<T>)new DateParamConverter();
+               }
+               return null;
+       }
+}


Reply via email to