fluid-api/src/main/java/com/fluidbpm/program/api/vo/role/Role.java
@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());
        }

        //Admin Permissions...
        if(this.getAdminPermissions() != null &&
                !this.getAdminPermissions().isEmpty())
        {
            JSONArray adminPerArr = new JSONArray();

            for(String toAdd : this.getAdminPermissions())
            {
                adminPerArr.put(toAdd);
            }

            returnVal.put(JSONMapping.ADMIN_PERMISSIONS, adminPerArr);
        }

        //Role to Form Definitions...
        if(this.getRoleToFormDefinitions() != null &&
                !this.getRoleToFormDefinitions().isEmpty())
        {
            JSONArray roleToFormDefArr = new JSONArray();
            for(RoleToFormDefinition toAdd :this.getRoleToFormDefinitions())
            {
                roleToFormDefArr.put(toAdd.toJsonObject());
            }

            returnVal.put(JSONMapping.ROLE_TO_FORM_DEFINITIONS,roleToFormDefArr);
        }

        //Role To Form Field To Form Definition...
        if(this.getRoleToFormFieldToFormDefinitions() != null &&
                !this.getRoleToFormFieldToFormDefinitions().isEmpty())
        {
            JSONArray roleToJobViewArr = new JSONArray();
            for(RoleToFormFieldToFormDefinition toAdd :this.getRoleToFormFieldToFormDefinitions())
            {
                roleToJobViewArr.put(toAdd.toJsonObject());
            }

            returnVal.put(JSONMapping.ROLE_TO_FORM_FIELD_TO_FORM_DEFINITIONS, roleToJobViewArr);
        }

        //Role to Job Views...
        if(this.getRoleToJobViews() != null &&
                !this.getRoleToJobViews().isEmpty())
        {
            JSONArray roleToJobViewArr = new JSONArray();
            for(RoleToJobView toAdd :this.getRoleToJobViews())
            {
                roleToJobViewArr.put(toAdd.toJsonObject());
            }

            returnVal.put(JSONMapping.ROLE_TO_JOB_VIEWS, roleToJobViewArr);
        }

        //Role to User Queries...
        if(this.getRoleToUserQueries() != null &&
                !this.getRoleToUserQueries().isEmpty())
        {
            JSONArray userQueriesArr = new JSONArray();
            for(RoleToUserQuery toAdd :this.getRoleToUserQueries())
            {
                userQueriesArr.put(toAdd.toJsonObject());
            }

            returnVal.put(JSONMapping.ROLE_TO_USER_QUERIES, userQueriesArr);
        }

        return returnVal;
    }
@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());
        }

        //Admin Permissions...
        if(this.getAdminPermissions() != null &&
                !this.getAdminPermissions().isEmpty())
        {
            JSONArray adminPerArr = new JSONArray();

            for(String toAdd : this.getAdminPermissions())
            {
                adminPerArr.put(toAdd);
            }

            returnVal.put(JSONMapping.ADMIN_PERMISSIONS, adminPerArr);
        }

        //Role to Form Definitions...
        if(this.getRoleToFormDefinitions() != null &&
                !this.getRoleToFormDefinitions().isEmpty())
        {
            JSONArray roleToFormDefArr = new JSONArray();
            for(RoleToFormDefinition toAdd :this.getRoleToFormDefinitions())
            {
                roleToFormDefArr.put(toAdd.toJsonObject());
            }

            returnVal.put(JSONMapping.ROLE_TO_FORM_DEFINITIONS,roleToFormDefArr);
        }

        //Role To Form Field To Form Definition...
        if(this.getRoleToFormFieldToFormDefinitions() != null &&
                !this.getRoleToFormFieldToFormDefinitions().isEmpty())
        {
            JSONArray roleToJobViewArr = new JSONArray();
            for(RoleToFormFieldToFormDefinition toAdd :this.getRoleToFormFieldToFormDefinitions())
            {
                roleToJobViewArr.put(toAdd.toJsonObject());
            }

            returnVal.put(JSONMapping.ROLE_TO_FORM_FIELD_TO_FORM_DEFINITIONS, roleToJobViewArr);
        }

        //Role to Job Views...
        if(this.getRoleToJobViews() != null &&
                !this.getRoleToJobViews().isEmpty())
        {
            JSONArray roleToJobViewArr = new JSONArray();
            for(RoleToJobView toAdd :this.getRoleToJobViews())
            {
                roleToJobViewArr.put(toAdd.toJsonObject());
            }

            returnVal.put(JSONMapping.ROLE_TO_JOB_VIEWS, roleToJobViewArr);
        }

        //Role to User Queries...
        if(this.getRoleToUserQueries() != null &&
                !this.getRoleToUserQueries().isEmpty())
        {
            JSONArray userQueriesArr = new JSONArray();
            for(RoleToUserQuery toAdd :this.getRoleToUserQueries())
            {
                userQueriesArr.put(toAdd.toJsonObject());
            }

            returnVal.put(JSONMapping.ROLE_TO_USER_QUERIES, userQueriesArr);
        }

        return returnVal;
    }
@ 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 ( ) ) ; } //Admin Permissions... if ( this . getAdminPermissions ( ) != null && ! this . getAdminPermissions ( ) . isEmpty ( ) ) { JSONArray adminPerArr = new JSONArray ( ) ; for ( String toAdd : this . getAdminPermissions ( ) ) { adminPerArr . put ( toAdd ) ; } returnVal . put ( JSONMapping . ADMIN_PERMISSIONS , adminPerArr ) ; } //Role to Form Definitions... if ( this . getRoleToFormDefinitions ( ) != null && ! this . getRoleToFormDefinitions ( ) . isEmpty ( ) ) { JSONArray roleToFormDefArr = new JSONArray ( ) ; for ( RoleToFormDefinition toAdd : this . getRoleToFormDefinitions ( ) ) { roleToFormDefArr . put ( toAdd . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . ROLE_TO_FORM_DEFINITIONS , roleToFormDefArr ) ; } //Role To Form Field To Form Definition... if ( this . getRoleToFormFieldToFormDefinitions ( ) != null && ! this . getRoleToFormFieldToFormDefinitions ( ) . isEmpty ( ) ) { JSONArray roleToJobViewArr = new JSONArray ( ) ; for ( RoleToFormFieldToFormDefinition toAdd : this . getRoleToFormFieldToFormDefinitions ( ) ) { roleToJobViewArr . put ( toAdd . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . ROLE_TO_FORM_FIELD_TO_FORM_DEFINITIONS , roleToJobViewArr ) ; } //Role to Job Views... if ( this . getRoleToJobViews ( ) != null && ! this . getRoleToJobViews ( ) . isEmpty ( ) ) { JSONArray roleToJobViewArr = new JSONArray ( ) ; for ( RoleToJobView toAdd : this . getRoleToJobViews ( ) ) { roleToJobViewArr . put ( toAdd . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . ROLE_TO_JOB_VIEWS , roleToJobViewArr ) ; } //Role to User Queries... if ( this . getRoleToUserQueries ( ) != null && ! this . getRoleToUserQueries ( ) . isEmpty ( ) ) { JSONArray userQueriesArr = new JSONArray ( ) ; for ( RoleToUserQuery toAdd : this . getRoleToUserQueries ( ) ) { userQueriesArr . put ( toAdd . toJsonObject ( ) ) ; } returnVal . put ( JSONMapping . ROLE_TO_USER_QUERIES , userQueriesArr ) ; } return returnVal ; }
Conversion to {@code JSONObject} from Java Object.

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

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