Class GraphObject

java.lang.Object
davmail.exchange.graph.GraphObject

public class GraphObject extends Object
Wrapper for Graph API JsonObject
  • Field Details

    • LOGGER

      protected static final org.apache.log4j.Logger LOGGER
    • jsonObject

      protected final org.codehaus.jettison.json.JSONObject jsonObject
    • statusCode

      protected int statusCode
    • vTodoToTaskStatusMap

      protected static final Map<String,String> vTodoToTaskStatusMap
    • taskTovTodoStatusMap

      protected static final Map<String,String> taskTovTodoStatusMap
    • importanceToPriorityMap

      protected static final Map<String,String> importanceToPriorityMap
    • priorityToImportanceMap

      protected static final Map<String,String> priorityToImportanceMap
  • Constructor Details

    • GraphObject

      public GraphObject()
    • GraphObject

      public GraphObject(org.codehaus.jettison.json.JSONObject jsonObject)
  • Method Details

    • optString

      public String optString(String key)
    • optString

      public String optString(GraphField field)
    • formatEmailAddress

      protected String formatEmailAddress(org.codehaus.jettison.json.JSONObject jsonObject)
    • getCalendarUid

      public String getCalendarUid()
    • optJSONArray

      public org.codehaus.jettison.json.JSONArray optJSONArray(String key)
    • put

      public GraphObject put(String alias, String value) throws org.codehaus.jettison.json.JSONException
      Set value for alias. First map property alias to a field to determine graph id, then set graph property or singleValueExtendedProperty
      Parameters:
      alias - field alias
      value - property value
      Throws:
      org.codehaus.jettison.json.JSONException - on error
    • put

      public GraphObject put(String alias, boolean value) throws org.codehaus.jettison.json.JSONException
      Set the boolean value on the field defined by alias. First map property alias to a field to determine graph id, then set graph property or singleValueExtendedProperty
      Parameters:
      alias - field alias
      value - property value
      Throws:
      org.codehaus.jettison.json.JSONException - on error
    • put

      public GraphObject put(String key, org.codehaus.jettison.json.JSONArray value) throws org.codehaus.jettison.json.JSONException
      Throws:
      org.codehaus.jettison.json.JSONException
    • put

      public GraphObject put(String key, org.codehaus.jettison.json.JSONObject value) throws org.codehaus.jettison.json.JSONException
      Throws:
      org.codehaus.jettison.json.JSONException
    • setCategories

      public void setCategories(String values) throws org.codehaus.jettison.json.JSONException
      Set categories from comma separated values.
      Parameters:
      values - comma separated values
      Throws:
      org.codehaus.jettison.json.JSONException - on error
    • setCategories

      public void setCategories(String[] values) throws org.codehaus.jettison.json.JSONException
      Throws:
      org.codehaus.jettison.json.JSONException
    • getSingleValueExtendedProperties

      protected org.codehaus.jettison.json.JSONArray getSingleValueExtendedProperties() throws org.codehaus.jettison.json.JSONException
      Get a singleValueExtendedProperties JSON array. Create an empty JSON array on the first call.
      Returns:
      singleValueExtendedProperties array
      Throws:
      org.codehaus.jettison.json.JSONException - on error
    • putSingleValueExtendedProperty

      protected void putSingleValueExtendedProperty(String key, Object value) throws org.codehaus.jettison.json.JSONException
      Set or replace a single value extended property. If a property with the same id already exists, replace its value; otherwise append a new entry.
      Parameters:
      key - property id
      value - property value
      Throws:
      org.codehaus.jettison.json.JSONException - on error
    • getString

      public String getString(String key) throws org.codehaus.jettison.json.JSONException
      Get mandatory property value.
      Parameters:
      key - property name
      Returns:
      value
      Throws:
      org.codehaus.jettison.json.JSONException - on missing property
    • optSectionString

      public String optSectionString(String section, String key)
      Get optional parameter from JSON property.
      Parameters:
      section - JSON property name
      key - internal property name
      Returns:
      value or null
    • getBoolean

      public boolean getBoolean(String key) throws org.codehaus.jettison.json.JSONException
      Throws:
      org.codehaus.jettison.json.JSONException
    • optBoolean

      public boolean optBoolean(String key)
    • getBoolean

      public boolean getBoolean(GraphField field) throws org.codehaus.jettison.json.JSONException
      Throws:
      org.codehaus.jettison.json.JSONException
    • optBoolean

      public boolean optBoolean(GraphField field)
    • optJSONObject

      public org.codehaus.jettison.json.JSONObject optJSONObject(String key)
    • optDateTimeTimeZone

      public Date optDateTimeTimeZone(String key) throws DavMailException
      Convert datetimetimezone to java date. Graph API returns some dates as json object with dateTime and timeZone, see datetimetimezone
      Parameters:
      key - property key, e.g. dueDateTime
      Returns:
      java date
      Throws:
      DavMailException - on error
    • getRecurrenceId

      public VProperty getRecurrenceId() throws DavMailException
      Compute recurrenceId property based on the original start and timezone.
      Returns:
      recurrenceId property
      Throws:
      DavMailException - on error
    • optInt

      public int optInt(String key)
    • toString

      public String toString(int indentFactor) throws org.codehaus.jettison.json.JSONException
      Throws:
      org.codehaus.jettison.json.JSONException
    • setTaskStatusFromVTodo

      public void setTaskStatusFromVTodo(VObject vEvent) throws org.codehaus.jettison.json.JSONException
      Throws:
      org.codehaus.jettison.json.JSONException
    • getVTodoStatusFromTask

      public String getVTodoStatusFromTask()
    • getTaskPriority

      protected String getTaskPriority()
    • setTaskImportanceFromVTodo

      public void setTaskImportanceFromVTodo(VObject vEvent) throws org.codehaus.jettison.json.JSONException
      Throws:
      org.codehaus.jettison.json.JSONException