You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2018/10/05 12:06:57 UTC
[2/3] syncope git commit: Do not report loggers used to support the
Audit process
Do not report loggers used to support the Audit process
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/04f0dcb8
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/04f0dcb8
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/04f0dcb8
Branch: refs/heads/master
Commit: 04f0dcb87957323827bed5a792ac15ac96b4f788
Parents: baf93da
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Oct 5 13:46:13 2018 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Oct 5 13:46:26 2018 +0200
----------------------------------------------------------------------
.../commands/logger/LoggerResultManager.java | 6 +-
.../logger/LoggerSyncopeOperations.java | 4 +-
.../console/events/EventCategoryPanel.java | 32 ++---
.../console/events/EventSelectionPanel.java | 6 +-
.../syncope/client/console/pages/Audit.java | 6 +-
.../syncope/client/console/pages/LogViewer.java | 14 +-
.../console/panels/LogStatementPanel.java | 4 +-
.../client/console/rest/LoggerRestClient.java | 12 +-
.../syncope/common/lib/log/EventCategory.java | 92 +++++++++++++
.../syncope/common/lib/log/EventCategoryTO.java | 92 -------------
.../syncope/common/lib/log/LogStatement.java | 111 +++++++++++++++
.../syncope/common/lib/log/LogStatementTO.java | 112 ---------------
.../common/lib/types/AuditLoggerName.java | 10 +-
.../common/rest/api/service/LoggerService.java | 45 +++++-
.../apache/syncope/core/logic/LoggerLogic.java | 138 ++++++++++---------
.../syncope/core/logic/MemoryAppender.java | 8 +-
.../syncope/core/logic/init/LoggerLoader.java | 20 +--
.../jpa/content/XMLContentLoader.java | 5 +-
.../provisioning/java/AuditManagerImpl.java | 3 +-
.../rest/cxf/service/LoggerServiceImpl.java | 8 +-
.../apache/syncope/fit/core/LoggerITCase.java | 26 ++--
21 files changed, 394 insertions(+), 360 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerResultManager.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerResultManager.java
index 327f8c0..2865b92 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerResultManager.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerResultManager.java
@@ -26,7 +26,7 @@ import java.util.List;
import java.util.Map;
import org.apache.syncope.client.cli.commands.CommonsResultManager;
import org.apache.syncope.client.cli.view.Table;
-import org.apache.syncope.common.lib.log.LogStatementTO;
+import org.apache.syncope.common.lib.log.LogStatement;
import org.apache.syncope.common.lib.log.LoggerTO;
public class LoggerResultManager extends CommonsResultManager {
@@ -41,9 +41,9 @@ public class LoggerResultManager extends CommonsResultManager {
tableBuilder.build().print();
}
- public void fromGetLastLogStatements(final List<LogStatementTO> statements) throws JsonProcessingException {
+ public void fromGetLastLogStatements(final List<LogStatement> statements) throws JsonProcessingException {
final Table.TableBuilder tableBuilder = new Table.TableBuilder("last statements").header("statement");
- for (final LogStatementTO statement : statements) {
+ for (final LogStatement statement : statements) {
tableBuilder.rowValues(Collections.singletonList(
MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(statement)));
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerSyncopeOperations.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerSyncopeOperations.java
index b1d52bf..8b44c37 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerSyncopeOperations.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerSyncopeOperations.java
@@ -22,7 +22,7 @@ import java.util.List;
import java.util.stream.Collectors;
import org.apache.syncope.client.cli.SyncopeServices;
import org.apache.syncope.common.lib.log.LogAppender;
-import org.apache.syncope.common.lib.log.LogStatementTO;
+import org.apache.syncope.common.lib.log.LogStatement;
import org.apache.syncope.common.lib.log.LoggerTO;
import org.apache.syncope.common.lib.types.LoggerType;
import org.apache.syncope.common.rest.api.service.LoggerService;
@@ -35,7 +35,7 @@ public class LoggerSyncopeOperations {
return loggerService.memoryAppenders().stream().map(LogAppender::getName).collect(Collectors.toList());
}
- public List<LogStatementTO> getLastLogStatements(final String appender) {
+ public List<LogStatement> getLastLogStatements(final String appender) {
return loggerService.getLastLogStatements(appender);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/client/console/src/main/java/org/apache/syncope/client/console/events/EventCategoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/events/EventCategoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/events/EventCategoryPanel.java
index e31ffdc..bf49fc2 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/events/EventCategoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/events/EventCategoryPanel.java
@@ -35,7 +35,7 @@ import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
-import org.apache.syncope.common.lib.log.EventCategoryTO;
+import org.apache.syncope.common.lib.log.EventCategory;
import org.apache.syncope.common.lib.types.AuditElements;
import org.apache.syncope.common.lib.types.AuditElements.EventCategoryType;
import org.apache.syncope.common.lib.types.AuditLoggerName;
@@ -57,9 +57,9 @@ public abstract class EventCategoryPanel extends Panel {
private static final long serialVersionUID = 6429053774964787734L;
- private final List<EventCategoryTO> eventCategoryTOs;
+ private final List<EventCategory> eventCategoryTOs;
- private final EventCategoryTO eventCategoryTO = new EventCategoryTO();
+ private final EventCategory eventCategoryTO = new EventCategory();
private final WebMarkupContainer categoryContainer;
@@ -75,13 +75,13 @@ public abstract class EventCategoryPanel extends Panel {
private final AjaxTextFieldPanel custom;
- private final ActionsPanel<EventCategoryTO> actionsPanel;
+ private final ActionsPanel<EventCategory> actionsPanel;
private final IModel<List<String>> model;
public EventCategoryPanel(
final String id,
- final List<EventCategoryTO> eventCategoryTOs,
+ final List<EventCategory> eventCategoryTOs,
final IModel<List<String>> model) {
super(id);
@@ -187,14 +187,14 @@ public abstract class EventCategoryPanel extends Panel {
categoryContainer.add(custom.hideLabel());
actionsPanel = new ActionsPanel<>("customActions", null);
- actionsPanel.add(new ActionLink<EventCategoryTO>() {
+ actionsPanel.add(new ActionLink<EventCategory>() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
- public void onClick(final AjaxRequestTarget target, final EventCategoryTO ignore) {
+ public void onClick(final AjaxRequestTarget target, final EventCategory ignore) {
if (StringUtils.isNotBlank(custom.getModelObject())) {
- Pair<EventCategoryTO, AuditElements.Result> parsed = AuditLoggerName.parseEventCategory(custom.
+ Pair<EventCategory, AuditElements.Result> parsed = AuditLoggerName.parseEventCategory(custom.
getModelObject());
String eventString = AuditLoggerName.buildEvent(
@@ -214,14 +214,14 @@ public abstract class EventCategoryPanel extends Panel {
}
}
}, ActionLink.ActionType.CREATE, StringUtils.EMPTY).hideLabel();
- actionsPanel.add(new ActionLink<EventCategoryTO>() {
+ actionsPanel.add(new ActionLink<EventCategory>() {
private static final long serialVersionUID = -3722207913631435521L;
@Override
- public void onClick(final AjaxRequestTarget target, final EventCategoryTO ignore) {
+ public void onClick(final AjaxRequestTarget target, final EventCategory ignore) {
if (StringUtils.isNotBlank(custom.getModelObject())) {
- Pair<EventCategoryTO, AuditElements.Result> parsed = AuditLoggerName.parseEventCategory(custom.
+ Pair<EventCategory, AuditElements.Result> parsed = AuditLoggerName.parseEventCategory(custom.
getModelObject());
String eventString = AuditLoggerName.buildEvent(
@@ -259,7 +259,7 @@ public abstract class EventCategoryPanel extends Panel {
});
}
- private List<String> filter(final List<EventCategoryTO> eventCategoryTOs, final EventCategoryType type) {
+ private List<String> filter(final List<EventCategory> eventCategoryTOs, final EventCategoryType type) {
Set<String> res = new HashSet<>();
eventCategoryTOs.stream().filter(eventCategory
@@ -274,7 +274,7 @@ public abstract class EventCategoryPanel extends Panel {
}
private List<String> filter(
- final List<EventCategoryTO> eventCategoryTOs, final EventCategoryType type, final String category) {
+ final List<EventCategory> eventCategoryTOs, final EventCategoryType type, final String category) {
Set<String> res = new HashSet<>();
@@ -348,7 +348,7 @@ public abstract class EventCategoryPanel extends Panel {
final InspectSelectedEvent inspectSelectedEvent = (InspectSelectedEvent) event.getPayload();
- final Map.Entry<EventCategoryTO, AuditElements.Result> categoryEvent = AuditLoggerName.parseEventCategory(
+ final Map.Entry<EventCategory, AuditElements.Result> categoryEvent = AuditLoggerName.parseEventCategory(
inspectSelectedEvent.getEvent());
eventCategoryTO.setType(categoryEvent.getKey().getType());
@@ -389,9 +389,9 @@ public abstract class EventCategoryPanel extends Panel {
}
private void setEvents() {
- final Iterator<EventCategoryTO> itor = eventCategoryTOs.iterator();
+ final Iterator<EventCategory> itor = eventCategoryTOs.iterator();
while (itor.hasNext() && eventCategoryTO.getEvents().isEmpty()) {
- final EventCategoryTO eventCategory = itor.next();
+ final EventCategory eventCategory = itor.next();
if (eventCategory.getType() == eventCategoryTO.getType()
&& StringUtils.equals(eventCategory.getCategory(), eventCategoryTO.getCategory())
&& StringUtils.equals(eventCategory.getSubcategory(), eventCategoryTO.getSubcategory())) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/client/console/src/main/java/org/apache/syncope/client/console/events/EventSelectionPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/events/EventSelectionPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/events/EventSelectionPanel.java
index 33844d9..6e3d5ca 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/events/EventSelectionPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/events/EventSelectionPanel.java
@@ -24,7 +24,7 @@ import java.util.List;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.console.wicket.ajax.form.IndicatorAjaxFormChoiceComponentUpdatingBehavior;
-import org.apache.syncope.common.lib.log.EventCategoryTO;
+import org.apache.syncope.common.lib.log.EventCategory;
import org.apache.syncope.common.lib.types.AuditElements;
import org.apache.syncope.common.lib.types.AuditLoggerName;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -48,7 +48,7 @@ public abstract class EventSelectionPanel extends Panel {
private final Set<String> selected = new HashSet<>();
public EventSelectionPanel(
- final String id, final EventCategoryTO eventCategoryTO, final IModel<List<String>> model) {
+ final String id, final EventCategory eventCategoryTO, final IModel<List<String>> model) {
super(id);
setOutputMarkupId(true);
@@ -184,7 +184,7 @@ public abstract class EventSelectionPanel extends Panel {
failureGroup.add(failureView);
}
- private List<String> getEvents(final EventCategoryTO eventCategoryTO) {
+ private List<String> getEvents(final EventCategory eventCategoryTO) {
final List<String> res;
res = eventCategoryTO.getEvents();
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/client/console/src/main/java/org/apache/syncope/client/console/pages/Audit.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/Audit.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/Audit.java
index 09ab57e..272842c 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/Audit.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/Audit.java
@@ -28,7 +28,7 @@ import org.apache.syncope.client.console.BookmarkablePageLinkBuilder;
import org.apache.syncope.client.console.events.EventCategoryPanel;
import org.apache.syncope.client.console.events.SelectedEventsPanel;
import org.apache.syncope.client.console.rest.LoggerRestClient;
-import org.apache.syncope.common.lib.log.EventCategoryTO;
+import org.apache.syncope.common.lib.log.EventCategory;
import org.apache.syncope.common.lib.types.AuditElements;
import org.apache.syncope.common.lib.types.AuditLoggerName;
import org.apache.syncope.common.lib.types.StandardEntitlement;
@@ -89,7 +89,7 @@ public class Audit extends BasePage {
(SelectedEventsPanel.EventSelectionChanged) event.getPayload();
eventSelectionChanged.getToBeRemoved().forEach(toBeRemoved -> {
- Pair<EventCategoryTO, AuditElements.Result> eventCategory =
+ Pair<EventCategory, AuditElements.Result> eventCategory =
AuditLoggerName.parseEventCategory(toBeRemoved);
AuditLoggerName auditLoggerName = new AuditLoggerName(
@@ -104,7 +104,7 @@ public class Audit extends BasePage {
});
eventSelectionChanged.getToBeAdded().forEach(toBeAdded -> {
- Pair<EventCategoryTO, AuditElements.Result> eventCategory =
+ Pair<EventCategory, AuditElements.Result> eventCategory =
AuditLoggerName.parseEventCategory(toBeAdded);
AuditLoggerName auditLoggerName = new AuditLoggerName(
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/client/console/src/main/java/org/apache/syncope/client/console/pages/LogViewer.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/LogViewer.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/LogViewer.java
index ed08b11..da27cf0 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/LogViewer.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/LogViewer.java
@@ -25,7 +25,7 @@ import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.panels.LogStatementPanel;
import org.apache.syncope.client.console.rest.LoggerRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
-import org.apache.syncope.common.lib.log.LogStatementTO;
+import org.apache.syncope.common.lib.log.LogStatement;
import org.apache.syncope.common.lib.types.StandardEntitlement;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior;
@@ -64,13 +64,13 @@ public class LogViewer extends WebPage {
viewer.add(stContainer);
final Model<Long> lastTimeInMillis = Model.of(0L);
- final IModel<List<LogStatementTO>> statementViewModel = new ListModel<>(new ArrayList<>());
- final ListView<LogStatementTO> statementView = new ListView<LogStatementTO>("statements", statementViewModel) {
+ final IModel<List<LogStatement>> statementViewModel = new ListModel<>(new ArrayList<>());
+ final ListView<LogStatement> statementView = new ListView<LogStatement>("statements", statementViewModel) {
private static final long serialVersionUID = -9180479401817023838L;
@Override
- protected void populateItem(final ListItem<LogStatementTO> item) {
+ protected void populateItem(final ListItem<LogStatement> item) {
LogStatementPanel panel = new LogStatementPanel("statement", item.getModelObject());
panel.setOutputMarkupId(true);
item.add(panel);
@@ -88,7 +88,7 @@ public class LogViewer extends WebPage {
target.prependJavaScript(
String.format("window.scrollTop = $('#%s').scrollTop();", stContainer.getMarkupId()));
- List<LogStatementTO> recentLogStatements = appenders.getModelObject() == null
+ List<LogStatement> recentLogStatements = appenders.getModelObject() == null
? new ArrayList<>()
: restClient.getLastLogStatements(appenders.getModelObject(), lastTimeInMillis.getObject());
if (!recentLogStatements.isEmpty()) {
@@ -97,7 +97,7 @@ public class LogViewer extends WebPage {
int currentSize = statementView.getModelObject().size();
int recentSize = recentLogStatements.size();
- List<LogStatementTO> newModelObject = SetUniqueList.<LogStatementTO>setUniqueList(
+ List<LogStatement> newModelObject = SetUniqueList.<LogStatement>setUniqueList(
new ArrayList<>(MAX_STATEMENTS_PER_APPENDER));
if (currentSize <= MAX_STATEMENTS_PER_APPENDER - recentSize) {
newModelObject.addAll(statementView.getModelObject());
@@ -124,7 +124,7 @@ public class LogViewer extends WebPage {
@Override
protected void onUpdate(final AjaxRequestTarget target) {
- List<LogStatementTO> lastStatements = appenders.getModelObject() == null
+ List<LogStatement> lastStatements = appenders.getModelObject() == null
? new ArrayList<>()
: restClient.getLastLogStatements(appenders.getModelObject(), 0);
statementViewModel.setObject(lastStatements);
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/client/console/src/main/java/org/apache/syncope/client/console/panels/LogStatementPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/LogStatementPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/LogStatementPanel.java
index abae16b..fa18338 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/LogStatementPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/LogStatementPanel.java
@@ -24,7 +24,7 @@ import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Alert;
import de.agilecoders.wicket.core.util.Attributes;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.FastDateFormat;
-import org.apache.syncope.common.lib.log.LogStatementTO;
+import org.apache.syncope.common.lib.log.LogStatement;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
@@ -39,7 +39,7 @@ public class LogStatementPanel extends Panel {
private final String labelCssClass;
- public LogStatementPanel(final String id, final LogStatementTO statement) {
+ public LogStatementPanel(final String id, final LogStatement statement) {
super(id);
Alert.Type type;
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/client/console/src/main/java/org/apache/syncope/client/console/rest/LoggerRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/LoggerRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/LoggerRestClient.java
index a4c7825..212cede 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/LoggerRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/LoggerRestClient.java
@@ -27,9 +27,9 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ObjectUtils;
-import org.apache.syncope.common.lib.log.EventCategoryTO;
+import org.apache.syncope.common.lib.log.EventCategory;
import org.apache.syncope.common.lib.log.LogAppender;
-import org.apache.syncope.common.lib.log.LogStatementTO;
+import org.apache.syncope.common.lib.log.LogStatement;
import org.apache.syncope.common.lib.log.LoggerTO;
import org.apache.syncope.common.lib.types.AuditLoggerName;
import org.apache.syncope.common.lib.types.LoggerLevel;
@@ -46,8 +46,8 @@ public class LoggerRestClient extends BaseRestClient {
map(LogAppender::getName).collect(Collectors.toList());
}
- public List<LogStatementTO> getLastLogStatements(final String appender, final long lastStatementTime) {
- List<LogStatementTO> result = new ArrayList<>();
+ public List<LogStatement> getLastLogStatements(final String appender, final long lastStatementTime) {
+ List<LogStatement> result = new ArrayList<>();
getService(LoggerService.class).getLastLogStatements(appender).stream().
filter(statement -> statement.getTimeMillis() > lastStatementTime).
forEachOrdered(statement -> {
@@ -100,11 +100,11 @@ public class LoggerRestClient extends BaseRestClient {
getService(LoggerService.class).delete(LoggerType.AUDIT, auditLoggerName.toLoggerName());
}
- public List<EventCategoryTO> listEvents() {
+ public List<EventCategory> listEvents() {
try {
return getService(LoggerService.class).events();
} catch (Exception e) {
- return Collections.<EventCategoryTO>emptyList();
+ return Collections.<EventCategory>emptyList();
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/common/lib/src/main/java/org/apache/syncope/common/lib/log/EventCategory.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/log/EventCategory.java b/common/lib/src/main/java/org/apache/syncope/common/lib/log/EventCategory.java
new file mode 100644
index 0000000..cf7d7a5
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/log/EventCategory.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.lib.log;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.syncope.common.lib.AbstractBaseBean;
+import org.apache.syncope.common.lib.types.AuditElements;
+
+@XmlRootElement(name = "eventCategory")
+@XmlType
+public class EventCategory extends AbstractBaseBean {
+
+ private static final long serialVersionUID = -4340060002701633401L;
+
+ private AuditElements.EventCategoryType type;
+
+ private String category;
+
+ private String subcategory;
+
+ private final List<String> events = new ArrayList<>();
+
+ /**
+ * Constructor for Type.REST event category.
+ */
+ public EventCategory() {
+ this(AuditElements.EventCategoryType.LOGIC);
+ }
+
+ /**
+ * Constructor for the given Type event category.
+ *
+ * @param type event category type
+ */
+ public EventCategory(final AuditElements.EventCategoryType type) {
+ super();
+ this.type = type;
+ }
+
+ public AuditElements.EventCategoryType getType() {
+ return type;
+ }
+
+ public void setType(final AuditElements.EventCategoryType type) {
+ this.type = type == null ? AuditElements.EventCategoryType.CUSTOM : type;
+ }
+
+ public String getCategory() {
+ return category;
+ }
+
+ public void setCategory(final String category) {
+ this.category = category;
+ }
+
+ public String getSubcategory() {
+ return subcategory;
+ }
+
+ public void setSubcategory(final String subcategory) {
+ this.subcategory = subcategory;
+ }
+
+ @XmlElementWrapper(name = "events")
+ @XmlElement(name = "event")
+ @JsonProperty("events")
+ public List<String> getEvents() {
+ return events;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/common/lib/src/main/java/org/apache/syncope/common/lib/log/EventCategoryTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/log/EventCategoryTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/log/EventCategoryTO.java
deleted file mode 100644
index 3ea4778..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/log/EventCategoryTO.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.common.lib.log;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-import org.apache.syncope.common.lib.AbstractBaseBean;
-import org.apache.syncope.common.lib.types.AuditElements;
-
-@XmlRootElement(name = "eventCategory")
-@XmlType
-public class EventCategoryTO extends AbstractBaseBean {
-
- private static final long serialVersionUID = -4340060002701633401L;
-
- private AuditElements.EventCategoryType type;
-
- private String category;
-
- private String subcategory;
-
- private final List<String> events = new ArrayList<>();
-
- /**
- * Constructor for Type.REST event category.
- */
- public EventCategoryTO() {
- this(AuditElements.EventCategoryType.LOGIC);
- }
-
- /**
- * Constructor for the given Type event category.
- *
- * @param type event category type
- */
- public EventCategoryTO(final AuditElements.EventCategoryType type) {
- super();
- this.type = type;
- }
-
- public AuditElements.EventCategoryType getType() {
- return type;
- }
-
- public void setType(final AuditElements.EventCategoryType type) {
- this.type = type == null ? AuditElements.EventCategoryType.CUSTOM : type;
- }
-
- public String getCategory() {
- return category;
- }
-
- public void setCategory(final String category) {
- this.category = category;
- }
-
- public String getSubcategory() {
- return subcategory;
- }
-
- public void setSubcategory(final String subcategory) {
- this.subcategory = subcategory;
- }
-
- @XmlElementWrapper(name = "events")
- @XmlElement(name = "event")
- @JsonProperty("events")
- public List<String> getEvents() {
- return events;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/common/lib/src/main/java/org/apache/syncope/common/lib/log/LogStatement.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/log/LogStatement.java b/common/lib/src/main/java/org/apache/syncope/common/lib/log/LogStatement.java
new file mode 100644
index 0000000..7c80a9d
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/log/LogStatement.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.lib.log;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.syncope.common.lib.AbstractBaseBean;
+import org.apache.syncope.common.lib.types.LoggerLevel;
+
+@XmlRootElement(name = "logStatement")
+@XmlType
+public class LogStatement extends AbstractBaseBean {
+
+ private static final long serialVersionUID = -2931205859104653385L;
+
+ private LoggerLevel level;
+
+ private String loggerName;
+
+ private String message;
+
+ private String stackTrace;
+
+ private long timeMillis;
+
+ private long threadId;
+
+ private String threadName;
+
+ private int threadPriority;
+
+ public LoggerLevel getLevel() {
+ return level;
+ }
+
+ public void setLevel(final LoggerLevel level) {
+ this.level = level;
+ }
+
+ public String getLoggerName() {
+ return loggerName;
+ }
+
+ public void setLoggerName(final String loggerName) {
+ this.loggerName = loggerName;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(final String message) {
+ this.message = message;
+ }
+
+ public String getStackTrace() {
+ return stackTrace;
+ }
+
+ public void setStackTrace(final String stackTrace) {
+ this.stackTrace = stackTrace;
+ }
+
+ public long getTimeMillis() {
+ return timeMillis;
+ }
+
+ public void setTimeMillis(final long timeMillis) {
+ this.timeMillis = timeMillis;
+ }
+
+ public long getThreadId() {
+ return threadId;
+ }
+
+ public void setThreadId(final long threadId) {
+ this.threadId = threadId;
+ }
+
+ public String getThreadName() {
+ return threadName;
+ }
+
+ public void setThreadName(final String threadName) {
+ this.threadName = threadName;
+ }
+
+ public int getThreadPriority() {
+ return threadPriority;
+ }
+
+ public void setThreadPriority(final int threadPriority) {
+ this.threadPriority = threadPriority;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/common/lib/src/main/java/org/apache/syncope/common/lib/log/LogStatementTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/log/LogStatementTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/log/LogStatementTO.java
deleted file mode 100644
index 7d28e15..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/log/LogStatementTO.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.common.lib.log;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-import org.apache.syncope.common.lib.AbstractBaseBean;
-import org.apache.syncope.common.lib.types.LoggerLevel;
-
-@XmlRootElement(name = "logStatement")
-@XmlType
-public class LogStatementTO extends AbstractBaseBean {
-
- private static final long serialVersionUID = -2931205859104653385L;
-
- private LoggerLevel level;
-
- private String loggerName;
-
- private String message;
-
- private String stackTrace;
-
- private long timeMillis;
-
- private long threadId;
-
- private String threadName;
-
- private int threadPriority;
-
- public LoggerLevel getLevel() {
- return level;
- }
-
- public void setLevel(final LoggerLevel level) {
- this.level = level;
- }
-
- public String getLoggerName() {
- return loggerName;
- }
-
- public void setLoggerName(final String loggerName) {
- this.loggerName = loggerName;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(final String message) {
- this.message = message;
- }
-
- public String getStackTrace() {
- return stackTrace;
- }
-
- public void setStackTrace(final String stackTrace) {
- this.stackTrace = stackTrace;
- }
-
- public long getTimeMillis() {
- return timeMillis;
- }
-
- public void setTimeMillis(final long timeMillis) {
- this.timeMillis = timeMillis;
- }
-
- public long getThreadId() {
- return threadId;
- }
-
- public void setThreadId(final long threadId) {
- this.threadId = threadId;
- }
-
- public String getThreadName() {
- return threadName;
- }
-
- public void setThreadName(final String threadName) {
- this.threadName = threadName;
- }
-
- public int getThreadPriority() {
- return threadPriority;
- }
-
- public void setThreadPriority(final int threadPriority) {
- this.threadPriority = threadPriority;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java
index 31622ec..a8ad231 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java
@@ -25,7 +25,7 @@ import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.AbstractBaseBean;
-import org.apache.syncope.common.lib.log.EventCategoryTO;
+import org.apache.syncope.common.lib.log.EventCategory;
import org.apache.syncope.common.lib.types.AuditElements.EventCategoryType;
import org.apache.syncope.common.lib.types.AuditElements.Result;
@@ -104,7 +104,7 @@ public class AuditLoggerName extends AbstractBaseBean {
throw new ParseException("Audit logger name must start with " + LoggerType.AUDIT.getPrefix(), 0);
}
- final Map.Entry<EventCategoryTO, Result> eventCategory = parseEventCategory(
+ Map.Entry<EventCategory, Result> eventCategory = parseEventCategory(
loggerName.replaceAll(LoggerType.AUDIT.getPrefix() + ".", ""));
return new AuditLoggerName(
@@ -116,8 +116,8 @@ public class AuditLoggerName extends AbstractBaseBean {
eventCategory.getValue());
}
- public static Pair<EventCategoryTO, Result> parseEventCategory(final String event) {
- EventCategoryTO eventCategoryTO = new EventCategoryTO();
+ public static Pair<EventCategory, Result> parseEventCategory(final String event) {
+ EventCategory eventCategoryTO = new EventCategory();
Result condition = null;
@@ -181,7 +181,7 @@ public class AuditLoggerName extends AbstractBaseBean {
final String event,
final AuditElements.Result condition) {
- final StringBuilder eventBuilder = new StringBuilder();
+ StringBuilder eventBuilder = new StringBuilder();
eventBuilder.append('[');
if (type != null) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java
index 6be9020..262325a 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java
@@ -20,6 +20,8 @@ package org.apache.syncope.common.rest.api.service;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
@@ -36,9 +38,9 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import org.apache.syncope.common.lib.log.EventCategoryTO;
+import org.apache.syncope.common.lib.log.EventCategory;
import org.apache.syncope.common.lib.log.LogAppender;
-import org.apache.syncope.common.lib.log.LogStatementTO;
+import org.apache.syncope.common.lib.log.LogStatement;
import org.apache.syncope.common.lib.log.LoggerTO;
import org.apache.syncope.common.lib.types.LoggerType;
import org.apache.syncope.common.rest.api.RESTHeaders;
@@ -58,6 +60,13 @@ public interface LoggerService extends JAXRSService {
*
* @return the list of memory appenders available in the current logging configuration
*/
+ @ApiResponses(
+ @ApiResponse(responseCode = "200",
+ description = "list of memory appenders available in the current logging configuration",
+ content =
+ @Content(array =
+ @ArraySchema(schema =
+ @Schema(implementation = LogAppender.class)))))
@GET
@Path("memoryAppenders")
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@@ -69,20 +78,34 @@ public interface LoggerService extends JAXRSService {
* @param memoryAppender memory appender name
* @return the last log statements available in the provided memory appender
*/
+ @ApiResponses(
+ @ApiResponse(responseCode = "200",
+ description = "last log statements available in the provided memory appender",
+ content =
+ @Content(array =
+ @ArraySchema(schema =
+ @Schema(implementation = LogStatement.class)))))
@GET
@Path("memoryAppenders/{memoryAppender}/lastLogStatements")
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- List<LogStatementTO> getLastLogStatements(@NotNull @PathParam("memoryAppender") String memoryAppender);
+ List<LogStatement> getLastLogStatements(@NotNull @PathParam("memoryAppender") String memoryAppender);
/**
* Returns the list of all managed events in audit.
*
* @return list of all managed events in audit
*/
+ @ApiResponses(
+ @ApiResponse(responseCode = "200",
+ description = "list of all managed events in audit",
+ content =
+ @Content(array =
+ @ArraySchema(schema =
+ @Schema(implementation = EventCategory.class)))))
@GET
@Path("events")
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- List<EventCategoryTO> events();
+ List<EventCategory> events();
/**
* Returns logger with matching type and name.
@@ -91,6 +114,12 @@ public interface LoggerService extends JAXRSService {
* @param name Logger name to be read
* @return logger with matching type and name
*/
+ @ApiResponses(
+ @ApiResponse(responseCode = "200",
+ description = "logger with matching type and name",
+ content =
+ @Content(schema =
+ @Schema(implementation = LoggerTO.class))))
@GET
@Path("{type}/{name}")
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@@ -102,6 +131,13 @@ public interface LoggerService extends JAXRSService {
* @param type LoggerType to be selected
* @return list of loggers with matching type
*/
+ @ApiResponses(
+ @ApiResponse(responseCode = "200",
+ description = "list of loggers with matching type",
+ content =
+ @Content(array =
+ @ArraySchema(schema =
+ @Schema(implementation = LoggerTO.class)))))
@GET
@Path("{type}")
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@@ -135,5 +171,4 @@ public interface LoggerService extends JAXRSService {
@Path("{type}/{name}")
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
void delete(@NotNull @PathParam("type") LoggerType type, @NotNull @PathParam("name") String name);
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java
index c576774..b96a4a2 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java
@@ -23,6 +23,7 @@ import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
+import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.logging.log4j.Level;
@@ -31,9 +32,9 @@ import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.LoggerConfig;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.SyncopeConstants;
-import org.apache.syncope.common.lib.log.EventCategoryTO;
+import org.apache.syncope.common.lib.log.EventCategory;
import org.apache.syncope.common.lib.log.LogAppender;
-import org.apache.syncope.common.lib.log.LogStatementTO;
+import org.apache.syncope.common.lib.log.LogStatement;
import org.apache.syncope.common.lib.log.LoggerTO;
import org.apache.syncope.common.lib.types.AuditElements.EventCategoryType;
import org.apache.syncope.common.lib.types.AuditLoggerName;
@@ -48,6 +49,7 @@ import org.apache.syncope.common.lib.types.AuditElements;
import org.apache.syncope.common.lib.types.StandardEntitlement;
import org.apache.syncope.core.logic.audit.AuditAppender;
import org.apache.syncope.core.logic.init.LoggerLoader;
+import org.apache.syncope.core.persistence.api.dao.DomainDAO;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.dao.LoggerDAO;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
@@ -83,15 +85,10 @@ public class LoggerLogic extends AbstractTransactionalLogic<LoggerTO> {
private ExternalResourceDAO resourceDAO;
@Autowired
- private EntityFactory entityFactory;
+ private DomainDAO domainDAO;
- private List<LoggerTO> list(final LoggerType type) {
- return loggerDAO.findAll(type).stream().map(logger -> {
- LoggerTO loggerTO = new LoggerTO();
- BeanUtils.copyProperties(logger, loggerTO);
- return loggerTO;
- }).collect(Collectors.toList());
- }
+ @Autowired
+ private EntityFactory entityFactory;
@PreAuthorize("hasRole('" + StandardEntitlement.LOG_LIST + "') and authentication.details.domain == "
+ "T(org.apache.syncope.common.lib.SyncopeConstants).MASTER_DOMAIN")
@@ -107,7 +104,7 @@ public class LoggerLogic extends AbstractTransactionalLogic<LoggerTO> {
@PreAuthorize("hasRole('" + StandardEntitlement.LOG_READ + "') and authentication.details.domain == "
+ "T(org.apache.syncope.common.lib.SyncopeConstants).MASTER_DOMAIN")
@Transactional(readOnly = true)
- public List<LogStatementTO> getLastLogStatements(final String memoryAppender) {
+ public List<LogStatement> getLastLogStatements(final String memoryAppender) {
MemoryAppender appender = loggerLoader.getMemoryAppenders().get(memoryAppender);
if (appender == null) {
throw new NotFoundException("Appender " + memoryAppender);
@@ -116,18 +113,29 @@ public class LoggerLogic extends AbstractTransactionalLogic<LoggerTO> {
return appender.getStatements().stream().collect(Collectors.toList());
}
+ private List<LoggerTO> list(final LoggerType type) {
+ return loggerDAO.findAll(type).stream().map(logger -> {
+ LoggerTO loggerTO = new LoggerTO();
+ BeanUtils.copyProperties(logger, loggerTO);
+ return loggerTO;
+ }).collect(Collectors.toList());
+ }
+
@PreAuthorize("hasRole('" + StandardEntitlement.LOG_LIST + "') and authentication.details.domain == "
+ "T(org.apache.syncope.common.lib.SyncopeConstants).MASTER_DOMAIN")
@Transactional(readOnly = true)
public List<LoggerTO> listLogs() {
- return list(LoggerType.LOG);
+ return list(LoggerType.LOG).stream().
+ filter(logger -> !logger.getKey().startsWith(SyncopeConstants.MASTER_DOMAIN)).
+ filter(logger -> domainDAO.findAll().stream().
+ noneMatch(domain -> logger.getKey().startsWith(domain.getKey()))).
+ collect(Collectors.toList());
}
@PreAuthorize("hasRole('" + StandardEntitlement.AUDIT_LIST + "')")
@Transactional(readOnly = true)
public List<AuditLoggerName> listAudits() {
return list(LoggerType.AUDIT).stream().
- filter(logger -> logger != null).
map(logger -> {
AuditLoggerName result = null;
try {
@@ -137,7 +145,9 @@ public class LoggerLogic extends AbstractTransactionalLogic<LoggerTO> {
}
return result;
- }).collect(Collectors.toList());
+ }).
+ filter(Objects::nonNull).
+ collect(Collectors.toList());
}
private void throwInvalidLogger(final LoggerType type) {
@@ -151,26 +161,22 @@ public class LoggerLogic extends AbstractTransactionalLogic<LoggerTO> {
+ "T(org.apache.syncope.common.lib.SyncopeConstants).MASTER_DOMAIN")
@Transactional(readOnly = true)
public LoggerTO readLog(final String name) {
- for (final LoggerTO logger : listLogs()) {
- if (logger.getKey().equals(name)) {
- return logger;
- }
- }
- throw new NotFoundException("Logger " + name);
+ return listLogs().stream().
+ filter(logger -> logger.getKey().equals(name)).findFirst().
+ orElseThrow(() -> new NotFoundException("Logger " + name));
}
@PreAuthorize("hasRole('" + StandardEntitlement.AUDIT_READ + "')")
@Transactional(readOnly = true)
public LoggerTO readAudit(final String name) {
- for (final AuditLoggerName logger : listAudits()) {
- if (logger.toLoggerName().equals(name)) {
- final LoggerTO loggerTO = new LoggerTO();
- loggerTO.setKey(logger.toLoggerName());
- loggerTO.setLevel(LoggerLevel.DEBUG);
- return loggerTO;
- }
- }
- throw new NotFoundException("Logger " + name);
+ return listAudits().stream().
+ filter(logger -> logger.toLoggerName().equals(name)).findFirst().
+ map(logger -> {
+ LoggerTO loggerTO = new LoggerTO();
+ loggerTO.setKey(logger.toLoggerName());
+ loggerTO.setLevel(LoggerLevel.DEBUG);
+ return loggerTO;
+ }).orElseThrow(() -> new NotFoundException("Audit " + name));
}
private LoggerTO setLevel(final String name, final Level level, final LoggerType expectedType) {
@@ -297,11 +303,11 @@ public class LoggerLogic extends AbstractTransactionalLogic<LoggerTO> {
}
}
- @PreAuthorize("hasRole('" + StandardEntitlement.AUDIT_LIST + "') or hasRole('"
- + StandardEntitlement.NOTIFICATION_LIST + "')")
- public List<EventCategoryTO> listAuditEvents() {
+ @PreAuthorize("hasRole('" + StandardEntitlement.AUDIT_LIST + "') "
+ + "or hasRole('" + StandardEntitlement.NOTIFICATION_LIST + "')")
+ public List<EventCategory> listAuditEvents() {
// use set to avoid duplications or null elements
- Set<EventCategoryTO> events = new HashSet<>();
+ Set<EventCategory> events = new HashSet<>();
try {
ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
@@ -319,75 +325,75 @@ public class LoggerLogic extends AbstractTransactionalLogic<LoggerTO> {
final Class<?> clazz = Class.forName(metadataReader.getClassMetadata().getClassName());
if (clazz.isAnnotationPresent(Component.class) && AbstractLogic.class.isAssignableFrom(clazz)) {
- EventCategoryTO eventCategoryTO = new EventCategoryTO();
- eventCategoryTO.setCategory(clazz.getSimpleName());
+ EventCategory eventCategory = new EventCategory();
+ eventCategory.setCategory(clazz.getSimpleName());
for (Method method : clazz.getDeclaredMethods()) {
if (Modifier.isPublic(method.getModifiers())
- && !eventCategoryTO.getEvents().contains(method.getName())) {
+ && !eventCategory.getEvents().contains(method.getName())) {
- eventCategoryTO.getEvents().add(method.getName());
+ eventCategory.getEvents().add(method.getName());
}
}
- events.add(eventCategoryTO);
+ events.add(eventCategory);
}
}
}
// SYNCOPE-608
- EventCategoryTO authenticationControllerEvents = new EventCategoryTO();
+ EventCategory authenticationControllerEvents = new EventCategory();
authenticationControllerEvents.setCategory(AuditElements.AUTHENTICATION_CATEGORY);
authenticationControllerEvents.getEvents().add(AuditElements.LOGIN_EVENT);
events.add(authenticationControllerEvents);
- events.add(new EventCategoryTO(EventCategoryType.PROPAGATION));
- events.add(new EventCategoryTO(EventCategoryType.PULL));
- events.add(new EventCategoryTO(EventCategoryType.PUSH));
+ events.add(new EventCategory(EventCategoryType.PROPAGATION));
+ events.add(new EventCategory(EventCategoryType.PULL));
+ events.add(new EventCategory(EventCategoryType.PUSH));
for (AnyTypeKind anyTypeKind : AnyTypeKind.values()) {
resourceDAO.findAll().forEach(resource -> {
- EventCategoryTO propEventCategoryTO = new EventCategoryTO(EventCategoryType.PROPAGATION);
- EventCategoryTO pullEventCategoryTO = new EventCategoryTO(EventCategoryType.PULL);
- EventCategoryTO pushEventCategoryTO = new EventCategoryTO(EventCategoryType.PUSH);
+ EventCategory propEventCategory = new EventCategory(EventCategoryType.PROPAGATION);
+ EventCategory pullEventCategory = new EventCategory(EventCategoryType.PULL);
+ EventCategory pushEventCategory = new EventCategory(EventCategoryType.PUSH);
- propEventCategoryTO.setCategory(anyTypeKind.name().toLowerCase());
- propEventCategoryTO.setSubcategory(resource.getKey());
+ propEventCategory.setCategory(anyTypeKind.name().toLowerCase());
+ propEventCategory.setSubcategory(resource.getKey());
- pullEventCategoryTO.setCategory(anyTypeKind.name().toLowerCase());
- pushEventCategoryTO.setCategory(anyTypeKind.name().toLowerCase());
- pullEventCategoryTO.setSubcategory(resource.getKey());
- pushEventCategoryTO.setSubcategory(resource.getKey());
+ pullEventCategory.setCategory(anyTypeKind.name().toLowerCase());
+ pushEventCategory.setCategory(anyTypeKind.name().toLowerCase());
+ pullEventCategory.setSubcategory(resource.getKey());
+ pushEventCategory.setSubcategory(resource.getKey());
for (ResourceOperation resourceOperation : ResourceOperation.values()) {
- propEventCategoryTO.getEvents().add(resourceOperation.name().toLowerCase());
+ propEventCategory.getEvents().add(resourceOperation.name().toLowerCase());
}
- pullEventCategoryTO.getEvents().add(ResourceOperation.DELETE.name().toLowerCase());
+ pullEventCategory.getEvents().add(ResourceOperation.DELETE.name().toLowerCase());
for (UnmatchingRule unmatching : UnmatchingRule.values()) {
String event = UnmatchingRule.toEventName(unmatching);
- pullEventCategoryTO.getEvents().add(event);
- pushEventCategoryTO.getEvents().add(event);
+ pullEventCategory.getEvents().add(event);
+ pushEventCategory.getEvents().add(event);
}
for (MatchingRule matching : MatchingRule.values()) {
String event = MatchingRule.toEventName(matching);
- pullEventCategoryTO.getEvents().add(event);
- pushEventCategoryTO.getEvents().add(event);
+ pullEventCategory.getEvents().add(event);
+ pushEventCategory.getEvents().add(event);
}
- events.add(propEventCategoryTO);
- events.add(pullEventCategoryTO);
- events.add(pushEventCategoryTO);
+ events.add(propEventCategory);
+ events.add(pullEventCategory);
+ events.add(pushEventCategory);
});
}
- EventCategoryTO eventCategoryTO = new EventCategoryTO(EventCategoryType.TASK);
- eventCategoryTO.setCategory(PullJobDelegate.class.getSimpleName());
- events.add(eventCategoryTO);
+ EventCategory eventCategory = new EventCategory(EventCategoryType.TASK);
+ eventCategory.setCategory(PullJobDelegate.class.getSimpleName());
+ events.add(eventCategory);
- eventCategoryTO = new EventCategoryTO(EventCategoryType.TASK);
- eventCategoryTO.setCategory(PushJobDelegate.class.getSimpleName());
- events.add(eventCategoryTO);
+ eventCategory = new EventCategory(EventCategoryType.TASK);
+ eventCategory.setCategory(PushJobDelegate.class.getSimpleName());
+ events.add(eventCategory);
} catch (Exception e) {
LOG.error("Failure retrieving audit/notification events", e);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/core/logic/src/main/java/org/apache/syncope/core/logic/MemoryAppender.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/MemoryAppender.java b/core/logic/src/main/java/org/apache/syncope/core/logic/MemoryAppender.java
index d78585b..36f6aa6 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/MemoryAppender.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/MemoryAppender.java
@@ -30,14 +30,14 @@ import org.apache.logging.log4j.core.config.plugins.PluginFactory;
import org.apache.logging.log4j.message.Message;
import org.apache.logging.log4j.message.ReusableMessage;
import org.apache.syncope.common.lib.collections.CircularFifoQueue;
-import org.apache.syncope.common.lib.log.LogStatementTO;
+import org.apache.syncope.common.lib.log.LogStatement;
import org.apache.syncope.common.lib.types.LoggerLevel;
import org.apache.syncope.core.provisioning.api.utils.ExceptionUtils2;
@Plugin(name = "Memory", category = "Core", elementType = Appender.ELEMENT_TYPE, printObject = true)
public class MemoryAppender extends AbstractAppender {
- private final CircularFifoQueue<LogStatementTO> statements;
+ private final CircularFifoQueue<LogStatement> statements;
protected MemoryAppender(
final String name,
@@ -51,7 +51,7 @@ public class MemoryAppender extends AbstractAppender {
@Override
public void append(final LogEvent event) {
- LogStatementTO statement = new LogStatementTO();
+ LogStatement statement = new LogStatement();
statement.setLevel(LoggerLevel.fromLevel(event.getLevel()));
statement.setLoggerName(event.getLoggerName());
@@ -74,7 +74,7 @@ public class MemoryAppender extends AbstractAppender {
this.statements.add(statement);
}
- public Queue<LogStatementTO> getStatements() {
+ public Queue<LogStatement> getStatements() {
return statements;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java b/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java
index 7a5e2dc..c530e49 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java
@@ -20,10 +20,10 @@ package org.apache.syncope.core.logic.init;
import java.sql.Connection;
import java.sql.SQLException;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
import javax.sql.DataSource;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
@@ -70,11 +70,11 @@ public class LoggerLoader implements SyncopeLoader {
@Override
public void load() {
- final LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
+ LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
ctx.getConfiguration().getAppenders().entrySet().stream().
filter(entry -> (entry.getValue() instanceof MemoryAppender)).
- forEachOrdered(entry -> {
+ forEach(entry -> {
memoryAppenders.put(entry.getKey(), (MemoryAppender) entry.getValue());
});
@@ -109,11 +109,10 @@ public class LoggerLoader implements SyncopeLoader {
ctx.getConfiguration().addAppender(appender);
}
- LoggerConfig logConf = new LoggerConfig(
- AuditLoggerName.getAuditLoggerName(entry.getKey()), null, false);
+ LoggerConfig logConf = new LoggerConfig(AuditLoggerName.getAuditLoggerName(entry.getKey()), null, false);
logConf.addAppender(appender, Level.DEBUG, null);
logConf.setLevel(Level.DEBUG);
- ctx.getConfiguration().addLogger(AuditLoggerName.getAuditLoggerName(entry.getKey()), logConf);
+ ctx.getConfiguration().addLogger(logConf.getName(), logConf);
// SYNCOPE-1144 For each custom audit appender class add related appenders to log4j logger
auditAppenders(entry.getKey()).forEach(auditAppender -> {
@@ -147,8 +146,7 @@ public class LoggerLoader implements SyncopeLoader {
}
public List<AuditAppender> auditAppenders(final String domain) throws BeansException {
- List<AuditAppender> auditAppenders = new ArrayList<>();
- implementationLookup.getAuditAppenderClasses().stream().map(clazz -> {
+ return implementationLookup.getAuditAppenderClasses().stream().map(clazz -> {
AuditAppender auditAppender;
if (ApplicationContextProvider.getBeanFactory().containsSingleton(clazz.getName())) {
auditAppender = (AuditAppender) ApplicationContextProvider.getBeanFactory().
@@ -160,10 +158,7 @@ public class LoggerLoader implements SyncopeLoader {
auditAppender.init();
}
return auditAppender;
- }).forEachOrdered(auditAppender -> {
- auditAppenders.add(auditAppender);
- });
- return auditAppenders;
+ }).collect(Collectors.toList());
}
public void addAppenderToContext(
@@ -211,6 +206,5 @@ public class LoggerLoader implements SyncopeLoader {
public String toString() {
return this.description;
}
-
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/XMLContentLoader.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/XMLContentLoader.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/XMLContentLoader.java
index 38fd8df..8b59615 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/XMLContentLoader.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/XMLContentLoader.java
@@ -117,7 +117,7 @@ public class XMLContentLoader extends AbstractContentDealer implements ContentLo
views.stringPropertyNames().stream().sorted().forEachOrdered(idx -> {
LOG.debug("[{}] Creating view {}", domain, views.get(idx).toString());
try {
- jdbcTemplate.execute(views.get(idx).toString().replaceAll("\\n", " "));
+ jdbcTemplate.execute(views.getProperty(idx).replaceAll("\\n", " "));
} catch (DataAccessException e) {
LOG.error("[{}] Could not create view", domain, e);
}
@@ -135,7 +135,7 @@ public class XMLContentLoader extends AbstractContentDealer implements ContentLo
indexes.stringPropertyNames().stream().sorted().forEachOrdered(idx -> {
LOG.debug("[{}] Creating index {}", domain, indexes.get(idx).toString());
try {
- jdbcTemplate.execute(indexes.get(idx).toString());
+ jdbcTemplate.execute(indexes.getProperty(idx));
} catch (DataAccessException e) {
LOG.error("[{}] Could not create index", domain, e);
}
@@ -143,5 +143,4 @@ public class XMLContentLoader extends AbstractContentDealer implements ContentLo
LOG.debug("Indexes created");
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AuditManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AuditManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AuditManagerImpl.java
index 3a2877f..180685f 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AuditManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AuditManagerImpl.java
@@ -120,9 +120,10 @@ public class AuditManagerImpl implements AuditManager {
Logger eventLogger = LoggerFactory.getLogger(
AuditLoggerName.getAuditEventLoggerName(AuthContextUtils.getDomain(), syncopeLogger.getKey()));
String serializedAuditEntry = POJOHelper.serialize(auditEntry);
+
if (throwable == null) {
logger.debug(serializedAuditEntry);
- eventLogger.debug(POJOHelper.serialize(auditEntry));
+ eventLogger.debug(serializedAuditEntry);
} else {
logger.debug(serializedAuditEntry, throwable);
eventLogger.debug(serializedAuditEntry, throwable);
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/LoggerServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/LoggerServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/LoggerServiceImpl.java
index a347dac..a143403 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/LoggerServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/LoggerServiceImpl.java
@@ -21,9 +21,9 @@ package org.apache.syncope.core.rest.cxf.service;
import java.text.ParseException;
import java.util.List;
import javax.ws.rs.BadRequestException;
-import org.apache.syncope.common.lib.log.EventCategoryTO;
+import org.apache.syncope.common.lib.log.EventCategory;
import org.apache.syncope.common.lib.log.LogAppender;
-import org.apache.syncope.common.lib.log.LogStatementTO;
+import org.apache.syncope.common.lib.log.LogStatement;
import org.apache.syncope.common.lib.log.LoggerTO;
import org.apache.syncope.common.lib.types.AuditLoggerName;
import org.apache.syncope.common.lib.types.LoggerType;
@@ -45,7 +45,7 @@ public class LoggerServiceImpl extends AbstractServiceImpl implements LoggerServ
}
@Override
- public List<LogStatementTO> getLastLogStatements(final String memoryAppender) {
+ public List<LogStatement> getLastLogStatements(final String memoryAppender) {
return logic.getLastLogStatements(memoryAppender);
}
@@ -119,7 +119,7 @@ public class LoggerServiceImpl extends AbstractServiceImpl implements LoggerServ
}
@Override
- public List<EventCategoryTO> events() {
+ public List<EventCategory> events() {
return logic.listAuditEvents();
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/04f0dcb8/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LoggerITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LoggerITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LoggerITCase.java
index 8c1c900..6831a56 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LoggerITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LoggerITCase.java
@@ -36,9 +36,9 @@ import javax.xml.ws.WebServiceException;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.log.EventCategoryTO;
+import org.apache.syncope.common.lib.log.EventCategory;
import org.apache.syncope.common.lib.log.LogAppender;
-import org.apache.syncope.common.lib.log.LogStatementTO;
+import org.apache.syncope.common.lib.log.LogStatement;
import org.apache.syncope.common.lib.log.LoggerTO;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
import org.apache.syncope.common.lib.to.ConnPoolConfTO;
@@ -74,11 +74,11 @@ public class LoggerITCase extends AbstractITCase {
@Test
public void lastStatements() {
- List<LogStatementTO> statements = loggerService.getLastLogStatements("connid");
+ List<LogStatement> statements = loggerService.getLastLogStatements("connid");
assertNotNull(statements);
assertFalse(statements.isEmpty());
- LogStatementTO statement = statements.get(0);
+ LogStatement statement = statements.get(0);
assertNotNull(statement);
assertNotNull(statement.getLoggerName());
assertNotNull(statement.getLevel());
@@ -163,11 +163,11 @@ public class LoggerITCase extends AbstractITCase {
@Test
public void listAuditEvents() {
- final List<EventCategoryTO> events = loggerService.events();
+ final List<EventCategory> events = loggerService.events();
boolean found = false;
- for (EventCategoryTO eventCategoryTO : events) {
+ for (EventCategory eventCategoryTO : events) {
if (UserLogic.class.getSimpleName().equals(eventCategoryTO.getCategory())) {
assertEquals(EventCategoryType.LOGIC, eventCategoryTO.getType());
assertTrue(eventCategoryTO.getEvents().contains("create"));
@@ -181,7 +181,7 @@ public class LoggerITCase extends AbstractITCase {
assertTrue(found);
found = false;
- for (EventCategoryTO eventCategoryTO : events) {
+ for (EventCategory eventCategoryTO : events) {
if (GroupLogic.class.getSimpleName().equals(eventCategoryTO.getCategory())) {
assertEquals(EventCategoryType.LOGIC, eventCategoryTO.getType());
assertTrue(eventCategoryTO.getEvents().contains("create"));
@@ -193,7 +193,7 @@ public class LoggerITCase extends AbstractITCase {
assertTrue(found);
found = false;
- for (EventCategoryTO eventCategoryTO : events) {
+ for (EventCategory eventCategoryTO : events) {
if (ResourceLogic.class.getSimpleName().equals(eventCategoryTO.getCategory())) {
assertEquals(EventCategoryType.LOGIC, eventCategoryTO.getType());
assertTrue(eventCategoryTO.getEvents().contains("create"));
@@ -206,7 +206,7 @@ public class LoggerITCase extends AbstractITCase {
assertTrue(found);
found = false;
- for (EventCategoryTO eventCategoryTO : events) {
+ for (EventCategory eventCategoryTO : events) {
if (AnyTypeKind.USER.name().toLowerCase().equals(eventCategoryTO.getCategory())) {
if (RESOURCE_NAME_LDAP.equals(eventCategoryTO.getSubcategory())
&& EventCategoryType.PULL == eventCategoryTO.getType()) {
@@ -219,7 +219,7 @@ public class LoggerITCase extends AbstractITCase {
assertTrue(found);
found = false;
- for (EventCategoryTO eventCategoryTO : events) {
+ for (EventCategory eventCategoryTO : events) {
if (AnyTypeKind.USER.name().toLowerCase().equals(eventCategoryTO.getCategory())) {
if (RESOURCE_NAME_CSV.equals(eventCategoryTO.getSubcategory())
&& EventCategoryType.PROPAGATION == eventCategoryTO.getType()) {
@@ -234,7 +234,7 @@ public class LoggerITCase extends AbstractITCase {
assertTrue(found);
found = false;
- for (EventCategoryTO eventCategoryTO : events) {
+ for (EventCategory eventCategoryTO : events) {
if (EventCategoryType.TASK == eventCategoryTO.getType()
&& "PullJobDelegate".equals(eventCategoryTO.getCategory())) {
found = true;
@@ -335,10 +335,10 @@ public class LoggerITCase extends AbstractITCase {
@Test
public void issueSYNCOPE976() {
- List<EventCategoryTO> events = loggerService.events();
+ List<EventCategory> events = loggerService.events();
assertNotNull(events);
- EventCategoryTO userLogic = events.stream().
+ EventCategory userLogic = events.stream().
filter(object -> "UserLogic".equals(object.getCategory())).findAny().get();
assertNotNull(userLogic);
assertEquals(1, userLogic.getEvents().stream().filter(event -> "create".equals(event)).count());