Class RedmineJSONBuilder


  • public class RedmineJSONBuilder
    extends java.lang.Object
    Converts Redmine objects to JSon format.
    • Constructor Detail

      • RedmineJSONBuilder

        public RedmineJSONBuilder()
    • Method Detail

      • writeProject

        public static void writeProject​(org.json.JSONWriter writer,
                                        Project project)
                                 throws java.lang.IllegalArgumentException,
                                        org.json.JSONException
        Writes a "create project" request.
        Parameters:
        writer - project writer.
        project - project to create.
        Throws:
        java.lang.IllegalArgumentException - if some project fields are not configured.
        org.json.JSONException - if IO error occurs.
      • toSimpleJSON

        public static <T> java.lang.String toSimpleJSON​(java.lang.String tag,
                                                        T object,
                                                        JsonObjectWriter<T> writer)
                                                 throws RedmineInternalError
        Converts object to a "simple" json.
        Parameters:
        tag - object tag.
        object - object to convert.
        writer - object writer.
        Returns:
        object String representation.
        Throws:
        RedmineInternalError - if conversion fails.
      • writeProject

        public static void writeProject​(Project project,
                                        org.json.JSONWriter writer)
                                 throws org.json.JSONException
        Throws:
        org.json.JSONException
      • writeCategory

        public static void writeCategory​(org.json.JSONWriter writer,
                                         IssueCategory category)
                                  throws org.json.JSONException
        Throws:
        org.json.JSONException
      • writeUser

        public static void writeUser​(org.json.JSONWriter writer,
                                     User user)
                              throws org.json.JSONException
        Throws:
        org.json.JSONException
      • writeGroup

        public static void writeGroup​(org.json.JSONWriter writer,
                                      Group group)
                               throws org.json.JSONException
        Throws:
        org.json.JSONException
      • writeIssue

        public static void writeIssue​(org.json.JSONWriter writer,
                                      Issue issue)
                               throws org.json.JSONException
        Throws:
        org.json.JSONException
      • addIfSetShort2

        public static void addIfSetShort2​(org.json.JSONWriter writer,
                                          java.lang.String jsonKeyName,
                                          PropertyStorage storage,
                                          Property<java.util.Date> property)
                                   throws org.json.JSONException
        Throws:
        org.json.JSONException
      • writeUpload

        public static void writeUpload​(org.json.JSONWriter writer,
                                       Attachment attachment)
                                throws org.json.JSONException
        Throws:
        org.json.JSONException
      • writeMembership

        public static void writeMembership​(org.json.JSONWriter writer,
                                           Membership membership)
                                    throws org.json.JSONException
        Throws:
        org.json.JSONException
      • writeWatchers

        public static void writeWatchers​(org.json.JSONWriter writer,
                                         java.util.Collection<Watcher> watchers)
                                  throws org.json.JSONException
        Throws:
        org.json.JSONException
      • writeWikiPageDetail

        public static void writeWikiPageDetail​(org.json.JSONWriter writer,
                                               WikiPageDetail detail)
                                        throws org.json.JSONException
        Throws:
        org.json.JSONException