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

        //Name...
        if(this.getName() != null)
        {
            returnVal.put(JSONMapping.NAME,this.getName());
        }

        //Description...
        if(this.getDescription() != null)
        {
            returnVal.put(JSONMapping.DESCRIPTION, this.getDescription());
        }

        //Flow Steps...
        if(this.getFlowSteps() != null && !this.getFlowSteps().isEmpty())
        {
            JSONArray jsonArray = new JSONArray();

            for(FlowStep rule : this.getFlowSteps())
            {
                jsonArray.put(rule.toJsonObject());
            }
            
            returnVal.put(JSONMapping.FLOW_STEPS, jsonArray);
        }

        //Date Created...
        if(this.getDateCreated() != null)
        {
            returnVal.put(JSONMapping.DATE_CREATED, this.getDateAsLongFromJson(
                    this.getDateCreated()));
        }

        //Date Last Updated...
        if(this.getDateLastUpdated() != null)
        {
            returnVal.put(JSONMapping.DATE_LAST_UPDATED, this.getDateAsLongFromJson(
                    this.getDateLastUpdated()));
        }

        return returnVal;
    }
@ Override public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; if ( this . getName ( ) != null ) { returnVal . put ( JSONMapping . NAME , this . getName ( ) ) ; } if ( this . getDescription ( ) != null ) { returnVal . put ( JSONMapping . DESCRIPTION , this . getDescription ( ) ) ; } if ( this . getFlowSteps ( ) != null && ! this . getFlowSteps ( ) . isEmpty ( ) ) { JSONArray jsonArray = new JSONArray ( ) ; for ( FlowStep rule : this . getFlowSteps ( ) ) { jsonArray . put ( rule . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . FLOW_STEPS , jsonArray ) ; } if ( this . getDateCreated ( ) != null ) { returnVal . put ( JSONMapping . DATE_CREATED , this . getDateAsLongFromJson ( this . getDateCreated ( ) ) ) ; } if ( this . getDateLastUpdated ( ) != null ) { returnVal . put ( JSONMapping . DATE_LAST_UPDATED , this . getDateAsLongFromJson ( this . getDateLastUpdated ( ) ) ) ; } return returnVal ; }
Conversion to {@code JSONObject} from Java Object.

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

@see ABaseFluidJSONObject#toJsonObject()