You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2018/05/31 06:56:55 UTC
syncope git commit: Small fixes
Repository: syncope
Updated Branches:
refs/heads/master 22900099e -> be8ae795d
Small fixes
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/be8ae795
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/be8ae795
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/be8ae795
Branch: refs/heads/master
Commit: be8ae795d4c2ee42ea84cb8eb7712079dc403016
Parents: 2290009
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu May 31 08:56:48 2018 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu May 31 08:56:48 2018 +0200
----------------------------------------------------------------------
.../html/repeater/data/table/AttrColumn.java | 16 ++++------
.../apache/syncope/core/logic/SchemaLogic.java | 32 +++++---------------
2 files changed, 13 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/be8ae795/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AttrColumn.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AttrColumn.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AttrColumn.java
index d562805..0aa49fd 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AttrColumn.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AttrColumn.java
@@ -18,8 +18,8 @@
*/
package org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table;
+import java.util.ArrayList;
import java.util.List;
-import org.apache.syncope.common.lib.to.AttrTO;
import org.apache.syncope.common.lib.types.SchemaType;
import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
@@ -49,29 +49,25 @@ public class AttrColumn<T extends AttributableTO> extends AbstractColumn<T, Stri
public void populateItem(
final Item<ICellPopulator<T>> cellItem, final String componentId, final IModel<T> rowModel) {
- List<String> values = null;
+ List<String> values = new ArrayList<>();
- AttrTO attr = null;
switch (schemaType) {
case PLAIN:
- attr = rowModel.getObject().getPlainAttr(name).get();
+ rowModel.getObject().getPlainAttr(name).ifPresent(attr -> values.addAll(attr.getValues()));
break;
case DERIVED:
- attr = rowModel.getObject().getDerAttr(name).get();
+ rowModel.getObject().getDerAttr(name).ifPresent(attr -> values.addAll(attr.getValues()));
break;
case VIRTUAL:
- attr = rowModel.getObject().getVirAttr(name).get();
+ rowModel.getObject().getVirAttr(name).ifPresent(attr -> values.addAll(attr.getValues()));
break;
default:
}
- if (attr != null) {
- values = attr.getValues();
- }
- if (values == null || values.isEmpty()) {
+ if (values.isEmpty()) {
cellItem.add(new Label(componentId, ""));
} else if (values.size() == 1) {
cellItem.add(new Label(componentId, values.get(0)));
http://git-wip-us.apache.org/repos/asf/syncope/blob/be8ae795/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
index b87d3d6..34b7d08 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/SchemaLogic.java
@@ -21,7 +21,6 @@ package org.apache.syncope.core.logic;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
-import java.util.function.Function;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
@@ -147,6 +146,7 @@ public class SchemaLogic extends AbstractTransactionalLogic<SchemaTO> {
@PreAuthorize("isAuthenticated()")
@Transactional(readOnly = true)
+ @SuppressWarnings("unchecked")
public <T extends SchemaTO> List<T> search(
final SchemaType schemaType, final List<String> anyTypeClasses, final String keyword) {
@@ -171,14 +171,8 @@ public class SchemaLogic extends AbstractTransactionalLogic<SchemaTO> {
? keyword == null
? virSchemaDAO.findAll()
: virSchemaDAO.findByKeyword(keyword)
- : virSchemaDAO.findByAnyTypeClasses(classes)).
- stream().map(new Function<VirSchema, T>() {
-
- @Override
- public T apply(final VirSchema schema) {
- return (T) binder.getVirSchemaTO(schema);
- }
- }).collect(Collectors.toList());
+ : virSchemaDAO.findByAnyTypeClasses(classes)).stream().
+ map(schema -> (T) binder.getVirSchemaTO(schema)).collect(Collectors.toList());
break;
case DERIVED:
@@ -186,14 +180,8 @@ public class SchemaLogic extends AbstractTransactionalLogic<SchemaTO> {
? keyword == null
? derSchemaDAO.findAll()
: derSchemaDAO.findByKeyword(keyword)
- : derSchemaDAO.findByAnyTypeClasses(classes)).
- stream().map(new Function<DerSchema, T>() {
-
- @Override
- public T apply(final DerSchema schema) {
- return (T) binder.getDerSchemaTO(schema);
- }
- }).collect(Collectors.toList());
+ : derSchemaDAO.findByAnyTypeClasses(classes)).stream().
+ map(schema -> (T) binder.getDerSchemaTO(schema)).collect(Collectors.toList());
break;
case PLAIN:
@@ -202,14 +190,8 @@ public class SchemaLogic extends AbstractTransactionalLogic<SchemaTO> {
? keyword == null
? plainSchemaDAO.findAll()
: plainSchemaDAO.findByKeyword(keyword)
- : plainSchemaDAO.findByAnyTypeClasses(classes)).
- stream().map(new Function<PlainSchema, T>() {
-
- @Override
- public T apply(final PlainSchema schema) {
- return (T) binder.getPlainSchemaTO(schema);
- }
- }).collect(Collectors.toList());
+ : plainSchemaDAO.findByAnyTypeClasses(classes)).stream().
+ map(schema -> (T) binder.getPlainSchemaTO(schema)).collect(Collectors.toList());
}
return result;