agave-notifications/notifications-core/src/main/java/org/iplantc/service/notification/model/NotificationAttemptCodec.java
/**
     * Encode an instance of the type parameter {@code T} into a BSON value.
     *
     * @param writer         the BSON writer to encode into
     * @param value          the value to encode
     * @param encoderContext the encoder context
     */
Encode an instance of the type parameter  T into a BSON value.
@param writer         the BSON writer to encode into
@param value          the value to encode
@param encoderContext the encoder context
Encode an instance of the type parameter T into a BSON value . @param writer the BSON writer to encode into @param value the value to encode @param encoderContext the encoder context
@Override
    public void encode(BsonWriter writer, NotificationAttempt value, EncoderContext encoderContext) {
        writer.writeStartDocument();
        if ( value.getAssociatedUuid() == null) {
            writer.writeNull("associatedUuid");
        } else {
            writer.writeString("associatedUuid", value.getAssociatedUuid());
        }
        writer.writeInt32("attemptNumber", value.getAttemptNumber());
        if ( value.getContent() == null) {
            writer.writeNull("content");
        } else {
            writer.writeString("content", value.getContent());
        }
        if ( value.getCreated() == null) {
            writer.writeNull("created");
        } else {
            writer.writeDateTime("created", value.getCreated().toEpochMilli());
        }
        if ( value.getEndTime() == null) {
            writer.writeNull("endTime");
        } else {
            writer.writeDateTime("endTime", value.getEndTime().toEpochMilli());
        }
        if (value.getEventName() == null) {
            writer.writeNull("event");
        } else {
            writer.writeString("event", value.getEventName());
        }
        if (value.getNotificationId() == null) {
            writer.writeNull("notificationId");
        } else {
            writer.writeString("notificationId", value.getNotificationId());
        }
        if (value.getOwner() == null) {
            writer.writeNull("owner");
        } else {
            writer.writeString("owner", value.getOwner());
        }
        if (value.getResponse() == null) {
            writer.writeNull("response");
        } else {
            writer.writeStartDocument("response");
            writer.writeInt32("code", value.getResponse().getCode());
            if ( value.getResponse().getMessage() == null) {
                writer.writeNull("message");
            } else {
                writer.writeString("message", value.getResponse().getMessage());
            }
            writer.writeEndDocument();
        }
        if ( value.getStartTime() == null) {
            writer.writeNull("startTime");
        } else {
            writer.writeDateTime("startTime", value.getStartTime().toEpochMilli());
        }
        if ( value.getTenantId() == null) {
            writer.writeNull("tenantId");
        } else {
            writer.writeString("tenantId", value.getTenantId());
        }
        if ( value.getCallbackUrl() == null) {
            writer.writeNull("url");
        } else {
            writer.writeString("url", value.getCallbackUrl());
        }
        if ( value.getUuid() == null) {
            writer.writeNull("id");
        } else {
            writer.writeString("id", value.getUuid());
        }
        writer.writeEndDocument();
    }
@ Override public void encode ( BsonWriter writer , NotificationAttempt value , EncoderContext encoderContext ) { writer . writeStartDocument ( ) ; if ( value . getAssociatedUuid ( ) == null ) { writer . writeNull ( "associatedUuid" ) ; } else { writer . writeString ( "associatedUuid" , value . getAssociatedUuid ( ) ) ; } writer . writeInt32 ( "attemptNumber" , value . getAttemptNumber ( ) ) ; if ( value . getContent ( ) == null ) { writer . writeNull ( "content" ) ; } else { writer . writeString ( "content" , value . getContent ( ) ) ; } if ( value . getCreated ( ) == null ) { writer . writeNull ( "created" ) ; } else { writer . writeDateTime ( "created" , value . getCreated ( ) . toEpochMilli ( ) ) ; } if ( value . getEndTime ( ) == null ) { writer . writeNull ( "endTime" ) ; } else { writer . writeDateTime ( "endTime" , value . getEndTime ( ) . toEpochMilli ( ) ) ; } if ( value . getEventName ( ) == null ) { writer . writeNull ( "event" ) ; } else { writer . writeString ( "event" , value . getEventName ( ) ) ; } if ( value . getNotificationId ( ) == null ) { writer . writeNull ( "notificationId" ) ; } else { writer . writeString ( "notificationId" , value . getNotificationId ( ) ) ; } if ( value . getOwner ( ) == null ) { writer . writeNull ( "owner" ) ; } else { writer . writeString ( "owner" , value . getOwner ( ) ) ; } if ( value . getResponse ( ) == null ) { writer . writeNull ( "response" ) ; } else { writer . writeStartDocument ( "response" ) ; writer . writeInt32 ( "code" , value . getResponse ( ) . getCode ( ) ) ; if ( value . getResponse ( ) . getMessage ( ) == null ) { writer . writeNull ( "message" ) ; } else { writer . writeString ( "message" , value . getResponse ( ) . getMessage ( ) ) ; } writer . writeEndDocument ( ) ; } if ( value . getStartTime ( ) == null ) { writer . writeNull ( "startTime" ) ; } else { writer . writeDateTime ( "startTime" , value . getStartTime ( ) . toEpochMilli ( ) ) ; } if ( value . getTenantId ( ) == null ) { writer . writeNull ( "tenantId" ) ; } else { writer . writeString ( "tenantId" , value . getTenantId ( ) ) ; } if ( value . getCallbackUrl ( ) == null ) { writer . writeNull ( "url" ) ; } else { writer . writeString ( "url" , value . getCallbackUrl ( ) ) ; } if ( value . getUuid ( ) == null ) { writer . writeNull ( "id" ) ; } else { writer . writeString ( "id" , value . getUuid ( ) ) ; } writer . writeEndDocument ( ) ; }
Encode an instance of the type parameter {@code T} into a BSON value.
Encode an instance of the type parameter { @code T } into a BSON value .