syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [15/16] syncope git commit: [SYNCOPE-938] Switching from commons-collections to Java 8 features
Date Tue, 22 Aug 2017 15:09:19 GMT
http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyDirectoryPanel.java
index ad02b53..828a698 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyDirectoryPanel.java
@@ -26,14 +26,12 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Date;
 import java.util.List;
-import org.apache.commons.collections4.CollectionUtils;
+import java.util.stream.Collectors;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.syncope.client.console.SyncopeConsoleSession;
 import org.apache.syncope.client.console.commons.AnyDataProvider;
 import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.commons.SerializableTransformer;
 import org.apache.syncope.client.console.commons.status.ConnObjectWrapper;
-import org.apache.syncope.client.console.commons.status.StatusBean;
 import org.apache.syncope.client.console.rest.AbstractAnyRestClient;
 import org.apache.syncope.client.console.rest.SchemaRestClient;
 import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.AttrColumn;
@@ -50,7 +48,6 @@ import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.to.AnyTO;
 import org.apache.syncope.common.lib.to.AnyTypeClassTO;
 import org.apache.syncope.common.lib.to.ConnObjectTO;
-import org.apache.syncope.common.lib.to.PropagationStatus;
 import org.apache.syncope.common.lib.to.ProvisioningResult;
 import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.wicket.PageReference;
@@ -118,16 +115,16 @@ public abstract class AnyDirectoryPanel<A extends AnyTO, E extends AbstractAnyRe
         altDefaultModal.size(Modal.Size.Large);
 
         this.pSchemaNames = new ArrayList<>();
-        for (AnyTypeClassTO anyTypeClassTO : AnyDirectoryPanelBuilder.class.cast(builder).getAnyTypeClassTOs()) {
+        AnyDirectoryPanelBuilder.class.cast(builder).getAnyTypeClassTOs().forEach(anyTypeClassTO -> {
             this.pSchemaNames.addAll(anyTypeClassTO.getPlainSchemas());
-        }
+        });
         this.dSchemaNames = new ArrayList<>();
-        for (AnyTypeClassTO anyTypeClassTO : AnyDirectoryPanelBuilder.class.cast(builder).getAnyTypeClassTOs()) {
+        AnyDirectoryPanelBuilder.class.cast(builder).getAnyTypeClassTOs().forEach(anyTypeClassTO -> {
             this.dSchemaNames.addAll(anyTypeClassTO.getDerSchemas());
-        }
+        });
 
         initResultTable();
-        
+
         // cahnge close callback in order to update header after model update
         modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
 
@@ -149,32 +146,29 @@ public abstract class AnyDirectoryPanel<A extends AnyTO, E extends AbstractAnyRe
         final List<IColumn<A, String>> columns = new ArrayList<>();
         final List<IColumn<A, String>> prefcolumns = new ArrayList<>();
 
