mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-07-08 15:43:16 +02:00
rename handler event and handler event type
This commit is contained in:
@@ -35,12 +35,10 @@ package sonia.scm;
|
||||
|
||||
/**
|
||||
* Handler event type.
|
||||
*
|
||||
* TODO for 2.0 rename to HandlerEventType
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public enum HandlerEvent
|
||||
public enum HandlerEventType
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -82,7 +80,7 @@ public enum HandlerEvent
|
||||
*
|
||||
* @param post
|
||||
*/
|
||||
private HandlerEvent(boolean post)
|
||||
private HandlerEventType(boolean post)
|
||||
{
|
||||
this.post = post;
|
||||
}
|
||||
@@ -116,5 +114,5 @@ public enum HandlerEvent
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private boolean post;
|
||||
private final boolean post;
|
||||
}
|
||||
@@ -30,23 +30,22 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.event;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.HandlerEvent;
|
||||
import sonia.scm.HandlerEventType;
|
||||
|
||||
/**
|
||||
* Base class for handler events.
|
||||
*
|
||||
* TODO for 2.0 rename to HandlerEvent
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
* @since 1.23
|
||||
*
|
||||
* @param <T>
|
||||
*/
|
||||
public interface HandlerEventBase<T>
|
||||
public interface HandlerEvent<T>
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -55,7 +54,7 @@ public interface HandlerEventBase<T>
|
||||
*
|
||||
* @return event type
|
||||
*/
|
||||
public HandlerEvent getEventType();
|
||||
public HandlerEventType getEventType();
|
||||
|
||||
/**
|
||||
* Returns the item which has changed.
|
||||
@@ -35,7 +35,7 @@ package sonia.scm.group;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.HandlerEvent;
|
||||
import sonia.scm.HandlerEventType;
|
||||
import sonia.scm.event.ScmEventBus;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
@@ -55,7 +55,7 @@ public abstract class AbstractGroupManager implements GroupManager
|
||||
* @param group group that has changed
|
||||
* @param event type of change event
|
||||
*/
|
||||
protected void fireEvent(Group group, HandlerEvent event)
|
||||
protected void fireEvent(Group group, HandlerEventType event)
|
||||
{
|
||||
ScmEventBus.getInstance().post(new GroupEvent(group, event));
|
||||
}
|
||||
|
||||
@@ -37,9 +37,9 @@ package sonia.scm.group;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import sonia.scm.HandlerEvent;
|
||||
import sonia.scm.HandlerEventType;
|
||||
import sonia.scm.event.Event;
|
||||
import sonia.scm.event.HandlerEventBase;
|
||||
import sonia.scm.event.HandlerEvent;
|
||||
|
||||
/**
|
||||
* The GroupEvent is fired if a group object changes.
|
||||
@@ -48,7 +48,7 @@ import sonia.scm.event.HandlerEventBase;
|
||||
* @since 1.23
|
||||
*/
|
||||
@Event
|
||||
public final class GroupEvent implements HandlerEventBase<Group>
|
||||
public final class GroupEvent implements HandlerEvent<Group>
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -58,7 +58,7 @@ public final class GroupEvent implements HandlerEventBase<Group>
|
||||
* @param group changed group
|
||||
* @param eventType type of the event
|
||||
*/
|
||||
public GroupEvent(Group group, HandlerEvent eventType)
|
||||
public GroupEvent(Group group, HandlerEventType eventType)
|
||||
{
|
||||
this.group = group;
|
||||
this.eventType = eventType;
|
||||
@@ -92,7 +92,7 @@ public final class GroupEvent implements HandlerEventBase<Group>
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public HandlerEvent getEventType()
|
||||
public HandlerEventType getEventType()
|
||||
{
|
||||
return eventType;
|
||||
}
|
||||
@@ -112,8 +112,8 @@ public final class GroupEvent implements HandlerEventBase<Group>
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** event type */
|
||||
private HandlerEvent eventType;
|
||||
private final HandlerEventType eventType;
|
||||
|
||||
/** changed group */
|
||||
private Group group;
|
||||
private final Group group;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ import com.google.common.collect.Maps;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.HandlerEvent;
|
||||
import sonia.scm.HandlerEventType;
|
||||
import sonia.scm.event.ScmEventBus;
|
||||
import sonia.scm.util.AssertUtil;
|
||||
|
||||
@@ -86,7 +86,7 @@ public abstract class AbstractRepositoryManager implements RepositoryManager
|
||||
* @param repository repository that has changed
|
||||
* @param event type of change event
|
||||
*/
|
||||
protected void fireEvent(Repository repository, HandlerEvent event)
|
||||
protected void fireEvent(Repository repository, HandlerEventType event)
|
||||
{
|
||||
ScmEventBus.getInstance().post(new RepositoryEvent(repository, event));
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ package sonia.scm.repository;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import sonia.scm.HandlerEvent;
|
||||
import sonia.scm.HandlerEventType;
|
||||
import sonia.scm.event.Event;
|
||||
import sonia.scm.event.HandlerEventBase;
|
||||
import sonia.scm.event.HandlerEvent;
|
||||
|
||||
/**
|
||||
* The RepositoryEvent is fired if a {@link Repository} object changes.
|
||||
@@ -47,7 +47,7 @@ import sonia.scm.event.HandlerEventBase;
|
||||
* @since 1.23
|
||||
*/
|
||||
@Event
|
||||
public final class RepositoryEvent implements HandlerEventBase<Repository>
|
||||
public final class RepositoryEvent implements HandlerEvent<Repository>
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -57,7 +57,7 @@ public final class RepositoryEvent implements HandlerEventBase<Repository>
|
||||
* @param repository changed repository
|
||||
* @param eventType type of the event
|
||||
*/
|
||||
public RepositoryEvent(Repository repository, HandlerEvent eventType)
|
||||
public RepositoryEvent(Repository repository, HandlerEventType eventType)
|
||||
{
|
||||
this.repository = repository;
|
||||
this.eventType = eventType;
|
||||
@@ -91,7 +91,7 @@ public final class RepositoryEvent implements HandlerEventBase<Repository>
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public HandlerEvent getEventType()
|
||||
public HandlerEventType getEventType()
|
||||
{
|
||||
return eventType;
|
||||
}
|
||||
@@ -111,8 +111,8 @@ public final class RepositoryEvent implements HandlerEventBase<Repository>
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** event type */
|
||||
private HandlerEvent eventType;
|
||||
private final HandlerEventType eventType;
|
||||
|
||||
/** changed repository */
|
||||
private Repository repository;
|
||||
private final Repository repository;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ import com.google.inject.Singleton;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.HandlerEvent;
|
||||
import sonia.scm.HandlerEventType;
|
||||
import sonia.scm.cache.Cache;
|
||||
import sonia.scm.cache.CacheManager;
|
||||
import sonia.scm.config.ScmConfiguration;
|
||||
@@ -345,7 +345,7 @@ public final class RepositoryServiceFactory
|
||||
@Subscribe(referenceType = ReferenceType.STRONG)
|
||||
public void onEvent(RepositoryEvent event)
|
||||
{
|
||||
if (event.getEventType() == HandlerEvent.DELETE)
|
||||
if (event.getEventType() == HandlerEventType.DELETE)
|
||||
{
|
||||
clearCaches(event.getItem().getId());
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ package sonia.scm.security;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import sonia.scm.HandlerEvent;
|
||||
import sonia.scm.HandlerEventType;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
@@ -66,7 +66,7 @@ public final class StoredAssignedPermissionEvent implements Serializable
|
||||
* @param type type of the event
|
||||
* @param permission permission object which has changed
|
||||
*/
|
||||
public StoredAssignedPermissionEvent(HandlerEvent type,
|
||||
public StoredAssignedPermissionEvent(HandlerEventType type,
|
||||
StoredAssignedPermission permission)
|
||||
{
|
||||
this.type = type;
|
||||
@@ -129,7 +129,7 @@ public final class StoredAssignedPermissionEvent implements Serializable
|
||||
*
|
||||
* @return type of event
|
||||
*/
|
||||
public HandlerEvent getEventType()
|
||||
public HandlerEventType getEventType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
@@ -151,5 +151,5 @@ public final class StoredAssignedPermissionEvent implements Serializable
|
||||
private StoredAssignedPermission permission;
|
||||
|
||||
/** type of the event */
|
||||
private HandlerEvent type;
|
||||
private HandlerEventType type;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ package sonia.scm.user;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.HandlerEvent;
|
||||
import sonia.scm.HandlerEventType;
|
||||
import sonia.scm.event.ScmEventBus;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
@@ -56,7 +56,7 @@ public abstract class AbstractUserManager implements UserManager
|
||||
* @param user user that has changed
|
||||
* @param event type of change event
|
||||
*/
|
||||
protected void fireEvent(User user, HandlerEvent event)
|
||||
protected void fireEvent(User user, HandlerEventType event)
|
||||
{
|
||||
ScmEventBus.getInstance().post(new UserEvent(user, event));
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ package sonia.scm.user;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import sonia.scm.HandlerEvent;
|
||||
import sonia.scm.HandlerEventType;
|
||||
import sonia.scm.event.Event;
|
||||
import sonia.scm.event.HandlerEventBase;
|
||||
import sonia.scm.event.HandlerEvent;
|
||||
|
||||
/**
|
||||
* The UserEvent is fired if a user object changes.
|
||||
@@ -47,7 +47,7 @@ import sonia.scm.event.HandlerEventBase;
|
||||
* @since 1.23
|
||||
*/
|
||||
@Event
|
||||
public final class UserEvent implements HandlerEventBase<User>
|
||||
public final class UserEvent implements HandlerEvent<User>
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -57,7 +57,7 @@ public final class UserEvent implements HandlerEventBase<User>
|
||||
* @param user changed user
|
||||
* @param eventType type of the event
|
||||
*/
|
||||
public UserEvent(User user, HandlerEvent eventType)
|
||||
public UserEvent(User user, HandlerEventType eventType)
|
||||
{
|
||||
this.user = user;
|
||||
this.eventType = eventType;
|
||||
@@ -91,7 +91,7 @@ public final class UserEvent implements HandlerEventBase<User>
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public HandlerEvent getEventType()
|
||||
public HandlerEventType getEventType()
|
||||
{
|
||||
return eventType;
|
||||
}
|
||||
@@ -111,8 +111,8 @@ public final class UserEvent implements HandlerEventBase<User>
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** type of the event */
|
||||
private HandlerEvent eventType;
|
||||
private final HandlerEventType eventType;
|
||||
|
||||
/** changed user */
|
||||
private User user;
|
||||
private final User user;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user