mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 16:35:45 +01:00
improve modification events to pass the item before it was modified to the subscriber
This commit is contained in:
@@ -222,13 +222,14 @@ public class DefaultGroupManager extends AbstractGroupManager
|
||||
|
||||
String name = group.getName();
|
||||
|
||||
if (groupDAO.contains(name))
|
||||
Group notModified = groupDAO.get(name);
|
||||
if (notModified != null)
|
||||
{
|
||||
removeDuplicateMembers(group);
|
||||
fireEvent(new GroupModificationEvent(group, notModified, HandlerEvent.BEFORE_MODIFY));
|
||||
group.setLastModified(System.currentTimeMillis());
|
||||
fireEvent(group, HandlerEvent.BEFORE_MODIFY);
|
||||
groupDAO.modify(group);
|
||||
fireEvent(group, HandlerEvent.MODIFY);
|
||||
fireEvent(new GroupModificationEvent(group, notModified, HandlerEvent.MODIFY));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -373,7 +373,7 @@ public class DefaultRepositoryManager extends AbstractRepositoryManager
|
||||
if (notModifiedRepository != null)
|
||||
{
|
||||
assertIsOwner(notModifiedRepository);
|
||||
fireEvent(repository, HandlerEvent.BEFORE_MODIFY);
|
||||
fireEvent(new RepositoryModificationEvent(repository, notModifiedRepository, HandlerEvent.BEFORE_MODIFY));
|
||||
repository.setLastModified(System.currentTimeMillis());
|
||||
getHandler(repository).modify(repository);
|
||||
repositoryDAO.modify(repository);
|
||||
@@ -384,7 +384,7 @@ public class DefaultRepositoryManager extends AbstractRepositoryManager
|
||||
"repository ".concat(repository.getName()).concat(" not found"));
|
||||
}
|
||||
|
||||
fireEvent(repository, HandlerEvent.MODIFY);
|
||||
fireEvent(new RepositoryModificationEvent(repository, notModifiedRepository, HandlerEvent.MODIFY));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -280,14 +280,15 @@ public class DefaultUserManager extends AbstractUserManager
|
||||
}
|
||||
|
||||
String name = user.getName();
|
||||
|
||||
if (userDAO.contains(name))
|
||||
|
||||
User notModified = userDAO.get(name);
|
||||
if (notModified != null)
|
||||
{
|
||||
AssertUtil.assertIsValid(user);
|
||||
fireEvent(new UserModificationEvent(user, notModified, HandlerEvent.BEFORE_MODIFY));
|
||||
user.setLastModified(System.currentTimeMillis());
|
||||
fireEvent(user, HandlerEvent.BEFORE_MODIFY);
|
||||
userDAO.modify(user);
|
||||
fireEvent(user, HandlerEvent.MODIFY);
|
||||
fireEvent(new UserModificationEvent(user, notModified, HandlerEvent.MODIFY));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user