JsonObject toJsonObject ( ) { JsonObjectBuilder ob = Json . createObjectBuilder ( ) ; ob . add ( "id" , enrollmentID ) ; ob . add ( "type" , type ) ; if ( this . secret != null ) { ob . add ( "secret" , secret ) ; } if ( null != maxEnrollments ) { ob . add ( "max_enrollments" , maxEnrollments ) ; } if ( affiliation != null ) { ob . add ( "affiliation" , affiliation ) ; } JsonArrayBuilder ab = Json . createArrayBuilder ( ) ; for ( Attribute attr : attrs ) { ab . add ( attr . toJsonObject ( ) ) ; } if ( caName != null ) { ob . add ( HFCAClient . FABRIC_CA_REQPROP , caName ) ; } ob . add ( "attrs" , ab . build ( ) ) ; return ob . build ( ) ; }
Convert the registration request to a JSON object