Added also support to publish event on site's Role removal
This commit is contained in:
parent
e7ce536e0e
commit
80e43886ec
|
@ -9,7 +9,7 @@ public class RoleEvent extends PortalModelListenerEvent<Role> {
|
||||||
private static final long serialVersionUID = 3939268094440017646L;
|
private static final long serialVersionUID = 3939268094440017646L;
|
||||||
|
|
||||||
public static final String CREATED_NAME = "role_created";
|
public static final String CREATED_NAME = "role_created";
|
||||||
// public static final String DELETED_NAME = "role_deleted";
|
public static final String DELETED_NAME = "role_deleted";
|
||||||
|
|
||||||
private RoleEvent(String name, Role role) throws PortalException, SystemException {
|
private RoleEvent(String name, Role role) throws PortalException, SystemException {
|
||||||
super(name, role);
|
super(name, role);
|
||||||
|
@ -25,13 +25,13 @@ public class RoleEvent extends PortalModelListenerEvent<Role> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static RoleEvent newDeletedEvent(Role role) {
|
public static RoleEvent newDeletedEvent(Role role) {
|
||||||
// try {
|
try {
|
||||||
// return new RoleEvent(DELETED_NAME, role);
|
return new RoleEvent(DELETED_NAME, role);
|
||||||
// } catch (PortalException | SystemException e) {
|
} catch (PortalException | SystemException e) {
|
||||||
// log.error("Cannot create event from Role model object", e);
|
log.error("Cannot create event from Role model object", e);
|
||||||
// return null;
|
return null;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -30,12 +30,23 @@ public class RoleEventPublisher extends AbstractEventPublisherBaseModelListener<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Uninteresting model events */
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBeforeRemove(Role role) throws ModelListenerException {
|
public void onBeforeRemove(Role role) throws ModelListenerException {
|
||||||
|
if (role.getType() == RoleConstants.TYPE_SITE) {
|
||||||
|
log.info("Removed a role having site type");
|
||||||
|
RoleEvent event = RoleEvent.newDeletedEvent(role);
|
||||||
|
|
||||||
|
if (log.isTraceEnabled()) {
|
||||||
|
log.trace("Event is: " + event);
|
||||||
|
}
|
||||||
|
publish(event);
|
||||||
|
} else if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Removed a non-site type role: " + role.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Uninteresting model events */
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAfterAddAssociation(Object classPK, String associationClassName, Object associationClassPK)
|
public void onAfterAddAssociation(Object classPK, String associationClassName, Object associationClassPK)
|
||||||
throws ModelListenerException {
|
throws ModelListenerException {
|
||||||
|
|
Loading…
Reference in New Issue