Class AbstractCalendarWebScript

    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.springframework.extensions.webscripts.AbstractWebScript

        org.springframework.extensions.webscripts.AbstractWebScript.ScriptDetails
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String addActivityEntry​(java.lang.String event, org.alfresco.service.cmr.calendar.CalendarEntry entry, org.alfresco.service.cmr.site.SiteInfo site, org.springframework.extensions.webscripts.WebScriptRequest req, org.json.simple.JSONObject json)
      Generates an activity entry for the entry
      protected java.util.Map<java.lang.String,​java.lang.Object> buildError​(java.lang.String message)
      Equivalent of jsonError in the old JavaScript controllers
      protected org.alfresco.query.PagingRequest buildPagingRequest​(org.springframework.extensions.webscripts.WebScriptRequest req)
      Builds up a listing Paging request, either using the defaults or the paging options specified
      protected org.alfresco.service.cmr.repository.NodeRef createIgnoreEvent​(org.springframework.extensions.webscripts.WebScriptRequest req, org.alfresco.service.cmr.calendar.CalendarEntry parent)
      For an event that is a recurring event, have an ignored child event generated for it
      protected abstract java.util.Map<java.lang.String,​java.lang.Object> executeImpl​(org.alfresco.service.cmr.site.SiteInfo site, java.lang.String eventName, org.springframework.extensions.webscripts.WebScriptRequest req, org.json.simple.JSONObject json, org.springframework.extensions.webscripts.Status status, org.springframework.extensions.webscripts.Cache cache)  
      protected java.util.Map<java.lang.String,​java.lang.Object> executeImpl​(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.Status status, org.springframework.extensions.webscripts.Cache cache)  
      protected boolean extractDates​(org.alfresco.service.cmr.calendar.CalendarEntry entry, org.json.simple.JSONObject json)
      Extracts the Start and End details, along with the All Day flag from the JSON, and returns if the event is all day or not
      protected java.lang.String getOrNull​(org.json.simple.JSONObject json, java.lang.String key)  
      protected java.util.Date parseDate​(java.lang.String date)
      Gets the date from the String, trying the various formats (New and Legacy) until one works...
      protected java.lang.String removeTimeZoneIfRequired​(java.util.Date date, java.lang.Boolean isAllDay, java.lang.Boolean removeTimezone)
      Removes the time zone for a given date if the Calendar Entry is an all day event
      protected java.lang.String removeTimeZoneIfRequired​(java.util.Date date, java.lang.Boolean isAllDay, java.lang.Boolean removeTimezone, java.lang.String datePattern)
      Removes the time zone for a given date if the Calendar Entry is an all day event
      void setActivityService​(org.alfresco.service.cmr.activities.ActivityService activityService)  
      void setCalendarService​(org.alfresco.service.cmr.calendar.CalendarService calendarService)  
      void setNodeService​(org.alfresco.service.cmr.repository.NodeService nodeService)  
      void setSiteService​(org.alfresco.service.cmr.site.SiteService siteService)  
      protected boolean useJSONErrors()
      Normally the Calendar webscripts return a 200 with JSON containing the error message.
      • Methods inherited from class org.springframework.extensions.webscripts.DeclarativeWebScript

        execute, executeFinallyImpl, executeImpl, executeImpl, getTemplateModel, renderFormatTemplate
      • Methods inherited from class org.springframework.extensions.webscripts.AbstractWebScript

        addModuleBundleToCache, checkModuleBundleCache, createArgs, createArgsM, createHeaders, createHeadersM, createScriptParameters, createStatusException, createTemplateParameters, executeScript, getContainer, getDescription, getExecuteScript, getResources, getStatusTemplate, init, renderString, renderString, renderTemplate, sendStatus, setURLModelFactory, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • CALENDAR_SERVICE_ACTIVITY_APP_NAME

        public static final java.lang.String CALENDAR_SERVICE_ACTIVITY_APP_NAME
        See Also:
        Constant Field Values
      • MSG_EVENT_NOT_FOUND

        protected static final java.lang.String MSG_EVENT_NOT_FOUND
        See Also:
        Constant Field Values
      • MSG_INVALID_JSON

        protected static final java.lang.String MSG_INVALID_JSON
        See Also:
        Constant Field Values
      • MAX_QUERY_ENTRY_COUNT

        protected static final int MAX_QUERY_ENTRY_COUNT
        When no maximum or paging info is given, what should we use?
        See Also:
        Constant Field Values
      • nodeService

        protected org.alfresco.service.cmr.repository.NodeService nodeService
      • siteService

        protected org.alfresco.service.cmr.site.SiteService siteService
      • activityService

        protected org.alfresco.service.cmr.activities.ActivityService activityService
      • calendarService

        protected org.alfresco.service.cmr.calendar.CalendarService calendarService
    • Constructor Detail

      • AbstractCalendarWebScript

        public AbstractCalendarWebScript()
    • Method Detail

      • setNodeService

        public void setNodeService​(org.alfresco.service.cmr.repository.NodeService nodeService)
      • setSiteService

        public void setSiteService​(org.alfresco.service.cmr.site.SiteService siteService)
      • setActivityService

        public void setActivityService​(org.alfresco.service.cmr.activities.ActivityService activityService)
      • setCalendarService

        public void setCalendarService​(org.alfresco.service.cmr.calendar.CalendarService calendarService)
      • parseDate

        protected java.util.Date parseDate​(java.lang.String date)
        Gets the date from the String, trying the various formats (New and Legacy) until one works...
      • extractDates

        protected boolean extractDates​(org.alfresco.service.cmr.calendar.CalendarEntry entry,
                                       org.json.simple.JSONObject json)
                                throws org.json.JSONException
        Extracts the Start and End details, along with the All Day flag from the JSON, and returns if the event is all day or not
        Throws:
        org.json.JSONException
      • getOrNull

        protected java.lang.String getOrNull​(org.json.simple.JSONObject json,
                                             java.lang.String key)
                                      throws org.json.JSONException
        Throws:
        org.json.JSONException
      • buildPagingRequest

        protected org.alfresco.query.PagingRequest buildPagingRequest​(org.springframework.extensions.webscripts.WebScriptRequest req)
        Builds up a listing Paging request, either using the defaults or the paging options specified
      • useJSONErrors

        protected boolean useJSONErrors()
        Normally the Calendar webscripts return a 200 with JSON containing the error message. Override this to switch to using HTTP status codes instead
      • buildError

        protected java.util.Map<java.lang.String,​java.lang.Object> buildError​(java.lang.String message)
        Equivalent of jsonError in the old JavaScript controllers
      • addActivityEntry

        protected java.lang.String addActivityEntry​(java.lang.String event,
                                                    org.alfresco.service.cmr.calendar.CalendarEntry entry,
                                                    org.alfresco.service.cmr.site.SiteInfo site,
                                                    org.springframework.extensions.webscripts.WebScriptRequest req,
                                                    org.json.simple.JSONObject json)
        Generates an activity entry for the entry
      • createIgnoreEvent

        protected org.alfresco.service.cmr.repository.NodeRef createIgnoreEvent​(org.springframework.extensions.webscripts.WebScriptRequest req,
                                                                                org.alfresco.service.cmr.calendar.CalendarEntry parent)
        For an event that is a recurring event, have an ignored child event generated for it
      • executeImpl

        protected java.util.Map<java.lang.String,​java.lang.Object> executeImpl​(org.springframework.extensions.webscripts.WebScriptRequest req,
                                                                                     org.springframework.extensions.webscripts.Status status,
                                                                                     org.springframework.extensions.webscripts.Cache cache)
        Overrides:
        executeImpl in class org.springframework.extensions.webscripts.DeclarativeWebScript
      • removeTimeZoneIfRequired

        protected java.lang.String removeTimeZoneIfRequired​(java.util.Date date,
                                                            java.lang.Boolean isAllDay,
                                                            java.lang.Boolean removeTimezone)
        Removes the time zone for a given date if the Calendar Entry is an all day event
        Returns:
        ISO 8601 formatted date String
      • removeTimeZoneIfRequired

        protected java.lang.String removeTimeZoneIfRequired​(java.util.Date date,
                                                            java.lang.Boolean isAllDay,
                                                            java.lang.Boolean removeTimezone,
                                                            java.lang.String datePattern)
        Removes the time zone for a given date if the Calendar Entry is an all day event
        Returns:
        ISO 8601 formatted date String if datePattern is null
      • executeImpl

        protected abstract java.util.Map<java.lang.String,​java.lang.Object> executeImpl​(org.alfresco.service.cmr.site.SiteInfo site,
                                                                                              java.lang.String eventName,
                                                                                              org.springframework.extensions.webscripts.WebScriptRequest req,
                                                                                              org.json.simple.JSONObject json,
                                                                                              org.springframework.extensions.webscripts.Status status,
                                                                                              org.springframework.extensions.webscripts.Cache cache)