[v1.1.0] Added new event publisher for new created and removed `Role`s having "`site`" type (#20896)
This commit is contained in:
parent
80e43886ec
commit
2dd141e1e9
|
@ -2,8 +2,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
|
||||
# Changelog for "event-publisher-portal"
|
||||
|
||||
## [v1.1.0-SNAPSHOT]
|
||||
Added new event publisher for new created `Role`s having "`site`" type (#20896)
|
||||
## [v1.1.0]
|
||||
Added new event publisher for new created and removed `Role`s having "`site`" type (#20896)
|
||||
|
||||
## [v1.0.0]
|
||||
- First release (#19461)
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -13,7 +13,7 @@
|
|||
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>event-publisher-hook</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.1.0</version>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<properties>
|
||||
|
|
|
@ -10,6 +10,7 @@ public class RoleEvent extends PortalModelListenerEvent<Role> {
|
|||
|
||||
public static final String CREATED_NAME = "role_created";
|
||||
public static final String DELETED_NAME = "role_deleted";
|
||||
// public static final String UPDATED_NAME = "role_updated";
|
||||
|
||||
private RoleEvent(String name, Role role) throws PortalException, SystemException {
|
||||
super(name, role);
|
||||
|
@ -34,4 +35,13 @@ public class RoleEvent extends PortalModelListenerEvent<Role> {
|
|||
}
|
||||
}
|
||||
|
||||
// public static RoleEvent newUpdatedEvent(Role role) {
|
||||
// try {
|
||||
// return new RoleEvent(UPDATED_NAME, role.getDescriptiveName());
|
||||
// } catch (PortalException | SystemException e) {
|
||||
// log.error("Cannot create event from Role model object", e);
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
|
@ -41,10 +41,25 @@ public class RoleEventPublisher extends AbstractEventPublisherBaseModelListener<
|
|||
}
|
||||
publish(event);
|
||||
} else if (log.isDebugEnabled()) {
|
||||
log.debug("Removed a non-site type role: " + role.getName());
|
||||
log.debug("Removed a non-site type role: " + role.getTitle());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAfterUpdate(Role role) throws ModelListenerException {
|
||||
// if (role.getType() == RoleConstants.TYPE_SITE) {
|
||||
// log.info("Updated a role having site type");
|
||||
// RoleEvent event = RoleEvent.newUpdatedEvent(role);
|
||||
//
|
||||
// if (log.isTraceEnabled()) {
|
||||
// log.trace("Event is: " + event);
|
||||
// }
|
||||
// publish(event);
|
||||
// } else if (log.isDebugEnabled()) {
|
||||
// log.debug("Updated a non-site type role: " + role.getName());
|
||||
// }
|
||||
}
|
||||
|
||||
/* Uninteresting model events */
|
||||
|
||||
@Override
|
||||
|
@ -61,10 +76,6 @@ public class RoleEventPublisher extends AbstractEventPublisherBaseModelListener<
|
|||
throws ModelListenerException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAfterUpdate(Role role) throws ModelListenerException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBeforeAddAssociation(Object classPK, String associationClassName, Object associationClassPK)
|
||||
throws ModelListenerException {
|
||||
|
|
Loading…
Reference in New Issue