Class OutputBuilder


  • public class OutputBuilder
    extends Object
    A builder for Output instances.
    • Constructor Detail

      • OutputBuilder

        public OutputBuilder()
    • Method Detail

      • getPayloadBuilder

        public javax.json.JsonObjectBuilder getPayloadBuilder()
      • setPayloadBuilder

        public void setPayloadBuilder​(javax.json.JsonObjectBuilder payloadBuilder)
      • add

        public OutputBuilder add​(String name,
                                 boolean value)
        Adds an output attribute If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
        Parameters:
        name - the name of the output attribute
        value - the value of the output attribute
        Returns:
        this instance
      • add

        public OutputBuilder add​(String name,
                                 double value)
        Adds an output attribute If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
        Parameters:
        name - the name of the output attribute
        value - the value of the output attribute
        Returns:
        this instance
      • add

        public OutputBuilder add​(String name,
                                 int value)
        Adds an output attribute If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
        Parameters:
        name - the name of the output attribute
        value - the value of the output attribute
        Returns:
        this instance
      • add

        public OutputBuilder add​(String name,
                                 long value)
        Adds an output attribute If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
        Parameters:
        name - the name of the output attribute
        value - the value of the output attribute
        Returns:
        this instance
      • add

        public OutputBuilder add​(String name,
                                 String value)
        Adds an output attribute If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
        Parameters:
        name - the name of the output attribute
        value - the value of the output attribute
        Returns:
        this instance
      • setError

        public OutputBuilder setError​(String technicalError)
        Reports a technical error. This will be reported as ERROR in STEP
        Parameters:
        technicalError - the error message of the technical error
        Returns:
        this instance
      • appendError

        public OutputBuilder appendError​(String technicalError)
        Appends a technical error message. Calling this method for the first time will have the same effect as calling setError
        Parameters:
        technicalError - the error message of the technical error
        Returns:
        this instance
      • setError

        public OutputBuilder setError​(String errorMessage,
                                      Throwable e)
        Reports a technical error and appends the exception causing this error as attachment
        Parameters:
        errorMessage - the error message of the technical error
        e - the exception that caused the technical error
        Returns:
        this instance
      • setBusinessError

        public OutputBuilder setBusinessError​(String businessError)
        Reports a business error. This will be reported as FAILED in STEP
        Parameters:
        businessError - the error message of the business error
        Returns:
        this instance
      • getPayloadJson

        public String getPayloadJson()
        Returns:
        the payload of this output. This has no eff
      • setPayloadJson

        public void setPayloadJson​(String payloadJson)
        Parameters:
        payloadJson - the payload of this output.
      • addAttachments

        public void addAttachments​(List<Attachment> attachments)
        Adds attachments to the output
        Parameters:
        attachments - the list of attachments to be added to the output
      • addAttachment

        public void addAttachment​(Attachment attachment)
        Adds an attachment to the output
        Parameters:
        attachment - the attachment to be added to the output
      • startMeasure

        public void startMeasure​(String id)
        Starts a performance measurement. The current time will be used as starttime
        Parameters:
        id - a unique identifier of the measurement
      • startMeasure

        public void startMeasure​(String id,
                                 long begin)
        Starts a performance measurement
        Parameters:
        id - a unique identifier of the measurement
        begin - the start time of the measurement
      • addMeasure

        public void addMeasure​(String measureName,
                               long durationMillis)
        Adds a performance measurement
        Parameters:
        measureName - a unique identifier of the measurement
        durationMillis - the duration of the measurement in ms
      • addMeasure

        public void addMeasure​(String measureName,
                               long aDurationMillis,
                               Map<String,​Object> data)
        Adds a performance measurement with custom data
        Parameters:
        measureName - a unique identifier of the measurement
        aDurationMillis - the duration of the measurement in ms
        data - the custom data of the measurement
      • stopMeasure

        public void stopMeasure()
        Stops the current performance measurement and adds it to the output
      • stopMeasure

        public void stopMeasure​(Map<String,​Object> data)
        Stops the current performance measurement and adds it to the output.
        Parameters:
        data - custom data to be added to the measurement
      • stopMeasureForAdditionalData

        public void stopMeasureForAdditionalData()
      • setLastMeasureAdditionalData

        public void setLastMeasureAdditionalData​(Map<String,​Object> data)
      • build

        public Output<javax.json.JsonObject> build()
        Builds the output instance
        Returns:
        the output message