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

        //Flow...
        if(this.getFlow() != null)
        {
            returnVal.put(JSONMapping.FLOW,this.getFlow());
        }

        //Form...
        if(this.getForm() != null)
        {
            returnVal.put(JSONMapping.FORM,this.getForm().toJsonObject());
        }

        //User Fields...
        if(this.getUserFields() != null && !this.getUserFields().isEmpty())
        {
            JSONArray fieldsArr = new JSONArray();
            for(Field toAdd :this.getUserFields())
            {
                fieldsArr.put(toAdd.toJsonObject());
            }

            returnVal.put(JSONMapping.USER_FIELDS, fieldsArr);
        }

        //Route Fields...
        if(this.getRouteFields() != null && !this.getRouteFields().isEmpty())
        {
            JSONArray fieldsArr = new JSONArray();
            for(Field toAdd :this.getRouteFields())
            {
                fieldsArr.put(toAdd.toJsonObject());
            }

            returnVal.put(JSONMapping.ROUTE_FIELDS, fieldsArr);
        }

        //Global Fields...
        if(this.getGlobalFields() != null && !this.getGlobalFields().isEmpty())
        {
            JSONArray fieldsArr = new JSONArray();
            for(Field toAdd :this.getGlobalFields())
            {
                fieldsArr.put(toAdd.toJsonObject());
            }

            returnVal.put(JSONMapping.GLOBAL_FIELDS, fieldsArr);
        }

        //Attachments...
        if(this.getAttachments() != null)
        {
            JSONArray jsonArray = new JSONArray();
            for(Attachment toAdd : this.getAttachments())
            {
                jsonArray.put(toAdd.toJsonObject());
            }

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

        //Flow State...
        if(this.getFlowState() != null)
        {
            returnVal.put(JSONMapping.FLOW_STATE, this.getFlowState().toString());
        }

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

        //Flow...
        if(this.getFlow() != null)
        {
            returnVal.put(JSONMapping.FLOW,this.getFlow());
        }

        //Form...
        if(this.getForm() != null)
        {
            returnVal.put(JSONMapping.FORM,this.getForm().toJsonObject());
        }

        //User Fields...
        if(this.getUserFields() != null && !this.getUserFields().isEmpty())
        {
            JSONArray fieldsArr = new JSONArray();
            for(Field toAdd :this.getUserFields())
            {
                fieldsArr.put(toAdd.toJsonObject());
            }

            returnVal.put(JSONMapping.USER_FIELDS, fieldsArr);
        }

        //Route Fields...
        if(this.getRouteFields() != null && !this.getRouteFields().isEmpty())
        {
            JSONArray fieldsArr = new JSONArray();
            for(Field toAdd :this.getRouteFields())
            {
                fieldsArr.put(toAdd.toJsonObject());
            }

            returnVal.put(JSONMapping.ROUTE_FIELDS, fieldsArr);
        }

        //Global Fields...
        if(this.getGlobalFields() != null && !this.getGlobalFields().isEmpty())
        {
            JSONArray fieldsArr = new JSONArray();
            for(Field toAdd :this.getGlobalFields())
            {
                fieldsArr.put(toAdd.toJsonObject());
            }

            returnVal.put(JSONMapping.GLOBAL_FIELDS, fieldsArr);
        }

        //Attachments...
        if(this.getAttachments() != null)
        {
            JSONArray jsonArray = new JSONArray();
            for(Attachment toAdd : this.getAttachments())
            {
                jsonArray.put(toAdd.toJsonObject());
            }

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

        //Flow State...
        if(this.getFlowState() != null)
        {
            returnVal.put(JSONMapping.FLOW_STATE, this.getFlowState().toString());
        }

        return returnVal;
    }
@ Override public JSONObject toJsonObject ( ) throws JSONException { JSONObject returnVal = super . toJsonObject ( ) ; //Flow... if ( this . getFlow ( ) != null ) { returnVal . put ( JSONMapping . FLOW , this . getFlow ( ) ) ; } //Form... if ( this . getForm ( ) != null ) { returnVal . put ( JSONMapping . FORM , this . getForm ( ) . toJsonObject ( ) ) ; } //User Fields... if ( this . getUserFields ( ) != null && ! this . getUserFields ( ) . isEmpty ( ) ) { JSONArray fieldsArr = new JSONArray ( ) ; for ( Field toAdd : this . getUserFields ( ) ) { fieldsArr . put ( toAdd . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . USER_FIELDS , fieldsArr ) ; } //Route Fields... if ( this . getRouteFields ( ) != null && ! this . getRouteFields ( ) . isEmpty ( ) ) { JSONArray fieldsArr = new JSONArray ( ) ; for ( Field toAdd : this . getRouteFields ( ) ) { fieldsArr . put ( toAdd . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . ROUTE_FIELDS , fieldsArr ) ; } //Global Fields... if ( this . getGlobalFields ( ) != null && ! this . getGlobalFields ( ) . isEmpty ( ) ) { JSONArray fieldsArr = new JSONArray ( ) ; for ( Field toAdd : this . getGlobalFields ( ) ) { fieldsArr . put ( toAdd . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . GLOBAL_FIELDS , fieldsArr ) ; } //Attachments... if ( this . getAttachments ( ) != null ) { JSONArray jsonArray = new JSONArray ( ) ; for ( Attachment toAdd : this . getAttachments ( ) ) { jsonArray . put ( toAdd . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . ATTACHMENTS , jsonArray ) ; } //Flow State... if ( this . getFlowState ( ) != null ) { returnVal . put ( JSONMapping . FLOW_STATE , this . getFlowState ( ) . toString ( ) ) ; } return returnVal ; }
Conversion to {@code JSONObject} from Java Object.

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

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