Class Event
- java.lang.Object
-
- de.fraunhofer.iese.mydata.common.MyDataEntity
-
- de.fraunhofer.iese.mydata.policy.event.Event
-
- All Implemented Interfaces:
ParameterListProvider
public class Event extends MyDataEntity implements ParameterListProvider
An event that occured in the system under observation, intercepted or monitored by a PolicyEnforcementPoint.- Author:
- Fraunhofer IESE
-
-
Constructor Summary
Constructors Constructor Description Event(ActionId actionId, boolean isTry, Parameter<?>... params)
Instantiates a new event.Event(ActionId actionId, Parameter<?>... params)
Instantiates a new event.Event(ActionId actionId, java.time.Instant instant, Parameter<?>... params)
Instantiates a new event.Event(ActionId actionId, java.time.Instant instant, ParameterList params)
Instantiates a new event.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addParameter(Parameter<?> param)
Adds a parameter.<T> void
addParameter(String name, T value)
Adds a parameter.void
clearParameters()
Clear parameters.boolean
equals(Object obj)
Long
getMillisecondSinceEpoch()
Gets the time at which the action occurred / was intercepted by the PEP.Parameter<?>
getParameterForName(String name)
Gets a parameter.<T> T
getParameterValue(String name, Class<T> clazz)
Gets a parameter value.Object
getValueForName(String name)
Gets the object which is added as parameter for given name.int
hashCode()
void
removeParameter(String name)
Adds a parameter.void
setParameters(ParameterList params)
Replaces all parameters with the parameters of the provided list.void
setTimestamp(java.time.Instant instant)
Sets the time at which the action occurred / was intercepted by the PEP.-
Methods inherited from class de.fraunhofer.iese.mydata.common.MyDataEntity
fromJson, getGson, getGson, toJson, toString, validate, validateAndNullCheck
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.fraunhofer.iese.mydata.policy.parameter.ParameterListProvider
getParameters
-
-
-
-
Constructor Detail
-
Event
public Event(ActionId actionId, java.time.Instant instant, Parameter<?>... params)
Instantiates a new event.- Parameters:
actionId
- the action component_idinstant
- the instant, will set the timestampparams
- the params
-
Event
public Event(ActionId actionId, java.time.Instant instant, ParameterList params)
Instantiates a new event.- Parameters:
actionId
- the action component_idinstant
- the instant, will set the timestampparams
- the params
-
Event
public Event(ActionId actionId, boolean isTry, Parameter<?>... params)
Instantiates a new event.- Parameters:
actionId
- the action component_idisTry
- the is tryparams
- the params
-
-
Method Detail
-
addParameter
public void addParameter(Parameter<?> param)
Description copied from interface:ParameterListProvider
Adds a parameter.- Specified by:
addParameter
in interfaceParameterListProvider
- Parameters:
param
- the parameter to add
-
addParameter
public <T> void addParameter(String name, T value)
Description copied from interface:ParameterListProvider
Adds a parameter.- Specified by:
addParameter
in interfaceParameterListProvider
- Type Parameters:
T
- the generic type- Parameters:
name
- the name of the parametervalue
- the value of the parameter
-
clearParameters
public void clearParameters()
Clear parameters.- Specified by:
clearParameters
in interfaceParameterListProvider
-
getMillisecondSinceEpoch
public Long getMillisecondSinceEpoch()
Gets the time at which the action occurred / was intercepted by the PEP.- Returns:
- the milliseconds since epoch
-
getParameterForName
public Parameter<?> getParameterForName(String name)
Description copied from interface:ParameterListProvider
Gets a parameter.- Specified by:
getParameterForName
in interfaceParameterListProvider
- Parameters:
name
- the name of the parameter- Returns:
- the parameter with the given name, or null if it does not exist
-
getParameterValue
public <T> T getParameterValue(String name, Class<T> clazz)
Description copied from interface:ParameterListProvider
Gets a parameter value.- Specified by:
getParameterValue
in interfaceParameterListProvider
- Type Parameters:
T
- the generic type- Parameters:
name
- the name of the parameterclazz
- the value of the parameter- Returns:
- the value of the parameter, or null if it does not exist
-
getValueForName
public Object getValueForName(String name)
Gets the object which is added as parameter for given name.- Parameters:
name
- the name- Returns:
- the object, null in case the parameter with the given name does not exist
-
removeParameter
public void removeParameter(String name)
Description copied from interface:ParameterListProvider
Adds a parameter.- Specified by:
removeParameter
in interfaceParameterListProvider
- Parameters:
name
- the name of the parameter to be deleted
-
setParameters
public void setParameters(ParameterList params)
Description copied from interface:ParameterListProvider
Replaces all parameters with the parameters of the provided list.- Specified by:
setParameters
in interfaceParameterListProvider
- Parameters:
params
- list of parameters
-
setTimestamp
public void setTimestamp(java.time.Instant instant)
Sets the time at which the action occurred / was intercepted by the PEP.- Parameters:
instant
- the instant to set
-
-