syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [3/6] syncope git commit: [SYNCOPE-938] Applying all Netbeans hints for upgrade to JDK 8
Date Fri, 25 Aug 2017 15:37:32 GMT
http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java b/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java
index c92f0ea..e707611 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java
@@ -105,7 +105,7 @@ public class Topology extends BasePage {
         protected Map<String, List<ConnInstanceTO>> load() {
             final Map<String, List<ConnInstanceTO>> res = new HashMap<>();
 
-            for (ConnInstanceTO conn : connectorRestClient.getAllConnectors()) {
+            connectorRestClient.getAllConnectors().forEach(conn -> {
                 final List<ConnInstanceTO> conns;
                 if (res.containsKey(conn.getLocation())) {
                     conns = res.get(conn.getLocation());
@@ -114,7 +114,7 @@ public class Topology extends BasePage {
                     res.put(conn.getLocation(), conns);
                 }
                 conns.add(conn);
-            }
+            });
 
             return res;
         }
@@ -130,13 +130,13 @@ public class Topology extends BasePage {
             final List<URI> connectorServers = new ArrayList<>();
             final List<URI> filePaths = new ArrayList<>();
 
-            for (String location : SyncopeConsoleSession.get().getPlatformInfo().getConnIdLocations()) {
+            SyncopeConsoleSession.get().getPlatformInfo().getConnIdLocations().forEach(location -> {
                 if (location.startsWith(CONNECTOR_SERVER_LOCATION_PREFIX)) {
                     connectorServers.add(URI.create(location));
                 } else {
                     filePaths.add(URI.create(location));
                 }
-            }
+            });
 
             return Pair.of(connectorServers, filePaths);
         }
@@ -248,7 +248,7 @@ public class Topology extends BasePage {
                 item.add(topologyNodePanel("cs", topologynode));
 
                 syncopeConnections.put(url, topologynode);
-                connections.put(url, new HashMap<Serializable, TopologyNode>());
+                connections.put(url, new HashMap<>());
             }
         };
 
@@ -287,7 +287,7 @@ public class Topology extends BasePage {
                 item.add(topologyNodePanel("fp", topologynode));
 
                 syncopeConnections.put(url, topologynode);
-                connections.put(url, new HashMap<Serializable, TopologyNode>());
+                connections.put(url, new HashMap<>());
             }
         };
 
