| Version 8 (modified by richard.james@…, 11 months ago) (diff) |
|---|
The following page describes the steps to include a new event handler for Grouper (not currently working, but hopefully not too far away...)
Grouper Authentication Event Java
package uk.ac.cardiff.model.event;
import uk.ac.cardiff.utility.EqualsUtil;
import uk.ac.cardiff.utility.HashCodeUtil;
import uk.ac.cardiff.utility.StringUtils;
/**
* The Class GrouperAuthenticationEvent.
*
*/
public class GrouperAuthenticationEvent extends AuthenticationEvent {
/**
* The name of a field not included in any of the superclasses and specific to this event.
*/
private String groupAction;
private String groupUser;
/**
* Instantiates a new Generic Authentication Event.
*/
public GrouperAuthenticationEvent() {
super();
}
/**
* New instance.
*
* @return the Grouper Authentication Event
*/
public static GrouperAuthenticationEvent newInstance() {
return new GrouperAuthenticationEvent();
}
/**
* Copy constructor.
*
* @param event
* the event to copy
*/
protected GrouperAuthenticationEvent(GrouperAuthenticationEvent event) {
super(event);
groupAction = event.getGroupAction();
groupUser = event.getGroupUser();
}
/**
* Copy method. Alternative to clone. Returns a copied version of this event.
*
* @return the Grouper Authentication Event
*/
public GrouperAuthenticationEvent copy() {
return new GrouperAuthenticationEvent(this);
}
/**
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if ((obj == null) || (obj.getClass() != this.getClass()))
return false;
GenericAuthenticationEvent that = (GenericAuthenticationEvent) obj;
boolean areEqual = EqualsUtil.areEqual(this.getEventTimeMillis(), that.getEventTimeMillis()) && EqualsUtil.areEqual(this.getEventId(), that.getEventId())
&& EqualsUtil.areEqual(this.getAuthenticationType(), that.getAuthenticationType()) && EqualsUtil.areEqual(this.getServiceHost(), that.getServiceHost())
&& EqualsUtil.areEqual(this.getResourceHost(), that.getResourceHost()) && EqualsUtil.areEqual(this.getPrincipalName(), that.getPrincipalName())
&& EqualsUtil.areEqual(this.getServiceId(), that.getServiceId()) && EqualsUtil.areEqual(this.getEventType(), that.getEventType())
&& EqualsUtil.areEqual(this.getResourceId(), that.getResourceId()) &&
// all new fields should be included in the quality method under here.
EqualsUtil.areEqual(this.getGroupUser(), that.getGroupUser()) && EqualsUtil.areEqual(this.getGroupAction(), that.getGroupAction());
return areEqual;
}
/**
* For hibernate, so the hashcode can be persisted.
*
* @return the hash code
*/
public int getHashCode() {
return hashCode();
}
/**
* For hibernate, does nothing as the hascode is computed on the fly from the <code>hashCode</code> method.
*
* @param hashCode
* the new hash code
*/
public void setHashCode(int hashCode) {
}
/**
* create a unique hash, with as uniform a distribution as possible.
*
* @return the int
*/
@Override
public int hashCode() {
int hash = HashCodeUtil.SEED;
// all inherited fields are hashed here.
hash = HashCodeUtil.hash(hash, getEventTimeMillis());
hash = HashCodeUtil.hash(hash, getAuthenticationType());
hash = HashCodeUtil.hash(hash, getEventId());
hash = HashCodeUtil.hash(hash, getServiceHost());
hash = HashCodeUtil.hash(hash, getResourceHost());
hash = HashCodeUtil.hash(hash, getPrincipalName());
hash = HashCodeUtil.hash(hash, getEventType());
hash = HashCodeUtil.hash(hash, getServiceId());
hash = HashCodeUtil.hash(hash, getResourceId());
// all new fields part of the business key should be hashed below.
hash = HashCodeUtil.hash(hash, getGroupAction());
hash = HashCodeUtil.hash(hash, getGroupUser());
return hash;
}
/**
* Automatic construction of a basic to string method for this class using reflection. Does not require modification unless different behavior is desired.
*/
public String toString() {
return StringUtils.buildToString(this);
}
/**
* @param groupUser
* the groupUser to set
*/
public void setGroupUser(String groupUser) {
this.groupUser = groupUser;
}
/**
* @return the groupUser
*/
public String getGroupUser() {
return groupUser;
}
/**
* @param groupAction
* the groupAction to set
*/
public void setGroupAction(String groupAction) {
this.groupAction = groupAction;
}
/**
* @return the groupUser
*/
public String getGroupAction() {
return groupAction;
}
}
grouper log event handler
Attachments
-
event-parse-formats-custom.xml
(4.7 KB) -
added by richard.james@… 11 months ago.
Grouper Event Parse Formats Custom
-
event-parse.xml
(8.1 KB) -
added by richard.james@… 11 months ago.
Grouper Event Parse
-
event-release.xml
(5.8 KB) -
added by richard.james@… 11 months ago.
Grouper Event Release
-
mua-core.xml
(12.5 KB) -
added by richard.james@… 11 months ago.
Mua Core
-
batch-event-parse.xml
(7.5 KB) -
added by richard.james@… 11 months ago.
MUA Batch Event Parse
