public static XContentBuilder marshall(RoleMembershipBean bean) throws StorageException {
        try (XContentBuilder builder = XContentFactory.jsonBuilder()) {
            preMarshall(bean);
            builder
                .startObject()
                    .field("id", bean.getId())
                    .field("organizationId", bean.getOrganizationId())
                    .field("roleId", bean.getRoleId())
                    .field("userId", bean.getUserId())
                    .field("createdOn", bean.getCreatedOn().getTime())
                .endObject();
            postMarshall(bean);
            return builder;
        } catch (IOException e) {
            throw new StorageException(e);
        }
    }
public static XContentBuilder marshall ( RoleMembershipBean bean ) throws StorageException { try ( XContentBuilder builder = XContentFactory . jsonBuilder ( ) ) { preMarshall ( bean ) ; builder . startObject ( ) . field ( "id" , bean . getId ( ) ) . field ( "organizationId" , bean . getOrganizationId ( ) ) . field ( "roleId" , bean . getRoleId ( ) ) . field ( "userId" , bean . getUserId ( ) ) . field ( "createdOn" , bean . getCreatedOn ( ) . getTime ( ) ) . endObject ( ) ; postMarshall ( bean ) ; return builder ; } catch ( IOException e ) { throw new StorageException ( e ) ; } }
Marshals the given bean into the given map.
@param bean the bean
@return the content builder
@throws StorageException when a storage problem occurs while storing a bean