@@ -371,32 +371,28 @@ public class Topology extends BasePage {
         // Add Resources
         // -----------------------------------------
         final Collection<String> administrableConns = new HashSet<>();
-        for (List<ConnInstanceTO> connInstances : connModel.getObject().values()) {
+        connModel.getObject().values().forEach(connInstances -> {
             administrableConns.addAll(connInstances.stream().map(EntityTO::getKey).collect(Collectors.toList()));
-        }
+        });
 
         final List<String> connToBeProcessed = new ArrayList<>();
-        for (final ResourceTO resourceTO : resModel.getObject()) {
-            if (administrableConns.contains(resourceTO.getConnector())) {
-                final TopologyNode topologynode = new TopologyNode(
-                        resourceTO.getKey(), resourceTO.getKey(), TopologyNode.Kind.RESOURCE);
-
-                final Map<Serializable, TopologyNode> remoteConnections;
-
-                if (connections.containsKey(resourceTO.getConnector())) {
-                    remoteConnections = connections.get(resourceTO.getConnector());
-                } else {
-                    remoteConnections = new HashMap<>();
-                    connections.put(resourceTO.getConnector(), remoteConnections);
-                }
-
-                remoteConnections.put(topologynode.getKey(), topologynode);
-
-                if (!connToBeProcessed.contains(resourceTO.getConnector())) {
-                    connToBeProcessed.add(resourceTO.getConnector());
-                }
-            }
-        }
+        resModel.getObject().stream().
+                filter((resourceTO) -> (administrableConns.contains(resourceTO.getConnector()))).
+                forEachOrdered(resourceTO -> {
+                    final TopologyNode topologynode = new TopologyNode(
+                            resourceTO.getKey(), resourceTO.getKey(), TopologyNode.Kind.RESOURCE);
+                    final Map<Serializable, TopologyNode> remoteConnections;
+                    if (connections.containsKey(resourceTO.getConnector())) {
+                        remoteConnections = connections.get(resourceTO.getConnector());
+                    } else {
+                        remoteConnections = new HashMap<>();
+                        connections.put(resourceTO.getConnector(), remoteConnections);
+                    }
+                    remoteConnections.put(topologynode.getKey(), topologynode);
+                    if (!connToBeProcessed.contains(resourceTO.getConnector())) {
+                        connToBeProcessed.add(resourceTO.getConnector());
+                    }
+                });
 
         final ListView<String> resources = new ListView<String>("resources", connToBeProcessed) {
 
@@ -466,9 +462,9 @@ public class Topology extends BasePage {
                 final StringBuilder jsPlumbConf = new StringBuilder();
                 jsPlumbConf.append(String.format(Locale.US, "activate(%.2f);", 0.68f));
 
-                for (String str : createConnections(connections)) {
+                createConnections(connections).forEach(str -> {
                     jsPlumbConf.append(str);
-                }
+                });
 
                 response.render(OnDomReadyHeaderItem.forScript(jsPlumbConf.toString()));
             }
@@ -521,14 +517,14 @@ public class Topology extends BasePage {
     private List<String> createConnections(final Map<Serializable, Map<Serializable, TopologyNode>> targets) {
         List<String> list = new ArrayList<>();
 
-        for (Map.Entry<Serializable, Map<Serializable, TopologyNode>> source : targets.entrySet()) {
-            for (Map.Entry<Serializable, TopologyNode> target : source.getValue().entrySet()) {
+        targets.entrySet().forEach(source -> {
+            source.getValue().entrySet().forEach(target -> {
                 list.add(String.format("connect('%s','%s','%s');",
                         source.getKey(),
                         target.getKey(),
                         target.getValue().getKind()));
-            }
-        }
+            });
+        });
         return list;
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AjaxFallbackDataTable.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AjaxFallbackDataTable.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AjaxFallbackDataTable.java
index b8bc02f..9cfa769 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AjaxFallbackDataTable.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AjaxFallbackDataTable.java
@@ -43,8 +43,6 @@ import org.apache.wicket.markup.repeater.Item;
 import org.apache.wicket.markup.repeater.OddEvenItem;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.Model;
-import org.apache.wicket.util.visit.IVisit;
-import org.apache.wicket.util.visit.IVisitor;
 
 public class AjaxFallbackDataTable<T extends Serializable, S> extends DataTable<T, S> {
 
@@ -142,29 +140,18 @@ public class AjaxFallbackDataTable<T extends Serializable, S> extends DataTable<
                             final AjaxDataTablePanel<?, ?> parent = findParent(AjaxDataTablePanel.class);
                             final Model<Boolean> isCheck = Model.<Boolean>of(Boolean.FALSE);
 
-                            parent.visitChildren(CheckGroupSelector.class,
-                                    new IVisitor<CheckGroupSelector, List<CheckGroupSelector>>() {
-
-                                @Override
-                                public void component(
-                                        final CheckGroupSelector t,
-                                        final IVisit<List<CheckGroupSelector>> ivisit) {
-                                    if (t.getMarkupId().equalsIgnoreCase(lastFocussedElementId)) {
-                                        isCheck.setObject(Boolean.TRUE);
-                                        ivisit.stop();
-                                    }
+                            parent.visitChildren(CheckGroupSelector.class, (selector, ivisit) -> {
+                                if (selector.getMarkupId().equalsIgnoreCase(lastFocussedElementId)) {
+                                    isCheck.setObject(Boolean.TRUE);
+                                    ivisit.stop();
                                 }
                             });
 
                             if (!isCheck.getObject()) {
-                                parent.visitChildren(Check.class, new IVisitor<Check<?>, List<Check<?>>>() {
-
-                                    @Override
-                                    public void component(final Check<?> t, final IVisit<List<Check<?>>> ivisit) {
-                                        if (t.getMarkupId().equalsIgnoreCase(lastFocussedElementId)) {
-                                            isCheck.setObject(Boolean.TRUE);
-                                            ivisit.stop();
-                                        }
+                                parent.visitChildren(Check.class, (check, ivisit) -> {
+                                    if (check.getMarkupId().equalsIgnoreCase(lastFocussedElementId)) {
+                                        isCheck.setObject(Boolean.TRUE);
+                                        ivisit.stop();
                                     }
                                 });
                             }

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDateFieldPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDateFieldPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDateFieldPanel.java
index 191b2a8..8020b70 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDateFieldPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDateFieldPanel.java
@@ -37,7 +37,7 @@ public class AjaxDateFieldPanel extends DateFieldPanel {
 
     @Override
     public FieldPanel<Date> clone() {
-        final FieldPanel<Date> panel = new AjaxDateFieldPanel(getId(), name, new Model<Date>(), fmt.getPattern());
+        FieldPanel<Date> panel = new AjaxDateFieldPanel(getId(), name, new Model<>(), fmt.getPattern());
         panel.setRequired(isRequired());
         panel.setReadOnly(isReadOnly());
         panel.setTitle(title);

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDateTimeFieldPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDateTimeFieldPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDateTimeFieldPanel.java
index 04c100af..723dd00 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDateTimeFieldPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDateTimeFieldPanel.java
@@ -38,9 +38,7 @@ public class AjaxDateTimeFieldPanel extends DateFieldPanel {
 
     @Override
     public FieldPanel<Date> clone() {
-        final FieldPanel<Date> panel =
-                new AjaxDateTimeFieldPanel(getId(), name, new Model<Date>(null), fmt.getPattern());
-
+        FieldPanel<Date> panel = new AjaxDateTimeFieldPanel(getId(), name, new Model<>(null), fmt.getPattern());
         panel.setRequired(isRequired());
         panel.setReadOnly(isReadOnly());
         panel.setTitle(title);

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
index 5edea5b..659140f 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
@@ -165,7 +165,7 @@ public class BinaryFieldPanel extends FieldPanel<String> {
         config.showRemove(false);
         config.showPreview(false);
 
-        fileUpload = new BootstrapFileInputField("fileUpload", new ListModel<>(new ArrayList<FileUpload>()), config);
+        fileUpload = new BootstrapFileInputField("fileUpload", new ListModel<>(new ArrayList<>()), config);
         fileUpload.setOutputMarkupId(true);
 
         fileUpload.add(new AjaxFormSubmitBehavior(Constants.ON_CHANGE) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/FieldPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/FieldPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/FieldPanel.java
index 0f31060..9df9c01 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/FieldPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/FieldPanel.java
@@ -69,7 +69,7 @@ public abstract class FieldPanel<T extends Serializable> extends AbstractFieldPa
                 Model.<String>of(),
                 title == null ? Model.<String>of() : Model.of(title),
                 new PopoverConfig().withHtml(html).withHoverTrigger().withPlacement(
-                index.getObject() != null && index.getObject() == 0
+                        index.getObject() != null && index.getObject() == 0
                         ? TooltipConfig.Placement.bottom
                         : this instanceof AjaxCheckBoxPanel
                                 ? TooltipConfig.Placement.right
@@ -121,7 +121,7 @@ public abstract class FieldPanel<T extends Serializable> extends AbstractFieldPa
     }
 
     public FieldPanel<T> setNewModel(final IModel<T> model) {
-        field.setModel(model == null ? new Model<T>() : model);
+        field.setModel(model == null ? new Model<>() : model);
         return this;
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/IndicatingOnConfirmAjaxLink.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/IndicatingOnConfirmAjaxLink.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/IndicatingOnConfirmAjaxLink.java
index a005baf..931d679 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/IndicatingOnConfirmAjaxLink.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/IndicatingOnConfirmAjaxLink.java
@@ -69,7 +69,7 @@ public abstract class IndicatingOnConfirmAjaxLink<T> extends IndicatingAjaxLink<
                             + "  })"
                             + "} else {"
                             + "  proceed = false;"
-                            + "};", new ArrayList<CharSequence>()
+                            + "};", new ArrayList<>()
                     )).asDomReadyScript());
         }
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/list/ConnConfPropertyListView.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/list/ConnConfPropertyListView.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/list/ConnConfPropertyListView.java
index 3711054..bc4ef01 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/list/ConnConfPropertyListView.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/list/ConnConfPropertyListView.java
@@ -82,7 +82,7 @@ public class ConnConfPropertyListView extends ListView<ConnConfProperty> {
                 || Constants.GUARDED_STRING.equalsIgnoreCase(property.getSchema().getType())
                 || Constants.GUARDED_BYTE_ARRAY.equalsIgnoreCase(property.getSchema().getType())) {
 
-            field = new AjaxPasswordFieldPanel("panel", label, new Model<String>(), false);
+            field = new AjaxPasswordFieldPanel("panel", label, new Model<>(), false);
             ((PasswordTextField) field.getField()).setResetPassword(false);
 
             required = property.getSchema().isRequired();
@@ -101,12 +101,12 @@ public class ConnConfPropertyListView extends ListView<ConnConfProperty> {
             if (ClassUtils.isAssignable(Number.class, propertySchemaClass)) {
                 @SuppressWarnings("unchecked")
                 Class<Number> numberClass = (Class<Number>) propertySchemaClass;
-                field = new AjaxSpinnerFieldPanel.Builder<>().build("panel", label, numberClass, new Model<Number>());
+                field = new AjaxSpinnerFieldPanel.Builder<>().build("panel", label, numberClass, new Model<>());
                 required = property.getSchema().isRequired();
             } else if (ClassUtils.isAssignable(Boolean.class, propertySchemaClass)) {
-                field = new AjaxCheckBoxPanel("panel", label, new Model<Boolean>());
+                field = new AjaxCheckBoxPanel("panel", label, new Model<>());
             } else {
-                field = new AjaxTextFieldPanel("panel", label, new Model<String>());
+                field = new AjaxTextFieldPanel("panel", label, new Model<>());
                 required = property.getSchema().isRequired();
             }
 
@@ -121,8 +121,7 @@ public class ConnConfPropertyListView extends ListView<ConnConfProperty> {
         final AbstractFieldPanel<? extends Serializable> fieldPanel;
         if (isArray) {
             final MultiFieldPanel multiFieldPanel = new MultiFieldPanel.Builder(
-                    new PropertyModel<List<String>>(property, "values")).setEventTemplate(true).build(
-                    "panel", label, field);
+                    new PropertyModel<>(property, "values")).setEventTemplate(true).build("panel", label, field);
             item.add(multiFieldPanel);
             fieldPanel = multiFieldPanel;
         } else {

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java b/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
index c7839ca..99d0cd2 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java
@@ -334,11 +334,11 @@ public class JobWidget extends BaseWidget {
         protected List<IColumn<JobTO, String>> getColumns() {
             List<IColumn<JobTO, String>> columns = new ArrayList<>();
 
-            columns.add(new PropertyColumn<JobTO, String>(new ResourceModel("refDesc"), "refDesc", "refDesc"));
+            columns.add(new PropertyColumn<>(new ResourceModel("refDesc"), "refDesc", "refDesc"));
 
-            columns.add(new BooleanPropertyColumn<JobTO>(new ResourceModel("scheduled"), "scheduled", "scheduled"));
+            columns.add(new BooleanPropertyColumn<>(new ResourceModel("scheduled"), "scheduled", "scheduled"));
 
-            columns.add(new DatePropertyColumn<JobTO>(new ResourceModel("start"), "start", "start"));
+            columns.add(new DatePropertyColumn<>(new ResourceModel("start"), "start", "start"));
 
             columns.add(new AbstractColumn<JobTO, String>(new Model<>(""), "running") {
 
@@ -351,8 +351,8 @@ public class JobWidget extends BaseWidget {
                         final IModel<JobTO> rowModel) {
 
                     JobTO jobTO = rowModel.getObject();
-                    JobActionPanel panel
-                            = new JobActionPanel(componentId, jobTO, JobWidget.this, pageRef);
+                    JobActionPanel panel =
+                            new JobActionPanel(componentId, jobTO, JobWidget.this, pageRef);
                     MetaDataRoleAuthorizationStrategy.authorize(panel, WebPage.ENABLE,
                             String.format("%s,%s%s,%s",
                                     StandardEntitlement.TASK_EXECUTE,
@@ -407,8 +407,8 @@ public class JobWidget extends BaseWidget {
                             SchedTaskTO schedTaskTO = new TaskRestClient().
                                     readSchedTask(SchedTaskTO.class, jobTO.getRefKey());
 
-                            SchedTaskWizardBuilder<SchedTaskTO> swb
-                                    = new SchedTaskWizardBuilder<>(schedTaskTO, pageRef);
+                            SchedTaskWizardBuilder<SchedTaskTO> swb =
+                                    new SchedTaskWizardBuilder<>(schedTaskTO, pageRef);
                             swb.setEventSink(AvailableJobsPanel.this);
 
                             target.add(jobModal.setContent(swb.build(BaseModal.CONTENT_ID, AjaxWizard.Mode.EDIT)));
@@ -567,13 +567,13 @@ public class JobWidget extends BaseWidget {
         protected List<IColumn<ExecTO, String>> getColumns() {
             List<IColumn<ExecTO, String>> columns = new ArrayList<>();
 
-            columns.add(new PropertyColumn<ExecTO, String>(new ResourceModel("refDesc"), "refDesc", "refDesc"));
+            columns.add(new PropertyColumn<>(new ResourceModel("refDesc"), "refDesc", "refDesc"));
 
-            columns.add(new DatePropertyColumn<ExecTO>(new ResourceModel("start"), "start", "start"));
+            columns.add(new DatePropertyColumn<>(new ResourceModel("start"), "start", "start"));
 
-            columns.add(new DatePropertyColumn<ExecTO>(new ResourceModel("end"), "end", "end"));
+            columns.add(new DatePropertyColumn<>(new ResourceModel("end"), "end", "end"));
 
-            columns.add(new PropertyColumn<ExecTO, String>(new ResourceModel("status"), "status", "status"));
+            columns.add(new PropertyColumn<>(new ResourceModel("status"), "status", "status"));
 
             return columns;
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/widgets/ReconciliationDetailsModalPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/widgets/ReconciliationDetailsModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/widgets/ReconciliationDetailsModalPanel.java
index 5fd1e62..15accd3 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/widgets/ReconciliationDetailsModalPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/widgets/ReconciliationDetailsModalPanel.java
@@ -110,7 +110,7 @@ public class ReconciliationDetailsModalPanel extends AbstractModalPanel<Any> {
         protected List<IColumn<Misaligned, String>> getColumns() {
             List<IColumn<Misaligned, String>> columns = new ArrayList<>();
 
-            columns.add(new PropertyColumn<Misaligned, String>(new ResourceModel("key"), "name", "name"));
+            columns.add(new PropertyColumn<>(new ResourceModel("key"), "name", "name"));
 
             columns.add(new AbstractColumn<Misaligned, String>(Model.of("Syncope")) {
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/wizards/AbstractMappingPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AbstractMappingPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/AbstractMappingPanel.java
index 5532f86..f344917 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AbstractMappingPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/AbstractMappingPanel.java
@@ -27,7 +27,6 @@ import java.lang.reflect.Modifier;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Comparator;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -86,7 +85,7 @@ public abstract class AbstractMappingPanel extends Panel {
     private static void initFieldNames(final Class<?> entityClass, final Set<String> keys) {
         List<Class<?>> classes = ClassUtils.getAllSuperclasses(entityClass);
         classes.add(entityClass);
-        for (Class<?> clazz : classes) {
+        classes.forEach(clazz -> {
             for (Field field : clazz.getDeclaredFields()) {
                 if (!Modifier.isStatic(field.getModifiers())
                         && !Collection.class.isAssignableFrom(field.getType())
@@ -95,7 +94,7 @@ public abstract class AbstractMappingPanel extends Panel {
                     keys.add(field.getName());
                 }
             }
-        }
+        });
     }
 
     /**
@@ -169,47 +168,43 @@ public abstract class AbstractMappingPanel extends Panel {
 
         mappingContainer.add(Constants.getJEXLPopover(this, TooltipConfig.Placement.bottom));
 
-        Collections.sort(model.getObject(), new Comparator<ItemTO>() {
-
-            @Override
-            public int compare(final ItemTO left, final ItemTO right) {
-                int compared;
-                if (left == null && right == null) {
-                    compared = 0;
-                } else if (left == null) {
-                    compared = 1;
-                } else if (right == null) {
-                    compared = -1;
-                } else if (left.isConnObjectKey()) {
-                    compared = -1;
-                } else if (right.isConnObjectKey()) {
-                    compared = 1;
-                } else if (left.isPassword()) {
-                    compared = -1;
-                } else if (right.isPassword()) {
-                    compared = 1;
-                } else if (left.getPurpose() == MappingPurpose.BOTH && right.getPurpose() != MappingPurpose.BOTH) {
-                    compared = -1;
-                } else if (left.getPurpose() != MappingPurpose.BOTH && right.getPurpose() == MappingPurpose.BOTH) {
-                    compared = 1;
-                } else if (left.getPurpose() == MappingPurpose.PROPAGATION
-                        && (right.getPurpose() == MappingPurpose.PULL
-                        || right.getPurpose() == MappingPurpose.NONE)) {
-                    compared = -1;
-                } else if (left.getPurpose() == MappingPurpose.PULL
-                        && right.getPurpose() == MappingPurpose.PROPAGATION) {
-                    compared = 1;
-                } else if (left.getPurpose() == MappingPurpose.PULL
-                        && right.getPurpose() == MappingPurpose.NONE) {
-                    compared = -1;
-                } else if (left.getPurpose() == MappingPurpose.NONE
-                        && right.getPurpose() != MappingPurpose.NONE) {
-                    compared = 1;
-                } else {
-                    compared = left.getIntAttrName().compareTo(right.getIntAttrName());
-                }
-                return compared;
+        Collections.sort(model.getObject(), (left, right) -> {
+            int compared;
+            if (left == null && right == null) {
+                compared = 0;
+            } else if (left == null) {
+                compared = 1;
+            } else if (right == null) {
+                compared = -1;
+            } else if (left.isConnObjectKey()) {
+                compared = -1;
+            } else if (right.isConnObjectKey()) {
+                compared = 1;
+            } else if (left.isPassword()) {
+                compared = -1;
+            } else if (right.isPassword()) {
+                compared = 1;
+            } else if (left.getPurpose() == MappingPurpose.BOTH && right.getPurpose() != MappingPurpose.BOTH) {
+                compared = -1;
+            } else if (left.getPurpose() != MappingPurpose.BOTH && right.getPurpose() == MappingPurpose.BOTH) {
+                compared = 1;
+            } else if (left.getPurpose() == MappingPurpose.PROPAGATION
+                    && (right.getPurpose() == MappingPurpose.PULL
+                    || right.getPurpose() == MappingPurpose.NONE)) {
+                compared = -1;
+            } else if (left.getPurpose() == MappingPurpose.PULL
+                    && right.getPurpose() == MappingPurpose.PROPAGATION) {
+                compared = 1;
+            } else if (left.getPurpose() == MappingPurpose.PULL
+                    && right.getPurpose() == MappingPurpose.NONE) {
+                compared = -1;
+            } else if (left.getPurpose() == MappingPurpose.NONE
+                    && right.getPurpose() != MappingPurpose.NONE) {
+                compared = 1;
+            } else {
+                compared = left.getIntAttrName().compareTo(right.getIntAttrName());
             }
+            return compared;
         });
 
         mappings = new ListView<ItemTO>("mappings", model) {
@@ -229,7 +224,7 @@ public abstract class AbstractMappingPanel extends Panel {
                 AjaxTextFieldPanel intAttrName = new AjaxTextFieldPanel(
                         "intAttrName",
                         getString("intAttrName"),
-                        new PropertyModel<String>(itemTO, "intAttrName"),
+                        new PropertyModel<>(itemTO, "intAttrName"),
                         false);
                 intAttrName.setChoices(Collections.<String>emptyList());
                 intAttrName.setRequired(true).hideLabel();
@@ -242,7 +237,7 @@ public abstract class AbstractMappingPanel extends Panel {
                 final AjaxTextFieldPanel extAttrName = new AjaxTextFieldPanel(
                         "extAttrName",
                         getString("extAttrName"),
-                        new PropertyModel<String>(itemTO, "extAttrName"));
+                        new PropertyModel<>(itemTO, "extAttrName"));
                 extAttrName.setChoices(getExtAttrNames().getObject());
 
                 boolean required = !itemTO.isPassword();
@@ -271,7 +266,7 @@ public abstract class AbstractMappingPanel extends Panel {
                 final AjaxTextFieldPanel mandatory = new AjaxTextFieldPanel(
                         "mandatoryCondition",
                         new ResourceModel("mandatoryCondition", "mandatoryCondition").getObject(),
-                        new PropertyModel<String>(itemTO, "mandatoryCondition"));
+                        new PropertyModel<>(itemTO, "mandatoryCondition"));
                 mandatory.hideLabel();
                 mandatory.setChoices(Arrays.asList(new String[] { "true", "false" }));
                 mandatory.setEnabled(!itemTO.isConnObjectKey());
@@ -284,7 +279,7 @@ public abstract class AbstractMappingPanel extends Panel {
                 final AjaxCheckBoxPanel connObjectKey = new AjaxCheckBoxPanel(
                         "connObjectKey",
                         new ResourceModel("connObjectKey", "connObjectKey").getObject(),
-                        new PropertyModel<Boolean>(itemTO, "connObjectKey"), false);
+                        new PropertyModel<>(itemTO, "connObjectKey"), false);
                 connObjectKey.hideLabel();
                 item.add(connObjectKey);
                 // -------------------------------
@@ -295,7 +290,7 @@ public abstract class AbstractMappingPanel extends Panel {
                 final AjaxCheckBoxPanel password = new AjaxCheckBoxPanel(
                         "password",
                         new ResourceModel("password", "password").getObject(),
-                        new PropertyModel<Boolean>(itemTO, "password"), false);
+                        new PropertyModel<>(itemTO, "password"), false);
                 item.add(password.hideLabel());
                 // -------------------------------
 
@@ -306,7 +301,7 @@ public abstract class AbstractMappingPanel extends Panel {
                 purpose.setOutputMarkupId(true);
 
                 final MappingPurposePanel purposeActions = new MappingPurposePanel(
-                        "purposeActions", new PropertyModel<MappingPurpose>(itemTO, "purpose"), purpose);
+                        "purposeActions", new PropertyModel<>(itemTO, "purpose"), purpose);
                 purpose.add(purposeActions.setRenderBodyOnly(true));
                 item.add(purpose);
                 // -------------------------------

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyObjectDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyObjectDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyObjectDetails.java
index 91ed3a5..5dff819 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyObjectDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyObjectDetails.java
@@ -37,8 +37,8 @@ public class AnyObjectDetails extends Details<AnyObjectTO> {
 
         AnyObjectTO anyObjectTO = wrapper.getInnerObject();
 
-        AjaxTextFieldPanel name = new AjaxTextFieldPanel("name", "name",
-                new PropertyModel<String>(anyObjectTO, "name"), false);
+        AjaxTextFieldPanel name =
+                new AjaxTextFieldPanel("name", "name", new PropertyModel<>(anyObjectTO, "name"), false);
         if (templateMode) {
             name.enableJexlHelp();
         } else {

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupDetails.java
index 33b7442..249f4cf 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/GroupDetails.java
@@ -37,8 +37,7 @@ public class GroupDetails extends Details<GroupTO> {
 
         GroupTO groupTO = GroupWrapper.class.cast(wrapper).getInnerObject();
 
-        AjaxTextFieldPanel name = new AjaxTextFieldPanel("name", "name",
-                new PropertyModel<String>(groupTO, "name"), false);
+        AjaxTextFieldPanel name = new AjaxTextFieldPanel("name", "name", new PropertyModel<>(groupTO, "name"), false);
         if (templateMode) {
             name.enableJexlHelp();
         } else {

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java
index 43051c6..6282061 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java
@@ -29,7 +29,6 @@ import org.apache.syncope.client.console.commons.Constants;
 import org.apache.syncope.client.console.panels.search.AnySelectionDirectoryPanel;
 import org.apache.syncope.client.console.panels.search.GroupSearchPanel;
 import org.apache.syncope.client.console.panels.search.GroupSelectionDirectoryPanel;
-import org.apache.syncope.client.console.panels.search.SearchClause;
 import org.apache.syncope.client.console.panels.search.SearchClausePanel;
 import org.apache.syncope.client.console.panels.search.SearchUtils;
 import org.apache.syncope.client.console.panels.search.UserSearchPanel;
@@ -171,7 +170,7 @@ public class Ownership extends WizardStep implements WizardModel.ICondition {
 
         groupSearchFragment = new Fragment("search", "groupSearchFragment", this);
         groupSearchPanel = new GroupSearchPanel.Builder(
-                new ListModel<>(new ArrayList<SearchClause>())).required(false).enableSearch(Ownership.this).
+                new ListModel<>(new ArrayList<>())).required(false).enableSearch(Ownership.this).
                 build("groupsearch");
         groupSearchFragment.add(groupSearchPanel.setRenderBodyOnly(true));
 
@@ -186,7 +185,7 @@ public class Ownership extends WizardStep implements WizardModel.ICondition {
 
         userSearchFragment = new Fragment("search", "userSearchFragment", this);
         userSearchPanel = UserSearchPanel.class.cast(new UserSearchPanel.Builder(
-                new ListModel<>(new ArrayList<SearchClause>())).required(false).enableSearch(Ownership.this).
+                new ListModel<>(new ArrayList<>())).required(false).enableSearch(Ownership.this).
                 build("usersearch"));
         userSearchFragment.add(userSearchPanel.setRenderBodyOnly(true));
 
@@ -247,8 +246,7 @@ public class Ownership extends WizardStep implements WizardModel.ICondition {
 
             @Override
             public void onClick(final AjaxRequestTarget target) {
-                send(Ownership.this, Broadcast.EXACT,
-                        new GroupSelectionDirectoryPanel.ItemSelection<GroupTO>(target, null));
+                send(Ownership.this, Broadcast.EXACT, new GroupSelectionDirectoryPanel.ItemSelection<>(target, null));
             }
 
             @Override
@@ -301,8 +299,7 @@ public class Ownership extends WizardStep implements WizardModel.ICondition {
 
             @Override
             public void onClick(final AjaxRequestTarget target) {
-                send(Ownership.this, Broadcast.EXACT,
-                        new GroupSelectionDirectoryPanel.ItemSelection<GroupTO>(target, null));
+                send(Ownership.this, Broadcast.EXACT, new GroupSelectionDirectoryPanel.ItemSelection<>(target, null));
             }
 
             @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PasswordPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PasswordPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PasswordPanel.java
index 44e673d..a54c6ca 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PasswordPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PasswordPanel.java
@@ -46,7 +46,7 @@ public class PasswordPanel extends Panel {
         add(form);
 
         FieldPanel<String> confirmPasswordField = new AjaxPasswordFieldPanel(
-                "confirmPassword", "confirmPassword", new Model<String>(), false);
+                "confirmPassword", "confirmPassword", new Model<>(), false);
 
         confirmPasswordField.setMarkupId("confirmPassword");
         confirmPasswordField.setPlaceholder("confirmPassword");
@@ -58,7 +58,7 @@ public class PasswordPanel extends Panel {
             confirmPasswordField.setVisible(false);
 
             AjaxTextFieldPanel passwordField = new AjaxTextFieldPanel(
-                    "password", "password", new PropertyModel<String>(wrapper.getInnerObject(), "password"), false);
+                    "password", "password", new PropertyModel<>(wrapper.getInnerObject(), "password"), false);
             passwordField.setRequired(true);
             passwordField.setMarkupId("password");
             passwordField.setPlaceholder("password");
@@ -66,7 +66,7 @@ public class PasswordPanel extends Panel {
             passwordField.enableJexlHelp();
         } else {
             AjaxPasswordFieldPanel passwordField = new AjaxPasswordFieldPanel(
-                    "password", "password", new PropertyModel<String>(wrapper.getInnerObject(), "password"), false);
+                    "password", "password", new PropertyModel<>(wrapper.getInnerObject(), "password"), false);
             passwordField.setRequired(true);
             passwordField.setMarkupId("password");
             passwordField.setPlaceholder("password");
@@ -76,7 +76,7 @@ public class PasswordPanel extends Panel {
         }
 
         AjaxCheckBoxPanel storePasswordInSyncope = new AjaxCheckBoxPanel("storePasswordInSyncope",
-                "storePasswordInSyncope", new PropertyModel<Boolean>(wrapper, "storePasswordInSyncope"));
+                "storePasswordInSyncope", new PropertyModel<>(wrapper, "storePasswordInSyncope"));
         storePasswordInSyncope.getField().setLabel(new ResourceModel("storePasswordInSyncope"));
         storePasswordInSyncope.setOutputMarkupId(true);
         storePasswordInSyncope.setOutputMarkupPlaceholderTag(true);

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserDetails.java
index 75ddac8..e2c5495 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserDetails.java
@@ -59,8 +59,7 @@ public class UserDetails extends Details<UserTO> {
         // ------------------------
         // Username
         // ------------------------
-        username = new AjaxTextFieldPanel(
-                "username", "username", new PropertyModel<String>(userTO, "username"), false);
+        username = new AjaxTextFieldPanel("username", "username", new PropertyModel<>(userTO, "username"), false);
 
         if (wrapper.getPreviousUserTO() != null && StringUtils.
                 compare(wrapper.getPreviousUserTO().getUsername(), wrapper.getInnerObject().getUsername()) != 0) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/VirAttrs.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/VirAttrs.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/VirAttrs.java
index 4ab5bee..d3d4a82 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/VirAttrs.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/VirAttrs.java
@@ -126,7 +126,7 @@ public class VirAttrs extends AbstractAttrs<VirSchemaTO> {
 
         Map<String, AttrTO> attrMap = EntityTOUtils.buildAttrMap(anyTO.getVirAttrs());
 
-        for (VirSchemaTO schema : schemas.values()) {
+        schemas.values().stream().map(schema -> {
             AttrTO attrTO = new AttrTO();
             attrTO.setSchema(schema.getKey());
             if (attrMap.containsKey(schema.getKey())) {
@@ -134,9 +134,10 @@ public class VirAttrs extends AbstractAttrs<VirSchemaTO> {
             } else {
                 attrTO.getValues().add(StringUtils.EMPTY);
             }
-
+            return attrTO;
+        }).forEachOrdered(attrTO -> {
             attrs.add(attrTO);
-        }
+        });
 
         anyTO.getVirAttrs().clear();
         anyTO.getVirAttrs().addAll(attrs);
@@ -148,7 +149,7 @@ public class VirAttrs extends AbstractAttrs<VirSchemaTO> {
 
         Map<String, AttrTO> attrMap = EntityTOUtils.buildAttrMap(anyTO.getVirAttrs());
 
-        for (VirSchemaTO schema : membershipSchemas.get(membershipTO.getGroupKey()).values()) {
+        membershipSchemas.get(membershipTO.getGroupKey()).values().stream().map(schema -> {
             AttrTO attrTO = new AttrTO();
             attrTO.setSchema(schema.getKey());
             if (attrMap.containsKey(schema.getKey())) {
@@ -156,9 +157,10 @@ public class VirAttrs extends AbstractAttrs<VirSchemaTO> {
             } else {
                 attrTO.getValues().add(StringUtils.EMPTY);
             }
-
+            return attrTO;
+        }).forEachOrdered(attrTO -> {
             attrs.add(attrTO);
-        }
+        });
 
         membershipTO.getVirAttrs().clear();
         membershipTO.getVirAttrs().addAll(attrs);
@@ -180,8 +182,8 @@ public class VirAttrs extends AbstractAttrs<VirSchemaTO> {
                 protected void populateItem(final ListItem<AttrTO> item) {
                     AttrTO attrTO = item.getModelObject();
 
-                    AbstractFieldPanel<?> panel
-                            = new AjaxTextFieldPanel("panel", attrTO.getSchema(), new Model<String>(), false);
+                    AbstractFieldPanel<?> panel =
+                            new AjaxTextFieldPanel("panel", attrTO.getSchema(), new Model<>(), false);
 
                     boolean readonly = attrTO.getSchemaInfo() == null
                             ? false

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/JEXLTransformersTogglePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/JEXLTransformersTogglePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/JEXLTransformersTogglePanel.java
index da3847b..6a85d96 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/JEXLTransformersTogglePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/JEXLTransformersTogglePanel.java
@@ -70,8 +70,8 @@ public class JEXLTransformersTogglePanel extends TogglePanel<Serializable> {
     }
 
     public JEXLTransformersTogglePanel setItem(final AjaxRequestTarget target, final ItemTO item) {
-        this.propagationJEXLTransformer.setNewModel(new PropertyModel<String>(item, "propagationJEXLTransformer"));
-        this.pullJEXLTransformer.setNewModel(new PropertyModel<String>(item, "pullJEXLTransformer"));
+        this.propagationJEXLTransformer.setNewModel(new PropertyModel<>(item, "propagationJEXLTransformer"));
+        this.pullJEXLTransformer.setNewModel(new PropertyModel<>(item, "pullJEXLTransformer"));
         setHeader(target, StringUtils.EMPTY);
         return this;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceConnCapabilitiesPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceConnCapabilitiesPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceConnCapabilitiesPanel.java
index 5f6073b..6268984 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceConnCapabilitiesPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceConnCapabilitiesPanel.java
@@ -18,7 +18,6 @@
  */
 package org.apache.syncope.client.console.wizards.resources;
 
-import java.util.List;
 import java.util.Set;
 import org.apache.syncope.client.console.commons.Constants;
 import org.apache.syncope.client.console.wicket.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior;
@@ -44,14 +43,14 @@ public class ResourceConnCapabilitiesPanel extends WizardStep {
         }
 
         final CapabilitiesPanel connCapabilitiesPanel = new CapabilitiesPanel(
-                new PropertyModel<List<ConnectorCapability>>(resourceTO, "capabilitiesOverride"));
+                new PropertyModel<>(resourceTO, "capabilitiesOverride"));
         connCapabilitiesPanel.setEnabled(resourceTO.isOverrideCapabilities());
         add(connCapabilitiesPanel);
 
         final AjaxCheckBoxPanel overrideCapabilities = new AjaxCheckBoxPanel(
                 "overrideCapabilities",
                 new ResourceModel("overrideCapabilities", "overrideCapabilities").getObject(),
-                new PropertyModel<Boolean>(resourceTO, "overrideCapabilities"));
+                new PropertyModel<>(resourceTO, "overrideCapabilities"));
         overrideCapabilities.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
 
             private static final long serialVersionUID = -1107858522700306810L;

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceConnConfPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceConnConfPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceConnConfPanel.java
index a5e397a..8a3aa5f 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceConnConfPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceConnConfPanel.java
@@ -20,7 +20,6 @@ package org.apache.syncope.client.console.wizards.resources;
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -61,15 +60,11 @@ public abstract class ResourceConnConfPanel extends AbstractConnConfPanel<Resour
                         List<ConnConfProperty> res = new ArrayList<>(super.getObject());
 
                         // re-order properties
-                        Collections.sort(res, new Comparator<ConnConfProperty>() {
-
-                            @Override
-                            public int compare(final ConnConfProperty left, final ConnConfProperty right) {
-                                if (left == null) {
-                                    return -1;
-                                } else {
-                                    return left.compareTo(right);
-                                }
+                        Collections.sort(res, (left, right) -> {
+                            if (left == null) {
+                                return -1;
+                            } else {
+                                return left.compareTo(right);
                             }
                         });
 
@@ -96,19 +91,19 @@ public abstract class ResourceConnConfPanel extends AbstractConnConfPanel<Resour
         List<ConnConfProperty> props = new ArrayList<>();
 
         if (resourceTO.getConnector() != null) {
-            for (ConnConfProperty property : restClient.read(resourceTO.getConnector()).getConf()) {
-                if (property.isOverridable()) {
-                    props.add(property);
-                }
-            }
+            restClient.read(resourceTO.getConnector()).getConf().stream().
+                    filter(property -> (property.isOverridable())).
+                    forEachOrdered(property -> {
+                        props.add(property);
+                    });
         }
         if (createFlag || resourceTO.getConfOverride().isEmpty()) {
             resourceTO.getConfOverride().clear();
         } else {
             Map<String, ConnConfProperty> valuedProps = new HashMap<>();
-            for (ConnConfProperty prop : resourceTO.getConfOverride()) {
+            resourceTO.getConfOverride().forEach(prop -> {
                 valuedProps.put(prop.getSchema().getName(), prop);
-            }
+            });
 
             for (int i = 0; i < props.size(); i++) {
                 if (valuedProps.containsKey(props.get(i).getSchema().getName())) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceDetailsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceDetailsPanel.java
index 856fa60..d5a8480 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceDetailsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceDetailsPanel.java
@@ -64,14 +64,14 @@ public class ResourceDetailsPanel extends WizardStep {
         container.add(new AjaxTextFieldPanel(
                 "key",
                 new ResourceModel("key", "key").
-                getObject(),
-                new PropertyModel<String>(resourceTO, "key"),
+                        getObject(),
+                new PropertyModel<>(resourceTO, "key"),
                 false).addRequiredLabel().setEnabled(createFlag));
 
         container.add(new AjaxCheckBoxPanel(
                 "enforceMandatoryCondition",
                 new ResourceModel("enforceMandatoryCondition", "enforceMandatoryCondition").getObject(),
-                new PropertyModel<Boolean>(resourceTO, "enforceMandatoryCondition"),
+                new PropertyModel<>(resourceTO, "enforceMandatoryCondition"),
                 false));
 
         container.add(new AjaxSpinnerFieldPanel.Builder<Integer>().build(
@@ -82,7 +82,7 @@ public class ResourceDetailsPanel extends WizardStep {
 
         container.add(new AjaxCheckBoxPanel("randomPwdIfNotProvided",
                 new ResourceModel("randomPwdIfNotProvided", "randomPwdIfNotProvided").getObject(),
-                new PropertyModel<Boolean>(resourceTO, "randomPwdIfNotProvided"),
+                new PropertyModel<>(resourceTO, "randomPwdIfNotProvided"),
                 false));
 
         container.add(new AjaxPalettePanel.Builder<String>().
@@ -95,28 +95,28 @@ public class ResourceDetailsPanel extends WizardStep {
         container.add(new AjaxDropDownChoicePanel<>(
                 "createTraceLevel",
                 new ResourceModel("createTraceLevel", "createTraceLevel").getObject(),
-                new PropertyModel<TraceLevel>(resourceTO, "createTraceLevel"),
+                new PropertyModel<>(resourceTO, "createTraceLevel"),
                 false).
                 setChoices(Arrays.asList(TraceLevel.values())).setNullValid(false));
 
         container.add(new AjaxDropDownChoicePanel<>(
                 "updateTraceLevel",
                 new ResourceModel("updateTraceLevel", "updateTraceLevel").getObject(),
-                new PropertyModel<TraceLevel>(resourceTO, "updateTraceLevel"),
+                new PropertyModel<>(resourceTO, "updateTraceLevel"),
                 false).
                 setChoices(Arrays.asList(TraceLevel.values())).setNullValid(false));
 
         container.add(new AjaxDropDownChoicePanel<>(
                 "deleteTraceLevel",
                 new ResourceModel("deleteTraceLevel", "deleteTraceLevel").getObject(),
-                new PropertyModel<TraceLevel>(resourceTO, "deleteTraceLevel"),
+                new PropertyModel<>(resourceTO, "deleteTraceLevel"),
                 false).
                 setChoices(Arrays.asList(TraceLevel.values())).setNullValid(false));
 
         container.add(new AjaxDropDownChoicePanel<>(
                 "provisioningTraceLevel",
                 new ResourceModel("provisioningTraceLevel", "provisioningTraceLevel").getObject(),
-                new PropertyModel<TraceLevel>(resourceTO, "provisioningTraceLevel"),
+                new PropertyModel<>(resourceTO, "provisioningTraceLevel"),
                 false).
                 setChoices(Arrays.asList(TraceLevel.values())).setNullValid(false));
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel.java
index f3ff8f5..aeace2d 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel.java
@@ -24,7 +24,6 @@ import java.util.Map;
 import org.apache.syncope.client.console.rest.PolicyRestClient;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
 import org.apache.syncope.client.console.wicket.markup.html.form.PolicyRenderer;
-import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
 import org.apache.syncope.common.lib.to.ResourceTO;
 import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.wicket.extensions.wizard.WizardStep;
@@ -48,9 +47,9 @@ public class ResourceSecurityPanel extends WizardStep {
         @Override
         protected Map<String, String> load() {
             Map<String, String> res = new HashMap<>();
-            for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.PASSWORD)) {
+            policyRestClient.getPolicies(PolicyType.PASSWORD).forEach(policyTO -> {
                 res.put(policyTO.getKey(), policyTO.getDescription());
-            }
+            });
             return res;
         }
     };
@@ -62,9 +61,9 @@ public class ResourceSecurityPanel extends WizardStep {
         @Override
         protected Map<String, String> load() {
             Map<String, String> res = new HashMap<>();
-            for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.ACCOUNT)) {
+            policyRestClient.getPolicies(PolicyType.ACCOUNT).forEach(policyTO -> {
                 res.put(policyTO.getKey(), policyTO.getDescription());
-            }
+            });
             return res;
         }
     };
@@ -76,9 +75,9 @@ public class ResourceSecurityPanel extends WizardStep {
         @Override
         protected Map<String, String> load() {
             Map<String, String> res = new HashMap<>();
-            for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.PULL)) {
+            policyRestClient.getPolicies(PolicyType.PULL).forEach(policyTO -> {
                 res.put(policyTO.getKey(), policyTO.getDescription());
-            }
+            });
             return res;
         }
     };
@@ -98,7 +97,7 @@ public class ResourceSecurityPanel extends WizardStep {
         AjaxDropDownChoicePanel<String> passwordPolicy = new AjaxDropDownChoicePanel<>(
                 "passwordPolicy",
                 new ResourceModel("passwordPolicy", "passwordPolicy").getObject(),
-                new PropertyModel<String>(resourceTO, "passwordPolicy"),
+                new PropertyModel<>(resourceTO, "passwordPolicy"),
                 false);
         passwordPolicy.setChoiceRenderer(new PolicyRenderer(passwordPolicies));
         passwordPolicy.setChoices(new ArrayList<>(passwordPolicies.getObject().keySet()));
@@ -112,7 +111,7 @@ public class ResourceSecurityPanel extends WizardStep {
         AjaxDropDownChoicePanel<String> accountPolicy = new AjaxDropDownChoicePanel<>(
                 "accountPolicy",
                 new ResourceModel("accountPolicy", "accountPolicy").getObject(),
-                new PropertyModel<String>(resourceTO, "accountPolicy"),
+                new PropertyModel<>(resourceTO, "accountPolicy"),
                 false);
         accountPolicy.setChoiceRenderer(new PolicyRenderer(accountPolicies));
         accountPolicy.setChoices(new ArrayList<>(accountPolicies.getObject().keySet()));
@@ -126,7 +125,7 @@ public class ResourceSecurityPanel extends WizardStep {
         AjaxDropDownChoicePanel<String> pullPolicy = new AjaxDropDownChoicePanel<>(
                 "pullPolicy",
                 new ResourceModel("pullPolicy", "pullPolicy").getObject(),
-                new PropertyModel<String>(resourceTO, "pullPolicy"),
+                new PropertyModel<>(resourceTO, "pullPolicy"),
                 false);
         pullPolicy.setChoiceRenderer(new PolicyRenderer(pullPolicies));
         pullPolicy.setChoices(new ArrayList<>(pullPolicies.getObject().keySet()));

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserApplication.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserApplication.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserApplication.java
index e35a166..5871842 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserApplication.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserApplication.java
@@ -21,7 +21,6 @@ package org.apache.syncope.client.enduser;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import java.io.File;
-import java.io.FileFilter;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.Serializable;
@@ -142,21 +141,10 @@ public class SyncopeEnduserApplication extends WebApplication implements Seriali
                 }
             }
             FileAlterationObserver observer = existsEnduserDir
-                    ? new FileAlterationObserver(enduserDir, new FileFilter() {
-
-                        @Override
-                        public boolean accept(final File pathname) {
-                            return StringUtils.contains(pathname.getPath(), CUSTOM_FORM_FILE);
-                        }
-                    })
+                    ? new FileAlterationObserver(enduserDir,
+                            pathname -> StringUtils.contains(pathname.getPath(), CUSTOM_FORM_FILE))
                     : new FileAlterationObserver(getClass().getResource("/" + CUSTOM_FORM_FILE).getFile(),
-                            new FileFilter() {
-
-                        @Override
-                        public boolean accept(final File pathname) {
-                            return StringUtils.contains(pathname.getPath(), CUSTOM_FORM_FILE);
-                        }
-                    });
+                            pathname -> StringUtils.contains(pathname.getPath(), CUSTOM_FORM_FILE));
 
             FileAlterationMonitor monitor = new FileAlterationMonitor(5000);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
index 370f91a..c7b70cc 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
@@ -22,10 +22,9 @@ import java.security.AccessControlException;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.stream.Collectors;
 import javax.ws.rs.core.EntityTag;
 import javax.ws.rs.core.MediaType;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Predicate;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.syncope.client.lib.AnonymousAuthenticationHandler;
@@ -85,13 +84,8 @@ public class SyncopeEnduserSession extends WebSession {
 
         datePlainSchemas = anonymousClient.getService(SchemaService.class).
                 list(new SchemaQuery.Builder().type(SchemaType.PLAIN).build());
-        CollectionUtils.filter(datePlainSchemas, new Predicate<PlainSchemaTO>() {
-
-            @Override
-            public boolean evaluate(final PlainSchemaTO object) {
-                return object.getType() == AttrSchemaType.Date;
-            }
-        });
+        datePlainSchemas.removeAll(datePlainSchemas.stream().
+                filter(object -> object.getType() != AttrSchemaType.Date).collect(Collectors.toSet()));
     }
 
     private void afterAuthentication() {

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/BaseUserSelfResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/BaseUserSelfResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/BaseUserSelfResource.java
index 3a092c3..10da85b 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/BaseUserSelfResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/BaseUserSelfResource.java
@@ -21,9 +21,8 @@ package org.apache.syncope.client.enduser.resources;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.text.ParseException;
+import java.util.ListIterator;
 import java.util.Set;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Transformer;
 import org.apache.commons.lang3.time.FastDateFormat;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.to.PlainSchemaTO;
@@ -34,45 +33,38 @@ public abstract class BaseUserSelfResource extends BaseResource {
 
     protected void dateToMillis(final Set<AttrTO> attrs, final PlainSchemaTO plainSchema)
             throws ParseException {
-        final FastDateFormat fmt = FastDateFormat.getInstance(plainSchema.getConversionPattern());
-
-        for (AttrTO attr : attrs) {
-            if (attr.getSchema().equals(plainSchema.getKey())) {
-                CollectionUtils.transform(attr.getValues(), new Transformer<String, String>() {
 
-                    @Override
-                    public String transform(final String input) {
+        final FastDateFormat fmt = FastDateFormat.getInstance(plainSchema.getConversionPattern());
+        attrs.stream().
+                filter(attr -> (attr.getSchema().equals(plainSchema.getKey()))).
+                forEachOrdered(attr -> {
+                    for (ListIterator<String> itor = attr.getValues().listIterator(); itor.hasNext();) {
+                        String value = itor.next();
                         try {
-                            return String.valueOf(fmt.parse(input).getTime());
+                            itor.set(String.valueOf(fmt.parse(value).getTime()));
                         } catch (ParseException ex) {
-                            LOG.error("Unable to parse date {}", input);
-                            return input;
+                            LOG.error("Unable to parse date {}", value);
                         }
                     }
                 });
-            }
-        }
     }
 
     protected void millisToDate(final Set<AttrTO> attrs, final PlainSchemaTO plainSchema)
             throws IllegalArgumentException {
-        final FastDateFormat fmt = FastDateFormat.getInstance(plainSchema.getConversionPattern());
-        for (AttrTO attr : attrs) {
-            if (attr.getSchema().equals(plainSchema.getKey())) {
-                CollectionUtils.transform(attr.getValues(), new Transformer<String, String>() {
 
-                    @Override
-                    public String transform(final String input) {
+        final FastDateFormat fmt = FastDateFormat.getInstance(plainSchema.getConversionPattern());
+        attrs.stream().
+                filter(attr -> (attr.getSchema().equals(plainSchema.getKey()))).
+                forEachOrdered(attr -> {
+                    for (ListIterator<String> itor = attr.getValues().listIterator(); itor.hasNext();) {
+                        String value = itor.next();
                         try {
-                            return fmt.format(Long.valueOf(input));
+                            itor.set(fmt.format(Long.valueOf(value)));
                         } catch (NumberFormatException ex) {
-                            LOG.error("Invalid format value for {}", input);
-                            return input;
+                            LOG.error("Invalid format value for {}", value);
                         }
                     }
                 });
-            }
-        }
     }
 
     protected void buildResponse(final ResourceResponse response, final int statusCode, final String message) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/InfoResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/InfoResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/InfoResource.java
index 24b90a0..58bd238 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/InfoResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/InfoResource.java
@@ -67,7 +67,7 @@ public class InfoResource extends BaseResource {
                                     PlatformInfoAdapter.toPlatformInfoRequest(
                                             SyncopeEnduserSession.get().getPlatformInfo(),
                                             customForm == null
-                                                    ? new HashMap<String, CustomAttributesInfo>()
+                                                    ? new HashMap<>()
                                                     : customForm)));
                 }
             });

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
index 36f11f4..80ec8d1 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
@@ -22,14 +22,12 @@ import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Predicate;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.client.enduser.SyncopeEnduserApplication;
 import org.apache.syncope.client.enduser.SyncopeEnduserConstants;
@@ -125,15 +123,15 @@ public class SchemaResource extends BaseResource {
                     : Collections.<AbstractSchemaTO>emptyList();
 
             if (group != null) {
-                for (AbstractSchemaTO schema : plainSchemas) {
+                plainSchemas.forEach(schema -> {
                     schema.setKey(compositeSchemaKey(group, schema.getKey()));
-                }
-                for (AbstractSchemaTO schema : derSchemas) {
+                });
+                derSchemas.forEach(schema -> {
                     schema.setKey(compositeSchemaKey(group, schema.getKey()));
-                }
-                for (AbstractSchemaTO schema : virSchemas) {
+                });
+                virSchemas.forEach(schema -> {
                     schema.setKey(compositeSchemaKey(group, schema.getKey()));
-                }
+                });
             }
 
             response.setTextEncoding(StandardCharsets.UTF_8.name());
@@ -160,7 +158,9 @@ public class SchemaResource extends BaseResource {
         return response;
     }
 
-    private List<AbstractSchemaTO> customizeSchemas(final List<AbstractSchemaTO> schemaTOs, final String groupParam,
+    private List<AbstractSchemaTO> customizeSchemas(
+            final List<AbstractSchemaTO> schemaTOs,
+            final String groupParam,
             final Map<String, CustomAttribute> customForm) {
 
         if (customForm.isEmpty()) {
@@ -168,28 +168,20 @@ public class SchemaResource extends BaseResource {
         }
         final boolean isGroupBlank = StringUtils.isBlank(groupParam);
 
-        CollectionUtils.filter(schemaTOs, new Predicate<AbstractSchemaTO>() {
-
-            @Override
-            public boolean evaluate(final AbstractSchemaTO object) {
-                return customForm.containsKey(isGroupBlank
-                        ? object.getKey()
-                        : compositeSchemaKey(groupParam, object.getKey()));
-            }
-        });
-
-        Collections.sort(schemaTOs, new Comparator<AbstractSchemaTO>() {
-
-            @Override
-            public int compare(final AbstractSchemaTO schemaTO1, final AbstractSchemaTO schemaTO2) {
-                List<String> order = new ArrayList<>(customForm.keySet());
-                return order.indexOf(isGroupBlank
-                        ? schemaTO1.getKey()
-                        : compositeSchemaKey(groupParam, schemaTO1.getKey()))
-                        - order.indexOf(isGroupBlank
-                                ? schemaTO2.getKey()
-                                : compositeSchemaKey(groupParam, schemaTO2.getKey()));
-            }
+        schemaTOs.removeAll(schemaTOs.stream().
+                filter(schema -> !customForm.containsKey(isGroupBlank
+                ? schema.getKey()
+                : compositeSchemaKey(groupParam, schema.getKey()))).
+                collect(Collectors.toSet()));
+
+        Collections.sort(schemaTOs, (schemaTO1, schemaTO2) -> {
+            List<String> order = new ArrayList<>(customForm.keySet());
+            return order.indexOf(isGroupBlank
+                    ? schemaTO1.getKey()
+                    : compositeSchemaKey(groupParam, schemaTO1.getKey()))
+                    - order.indexOf(isGroupBlank
+                            ? schemaTO2.getKey()
+                            : compositeSchemaKey(groupParam, schemaTO2.getKey()));
         });
 
         return schemaTOs;

http://git-wip-us.apache.org/repos/asf/syncope/blob/5be24a03/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
index 00bc356..9d8d7d5 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
@@ -23,8 +23,6 @@ import java.util.Set;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-import org.apache.commons.collections4.IterableUtils;
-import org.apache.commons.collections4.Predicate;
 import org.apache.commons.lang3.SerializationUtils;
 import org.apache.syncope.client.enduser.SyncopeEnduserApplication;
 import org.apache.syncope.client.enduser.SyncopeEnduserConstants;
@@ -34,7 +32,6 @@ import org.apache.syncope.client.enduser.util.UserRequestValidator;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.to.MembershipTO;
-import org.apache.syncope.common.lib.to.PlainSchemaTO;
 import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.rest.api.service.UserSelfService;
 
@@ -88,89 +85,79 @@ public class UserSelfCreateResource extends BaseUserSelfResource {
 
                     // 1. membership attributes management
                     Set<AttrTO> membAttrs = new HashSet<>();
-                    for (AttrTO attr : userTO.getPlainAttrs()) {
-                        if (attr.getSchema().contains(SyncopeEnduserConstants.MEMBERSHIP_ATTR_SEPARATOR)) {
-                            final String[] simpleAttrs = attr.getSchema().split(
-                                    SyncopeEnduserConstants.MEMBERSHIP_ATTR_SEPARATOR);
-                            MembershipTO membership = IterableUtils.find(userTO.getMemberships(),
-                                    new Predicate<MembershipTO>() {
-
-                                @Override
-                                public boolean evaluate(final MembershipTO item) {
-                                    return simpleAttrs[0].equals(item.getGroupName());
+                    userTO.getPlainAttrs().stream().
+                            filter(attr -> (attr.getSchema().
+                            contains(SyncopeEnduserConstants.MEMBERSHIP_ATTR_SEPARATOR))).
+                            forEachOrdered(attr -> {
+                                String[] simpleAttrs = attr.getSchema().split(
+                                        SyncopeEnduserConstants.MEMBERSHIP_ATTR_SEPARATOR);
+                                MembershipTO membership = userTO.getMemberships().stream().
+                                        filter(memb -> simpleAttrs[0].equals(memb.getGroupName())).
+                                        findFirst().orElse(null);
+                                if (membership == null) {
+                                    membership = new MembershipTO.Builder().group(null, simpleAttrs[0]).build();
+                                    userTO.getMemberships().add(membership);
                                 }
+
+                                AttrTO clone = SerializationUtils.clone(attr);
+                                clone.setSchema(simpleAttrs[1]);
+                                membership.getPlainAttrs().add(clone);
+                                membAttrs.add(attr);
                             });
-                            if (membership == null) {
-                                membership = new MembershipTO.Builder().group(null, simpleAttrs[0]).build();
-                                userTO.getMemberships().add(membership);
-                            }
-
-                            AttrTO clone = SerializationUtils.clone(attr);
-                            clone.setSchema(simpleAttrs[1]);
-                            membership.getPlainAttrs().add(clone);
-                            membAttrs.add(attr);
-                        }
-                    }
                     userTO.getPlainAttrs().removeAll(membAttrs);
 
                     // 2. millis -> Date conversion for PLAIN attributes of USER and its MEMBERSHIPS
-                    for (PlainSchemaTO plainSchema : SyncopeEnduserSession.get().getDatePlainSchemas()) {
+                    SyncopeEnduserSession.get().getDatePlainSchemas().stream().map(plainSchema -> {
                         millisToDate(userTO.getPlainAttrs(), plainSchema);
-                        for (MembershipTO membership : userTO.getMemberships()) {
+                        return plainSchema;
+                    }).forEachOrdered(plainSchema -> {
+                        userTO.getMemberships().forEach(membership -> {
                             millisToDate(membership.getPlainAttrs(), plainSchema);
-                        }
-                    }
+                        });
+                    });
 
                     membAttrs.clear();
-                    for (AttrTO attr : userTO.getDerAttrs()) {
-                        if (attr.getSchema().contains(SyncopeEnduserConstants.MEMBERSHIP_ATTR_SEPARATOR)) {
-                            final String[] simpleAttrs = attr.getSchema().split(
-                                    SyncopeEnduserConstants.MEMBERSHIP_ATTR_SEPARATOR);
-                            MembershipTO membership = IterableUtils.find(userTO.getMemberships(),
-                                    new Predicate<MembershipTO>() {
-
-                                @Override
-                                public boolean evaluate(final MembershipTO item) {
-                                    return simpleAttrs[0].equals(item.getGroupName());
+                    userTO.getDerAttrs().stream().
+                            filter(attr -> (attr.getSchema().
+                            contains(SyncopeEnduserConstants.MEMBERSHIP_ATTR_SEPARATOR))).
+                            forEachOrdered(attr -> {
+                                String[] simpleAttrs = attr.getSchema().split(
+                                        SyncopeEnduserConstants.MEMBERSHIP_ATTR_SEPARATOR);
+                                MembershipTO membership = userTO.getMemberships().stream().
+                                        filter(memb -> simpleAttrs[0].equals(memb.getGroupName())).
+                                        findFirst().orElse(null);
+                                if (membership == null) {
+                                    membership = new MembershipTO.Builder().group(null, simpleAttrs[0]).build();
+                                    userTO.getMemberships().add(membership);
                                 }
+
+                                AttrTO clone = SerializationUtils.clone(attr);
+                                clone.setSchema(simpleAttrs[1]);
+                                membership.getDerAttrs().add(clone);
+                                membAttrs.add(attr);
                             });
-                            if (membership == null) {
-                                membership = new MembershipTO.Builder().group(null, simpleAttrs[0]).build();
-                                userTO.getMemberships().add(membership);
-                            }
-
-                            AttrTO clone = SerializationUtils.clone(attr);
-                            clone.setSchema(simpleAttrs[1]);
-                            membership.getDerAttrs().add(clone);
-                            membAttrs.add(attr);
-                        }
-                    }
                     userTO.getDerAttrs().removeAll(membAttrs);
 
                     membAttrs.clear();
-                    for (AttrTO attr : userTO.getVirAttrs()) {
-                        if (attr.getSchema().contains(SyncopeEnduserConstants.MEMBERSHIP_ATTR_SEPARATOR)) {
-                            final String[] simpleAttrs = attr.getSchema().split(
-                                    SyncopeEnduserConstants.MEMBERSHIP_ATTR_SEPARATOR);
-                            MembershipTO membership = IterableUtils.find(userTO.getMemberships(),
-                                    new Predicate<MembershipTO>() {
-
-                                @Override
-                                public boolean evaluate(final MembershipTO item) {
-                                    return simpleAttrs[0].equals(item.getGroupName());
+                    userTO.getVirAttrs().stream().
+                            filter(attr -> (attr.getSchema().
+                            contains(SyncopeEnduserConstants.MEMBERSHIP_ATTR_SEPARATOR))).
+                            forEachOrdered(attr -> {
+                                String[] simpleAttrs = attr.getSchema().split(
+                                        SyncopeEnduserConstants.MEMBERSHIP_ATTR_SEPARATOR);
+                                MembershipTO membership = userTO.getMemberships().stream().
+                                        filter(memb -> simpleAttrs[0].equals(memb.getGroupName())).
+                                        findFirst().orElse(null);
+                                if (membership == null) {
+                                    membership = new MembershipTO.Builder().group(null, simpleAttrs[0]).build();
+                                    userTO.getMemberships().add(membership);
                                 }
+
+                                AttrTO clone = SerializationUtils.clone(attr);
+                                clone.setSchema(simpleAttrs[1]);
+                                membership.getVirAttrs().add(clone);
+                                membAttrs.add(attr);
                             });
-                            if (membership == null) {
-                                membership = new MembershipTO.Builder().group(null, simpleAttrs[0]).build();
-                                userTO.getMemberships().add(membership);
-                            }
-
-                            AttrTO clone = SerializationUtils.clone(attr);
-                            clone.setSchema(simpleAttrs[1]);
-                            membership.getVirAttrs().add(clone);
-                            membAttrs.add(attr);
-                        }
-                    }
                     userTO.getVirAttrs().removeAll(membAttrs);
 
                     LOG.debug("Received user self registration request for user: [{}]", userTO.getUsername());
@@ -197,7 +184,6 @@ public class UserSelfCreateResource extends BaseUserSelfResource {
                         ? "Request received is not valid }}"
                         : "Self registration not allowed }}").toString());
             }
-
         } catch (Exception e) {
             LOG.error("Unable to create userTO", e);
             response.setError(Response.Status.BAD_REQUEST.getStatusCode(),


Mime
View raw message