@Override public boolean equals(Object object) { if (object != null && getClass().isAssignableFrom(object.getClass())) { return StringUtils.equals(getActionName(), ((ActionExecutionEvent) object).getActionName()); } return false; }
@Override public boolean matches(Object otherEvent) { if (otherEvent == null) { return false; } boolean isMatching = false; if (getClass().isAssignableFrom(otherEvent.getClass())) { ActionExecutionEvent actionEvent = (ActionExecutionEvent) otherEvent; isMatching = getActionName() == null || getActionName().equals(actionEvent.getActionName()); } return isMatching; }
@Override public void onEvent(Event event, Object source, Object data) { if (event == null || source == null || !(event instanceof ActionExecutionEvent)) { return; } String name = ((ActionExecutionEvent) event).getActionName(); if (!SUPPORTED_EVENTS.contains(name)) { return; } if (event instanceof ActionExecutingEvent) { this.lockManager.lock(((XWikiDocument) source).getDocumentReference()); } else if (event instanceof ActionExecutedEvent) { this.lockManager.unlock(((XWikiDocument) source).getDocumentReference()); } } }