org.electrocodeogram.cpc.core.api.hub.event
Class CloneNotificationEvent

java.lang.Object
  extended by org.electrocodeogram.cpc.core.api.hub.event.CPCEvent
      extended by org.electrocodeogram.cpc.core.api.hub.event.CloneEvent
          extended by org.electrocodeogram.cpc.core.api.hub.event.CloneNotificationEvent
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable<CPCEvent>

public class CloneNotificationEvent
extends CloneEvent

Notification event object for clone modification warnings. Send whenever some module detected that a recent clone content modification might have introduced update anomalies.

This event type is typically generated by the CPC Notification module.
However, other modules are allowed to generate events of this type too.

The CPC Notification UI module will listen to events of this type and will display them to the user in some appropriate way. Other modules may also listen to this event and may initiate their own actions.

Author:
vw

Nested Class Summary
static class CloneNotificationEvent.Type
          Possible presentation styles for this notification event.
 
Field Summary
protected  java.lang.String message
           
protected  IClone modifiedClone
           
protected  CloneNotificationEvent.Type type
           
protected  double weight
           
 
Constructor Summary
CloneNotificationEvent(ICloneFile cloneFile)
          Creates a new CloneNotificationEvent for the given file.
 
Method Summary
 java.lang.String getMessage()
          Retrieves the message for this notification.
 IClone getModifiedClone()
          Retrieves the clone instance which triggered this event.
 CloneNotificationEvent.Type getType()
          Retrieves the type of this notification event.
 double getWeight()
          Retrieves the weight of this notification.
 boolean isValid()
          Checks if this event has been fully initialised.
 void setMessage(java.lang.String message)
          Retrieves the message for this notification.
 void setModifiedClone(IClone modifiedClone)
          Sets the clone instance which triggered this event.
 void setType(CloneNotificationEvent.Type type)
          Sets the type of this notification event.
 void setWeight(double weight)
          Sets the weight of this notification.
 java.lang.String toString()
          Every event should implement a sensible toString method for use in debugging log messages.
 
Methods inherited from class org.electrocodeogram.cpc.core.api.hub.event.CloneEvent
getCloneFile, subToString
 
Methods inherited from class org.electrocodeogram.cpc.core.api.hub.event.CPCEvent
checkSeal, clone, compareTo, getCreationTime, seal
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

modifiedClone

protected IClone modifiedClone

type

protected CloneNotificationEvent.Type type

weight

protected double weight

message

protected java.lang.String message
Constructor Detail

CloneNotificationEvent

public CloneNotificationEvent(ICloneFile cloneFile)
Creates a new CloneNotificationEvent for the given file.

Parameters:
cloneFile - the file which contains the affected clone, never null.
Method Detail

getModifiedClone

public IClone getModifiedClone()
Retrieves the clone instance which triggered this event.

Returns:
the modified clone, never null.

setModifiedClone

public void setModifiedClone(IClone modifiedClone)
Sets the clone instance which triggered this event.

This is a required value.

Parameters:
modifiedClone - the modified clone, never null.

getType

public CloneNotificationEvent.Type getType()
Retrieves the type of this notification event.
Specifies how this event should be presented to the user.

Returns:
CloneNotificationEvent.Type of this event, never null.

setType

public void setType(CloneNotificationEvent.Type type)
Sets the type of this notification event.
Specifies how this event should be presented to the user.

This is a required value.

Parameters:
type - the CloneNotificationEvent.Type of this event, never null.

getWeight

public double getWeight()
Retrieves the weight of this notification.
This value is usually directly related to the weight in the IEvaluationResult which triggered this event.

Returns:
the weight of this notification, always >=0.
See Also:
IEvaluationResult.getWeight()

setWeight

public void setWeight(double weight)
Sets the weight of this notification.
This value is usually directly related to the weight in the IEvaluationResult which triggered this event.

Parameters:
weight - the weight of this notification, always >=0.
See Also:
IEvaluationResult.getWeight()

getMessage

public java.lang.String getMessage()
Retrieves the message for this notification.
This value is usually directly related to the message in the IEvaluationResult which triggered this event.

Returns:
the message for this notification, may be NULL.
See Also:
IEvaluationResult.getMessage()

setMessage

public void setMessage(java.lang.String message)
Retrieves the message for this notification.
This value is usually directly related to the message in the IEvaluationResult which triggered this event.

Parameters:
message - the message for this notification, may be NULL.

isValid

public boolean isValid()
Description copied from class: CPCEvent
Checks if this event has been fully initialised.
Will return false if one of the mandatory fields of the event has not yet been filled out.

Subclasses should override this method but should never return true. Instead they should delegate to the super class implementation once all validity checks on their level have passed.

The CPCEvent.isValid() implementation always returns true.

Overrides:
isValid in class CPCEvent
Returns:
true if this event is valid, false otherwise.
See Also:
IEventHubRegistry.dispatch(CPCEvent)

toString

public java.lang.String toString()
Description copied from class: CPCEvent
Every event should implement a sensible toString method for use in debugging log messages.

Specified by:
toString in class CPCEvent
Returns:
debug string representation, never null.