fluid-api/src/main/java/com/fluidbpm/program/api/vo/mail/MailMessage.java
@Override
    public JSONObject toJsonObject() throws JSONException
    {
        JSONObject returnVal = super.toJsonObject();

        //Mail Template...
        if(this.getMailTemplate() != null)
        {
            returnVal.put(JSONMapping.MAIL_TEMPLATE, this.getMailTemplate());
        }

        //Mail SMTP Server...
        if(this.getMailSMTPServer() != null)
        {
            returnVal.put(JSONMapping.MAIL_SMTP_SERVER, this.getMailSMTPServer());
        }

        //Recipients...
        if(this.getRecipients() != null && this.getRecipients().length > 0)
        {
            JSONArray jsonArray = new JSONArray();

            for(String item : this.getRecipients())
            {
                jsonArray.put(item);
            }

            returnVal.put(JSONMapping.RECIPIENTS, jsonArray);
        }

        //Attachments...
        if(this.getAttachments() != null && !this.getAttachments().isEmpty())
        {
            JSONArray jsonArray = new JSONArray();

            for(MailMessageAttachment item : this.getAttachments())
            {
                jsonArray.put(item.toJsonObject());
            }

            returnVal.put(JSONMapping.ATTACHMENTS, jsonArray);
        }

        //Name Values...
        if(this.getNameValues() != null &&
                !this.getNameValues().isEmpty())
        {
            JSONArray jsonArray = new JSONArray();

            for(MailMessageNameValue item : this.getNameValues())
            {
                jsonArray.put(item.toJsonObject());
            }

            returnVal.put(JSONMapping.NAME_VALUES, jsonArray);
        }

        return returnVal;
    }
@Override
    public JSONObject toJsonObject() throws JSONException
    {
        JSONObject returnVal = super.toJsonObject();

        //Mail Template...
        if(this.getMailTemplate() != null)
        {
            returnVal.put(JSONMapping.MAIL_TEMPLATE, this.getMailTemplate());
        }

        //Mail SMTP Server...
        if(this.getMailSMTPServer() != null)
        {
            returnVal.put(JSONMapping.MAIL_SMTP_SERVER, this.getMailSMTPServer());
        }

        //Recipients...
        if(this.getRecipients() != null && this.getRecipients().length > 0)
        {
            JSONArray jsonArray = new JSONArray();

            for(String item : this.getRecipients())
            {
                jsonArray.put(item);
            }

            returnVal.put(JSONMapping.RECIPIENTS, jsonArray);
        }

        //Attachments...
        if(this.getAttachments() != null && !this.getAttachments().isEmpty())
        {
            JSONArray jsonArray = new JSONArray();

            for(MailMessageAttachment item : this.getAttachments())
            {
                jsonArray.put(item.toJsonObject());
            }

            returnVal.put(JSONMapping.ATTACHMENTS, jsonArray);
        }

        //Name Values...
        if(this.getNameValues() != null &&
                !this.getNameValues().isEmpty())
        {
            JSONArray jsonArray = new JSONArray();

            for(MailMessageNameValue item : this.getNameValues())
            {
                jsonArray.put(item.toJsonObject());
            }

            returnVal.put(JSONMapping.NAME_VALUES, jsonArray);
        }

        return returnVal;
    }
@ Override public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; //Mail Template... if ( this . getMailTemplate ( ) != null ) { returnVal . put ( JSONMapping . MAIL_TEMPLATE , this . getMailTemplate ( ) ) ; } //Mail SMTP Server... if ( this . getMailSMTPServer ( ) != null ) { returnVal . put ( JSONMapping . MAIL_SMTP_SERVER , this . getMailSMTPServer ( ) ) ; } //Recipients... if ( this . getRecipients ( ) != null && this . getRecipients ( ) . length > 0 ) { JSONArray jsonArray = new JSONArray ( ) ; for ( String item : this . getRecipients ( ) ) { jsonArray . put ( item ) ; } returnVal . put ( JSONMapping . RECIPIENTS , jsonArray ) ; } //Attachments... if ( this . getAttachments ( ) != null && ! this . getAttachments ( ) . isEmpty ( ) ) { JSONArray jsonArray = new JSONArray ( ) ; for ( MailMessageAttachment item : this . getAttachments ( ) ) { jsonArray . put ( item . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . ATTACHMENTS , jsonArray ) ; } //Name Values... if ( this . getNameValues ( ) != null && ! this . getNameValues ( ) . isEmpty ( ) ) { JSONArray jsonArray = new JSONArray ( ) ; for ( MailMessageNameValue item : this . getNameValues ( ) ) { jsonArray . put ( item . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . NAME_VALUES , jsonArray ) ; } return returnVal ; }
Conversion to {@code JSONObject} from Java Object.

@return {@code JSONObject} representation of {@code MailMessage}
@throws JSONException If there is a problem with the JSON Body.

@see ABaseFluidJSONObject#toJsonObject()
Conversion to { @code JSONObject } from Java Object .