public abstract class AbstractActivity extends EventObject implements Activity, CsvRecordOutputWriter
Activity.
It defines an "addFrameNumbers" property that will be used to link two activities regarding the addition
of frame numbers during the reasoning process.
Additionally an activity extension method is provided, see extendActivity(Activity).
If a replaceable activity is required, refer to AbstractReplaceableActivity.| Modifier and Type | Field and Description |
|---|---|
static String |
PROPERTY_ADD_FRAME_NUMBERS |
static String |
PROPERTY_NEW_END_INSTANT |
static String |
PROPERTY_NEW_START_INSTANT |
source| Constructor and Description |
|---|
AbstractActivity(Object source)
Constructs a prototypical Activity event.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addOptionalField(OptionalField field)
Convenience method to add an optional field to the collection of all optional fields.
|
void |
addPropertyChangeListener(PropertyChangeListener l)
Adds a property change listener for all properties of this activity.
|
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener l)
Adds a property change listener for one exactly defined property of this activity.
|
void |
extendActivity(Activity act)
Extends this activity by act.
|
String |
getActivityType()
Defines the type of the activity - this value should be unique in the sense that it should be possible to
identify the class of the object by using this String exclusively among all activities.
|
Collection<Long> |
getCompoundFrameNumbers()
This method returns a sorted collection of all frame numbers in consecutive order and greater than zero, that
define this activity.
|
String |
getDescription() |
String |
getDestinationAddressAsString()
An address that can be interpreted as the destination address for this activity.
|
java.time.Instant |
getEndInstant()
Returns a fixed point in time that fixates the end of this activity's time-line, i.e.
|
Date |
getEndTimestamp()
This method should only be used within Drools rule-files and serve as timestamp indicator.
|
Collection<OptionalField> |
getOptionalFields()
This method returns a collection of attribute/value pairs that have to be included in the final output of all
output processors including the CVS encoder and the JSON encoder.
|
String |
getSourceAddressAsString()
An address that can be interpreted as the source address for this activity.
|
java.time.Instant |
getStartInstant()
Returns a fixed point in time that fixates the start of this activity's time-line, i.e.
|
Date |
getStartTimestamp()
This method should only be used within Drools rule-files and serve as timestamp indicator.
|
boolean |
isExcludedFromOutput()
This method's return value indicates whether or not this activity will be included in the final output.
|
void |
removePropertyChangeListener(PropertyChangeListener l)
Removes the specified listener.
|
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener l)
The specified listener will no longer receive notifications for propertyName.
|
void |
removeReplacedActivity(ReplaceableActivity act) |
void |
setDescription(String description) |
void |
setDestinationAddress(String destinationAddress) |
void |
setEndInstant(java.time.Instant endInstant) |
void |
setExcludedFromOutput(boolean isExcludedFromOutput)
Setter for
Activity.isExcludedFromOutput(). |
void |
setSourceAddress(String sourceAddress) |
void |
setStartInstant(java.time.Instant startInstant) |
String |
toString() |
void |
writeCsvRecord(org.apache.commons.csv.CSVPrinter csvPrinter)
Writes a single record to the provided csvPrinter.
|
getSourcepublic static final String PROPERTY_ADD_FRAME_NUMBERS
public static final String PROPERTY_NEW_START_INSTANT
public static final String PROPERTY_NEW_END_INSTANT
public AbstractActivity(Object source)
source - The object on which the Event initially occurred.IllegalArgumentException - if source is null.public String getActivityType()
ActivitygetActivityType in interface Activitypublic Date getStartTimestamp()
ActivityInstant caused by the Drools engine pseudo-clock implementation.getStartTimestamp in interface ActivityInstant), representing
the starting point in time for this Activity.
Please note that this method returns an object which may not be persistent, i.e. the start timestamp
object may be overwritten by implementations.Activity.getStartInstant(),
setStartInstant(java.time.Instant),
setStartInstant(java.time.Instant)public java.time.Instant getStartInstant()
ActivityActivity.getEndInstant() must return the same referencegetStartInstant in interface Activitypublic void setStartInstant(java.time.Instant startInstant)
public Date getEndTimestamp()
ActivityInstant caused by the Drools engine pseudo-clock implementation.getEndTimestamp in interface ActivityInstant), representing
the ending point in time for this Activity.
Please note that this method returns an object which may not be persistent, i.e. the end timestamp
object may be overwritten by implementations.Activity.getEndInstant(),
setEndInstant(java.time.Instant),
setEndInstant(java.time.Instant)public java.time.Instant getEndInstant()
ActivityActivity.getStartInstant() must return the same referencegetEndInstant in interface Activitypublic void setEndInstant(java.time.Instant endInstant)
public String getSourceAddressAsString()
ActivitygetSourceAddressAsString in interface Activitypublic String getDestinationAddressAsString()
ActivitygetDestinationAddressAsString in interface Activitypublic String getDescription()
getDescription in interface Activitypublic void setDescription(String description)
public void extendActivity(Activity act)
act1.extendActivity(act2); act2.extendActivity(act1);act - the activity to be merged with this activityprotected void addOptionalField(OptionalField field)
field - the optional field to add, may not be nullpublic Collection<Long> getCompoundFrameNumbers()
ActivitygetCompoundFrameNumbers in interface Activitypublic Collection<OptionalField> getOptionalFields()
ActivitygetOptionalFields in interface Activitypublic void setSourceAddress(String sourceAddress)
public void setDestinationAddress(String destinationAddress)
public void removeReplacedActivity(ReplaceableActivity act)
public void addPropertyChangeListener(PropertyChangeListener l)
ActivityaddPropertyChangeListener in interface Activityl - the listener to addpublic void addPropertyChangeListener(String propertyName, PropertyChangeListener l)
ActivityaddPropertyChangeListener in interface ActivitypropertyName - the name of property to receive notifications forl - the listener to addpublic void removePropertyChangeListener(PropertyChangeListener l)
ActivityremovePropertyChangeListener in interface Activityl - the listener to removepublic void removePropertyChangeListener(String propertyName, PropertyChangeListener l)
ActivityremovePropertyChangeListener in interface ActivitypropertyName - the name of property to stop receiving notifications forl - the listener to removepublic boolean isExcludedFromOutput()
ActivityisExcludedFromOutput in interface Activitypublic void setExcludedFromOutput(boolean isExcludedFromOutput)
ActivityActivity.isExcludedFromOutput().setExcludedFromOutput in interface ActivityisExcludedFromOutput - whether or not to exclude this activity from the final outputpublic void writeCsvRecord(org.apache.commons.csv.CSVPrinter csvPrinter)
throws IOException
activityType, startInstant, endInstant, sourceAddress, destinationAddress, description, frameNumbers, optionalFields
writeCsvRecord in interface CsvRecordOutputWritercsvPrinter - An initialized csvPrinter, shared among all activitiesIOException - If the csvPrinter reaches an invalid statepublic String toString()
toString in class EventObjectCopyright © 2013–2015 Institute of networks and security. All rights reserved.