mil.dod.th.ose.remote/src/mil/dod/th/ose/remote/messaging/TerraHarvestMessageUtil.java
public static TerraHarvestMessage buildErrorResponseMessage(final TerraHarvestMessage request, 
            final ErrorCode errorCode, final String errorDescription)
    {
        //build the data first
        final GenericErrorResponseData genericErrorResponseMessage = GenericErrorResponseData.newBuilder().
            setError(errorCode).
            setErrorDescription(errorDescription).
            build();
        
        // build a base namespace message
        final BaseNamespace baseMessage = BaseNamespace.newBuilder().
                setType(BaseMessageType.GenericErrorResponse).
                setData(genericErrorResponseMessage.toByteString()).
                build();
        //build a TerraHarvestPayLoad message
        final TerraHarvestPayload payLoad = TerraHarvestPayload.newBuilder().
                setNamespace(Namespace.Base).
                setNamespaceMessage(baseMessage.toByteString()).
                build();
        // build a terra harvest message
        final TerraHarvestMessage fullMessage = getPartialMessage().
                setSourceId(request.getDestId()).
                // send message back to source
                setDestId(request.getSourceId()).
                setMessageId(request.getMessageId()).
                setTerraHarvestPayload(payLoad.toByteString()).
                build();

        return fullMessage;
    }
/**
     * Create a terra harvest message for error response handling. This method should be used for all generic errors, 
     * as in those not specific to a namespace.  These errors are defined by {@link ErrorCode}.
     * 
     * @param request
     *      request message that this error response is being sent for
     * @param errorCode
     *      represents the occurrence of a generic error defined by the TerraHarvestMessage ErrorCode enum type
     * @param errorDescription
     *      field can optionally describe the TerraHarvestMessage error in more detail
     * @return 
     *      the terra harvest message created
     */
Create a terra harvest message for error response handling. This method should be used for all generic errors,
as in those not specific to a namespace.  These errors are defined by  ErrorCode.

@param request
request message that this error response is being sent for
@param errorCode
represents the occurrence of a generic error defined by the TerraHarvestMessage ErrorCode enum type
@param errorDescription
field can optionally describe the TerraHarvestMessage error in more detail
@return
the terra harvest message created
Create a terra harvest message for error response handling . This method should be used for all generic errors as in those not specific to a namespace . These errors are defined by ErrorCode . @param request request message that this error response is being sent for @param errorCode represents the occurrence of a generic error defined by the TerraHarvestMessage ErrorCode enum type @param errorDescription field can optionally describe the TerraHarvestMessage error in more detail @return the terra harvest message created
public static TerraHarvestMessage buildErrorResponseMessage(final TerraHarvestMessage request, 
            final ErrorCode errorCode, final String errorDescription)
    {
        final GenericErrorResponseData genericErrorResponseMessage = GenericErrorResponseData.newBuilder().
            setError(errorCode).
            setErrorDescription(errorDescription).
            build();
        final BaseNamespace baseMessage = BaseNamespace.newBuilder().
                setType(BaseMessageType.GenericErrorResponse).
                setData(genericErrorResponseMessage.toByteString()).
                build();
        final TerraHarvestPayload payLoad = TerraHarvestPayload.newBuilder().
                setNamespace(Namespace.Base).
                setNamespaceMessage(baseMessage.toByteString()).
                build();
        final TerraHarvestMessage fullMessage = getPartialMessage().
                setSourceId(request.getDestId()).
                setDestId(request.getSourceId()).
                setMessageId(request.getMessageId()).
                setTerraHarvestPayload(payLoad.toByteString()).
                build();
        return fullMessage;
    }
public static TerraHarvestMessage buildErrorResponseMessage ( final TerraHarvestMessage request , final ErrorCode errorCode , final String errorDescription ) { final GenericErrorResponseData genericErrorResponseMessage = GenericErrorResponseData . newBuilder ( ) . setError ( errorCode ) . setErrorDescription ( errorDescription ) . build ( ) ; final BaseNamespace baseMessage = BaseNamespace . newBuilder ( ) . setType ( BaseMessageType . GenericErrorResponse ) . setData ( genericErrorResponseMessage . toByteString ( ) ) . build ( ) ; final TerraHarvestPayload payLoad = TerraHarvestPayload . newBuilder ( ) . setNamespace ( Namespace . Base ) . setNamespaceMessage ( baseMessage . toByteString ( ) ) . build ( ) ; final TerraHarvestMessage fullMessage = getPartialMessage ( ) . setSourceId ( request . getDestId ( ) ) . setDestId ( request . getSourceId ( ) ) . setMessageId ( request . getMessageId ( ) ) . setTerraHarvestPayload ( payLoad . toByteString ( ) ) . build ( ) ; return fullMessage ; }
Create a terra harvest message for error response handling.
Create a terra harvest message for error response handling .
//build the data first // build a base namespace message //build a TerraHarvestPayLoad message // build a terra harvest message // send message back to source