Class CadfEvent.Builder
- java.lang.Object
-
- org.linuxforhealth.fhir.audit.cadf.CadfEvent.Builder
-
- Enclosing class:
- CadfEvent
public static class CadfEvent.Builder extends java.lang.Object
Builder of the CadfEvent objects
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CadfEvent.Builder
action(Action action)
CadfEvent.Builder
attachment(CadfAttachment attachment)
A convenience method to add one attachment at a time.CadfEvent.Builder
attachments(CadfAttachment[] attachments)
An optional array of extended or domain-specific information about the event or its context.CadfEvent
build()
CadfEvent.Builder
duration(java.lang.String duration)
This optional property describes the duration of activity for long-running activities.CadfEvent.Builder
eventTime(java.lang.String eventTime)
CadfEvent.Builder
eventType(EventType eventType)
CadfEvent.Builder
id(java.lang.String id)
CadfEvent.Builder
initiator(CadfResource initiator)
Property that represents the event INITIATOR.CadfEvent.Builder
initiatorId(java.lang.String initiatorId)
Property that identifies the event INITIATOR.CadfEvent.Builder
measurement(CadfMeasurement measurement)
A convenience method to add one measurement at a time.CadfEvent.Builder
measurements(CadfMeasurement[] measurements)
Property representing measurements associated with the event.CadfEvent.Builder
name(java.lang.String name)
Sets a descriptive name for the event.CadfEvent.Builder
observer(CadfResource observer)
Property that represents the event OBSERVER.CadfEvent.Builder
observerId(java.lang.String observerId)
Property that identifies the event OBSERVER.CadfEvent.Builder
outcome(Outcome outcome)
CadfEvent.Builder
reason(java.lang.String reasonType, java.lang.String reasonCode, java.lang.String policyType, java.lang.String policyId)
A convenience method to set the event reason.CadfEvent.Builder
reason(CadfReason reason)
Sets the event reason.CadfEvent.Builder
reporterChain(CadfReporterStep[] chain)
An array of Reporterstep typed data that contains information about the sequenced handling of or change to the associated CADF Event Record by any REPORTER.CadfEvent.Builder
severity(java.lang.String severity)
This optional property describes domain-relative severity assigned to the event by OBSERVER.CadfEvent.Builder
tag(java.lang.String tag)
A convenience method allowing to add one tag at a time as opposed to an array.CadfEvent.Builder
tags(java.lang.String[] tags)
An optional array of Tags that MAY be used to further qualify or categorize the CADF Event Record.CadfEvent.Builder
target(CadfResource target)
Property that represents the event TARGET.CadfEvent.Builder
targetId(java.lang.String targetId)
Property that identifies the event TARGET.CadfEvent.Builder
typeUri(java.lang.String typeUri)
Set the typeURI property of the CADF event entity.
-
-
-
Constructor Detail
-
Builder
public Builder()
-
Builder
public Builder(java.lang.String id, EventType eventType, java.lang.String eventTime, Action action, Outcome outcome)
CadfEvent builder constructor. Supply initial values for the event definition.- Parameters:
id
- -- String. Globally unique identifier for the event. If null value is provided, the identifier is generated automatically.eventType
- -- CadfEvent.EventType. SeeEventType
for guidance.eventTime
- -- Date. Timestamp of the event occurrence. If null value is provided, this property is set to the current timestamp.action
- -- CadfEvent.Action. Indicates the action that created this event.outcome
- -- CadfEvent.Outcome. Indicate the action's outcome.
-
-
Method Detail
-
id
public CadfEvent.Builder id(java.lang.String id)
-
eventType
public CadfEvent.Builder eventType(EventType eventType)
-
eventTime
public CadfEvent.Builder eventTime(java.lang.String eventTime)
-
action
public CadfEvent.Builder action(Action action)
-
outcome
public CadfEvent.Builder outcome(Outcome outcome)
-
typeUri
public CadfEvent.Builder typeUri(java.lang.String typeUri)
Set the typeURI property of the CADF event entity. Defaults to "http://schemas.dmtf.org/cloud/audit/1.0/event" Although it is formally * optional, it is required in the JSON representation of the event. Subsequently, if it is not set,build()
will throw anIllegalStateException
- Parameters:
typeUri
-- Returns:
- Builder
-
reason
public CadfEvent.Builder reason(java.lang.String reasonType, java.lang.String reasonCode, java.lang.String policyType, java.lang.String policyId)
A convenience method to set the event reason. Instantiates a newCadfReason
object using the supplied values. Reason is a required property if the event type is "control", otherwise it is optional.- Parameters:
reasonType
-reasonCode
-policyType
-policyId
-- Returns:
- Builder
- See Also:
CadfReason
-
reason
public CadfEvent.Builder reason(CadfReason reason)
Sets the event reason. This property contains domain-specific reason code and policy data that provides an additional level of detail to the outcome value. Reason is a required property if the event type is "control", otherwise it is optional.- Parameters:
reason
-- Returns:
- Builder
- See Also:
CadfReason
-
name
public CadfEvent.Builder name(java.lang.String name)
Sets a descriptive name for the event. Optional.- Parameters:
name
- -- event descriptive name.- Returns:
- Builder
-
severity
public CadfEvent.Builder severity(java.lang.String severity)
This optional property describes domain-relative severity assigned to the event by OBSERVER.- Parameters:
severity
- -- Severity descriptor.- Returns:
- Builder
-
duration
public CadfEvent.Builder duration(java.lang.String duration)
This optional property describes the duration of activity for long-running activities. It is typically used in the second of a pair of events marking the start and end of such activity. Value as defined by xs:duration per XMLSchema2- Parameters:
duration
- -- String in the format [-]PnYnMnD[TnHnMnS]- Returns:
- Builder
-
tags
public CadfEvent.Builder tags(java.lang.String[] tags)
An optional array of Tags that MAY be used to further qualify or categorize the CADF Event Record. Each tag is represented by a URI consisting of an optional namespace, a required tag name, and an optional value, e.g. //GRC20.gov/cloud/security/pci-dss?value=enabled In this example "//GRC20.gov/cloud/security/" is the namespace, "pci-dss" is the tag name and "enabled" is the value.- Parameters:
tags
- -- Array of strings, each in the format [//namespace/]tag-name[?value=tag-value]- Returns:
- Builder
-
tag
public CadfEvent.Builder tag(java.lang.String tag)
A convenience method allowing to add one tag at a time as opposed to an array.- Parameters:
tag
- -- A String in the format [//namespace/]tag-name[?value=tag-value]- Returns:
- Builder
- See Also:
tags(String[])
-
initiator
public CadfEvent.Builder initiator(CadfResource initiator)
Property that represents the event INITIATOR. It is required when initiatorId is not supplied.
-
initiatorId
public CadfEvent.Builder initiatorId(java.lang.String initiatorId)
Property that identifies the event INITIATOR. This property can be used instead of the "initiator" property if the CADF Event data is contained within the same CADF Log or Report that also contains a valid CADF Resource definition for the resource being referenced as the INITIATOR.
-
target
public CadfEvent.Builder target(CadfResource target)
Property that represents the event TARGET. It is required when targetId is not supplied.
-
targetId
public CadfEvent.Builder targetId(java.lang.String targetId)
Property that identifies the event TARGET. This property can be used instead of the "target" property if the CADF Event data is contained within the same CADF Log or Report that also contains a valid CADF Resource definition for the resource being referenced as the TARGET.
-
observer
public CadfEvent.Builder observer(CadfResource observer)
Property that represents the event OBSERVER. It is required when observerId is not supplied.
-
observerId
public CadfEvent.Builder observerId(java.lang.String observerId)
Property that identifies the event OBSERVER. This property can be used instead of the "observer" property if the CADF Event data is contained within the same CADF Log or Report that also contains a valid CADF Resource definition for the resource being referenced as the OBSERVER.
-
measurements
public CadfEvent.Builder measurements(CadfMeasurement[] measurements)
Property representing measurements associated with the event. Reguired if the event type is "monitor".
-
measurement
public CadfEvent.Builder measurement(CadfMeasurement measurement)
A convenience method to add one measurement at a time.- See Also:
measurements(CadfMeasurement[])
-
attachments
public CadfEvent.Builder attachments(CadfAttachment[] attachments)
An optional array of extended or domain-specific information about the event or its context.
-
attachment
public CadfEvent.Builder attachment(CadfAttachment attachment)
A convenience method to add one attachment at a time.- See Also:
attachments(CadfAttachment[])
-
reporterChain
public CadfEvent.Builder reporterChain(CadfReporterStep[] chain)
An array of Reporterstep typed data that contains information about the sequenced handling of or change to the associated CADF Event Record by any REPORTER. Does not include the OBSERVER.
-
-