@SuppressWarnings("unchecked")
public void onEvent(Event<Object, Object> event) throws Exception
{
Object target = event.getData();
MembershipHandler membershipHanler = service_.getMembershipHandler();
if (target instanceof User)
{
User user = (User)target;
log.info("Remove all Membership by User: " + user.getUserName());
membershipHanler.removeMembershipByUser(user.getUserName(), true);
}
else if (target instanceof Group)
{
Group group = (Group)target;
log.info("Remove all Membership by Group: " + group.getGroupName());
List<Membership> members = (List<Membership>)membershipHanler.findMembershipsByGroup(group);
for (Membership member : members)
{
membershipHanler.removeMembership(member.getId(), true);
}
}
else if (target instanceof MembershipType)
{
try