-        columns.add(new KeyPropertyColumn<A>(
+        columns.add(new KeyPropertyColumn<>(
                 new ResourceModel(Constants.KEY_FIELD_NAME, Constants.KEY_FIELD_NAME), Constants.KEY_FIELD_NAME));
 
-        for (String name : prefMan.getList(
-                getRequest(), DisplayAttributesModalPanel.getPrefDetailView(type))) {
-            if (!Constants.KEY_FIELD_NAME.equalsIgnoreCase(name)) {
-                addPropertyColumn(
-                        name,
-                        ReflectionUtils.findField(DisplayAttributesModalPanel.getTOClass(type), name),
-                        prefcolumns);
-            }
-        }
-
-        for (String name : prefMan.getList(
-                getRequest(), DisplayAttributesModalPanel.getPrefPlainAttributeView(type))) {
-            if (pSchemaNames.contains(name)) {
-                prefcolumns.add(new AttrColumn<A>(name, SchemaType.PLAIN));
-            }
-        }
-
-        for (String name : prefMan.getList(
-                getRequest(), DisplayAttributesModalPanel.getPrefDerivedAttributeView(type))) {
-            if (dSchemaNames.contains(name)) {
-                prefcolumns.add(new AttrColumn<A>(name, SchemaType.DERIVED));
-            }
-        }
+        prefMan.getList(getRequest(), DisplayAttributesModalPanel.getPrefDetailView(type)).stream().
+                filter(name -> !Constants.KEY_FIELD_NAME.equalsIgnoreCase(name)).
+                forEachOrdered(name -> {
+                    addPropertyColumn(
+                            name,
+                            ReflectionUtils.findField(DisplayAttributesModalPanel.getTOClass(type), name),
+                            prefcolumns);
+                });
+
+        prefMan.getList(getRequest(), DisplayAttributesModalPanel.getPrefPlainAttributeView(type)).stream().
+                filter(name -> pSchemaNames.contains(name)).
+                forEachOrdered(name -> {
+                    prefcolumns.add(new AttrColumn<>(name, SchemaType.PLAIN));
+                });
+
+        prefMan.getList(getRequest(), DisplayAttributesModalPanel.getPrefDerivedAttributeView(type)).stream().
+                filter(name -> (dSchemaNames.contains(name))).
+                forEachOrdered(name -> {
+                    prefcolumns.add(new AttrColumn<>(name, SchemaType.DERIVED));
+                });
 
         // Add defaults in case of no selection
         if (prefcolumns.isEmpty()) {
@@ -201,17 +195,17 @@ public abstract class AnyDirectoryPanel<A extends AnyTO, E extends AbstractAnyRe
             final List<IColumn<A, String>> columns) {
 
         if (Constants.KEY_FIELD_NAME.equalsIgnoreCase(name)) {
-            columns.add(new KeyPropertyColumn<A>(new ResourceModel(name, name), name, name));
+            columns.add(new KeyPropertyColumn<>(new ResourceModel(name, name), name, name));
         } else if (Constants.DEFAULT_TOKEN_FIELD_NAME.equalsIgnoreCase(name)) {
-            columns.add(new TokenColumn<A>(new ResourceModel(name, name), name));
+            columns.add(new TokenColumn<>(new ResourceModel(name, name), name));
         } else if (field != null
                 && (field.getType().equals(Boolean.class) || field.getType().equals(boolean.class))) {
 
-            columns.add(new BooleanPropertyColumn<A>(new ResourceModel(name, name), name, name));
+            columns.add(new BooleanPropertyColumn<>(new ResourceModel(name, name), name, name));
         } else if (field != null && field.getType().equals(Date.class)) {
-            columns.add(new DatePropertyColumn<A>(new ResourceModel(name, name), name, name));
+            columns.add(new DatePropertyColumn<>(new ResourceModel(name, name), name, name));
         } else {
-            columns.add(new PropertyColumn<A, String>(new ResourceModel(name, name), name, name));
+            columns.add(new PropertyColumn<>(new ResourceModel(name, name), name, name));
         }
     }
 
@@ -291,24 +285,16 @@ public abstract class AnyDirectoryPanel<A extends AnyTO, E extends AbstractAnyRe
         return new StatusPanel(
                 panelId,
                 ((ProvisioningResult<A>) result).getEntity(),
-                new ListModel<>(new ArrayList<StatusBean>()),
-                CollectionUtils.collect(
-                        ((ProvisioningResult<A>) result).getPropagationStatuses(),
-                        new SerializableTransformer<PropagationStatus, Pair<ConnObjectTO, ConnObjectWrapper>>() {
-
-                    private static final long serialVersionUID = -4931455531906427515L;
-
-                    @Override
-                    public Pair<ConnObjectTO, ConnObjectWrapper> transform(final PropagationStatus input) {
-                        ConnObjectTO before = input.getBeforeObj();
-                        ConnObjectWrapper afterObjWrapper = new ConnObjectWrapper(
-                                ((ProvisioningResult<A>) result).getEntity(),
-                                input.getResource(),
-                                input.getAfterObj());
-                        return Pair.of(before, afterObjWrapper);
-                    }
-
-                }, new ArrayList<Pair<ConnObjectTO, ConnObjectWrapper>>()),
+                new ListModel<>(new ArrayList<>()),
+                ((ProvisioningResult<A>) result).getPropagationStatuses().stream().
+                        map(input -> {
+                            ConnObjectTO before = input.getBeforeObj();
+                            ConnObjectWrapper afterObjWrapper = new ConnObjectWrapper(
+                                    ((ProvisioningResult<A>) result).getEntity(),
+                                    input.getResource(),
+                                    input.getAfterObj());
+                            return Pair.of(before, afterObjWrapper);
+                        }).collect(Collectors.toList()),
                 pageRef);
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel.java
index 7d0867a..bb809be 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel.java
@@ -18,11 +18,9 @@
  */
 package org.apache.syncope.client.console.panels;
 
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Transformer;
+import java.util.stream.Collectors;
 import org.apache.syncope.client.console.rest.AnyTypeClassRestClient;
 import org.apache.syncope.client.console.rest.ConfRestClient;
 import org.apache.syncope.client.console.rest.SchemaRestClient;
@@ -66,7 +64,7 @@ public class AnyTypeClassDetailsPanel extends Panel {
         antTypeClassForm.setOutputMarkupId(true);
         add(antTypeClassForm);
 
-        final AjaxTextFieldPanel key = new AjaxTextFieldPanel("key", getString("key"), new PropertyModel<String>(
+        final AjaxTextFieldPanel key = new AjaxTextFieldPanel("key", getString("key"), new PropertyModel<>(
                 this.anyTypeClassTO, "key"));
         key.addRequiredLabel();
         key.setEnabled(anyTypeClassTO.getKey() == null || this.anyTypeClassTO.getKey().isEmpty());
@@ -109,22 +107,16 @@ public class AnyTypeClassDetailsPanel extends Panel {
 
     private void buildAvailableSchemas(final String key) {
 
-        List<String> configurationSchemas = new ArrayList<>();
-        CollectionUtils.collect(new ConfRestClient().list(), new Transformer<AttrTO, String>() {
-
-            @Override
-            public String transform(final AttrTO attrTO) {
-                return attrTO.getSchema();
-            }
-        }, configurationSchemas);
-
-        for (AnyTypeClassTO item : new AnyTypeClassRestClient().list()) {
-            if (key == null || !item.getKey().equals(key)) {
-                availablePlainSchemas.removeAll(item.getPlainSchemas());
-                availableDerSchemas.removeAll(item.getDerSchemas());
-                availableVirSchemas.removeAll(item.getVirSchemas());
-            }
-        }
+        List<String> configurationSchemas = new ConfRestClient().list().stream().
+                map(AttrTO::getSchema).collect(Collectors.toList());
+
+        new AnyTypeClassRestClient().list().stream().
+                filter(item -> key == null || !item.getKey().equals(key)).
+                forEach(item -> {
+                    availablePlainSchemas.removeAll(item.getPlainSchemas());
+                    availableDerSchemas.removeAll(item.getDerSchemas());
+                    availableVirSchemas.removeAll(item.getVirSchemas());
+                });
 
         availablePlainSchemas.removeAll(configurationSchemas);
         availablePlainSchemas.removeAll(LAYOUT_PARAMETERS);

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel.java
index 7cf3b33..582dc9f 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel.java
@@ -18,17 +18,15 @@
  */
 package org.apache.syncope.client.console.panels;
 
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-import org.apache.commons.collections4.CollectionUtils;
+import java.util.stream.Collectors;
 import org.apache.syncope.client.console.rest.AnyTypeClassRestClient;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPalettePanel;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
-import org.apache.syncope.common.lib.EntityTOUtils;
-import org.apache.syncope.common.lib.to.AnyTypeClassTO;
 import org.apache.syncope.common.lib.to.AnyTypeTO;
+import org.apache.syncope.common.lib.to.EntityTO;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.wicket.markup.html.WebMarkupContainer;
 import org.apache.wicket.markup.html.form.Form;
@@ -74,7 +72,6 @@ public class AnyTypeDetailsPanel extends Panel {
     }
 
     private List<String> getAvailableAnyTypeClasses() {
-        return CollectionUtils.collect(new AnyTypeClassRestClient().list(),
-                EntityTOUtils.<AnyTypeClassTO>keyTransformer(), new ArrayList<String>());
+        return new AnyTypeClassRestClient().list().stream().map(EntityTO::getKey).collect(Collectors.toList());
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/panels/BeanPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/BeanPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/BeanPanel.java
index c09fb43..d30bdbe 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/BeanPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/BeanPanel.java
@@ -26,8 +26,7 @@ import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Transformer;
+import java.util.stream.Collectors;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.syncope.client.console.panels.search.AnyObjectSearchPanel;
@@ -50,6 +49,7 @@ import org.apache.syncope.common.lib.report.Schema;
 import org.apache.syncope.common.lib.report.SearchCondition;
 import org.apache.syncope.common.lib.search.AbstractFiqlSearchConditionBuilder;
 import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.EntityTO;
 import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.list.ListItem;
@@ -209,26 +209,19 @@ public class BeanPanel<T extends Serializable> extends Panel {
                             }
                         }
 
-                        panel = new AjaxPalettePanel.Builder<String>().setName(fieldName).build(
+                        panel = new AjaxPalettePanel.Builder<>().setName(fieldName).build(
                                 "value",
-                                new PropertyModel<List<String>>(bean.getObject(), fieldName),
-                                new ListModel<>(
-                                        CollectionUtils.collect(
-                                                choices, new Transformer<AbstractSchemaTO, String>() {
-
-                                            @Override
-                                            public String transform(final AbstractSchemaTO input) {
-                                                return input.getKey();
-                                            }
-                                        }, new ArrayList<String>()))).hideLabel();
+                                new PropertyModel<>(bean.getObject(), fieldName),
+                                new ListModel<>(choices.stream().map(EntityTO::getKey).collect(Collectors.toList()))).
+                                hideLabel();
                     } else if (listItemType.isEnum()) {
-                        panel = new AjaxPalettePanel.Builder<String>().setName(fieldName).build(
+                        panel = new AjaxPalettePanel.Builder<>().setName(fieldName).build(
                                 "value",
-                                new PropertyModel<List<String>>(bean.getObject(), fieldName),
+                                new PropertyModel<>(bean.getObject(), fieldName),
                                 new ListModel(Arrays.asList(listItemType.getEnumConstants()))).hideLabel();
                     } else {
                         panel = new MultiFieldPanel.Builder<>(
-                                new PropertyModel<List<String>>(bean.getObject(), fieldName)).build(
+                                new PropertyModel<>(bean.getObject(), fieldName)).build(
                                 "value",
                                 fieldName,
                                 buildSinglePanel(bean.getObject(), field.getType(), fieldName, "panel")).hideLabel();

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.java
index 1399c3e..1f01e59 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjectListViewPanel.java
@@ -20,9 +20,7 @@ package org.apache.syncope.client.console.panels;
 
 import java.io.Serializable;
 import java.util.List;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.IterableUtils;
-import org.apache.commons.collections4.Predicate;
+import java.util.Optional;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.syncope.client.console.commons.ConnIdSpecialName;
@@ -68,17 +66,12 @@ public abstract class ConnObjectListViewPanel extends Panel {
 
             @Override
             protected Component getValueComponent(final String key, final ConnObjectTO bean) {
-                final AttrTO attrTO = IterableUtils.find(bean.getAttrs(), new Predicate<AttrTO>() {
+                Optional<AttrTO> attrTO =
+                        bean.getAttrs().stream().filter(object -> object.getSchema().equals(key)).findAny();
 
-                    @Override
-                    public boolean evaluate(final AttrTO object) {
-                        return object.getSchema().equals(key);
-                    }
-                });
-
-                return attrTO == null || CollectionUtils.isEmpty(attrTO.getValues())
+                return !attrTO.isPresent() || attrTO.get().getValues().isEmpty()
                         ? new Label("field", StringUtils.EMPTY)
-                        : new CollectionPanel("field", attrTO.getValues());
+                        : new CollectionPanel("field", attrTO.get().getValues());
             }
 
         };

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjects.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjects.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjects.java
index d29ce1a..fc8318d 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjects.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnObjects.java
@@ -18,11 +18,9 @@
  */
 package org.apache.syncope.client.console.panels;
 
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Transformer;
+import java.util.stream.Collectors;
 import org.apache.syncope.client.console.commons.Constants;
 import org.apache.syncope.client.console.rest.AnyTypeRestClient;
 import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
@@ -50,20 +48,14 @@ public class ConnObjects extends Panel implements ModalPanel {
     public ConnObjects(final ResourceTO resource, final PageReference pageRef) {
         super(BaseModal.CONTENT_ID);
 
-        List<String> availableAnyTypes = CollectionUtils.collect(
-                resource.getProvisions(), new Transformer<ProvisionTO, String>() {
-
-            @Override
-            public String transform(final ProvisionTO provision) {
-                return provision.getAnyType();
-            }
-        }, new ArrayList<String>());
+        List<String> availableAnyTypes = resource.getProvisions().stream().
+                map(ProvisionTO::getAnyType).collect(Collectors.toList());
         Collections.sort(availableAnyTypes, new AnyTypeRestClient.AnyTypeKeyComparator());
         if (resource.getOrgUnit() != null) {
             availableAnyTypes.add(0, SyncopeConstants.REALM_ANYTYPE);
         }
 
-        anyTypes = new AjaxDropDownChoicePanel<>("anyTypes", "anyTypes", new Model<String>());
+        anyTypes = new AjaxDropDownChoicePanel<>("anyTypes", "anyTypes", new Model<>());
         anyTypes.setChoices(availableAnyTypes);
         anyTypes.hideLabel();
         anyTypes.setNullValid(false);

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConsoleLogPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConsoleLogPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConsoleLogPanel.java
index 5dd4de5..f1e9dc2 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConsoleLogPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConsoleLogPanel.java
@@ -22,8 +22,7 @@ import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import org.apache.commons.collections4.ComparatorUtils;
-import org.apache.commons.collections4.Transformer;
+import org.apache.commons.lang3.ObjectUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.core.LoggerContext;
 import org.apache.logging.log4j.core.config.LoggerConfig;
@@ -55,7 +54,7 @@ public class ConsoleLogPanel extends AbstractLogsPanel<LoggerTO> {
             LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
 
             List<LoggerTO> result = new ArrayList<>();
-            for (final LoggerConfig logger : ctx.getConfiguration().getLoggers().values()) {
+            ctx.getConfiguration().getLoggers().values().forEach(logger -> {
                 String loggerName = LogManager.ROOT_LOGGER_NAME.equals(logger.getName())
                         ? SyncopeConstants.ROOT_LOGGER : logger.getName();
                 if (logger.getLevel() != null) {
@@ -64,15 +63,8 @@ public class ConsoleLogPanel extends AbstractLogsPanel<LoggerTO> {
                     loggerTO.setLevel(LoggerLevel.fromLevel(logger.getLevel()));
                     result.add(loggerTO);
                 }
-            }
-            Collections.sort(result, ComparatorUtils.transformedComparator(
-                    ComparatorUtils.<String>naturalComparator(), new Transformer<LoggerTO, String>() {
-
-                @Override
-                public String transform(final LoggerTO input) {
-                    return input.getKey();
-                }
-            }));
+            });
+            Collections.sort(result, (o1, o2) -> ObjectUtils.compare(o1.getKey(), o2.getKey()));
 
             return result;
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/panels/HistoryConfDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/HistoryConfDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/HistoryConfDetails.java
index 00d95b3..563641c 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/HistoryConfDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/HistoryConfDetails.java
@@ -24,9 +24,7 @@ import java.util.ArrayList;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.IterableUtils;
-import org.apache.commons.collections4.Predicate;
+import java.util.stream.Collectors;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.syncope.client.console.SyncopeConsoleSession;
 import org.apache.syncope.client.console.rest.ConnectorRestClient;
@@ -66,14 +64,8 @@ public class HistoryConfDetails<T extends AbstractHistoryConf> extends Multileve
         super();
 
         // remove selected conf from list
-        CollectionUtils.filter(availableHistoryConfTOs, new Predicate<T>() {
-
-            @Override
-            public boolean evaluate(final T object) {
-                return !object.getKey().equals(selectedHistoryConfTO.getKey());
-            }
-        });
-        this.availableHistoryConfTOs = availableHistoryConfTOs;
+        this.availableHistoryConfTOs = availableHistoryConfTOs.stream().
+                filter(object -> object.getKey().equals(selectedHistoryConfTO.getKey())).collect(Collectors.toList());
         this.selectedHistoryConfTO = selectedHistoryConfTO;
 
         // add current conf to list
@@ -81,11 +73,7 @@ public class HistoryConfDetails<T extends AbstractHistoryConf> extends Multileve
 
         Form<?> form = initDropdownDiffConfForm();
         add(form);
-        if (availableHistoryConfTOs.isEmpty()) {
-            form.setVisible(false);
-        } else {
-            form.setVisible(true);
-        }
+        form.setVisible(!availableHistoryConfTOs.isEmpty());
 
         showConfigurationSinglePanel();
     }
@@ -109,9 +97,9 @@ public class HistoryConfDetails<T extends AbstractHistoryConf> extends Multileve
 
     private void showConfigurationDiffPanel(final List<T> historyConfTOs) {
         List<Pair<String, String>> infos = new ArrayList<>();
-        for (T historyConfTO : historyConfTOs) {
+        historyConfTOs.forEach(historyConfTO -> {
             infos.add(getJSONInfo(historyConfTO));
-        }
+        });
 
         jsonPanel = new JsonDiffPanel(null, new PropertyModel<String>(infos.get(0), "value"),
                 new PropertyModel<String>(infos.get(1), "value"), null) {
@@ -170,7 +158,7 @@ public class HistoryConfDetails<T extends AbstractHistoryConf> extends Multileve
         return historyConfMap;
     }
 
-    private Form initDropdownDiffConfForm() {
+    private Form<?> initDropdownDiffConfForm() {
         final Form<T> form = new Form<>("form");
         form.setModel(new CompoundPropertyModel<>(selectedHistoryConfTO));
         form.setOutputMarkupId(true);
@@ -181,7 +169,7 @@ public class HistoryConfDetails<T extends AbstractHistoryConf> extends Multileve
         final AjaxDropDownChoicePanel<String> dropdownElem = new AjaxDropDownChoicePanel<>(
                 "compareDropdown",
                 getString("compare"),
-                new PropertyModel<String>(selectedHistoryConfTO, "key"),
+                new PropertyModel<>(selectedHistoryConfTO, "key"),
                 false);
         dropdownElem.setChoices(keys);
         dropdownElem.setChoiceRenderer(new IChoiceRenderer<String>() {
@@ -217,13 +205,8 @@ public class HistoryConfDetails<T extends AbstractHistoryConf> extends Multileve
                 final String selectedKey = dropdownElem.getModelObject();
                 if (selectedKey != null) {
                     if (!selectedKey.isEmpty()) {
-                        T confToCompare = IterableUtils.find(availableHistoryConfTOs, new Predicate<T>() {
-
-                            @Override
-                            public boolean evaluate(final T object) {
-                                return object.getKey().equals(selectedKey);
-                            }
-                        });
+                        T confToCompare = availableHistoryConfTOs.stream().
+                                filter(object -> object.getKey().equals(selectedKey)).findAny().orElse(null);
                         elemsToCompare.add(confToCompare);
                         showConfigurationDiffPanel(elemsToCompare);
                     } else {

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java
index 6dce4eb..06729c9 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java
@@ -22,12 +22,9 @@ import java.io.Serializable;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
-import org.apache.commons.collections4.IteratorUtils;
-import org.apache.commons.collections4.Predicate;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.client.console.commons.Constants;
 import org.apache.syncope.client.console.wicket.ajax.form.IndicatorAjaxFormChoiceComponentUpdatingBehavior;
@@ -139,7 +136,7 @@ public abstract class ListViewPanel<T extends Serializable> extends WizardMgtPan
         final List<String> toBeIncluded;
         if (includes == null || includes.isEmpty()) {
             toBeIncluded = new ArrayList<>();
-            for (Field field : Arrays.asList(reference.getDeclaredFields())) {
+            for (Field field : reference.getDeclaredFields()) {
                 toBeIncluded.add(field.getName());
             }
         } else {
@@ -155,9 +152,9 @@ public abstract class ListViewPanel<T extends Serializable> extends WizardMgtPan
         } else {
             listOfItems = list;
             if (LOG.isDebugEnabled()) {
-                for (String field : toBeIncluded) {
+                toBeIncluded.forEach(field -> {
                     LOG.debug("Show field {}", field);
-                }
+                });
             }
         }
 
@@ -396,13 +393,7 @@ public abstract class ListViewPanel<T extends Serializable> extends WizardMgtPan
         protected T getActualItem(final T item, final List<T> list) {
             return item == null
                     ? null
-                    : IteratorUtils.find(list.iterator(), new Predicate<T>() {
-
-                        @Override
-                        public boolean evaluate(final T object) {
-                            return item.equals(object);
-                        }
-                    });
+                    : list.stream().filter(object -> item.equals(object)).findAny().orElse(null);
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/panels/MembersTogglePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/MembersTogglePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/MembersTogglePanel.java
index 70d2dda..81167d8 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/MembersTogglePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/MembersTogglePanel.java
@@ -20,8 +20,7 @@ package org.apache.syncope.client.console.panels;
 
 import java.io.Serializable;
 import java.util.List;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Predicate;
+import java.util.stream.Collectors;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.client.console.SyncopeConsoleSession;
 import org.apache.syncope.client.console.pages.BasePage;
@@ -54,15 +53,8 @@ public abstract class MembersTogglePanel extends TogglePanel<Serializable> {
 
         @Override
         protected List<String> load() {
-            List<String> result = new AnyTypeRestClient().list();
-            CollectionUtils.filter(result, new Predicate<String>() {
-
-                @Override
-                public boolean evaluate(final String anyType) {
-                    return !AnyTypeKind.GROUP.name().equals(anyType);
-                }
-            });
-            return result;
+            return new AnyTypeRestClient().list().stream().
+                    filter(anyType -> !AnyTypeKind.GROUP.name().equals(anyType)).collect(Collectors.toList());
         }
     };
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java
index fe708f8..f8ea7bc 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java
@@ -24,7 +24,7 @@ import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
-import org.apache.commons.collections4.CollectionUtils;
+import java.util.stream.Collectors;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.commons.lang3.tuple.Triple;
@@ -42,10 +42,10 @@ 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.wizards.WizardMgtPanel;
 import org.apache.syncope.client.console.wizards.any.ConnObjectPanel;
-import org.apache.syncope.common.lib.EntityTOUtils;
 import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.to.AnyTypeTO;
 import org.apache.syncope.common.lib.to.ConnObjectTO;
+import org.apache.syncope.common.lib.to.EntityTO;
 import org.apache.syncope.common.lib.to.PropagationStatus;
 import org.apache.syncope.common.lib.to.ProvisioningResult;
 import org.apache.syncope.common.lib.to.RealmTO;
@@ -167,7 +167,7 @@ public abstract class Realm extends WizardMgtPanel<RealmTO> {
         });
 
         final Triple<UserFormLayoutInfo, GroupFormLayoutInfo, Map<String, AnyObjectFormLayoutInfo>> formLayoutInfo =
-                FormLayoutInfoUtils.fetch(CollectionUtils.collect(anyTypes, EntityTOUtils.keyTransformer()));
+                FormLayoutInfoUtils.fetch(anyTypes.stream().map(EntityTO::getKey).collect(Collectors.toList()));
 
         for (final AnyTypeTO anyType : anyTypes) {
             tabs.add(new ITabComponent(
@@ -221,11 +221,11 @@ public abstract class Realm extends WizardMgtPanel<RealmTO> {
                     ConnObjectTO afterObj = bean.getAfterObj();
                     String remoteId = afterObj == null
                             || afterObj.getAttrs().isEmpty()
-                            || afterObj.getAttr(ConnIdSpecialName.NAME) == null
-                            || afterObj.getAttr(ConnIdSpecialName.NAME).getValues() == null
-                            || afterObj.getAttr(ConnIdSpecialName.NAME).getValues().isEmpty()
+                            || !afterObj.getAttr(ConnIdSpecialName.NAME).isPresent()
+                            || afterObj.getAttr(ConnIdSpecialName.NAME).get().getValues() == null
+                            || afterObj.getAttr(ConnIdSpecialName.NAME).get().getValues().isEmpty()
                             ? StringUtils.EMPTY
-                            : afterObj.getAttr(ConnIdSpecialName.NAME).getValues().get(0);
+                            : afterObj.getAttr(ConnIdSpecialName.NAME).get().getValues().get(0);
 
                     return new Label("field", remoteId);
                 } else if ("status".equalsIgnoreCase(key)) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmChoicePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmChoicePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmChoicePanel.java
index 79c3322..7e74241 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmChoicePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmChoicePanel.java
@@ -33,8 +33,6 @@ import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import org.apache.commons.collections4.IterableUtils;
-import org.apache.commons.collections4.Predicate;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.syncope.client.console.SyncopeConsoleSession;
@@ -100,10 +98,10 @@ public class RealmChoicePanel extends Panel {
 
                 if (tree.containsKey(key)) {
                     Pair<RealmTO, List<RealmTO>> subtree = tree.get(key);
-                    for (RealmTO child : subtree.getValue()) {
+                    subtree.getValue().forEach(child -> {
                         full.add(Pair.of(indent + child.getName(), child));
                         getChildren(full, child.getKey(), tree, "     " + indent + (indent.isEmpty() ? "|--- " : ""));
-                    }
+                    });
                 }
             }
 
@@ -124,20 +122,17 @@ public class RealmChoicePanel extends Panel {
 
             @Override
             protected List<DynRealmTO> load() {
-                final List<DynRealmTO> dynRealms = realmRestClient.listDynReams();
-                dynRealms.sort(new Comparator<DynRealmTO>() {
-
-                    @Override
-                    public int compare(final DynRealmTO left, final DynRealmTO right) {
-                        if (left == null) {
-                            return -1;
-                        } else if (right == null) {
-                            return 1;
-                        } else {
-                            return left.getKey().compareTo(right.getKey());
-                        }
+                List<DynRealmTO> dynRealms = realmRestClient.listDynReams();
+                dynRealms.sort((left, right) -> {
+                    if (left == null) {
+                        return -1;
+                    } else if (right == null) {
+                        return 1;
+                    } else {
+                        return left.getKey().compareTo(right.getKey());
                     }
                 });
+
                 return dynRealms;
             }
         };
@@ -221,13 +216,8 @@ public class RealmChoicePanel extends Panel {
 
                         @Override
                         public boolean isEnabled() {
-                            return IterableUtils.matchesAny(availableRealms, new Predicate<String>() {
-
-                                @Override
-                                public boolean evaluate(final String availableRealm) {
-                                    return realmTO.getFullPath().startsWith(availableRealm);
-                                }
-                            });
+                            return availableRealms.stream().
+                                    anyMatch(availableRealm -> realmTO.getFullPath().startsWith(availableRealm));
                         }
                     });
                 }
@@ -283,13 +273,9 @@ public class RealmChoicePanel extends Panel {
 
                             @Override
                             public boolean isEnabled() {
-                                return IterableUtils.matchesAny(availableRealms, new Predicate<String>() {
-
-                                    @Override
-                                    public boolean evaluate(final String availableRealm) {
-                                        return SyncopeConstants.ROOT_REALM.equals(availableRealm)
-                                                || realmTO.getKey().equals(availableRealm);
-                                    }
+                                return availableRealms.stream().anyMatch(availableRealm -> {
+                                    return SyncopeConstants.ROOT_REALM.equals(availableRealm)
+                                            || realmTO.getKey().equals(availableRealm);
                                 });
                             }
                         });
@@ -328,11 +314,11 @@ public class RealmChoicePanel extends Panel {
 
     private Map<String, Pair<RealmTO, List<RealmTO>>> reloadRealmParentMap(final List<RealmTO> realms) {
         tree.clear();
-        tree.put(null, Pair.<RealmTO, List<RealmTO>>of(realms.get(0), new ArrayList<RealmTO>()));
+        tree.put(null, Pair.<RealmTO, List<RealmTO>>of(realms.get(0), new ArrayList<>()));
 
         final Map<String, List<RealmTO>> cache = new HashMap<>();
 
-        for (RealmTO realm : realms) {
+        realms.forEach(realm -> {
             final List<RealmTO> children = new ArrayList<>();
             tree.put(realm.getKey(), Pair.<RealmTO, List<RealmTO>>of(realm, children));
 
@@ -348,7 +334,7 @@ public class RealmChoicePanel extends Panel {
             } else {
                 cache.put(realm.getParent(), new ArrayList<>(Collections.singleton(realm)));
             }
-        }
+        });
 
         return tree;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmDetails.java
index 4f48c3c..ddd903a 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmDetails.java
@@ -22,7 +22,7 @@ import java.util.ArrayList;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import org.apache.commons.collections4.CollectionUtils;
+import java.util.stream.Collectors;
 import org.apache.syncope.client.console.SyncopeConsoleSession;
 import org.apache.syncope.client.console.rest.PolicyRestClient;
 import org.apache.syncope.client.console.rest.ResourceRestClient;
@@ -32,11 +32,10 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPalettePane
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
 import org.apache.syncope.client.console.wicket.markup.html.form.FieldPanel;
 import org.apache.syncope.client.console.wicket.markup.html.form.PolicyRenderer;
-import org.apache.syncope.common.lib.EntityTOUtils;
 import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
+import org.apache.syncope.common.lib.to.EntityTO;
 import org.apache.syncope.common.lib.to.RealmTO;
-import org.apache.syncope.common.lib.to.ResourceTO;
 import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.wicket.markup.html.WebMarkupContainer;
 import org.apache.wicket.markup.html.form.DropDownChoice;
@@ -119,19 +118,19 @@ public class RealmDetails extends Panel {
         container.add(generics.setVisible(unwrapped));
 
         FieldPanel<String> name = new AjaxTextFieldPanel(
-                "name", "name", new PropertyModel<String>(realmTO, "name"), false);
+                "name", "name", new PropertyModel<>(realmTO, "name"), false);
         name.addRequiredLabel();
         generics.add(name);
 
         FieldPanel<String> fullPath = new AjaxTextFieldPanel(
-                "fullPath", "fullPath", new PropertyModel<String>(realmTO, "fullPath"), false);
+                "fullPath", "fullPath", new PropertyModel<>(realmTO, "fullPath"), false);
         fullPath.setEnabled(false);
         generics.add(fullPath);
 
         AjaxDropDownChoicePanel<String> accountPolicy = new AjaxDropDownChoicePanel<>(
                 "accountPolicy",
                 new ResourceModel("accountPolicy", "accountPolicy").getObject(),
-                new PropertyModel<String>(realmTO, "accountPolicy"),
+                new PropertyModel<>(realmTO, "accountPolicy"),
                 false);
         accountPolicy.setChoiceRenderer(new PolicyRenderer(accountPolicies));
         accountPolicy.setChoices(new ArrayList<>(accountPolicies.getObject().keySet()));
@@ -141,7 +140,7 @@ public class RealmDetails extends Panel {
         AjaxDropDownChoicePanel<String> passwordPolicy = new AjaxDropDownChoicePanel<>(
                 "passwordPolicy",
                 new ResourceModel("passwordPolicy", "passwordPolicy").getObject(),
-                new PropertyModel<String>(realmTO, "passwordPolicy"),
+                new PropertyModel<>(realmTO, "passwordPolicy"),
                 false);
         passwordPolicy.setChoiceRenderer(new PolicyRenderer(passwordPolicies));
         passwordPolicy.setChoices(new ArrayList<>(passwordPolicies.getObject().keySet()));
@@ -156,10 +155,10 @@ public class RealmDetails extends Panel {
         actionsClassNames.setOutputMarkupId(true);
         container.add(actionsClassNames);
 
-        container.add(new AjaxPalettePanel.Builder<String>().build("resources",
-                new PropertyModel<List<String>>(realmTO, "resources"),
-                new ListModel<>(CollectionUtils.collect(new ResourceRestClient().list(),
-                        EntityTOUtils.<ResourceTO>keyTransformer(), new ArrayList<String>()))).
+        container.add(new AjaxPalettePanel.Builder<>().build("resources",
+                new PropertyModel<>(realmTO, "resources"),
+                new ListModel<>(new ResourceRestClient().list().stream().
+                        map(EntityTO::getKey).collect(Collectors.toList()))).
                 setOutputMarkupId(true).
                 setEnabled(!SyncopeConstants.ROOT_REALM.equals(realmTO.getName())).
                 setVisible(!SyncopeConstants.ROOT_REALM.equals(realmTO.getName())));

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
index af1b84c..c4596e6 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
@@ -27,8 +27,7 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Transformer;
+import java.util.stream.Collectors;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.client.console.SyncopeConsoleSession;
 import org.apache.syncope.client.console.commons.Constants;
@@ -156,7 +155,7 @@ public class SchemaTypePanel extends TypesDirectoryPanel<AbstractSchemaTO, Schem
 
             if (clazzField != null) {
                 if (clazzField.getType().equals(Boolean.class) || clazzField.getType().equals(boolean.class)) {
-                    columns.add(new BooleanPropertyColumn<AbstractSchemaTO>(new ResourceModel(field), field, field));
+                    columns.add(new BooleanPropertyColumn<>(new ResourceModel(field), field, field));
                 } else {
                     final IColumn<AbstractSchemaTO, String> column = new PropertyColumn<AbstractSchemaTO, String>(
                             new ResourceModel(field), field, field) {
@@ -254,22 +253,15 @@ public class SchemaTypePanel extends TypesDirectoryPanel<AbstractSchemaTO, Schem
             Collections.sort(list, comparator);
 
             if (SchemaType.PLAIN == this.schemaType) {
-                final List<String> configurations = new ArrayList<>();
-
-                CollectionUtils.collect(confRestClient.list(), new Transformer<AttrTO, String>() {
-
-                    @Override
-                    public String transform(final AttrTO attrTO) {
-                        return attrTO.getSchema();
-                    }
-                }, configurations);
+                final List<String> configurations = confRestClient.list().stream().
+                        map(AttrTO::getSchema).collect(Collectors.toList());
 
                 final List<AbstractSchemaTO> res = new ArrayList<>();
-                for (AbstractSchemaTO item : list) {
-                    if (!configurations.contains(item.getKey())) {
-                        res.add(item);
-                    }
-                }
+                list.stream().
+                        filter(item -> !configurations.contains(item.getKey())).
+                        forEachOrdered(item -> {
+                            res.add(item);
+                        });
                 return res.subList((int) first, (int) first + (int) count).iterator();
             } else {
                 return list.subList((int) first, (int) first + (int) count).iterator();

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
index ceb51be..e5d72ea 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
@@ -23,9 +23,8 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.IterableUtils;
-import org.apache.commons.collections4.Predicate;
+import java.util.Optional;
+import java.util.stream.Collectors;
 import org.apache.syncope.client.console.SyncopeConsoleSession;
 import org.apache.syncope.client.console.commons.Constants;
 import org.apache.syncope.client.console.rest.ConnectorRestClient;
@@ -34,11 +33,10 @@ import org.apache.syncope.client.console.wicket.ajax.form.IndicatorAjaxFormCompo
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
 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.EntityTOUtils;
 import org.apache.syncope.common.lib.to.AbstractSchemaTO;
 import org.apache.syncope.common.lib.to.ConnIdObjectClassTO;
 import org.apache.syncope.common.lib.to.ConnInstanceTO;
-import org.apache.syncope.common.lib.to.ProvisionTO;
+import org.apache.syncope.common.lib.to.EntityTO;
 import org.apache.syncope.common.lib.to.ResourceTO;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
 import org.apache.wicket.PageReference;
@@ -66,14 +64,13 @@ public class VirSchemaDetails extends AbstractSchemaDetailsPanel {
         super(id, pageReference, schemaTO);
 
         AjaxCheckBoxPanel readonly = new AjaxCheckBoxPanel("readonly", getString("readonly"),
-                new PropertyModel<Boolean>(schemaTO, "readonly"));
+                new PropertyModel<>(schemaTO, "readonly"));
         schemaForm.add(readonly);
 
         final AjaxDropDownChoicePanel<String> resource = new AjaxDropDownChoicePanel<>(
                 "resource", getString("resource"), new PropertyModel<String>(schemaTO, "resource"), false).
                 setNullValid(false);
-        resource.setChoices(CollectionUtils.collect(resourceRestClient.list(),
-                EntityTOUtils.<ResourceTO>keyTransformer(), new ArrayList<String>()));
+        resource.setChoices(resourceRestClient.list().stream().map(EntityTO::getKey).collect(Collectors.toList()));
         resource.setOutputMarkupId(true);
         resource.addRequiredLabel();
         if (resource.getModelObject() != null) {
@@ -94,7 +91,7 @@ public class VirSchemaDetails extends AbstractSchemaDetailsPanel {
         schemaForm.add(anyType);
 
         final AjaxTextFieldPanel extAttrName = new AjaxTextFieldPanel(
-                "extAttrName", getString("extAttrName"), new PropertyModel<String>(schemaTO, "extAttrName"));
+                "extAttrName", getString("extAttrName"), new PropertyModel<>(schemaTO, "extAttrName"));
         extAttrName.setOutputMarkupId(true);
         extAttrName.addRequiredLabel();
         if (selectedResource != null) {
@@ -158,9 +155,9 @@ public class VirSchemaDetails extends AbstractSchemaDetailsPanel {
 
             if (SyncopeConsoleSession.get().owns(StandardEntitlement.RESOURCE_READ, adminRealm)) {
                 selectedResource = resource;
-                for (ProvisionTO provisionTO : selectedResource.getProvisions()) {
+                selectedResource.getProvisions().forEach(provisionTO -> {
                     anyTypes.put(provisionTO.getAnyType(), provisionTO.getObjectClass());
-                }
+                });
             }
         }
     }
@@ -170,17 +167,12 @@ public class VirSchemaDetails extends AbstractSchemaDetailsPanel {
         connInstanceTO.setKey(selectedResource.getConnector());
         connInstanceTO.getConf().addAll(selectedResource.getConfOverride());
 
-        ConnIdObjectClassTO connIdObjectClass = IterableUtils.find(
-                connRestClient.buildObjectClassInfo(connInstanceTO, false), new Predicate<ConnIdObjectClassTO>() {
-
-            @Override
-            public boolean evaluate(final ConnIdObjectClassTO object) {
-                return object.getType().equals(anyTypes.get(anyType.getModelObject()));
-            }
-        });
+        Optional<ConnIdObjectClassTO> connIdObjectClass = connRestClient.buildObjectClassInfo(connInstanceTO, false).
+                stream().filter(object -> object.getType().equals(anyTypes.get(anyType.getModelObject()))).
+                findAny();
 
-        return connIdObjectClass == null
-                ? Collections.<String>emptyList()
-                : connIdObjectClass.getAttributes();
+        return connIdObjectClass.isPresent()
+                ? connIdObjectClass.get().getAttributes()
+                : Collections.<String>emptyList();
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/panels/search/AbstractSearchPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/search/AbstractSearchPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/search/AbstractSearchPanel.java
index 050896f..f96da97 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/search/AbstractSearchPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/search/AbstractSearchPanel.java
@@ -19,19 +19,17 @@
 package org.apache.syncope.client.console.panels.search;
 
 import java.io.Serializable;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import org.apache.commons.collections4.CollectionUtils;
+import java.util.stream.Collectors;
 import org.apache.syncope.client.console.rest.AnyTypeRestClient;
 import org.apache.syncope.client.console.rest.ResourceRestClient;
 import org.apache.syncope.client.console.rest.SchemaRestClient;
 import org.apache.syncope.client.console.wicket.markup.html.form.MultiFieldPanel;
-import org.apache.syncope.common.lib.EntityTOUtils;
 import org.apache.syncope.common.lib.search.SearchableFields;
+import org.apache.syncope.common.lib.to.EntityTO;
 import org.apache.syncope.common.lib.to.PlainSchemaTO;
-import org.apache.syncope.common.lib.to.ResourceTO;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.wicket.event.IEventSink;
@@ -192,8 +190,7 @@ public abstract class AbstractSearchPanel extends Panel {
 
             @Override
             protected List<String> load() {
-                return CollectionUtils.collect(resourceRestClient.list(),
-                        EntityTOUtils.<ResourceTO>keyTransformer(), new ArrayList<String>());
+                return resourceRestClient.list().stream().map(EntityTO::getKey).collect(Collectors.toList());
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClausePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClausePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClausePanel.java
index 28958ee..cc66d40 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClausePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClausePanel.java
@@ -26,9 +26,7 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Transformer;
-import org.apache.commons.collections4.functors.StringValueTransformer;
+import java.util.stream.Collectors;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.client.console.commons.Constants;
 import org.apache.syncope.client.console.panels.search.SearchClause.Comparator;
@@ -110,7 +108,7 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
 
         super(id, name, clause);
 
-        this.clause = clause == null ? new Model<SearchClause>(null) : clause;
+        this.clause = clause == null ? new Model<>(null) : clause;
 
         this.required = required;
         this.types = types;
@@ -201,9 +199,8 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
                         return names;
 
                     case GROUP_MEMBERSHIP:
-                        final List<String> groups = CollectionUtils.collect(groupNames.getObject().keySet(),
-                                StringValueTransformer.<String>stringValueTransformer(), new ArrayList<String>());
-
+                        final List<String> groups = groupNames.getObject().keySet().
+                                stream().collect(Collectors.toList());
                         Collections.sort(groups);
                         return groups;
 
@@ -218,14 +215,8 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
                         return resources;
 
                     case RELATIONSHIP:
-                        final List<String> relations = CollectionUtils.collect(
-                                new RelationshipTypeRestClient().list(), new Transformer<RelationshipTypeTO, String>() {
-
-                            @Override
-                            public String transform(final RelationshipTypeTO input) {
-                                return input.getKey();
-                            }
-                        }, new ArrayList<String>());
+                        final List<String> relations = new RelationshipTypeRestClient().list().stream().
+                                map(RelationshipTypeTO::getKey).collect(Collectors.toList());
                         return relations;
 
                     default:
@@ -364,7 +355,7 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
         }
 
         final AjaxDropDownChoicePanel<String> property = new AjaxDropDownChoicePanel<>(
-                "property", "property", new PropertyModel<String>(searchClause, "property"));
+                "property", "property", new PropertyModel<>(searchClause, "property"));
         property.hideLabel().setRequired(required).setOutputMarkupId(true);
         property.setChoices(properties);
         property.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
@@ -378,7 +369,7 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
         field.add(property);
 
         final AjaxDropDownChoicePanel<SearchClause.Comparator> comparator = new AjaxDropDownChoicePanel<>(
-                "comparator", "comparator", new PropertyModel<SearchClause.Comparator>(searchClause, "comparator"));
+                "comparator", "comparator", new PropertyModel<>(searchClause, "comparator"));
         comparator.setChoices(comparators);
         comparator.setNullValid(false).hideLabel().setOutputMarkupId(true);
         comparator.setRequired(required);
@@ -386,7 +377,7 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
         field.add(comparator);
 
         final AjaxTextFieldPanel value = new AjaxTextFieldPanel(
-                "value", "value", new PropertyModel<String>(searchClause, "value"), false);
+                "value", "value", new PropertyModel<>(searchClause, "value"), false);
         value.hideLabel().setOutputMarkupId(true);
         field.add(value);
 
@@ -426,7 +417,7 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
         });
 
         final AjaxDropDownChoicePanel<SearchClause.Type> type = new AjaxDropDownChoicePanel<>(
-                "type", "type", new PropertyModel<SearchClause.Type>(searchClause, "type"));
+                "type", "type", new PropertyModel<>(searchClause, "type"));
         type.setChoices(types).hideLabel().setRequired(required).setOutputMarkupId(true);
         type.setNullValid(false);
         type.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/panels/search/UserSearchPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/search/UserSearchPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/search/UserSearchPanel.java
index faaecb8..efc9de8 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/search/UserSearchPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/search/UserSearchPanel.java
@@ -20,10 +20,9 @@ package org.apache.syncope.client.console.panels.search;
 
 import java.util.ArrayList;
 import java.util.List;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Transformer;
+import java.util.stream.Collectors;
 import org.apache.syncope.client.console.rest.RoleRestClient;
-import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.EntityTO;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.LoadableDetachableModel;
@@ -62,13 +61,7 @@ public final class UserSearchPanel extends AnyObjectSearchPanel {
 
             @Override
             protected List<String> load() {
-                return CollectionUtils.collect(roleRestClient.list(), new Transformer<RoleTO, String>() {
-
-                    @Override
-                    public String transform(final RoleTO input) {
-                        return input.getKey();
-                    }
-                }, new ArrayList<String>());
+                return roleRestClient.list().stream().map(EntityTO::getKey).collect(Collectors.toList());
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java
index 7507d04..91b24d0 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java
@@ -20,8 +20,7 @@ package org.apache.syncope.client.console.policies;
 
 import java.util.ArrayList;
 import java.util.List;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Transformer;
+import java.util.stream.Collectors;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.client.console.SyncopeConsoleSession;
 import org.apache.syncope.client.console.commons.Constants;
@@ -41,7 +40,7 @@ import org.apache.syncope.client.console.wizards.AjaxWizard;
 import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
 import org.apache.syncope.common.lib.policy.AccountPolicyTO;
 import org.apache.syncope.common.lib.policy.PasswordPolicyTO;
-import org.apache.syncope.common.lib.to.ResourceTO;
+import org.apache.syncope.common.lib.to.EntityTO;
 import org.apache.wicket.Component;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -82,15 +81,7 @@ public class PolicyModalPanelBuilder<T extends AbstractPolicyTO> extends Abstrac
 
             @Override
             protected List<String> load() {
-                return CollectionUtils.collect(
-                        new ResourceRestClient().list(),
-                        new Transformer<ResourceTO, String>() {
-
-                    @Override
-                    public String transform(final ResourceTO input) {
-                        return input.getKey();
-                    }
-                }, new ArrayList<String>());
+                return new ResourceRestClient().list().stream().map(EntityTO::getKey).collect(Collectors.toList());
             }
         };
 
@@ -103,7 +94,7 @@ public class PolicyModalPanelBuilder<T extends AbstractPolicyTO> extends Abstrac
             final List<Component> fields = new ArrayList<>();
 
             FieldPanel<String> description = new AjaxTextFieldPanel("field", "description",
-                    new PropertyModel<String>(policyTO, "description"), false);
+                    new PropertyModel<>(policyTO, "description"), false);
             description.setRequired(true);
             fields.add(description);
 
@@ -117,7 +108,7 @@ public class PolicyModalPanelBuilder<T extends AbstractPolicyTO> extends Abstrac
                 fields.add(new AjaxCheckBoxPanel(
                         "field",
                         "propagateSuspension",
-                        new PropertyModel<Boolean>(policyTO, "propagateSuspension"),
+                        new PropertyModel<>(policyTO, "propagateSuspension"),
                         false));
 
                 fields.add(new AjaxPalettePanel.Builder<String>().setName("passthroughResources").build(
@@ -136,7 +127,7 @@ public class PolicyModalPanelBuilder<T extends AbstractPolicyTO> extends Abstrac
                 fields.add(new AjaxCheckBoxPanel(
                         "field",
                         "allowNullPassword",
-                        new PropertyModel<Boolean>(policyTO, "allowNullPassword"),
+                        new PropertyModel<>(policyTO, "allowNullPassword"),
                         false));
             }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java
index fd3c72e..6375bac 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java
@@ -24,9 +24,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Predicate;
-import org.apache.commons.collections4.Transformer;
+import java.util.stream.Collectors;
 import org.apache.commons.lang3.SerializationUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.client.console.SyncopeConsoleSession;
@@ -102,7 +100,7 @@ public class PolicyRuleDirectoryPanel<T extends AbstractPolicyTO> extends Direct
     protected List<IColumn<PolicyRuleWrapper, String>> getColumns() {
         final List<IColumn<PolicyRuleWrapper, String>> columns = new ArrayList<>();
 
-        columns.add(new PropertyColumn<PolicyRuleWrapper, String>(
+        columns.add(new PropertyColumn<>(
                 new StringResourceModel("ruleConf", this), "name", "name"));
 
         columns.add(new AbstractColumn<PolicyRuleWrapper, String>(
@@ -160,13 +158,9 @@ public class PolicyRuleDirectoryPanel<T extends AbstractPolicyTO> extends Direct
                 final RuleConf rule = model.getObject().getConf();
                 try {
                     final T actual = restClient.getPolicy(policy);
-                    CollectionUtils.filter(getRuleConf(actual), new Predicate<RuleConf>() {
-
-                        @Override
-                        public boolean evaluate(final RuleConf object) {
-                            return !object.getName().equals(rule.getName());
-                        }
-                    });
+                    List<RuleConf> conf = getRuleConf(actual);
+                    conf.removeAll(conf.stream().
+                            filter(object -> object.getName().equals(rule.getName())).collect(Collectors.toList()));
                     restClient.updatePolicy(actual);
                     SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
                     customActionOnFinishCallback(target);
@@ -235,14 +229,9 @@ public class PolicyRuleDirectoryPanel<T extends AbstractPolicyTO> extends Direct
         public Iterator<PolicyRuleWrapper> iterator(final long first, final long count) {
             final T actual = restClient.getPolicy(policy);
 
-            final ArrayList<PolicyRuleWrapper> rules = CollectionUtils.collect(getRuleConf(actual),
-                    new Transformer<RuleConf, PolicyRuleWrapper>() {
-
-                @Override
-                public PolicyRuleWrapper transform(final RuleConf input) {
-                    return new PolicyRuleWrapper(input.getName()).setName(input.getName()).setConf(input);
-                }
-            }, new ArrayList<PolicyRuleWrapper>());
+            final List<PolicyRuleWrapper> rules = getRuleConf(actual).stream().map(input
+                    -> new PolicyRuleWrapper(input.getName()).setName(input.getName()).setConf(input)).
+                    collect(Collectors.toList());
 
             Collections.sort(rules, comparator);
             return rules.subList((int) first, (int) (first + count)).iterator();

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java
index 698c3f5..b9a36a9 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java
@@ -22,8 +22,7 @@ import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Predicate;
+import java.util.stream.Collectors;
 import org.apache.syncope.client.console.SyncopeConsoleSession;
 import org.apache.syncope.client.console.panels.BeanPanel;
 import org.apache.syncope.client.console.rest.PolicyRestClient;
@@ -80,13 +79,8 @@ public class PolicyRuleWizardBuilder
         if (modelObject.isNew()) {
             composable.getRuleConfs().add(modelObject.getConf());
         } else {
-            CollectionUtils.filter(composable.getRuleConfs(), new Predicate<RuleConf>() {
-
-                @Override
-                public boolean evaluate(final RuleConf object) {
-                    return !object.getName().equals(modelObject.getOldName());
-                }
-            });
+            composable.getRuleConfs().removeAll(composable.getRuleConfs().stream().
+                    filter(conf -> conf.getName().equals(modelObject.getOldName())).collect(Collectors.toList()));
             composable.getRuleConfs().add(modelObject.getConf());
         }
 
@@ -109,7 +103,7 @@ public class PolicyRuleWizardBuilder
         public Profile(final PolicyRuleDirectoryPanel.PolicyRuleWrapper rule) {
 
             final AjaxTextFieldPanel name = new AjaxTextFieldPanel(
-                    "name", "rule", new PropertyModel<String>(rule, "name"), false);
+                    "name", "rule", new PropertyModel<>(rule, "name"), false);
             name.addRequiredLabel();
             add(name);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicySpecModalPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicySpecModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicySpecModalPanel.java
index fbe0c4e..19dd7ba 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicySpecModalPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicySpecModalPanel.java
@@ -26,8 +26,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Transformer;
+import java.util.stream.Collectors;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.client.console.SyncopeConsoleSession;
 import org.apache.syncope.client.console.commons.Constants;
@@ -42,7 +41,7 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownCho
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPalettePanel;
 import org.apache.syncope.client.console.wicket.markup.html.form.MultiPanel;
 import org.apache.syncope.common.lib.policy.PullPolicyTO;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.EntityTO;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.common.lib.types.ConflictResolutionAction;
 import org.apache.syncope.common.lib.types.SchemaType;
@@ -74,25 +73,20 @@ public class PolicySpecModalPanel extends AbstractModalPanel<PullPolicyTO> {
         add(new AjaxDropDownChoicePanel<>(
                 "conflictResolutionAction",
                 "conflictResolutionAction",
-                new PropertyModel<ConflictResolutionAction>(policyTO.getSpecification(), "conflictResolutionAction")).
-                setChoices(Arrays.asList(ConflictResolutionAction.values())));
+                new PropertyModel<>(policyTO.getSpecification(), "conflictResolutionAction")).
+                setChoices(Arrays.asList((Serializable[]) ConflictResolutionAction.values())));
 
         model = new PropertyModel<List<CorrelationRule>>(policyTO.getSpecification(), "correlationRules") {
 
             private static final long serialVersionUID = -8168676563540297301L;
 
-            private List<CorrelationRule> rules = CollectionUtils.collect(
-                    policyTO.getSpecification().getCorrelationRules() == null
-                    ? Collections.<String>emptySet()
-                    : policyTO.getSpecification().getCorrelationRules().keySet(),
-                    new Transformer<String, CorrelationRule>() {
-
-                @Override
-                public CorrelationRule transform(final String input) {
-                    return new CorrelationRule(
-                            input, policyTO.getSpecification().getCorrelationRules().get(input));
-                }
-            }, new ArrayList<CorrelationRule>());
+            private List<CorrelationRule> rules =
+                    (policyTO.getSpecification().getCorrelationRules() == null
+                            ? Collections.<String>emptySet()
+                            : policyTO.getSpecification().getCorrelationRules().keySet()).stream().
+                            map(rule -> new CorrelationRule(
+                            rule, policyTO.getSpecification().getCorrelationRules().get(rule))).
+                            collect(Collectors.toList());
 
             @Override
             public List<CorrelationRule> getObject() {
@@ -129,9 +123,9 @@ public class PolicySpecModalPanel extends AbstractModalPanel<PullPolicyTO> {
     public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
         try {
             getItem().getSpecification().getCorrelationRules().clear();
-            for (CorrelationRule rule : model.getObject()) {
+            model.getObject().forEach(rule -> {
                 getItem().getSpecification().getCorrelationRules().put(rule.getAny(), rule.getRule());
-            }
+            });
             restClient.updatePolicy(getItem());
             SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
             this.modal.close(target);
@@ -276,20 +270,14 @@ public class PolicySpecModalPanel extends AbstractModalPanel<PullPolicyTO> {
 
         private static List<String> getPlainSchemas(final CorrelationRule rule) {
             final List<String> choices = StringUtils.isEmpty(rule.getAny())
-                    ? new ArrayList<String>()
-                    : CollectionUtils.collect(
-                            new SchemaRestClient().getSchemas(SchemaType.PLAIN,
-                                    rule.getAny().equals(AnyTypeKind.USER.name())
-                                    ? AnyTypeKind.USER
-                                    : rule.getAny().equals(AnyTypeKind.GROUP.name())
-                                    ? AnyTypeKind.GROUP
-                                    : AnyTypeKind.ANY_OBJECT), new Transformer<AbstractSchemaTO, String>() {
-
-                        @Override
-                        public String transform(final AbstractSchemaTO input) {
-                            return input.getKey();
-                        }
-                    }, new ArrayList<String>());
+                    ? new ArrayList<>()
+                    : new SchemaRestClient().getSchemas(SchemaType.PLAIN,
+                            rule.getAny().equals(AnyTypeKind.USER.name())
+                            ? AnyTypeKind.USER
+                            : rule.getAny().equals(AnyTypeKind.GROUP.name())
+                            ? AnyTypeKind.GROUP
+                            : AnyTypeKind.ANY_OBJECT).stream().map(EntityTO::getKey).
+                            collect(Collectors.toList());
 
             Collections.sort(choices);
             return choices;

http://git-wip-us.apache.org/repos/asf/syncope/blob/74ee038a/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportWizardBuilder.java
index ceaa524..ffb24e2 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportWizardBuilder.java
@@ -19,17 +19,15 @@
 package org.apache.syncope.client.console.reports;
 
 import java.io.Serializable;
-import java.util.ArrayList;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Transformer;
+import java.util.stream.Collectors;
 import org.apache.syncope.client.console.rest.ReportRestClient;
 import org.apache.syncope.client.console.tasks.CrontabPanel;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
 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.client.console.wizards.AjaxWizardBuilder;
+import org.apache.syncope.common.lib.to.EntityTO;
 import org.apache.syncope.common.lib.to.ReportTO;
-import org.apache.syncope.common.lib.to.ReportTemplateTO;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.extensions.wizard.WizardModel;
 import org.apache.wicket.extensions.wizard.WizardStep;
@@ -72,28 +70,22 @@ public class ReportWizardBuilder extends AjaxWizardBuilder<ReportTO> {
         public Profile(final ReportTO reportTO) {
 
             AjaxTextFieldPanel name = new AjaxTextFieldPanel(
-                    "name", "name", new PropertyModel<String>(reportTO, "name"), false);
+                    "name", "name", new PropertyModel<>(reportTO, "name"), false);
             name.addRequiredLabel();
             name.setEnabled(true);
             add(name);
 
             final AjaxDropDownChoicePanel<String> template = new AjaxDropDownChoicePanel<>(
                     "template", getString("template"),
-                    new PropertyModel<String>(reportTO, "template"));
-            template.setChoices(CollectionUtils.collect(
-                    restClient.listTemplates(), new Transformer<ReportTemplateTO, String>() {
-
-                @Override
-                public String transform(final ReportTemplateTO input) {
-                    return input.getKey();
-                }
-            }, new ArrayList<String>()));
+                    new PropertyModel<>(reportTO, "template"));
+            template.setChoices(restClient.listTemplates().stream().
+                    map(EntityTO::getKey).collect(Collectors.toList()));
 
             template.addRequiredLabel();
             add(template);
 
             AjaxCheckBoxPanel active = new AjaxCheckBoxPanel(
-                    "active", "active", new PropertyModel<Boolean>(reportTO, "active"), false);
+                    "active", "active", new PropertyModel<>(reportTO, "active"), false);
             add(active);
         }
     }
@@ -104,7 +96,7 @@ public class ReportWizardBuilder extends AjaxWizardBuilder<ReportTO> {
 
         public Schedule(final ReportTO reportTO) {
             crontabPanel = new CrontabPanel(
-                    "schedule", new PropertyModel<String>(reportTO, "cronExpression"), reportTO.getCronExpression());
+                    "schedule", new PropertyModel<>(reportTO, "cronExpression"), reportTO.getCronExpression());
             add(crontabPanel);
         }
 


Mime
View raw message