Repository: syncope
Updated Branches:
  refs/heads/master 6b9cd592b -> 3f58b93c1


Fixed SYNCOPE-713


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/3f58b93c
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/3f58b93c
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/3f58b93c

Branch: refs/heads/master
Commit: 3f58b93c195d2d80f010b3362aa8d445cfff6970
Parents: 6b9cd59
Author: massi <[email protected]>
Authored: Wed Oct 21 12:13:45 2015 +0200
Committer: massi <[email protected]>
Committed: Wed Oct 21 12:13:45 2015 +0200

----------------------------------------------------------------------
 .../configuration/ConfigurationGet.java         |  2 +-
 .../console/rest/ConfigurationRestClient.java   | 15 ++++------
 .../apache/syncope/common/lib/to/ConfTO.java    | 30 --------------------
 .../rest/api/service/ConfigurationService.java  |  4 +--
 .../syncope/core/logic/ConfigurationLogic.java  |  8 +++---
 .../api/data/ConfigurationDataBinder.java       |  4 +--
 .../java/data/ConfigurationDataBinderImpl.java  | 21 +++++++-------
 .../cxf/service/ConfigurationServiceImpl.java   |  4 +--
 .../fit/core/reference/ConfigurationITCase.java |  6 ++--
 9 files changed, 31 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/3f58b93c/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java
----------------------------------------------------------------------
diff --git 
a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java
 
b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java
index 91f3dce..472e40f 100644
--- 
a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java
+++ 
b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java
@@ -27,7 +27,7 @@ public class ConfigurationGet extends 
AbstractConfigurationCommand {
 
     public void get() {
         try {
-            configurationResultManager.fromGet(new 
LinkedList<>(configurationService.list().getPlainAttrs()));
+            configurationResultManager.fromGet(new 
LinkedList<>(configurationService.list()));
         } catch (final Exception ex) {
             configurationResultManager.genericError(ex.getMessage());
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/3f58b93c/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfigurationRestClient.java
----------------------------------------------------------------------
diff --git 
a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfigurationRestClient.java
 
b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfigurationRestClient.java
index ade9408..c24cf53 100644
--- 
a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfigurationRestClient.java
+++ 
b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfigurationRestClient.java
@@ -18,14 +18,12 @@
  */
 package org.apache.syncope.client.console.rest;
 
-import java.util.Iterator;
 import java.util.List;
 import javax.ws.rs.core.Response;
 import org.apache.syncope.client.console.SyncopeConsoleSession;
 import org.apache.syncope.client.console.commons.AttrLayoutType;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.AttrTO;
-import org.apache.syncope.common.lib.to.ConfTO;
 import org.apache.syncope.common.rest.api.service.ConfigurationService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -38,19 +36,18 @@ public class ConfigurationRestClient extends BaseRestClient 
{
     @Autowired
     private SchemaRestClient schemaRestClient;
 
-    public ConfTO list() {
-        ConfTO conf = getService(ConfigurationService.class).list();
+    public List<AttrTO> list() {
+        final List<AttrTO> attrTOs = 
getService(ConfigurationService.class).list();
 
-        for (Iterator<AttrTO> it = conf.getPlainAttrs().iterator(); 
it.hasNext();) {
-            AttrTO attr = it.next();
+        for (AttrTO attrTO : attrTOs) {
             for (AttrLayoutType type : AttrLayoutType.values()) {
-                if (type.getConfKey().equals(attr.getSchema())) {
-                    it.remove();
+                if (type.getConfKey().equals(attrTO.getSchema())) {
+                    attrTOs.remove(attrTO);
                 }
             }
         }
 
-        return conf;
+        return attrTOs;
     }
 
     public AttrTO get(final String key) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/3f58b93c/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConfTO.java
----------------------------------------------------------------------
diff --git 
a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConfTO.java 
b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConfTO.java
deleted file mode 100644
index 77e1af2..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConfTO.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.common.lib.to;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-@XmlRootElement(name = "conf")
-@XmlType
-public class ConfTO extends AnyTO {
-
-    private static final long serialVersionUID = -3825039700228595590L;
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/3f58b93c/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java
----------------------------------------------------------------------
diff --git 
a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java
 
b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java
index 875ebc5..59339c4 100644
--- 
a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java
+++ 
b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.common.rest.api.service;
 
+import java.util.List;
 import javax.validation.constraints.NotNull;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
@@ -29,7 +30,6 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import org.apache.syncope.common.lib.to.AttrTO;
-import org.apache.syncope.common.lib.to.ConfTO;
 
 /**
  * REST operations for configuration.
@@ -53,7 +53,7 @@ public interface ConfigurationService extends JAXRSService {
      */
     @GET
     @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-    ConfTO list();
+    List<AttrTO> list();
 
     /**
      * Returns configuration parameter with matching schema.

http://git-wip-us.apache.org/repos/asf/syncope/blob/3f58b93c/core/logic/src/main/java/org/apache/syncope/core/logic/ConfigurationLogic.java
----------------------------------------------------------------------
diff --git 
a/core/logic/src/main/java/org/apache/syncope/core/logic/ConfigurationLogic.java
 
b/core/logic/src/main/java/org/apache/syncope/core/logic/ConfigurationLogic.java
index b989ac2..3f0115d 100644
--- 
a/core/logic/src/main/java/org/apache/syncope/core/logic/ConfigurationLogic.java
+++ 
b/core/logic/src/main/java/org/apache/syncope/core/logic/ConfigurationLogic.java
@@ -20,8 +20,8 @@ package org.apache.syncope.core.logic;
 
 import java.io.OutputStream;
 import java.lang.reflect.Method;
+import java.util.List;
 import org.apache.syncope.common.lib.to.AttrTO;
-import org.apache.syncope.common.lib.to.ConfTO;
 import org.apache.syncope.common.lib.types.Entitlement;
 import org.apache.syncope.core.misc.security.AuthContextUtils;
 import org.apache.syncope.core.persistence.api.content.ContentExporter;
@@ -39,7 +39,7 @@ import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 
 @Component
-public class ConfigurationLogic extends AbstractTransactionalLogic<ConfTO> {
+public class ConfigurationLogic extends AbstractTransactionalLogic<AttrTO> {
 
     @Autowired
     private ConfDAO confDAO;
@@ -73,7 +73,7 @@ public class ConfigurationLogic extends 
AbstractTransactionalLogic<ConfTO> {
     }
 
     @PreAuthorize("hasRole('" + Entitlement.CONFIGURATION_LIST + "')")
-    public ConfTO list() {
+    public List<AttrTO> list() {
         return binder.getConfTO(confDAO.get());
     }
 
@@ -114,7 +114,7 @@ public class ConfigurationLogic extends 
AbstractTransactionalLogic<ConfTO> {
     }
 
     @Override
-    protected ConfTO resolveReference(final Method method, final Object... 
args)
+    protected AttrTO resolveReference(final Method method, final Object... 
args)
             throws UnresolvedReferenceException {
 
         throw new UnresolvedReferenceException();

http://git-wip-us.apache.org/repos/asf/syncope/blob/3f58b93c/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ConfigurationDataBinder.java
----------------------------------------------------------------------
diff --git 
a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ConfigurationDataBinder.java
 
b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ConfigurationDataBinder.java
index e3a27bc..020a6ae 100644
--- 
a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ConfigurationDataBinder.java
+++ 
b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ConfigurationDataBinder.java
@@ -18,8 +18,8 @@
  */
 package org.apache.syncope.core.provisioning.api.data;
 
+import java.util.List;
 import org.apache.syncope.common.lib.to.AttrTO;
-import org.apache.syncope.common.lib.to.ConfTO;
 import org.apache.syncope.core.persistence.api.entity.conf.CPlainAttr;
 import org.apache.syncope.core.persistence.api.entity.conf.Conf;
 
@@ -27,7 +27,7 @@ public interface ConfigurationDataBinder {
 
     AttrTO getAttrTO(CPlainAttr attr);
 
-    ConfTO getConfTO(Conf conf);
+    List<AttrTO> getConfTO(Conf conf);
 
     CPlainAttr getAttribute(AttrTO attributeTO);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/3f58b93c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConfigurationDataBinderImpl.java
----------------------------------------------------------------------
diff --git 
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConfigurationDataBinderImpl.java
 
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConfigurationDataBinderImpl.java
index fe135b2..c0f0485 100644
--- 
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConfigurationDataBinderImpl.java
+++ 
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ConfigurationDataBinderImpl.java
@@ -18,12 +18,12 @@
  */
 package org.apache.syncope.core.provisioning.java.data;
 
+import java.util.ArrayList;
 import org.apache.syncope.core.provisioning.api.data.ConfigurationDataBinder;
 import java.util.Collections;
 import java.util.List;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.AttrTO;
-import org.apache.syncope.common.lib.to.ConfTO;
 import org.apache.syncope.common.lib.types.ClientExceptionType;
 import 
org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidPlainAttrValueException;
 import org.apache.syncope.core.persistence.api.dao.NotFoundException;
@@ -34,21 +34,22 @@ import 
org.apache.syncope.core.persistence.api.entity.conf.CPlainAttr;
 import 
org.apache.syncope.core.persistence.api.entity.conf.CPlainAttrUniqueValue;
 import org.apache.syncope.core.persistence.api.entity.conf.CPlainAttrValue;
 import org.apache.syncope.core.persistence.api.entity.conf.Conf;
-import 
org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 import org.springframework.stereotype.Component;
 
 @Component
 public class ConfigurationDataBinderImpl extends AbstractAnyDataBinder 
implements ConfigurationDataBinder {
 
     @Override
-    public ConfTO getConfTO(final Conf conf) {
-        ConfTO confTO = new ConfTO();
-        confTO.setKey(conf.getKey());
-
-        fillTO(confTO, null, conf.getAuxClasses(),
-                conf.getPlainAttrs(), conf.getDerAttrs(), conf.getVirAttrs(), 
Collections.<ExternalResource>emptySet());
-
-        return confTO;
+    public List<AttrTO> getConfTO(final Conf conf) {
+        final List<AttrTO> attrTOs = new ArrayList<>();
+        for (final CPlainAttr plainAttr : conf.getPlainAttrs()) {
+            final AttrTO attrTO = new AttrTO();
+            attrTO.setSchema(plainAttr.getSchema().getKey());
+            attrTO.getValues().addAll(plainAttr.getValuesAsStrings());
+            attrTO.setReadonly(plainAttr.getSchema().isReadonly());
+            attrTOs.add(attrTO);
+        }
+        return attrTOs;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/3f58b93c/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConfigurationServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConfigurationServiceImpl.java
 
b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConfigurationServiceImpl.java
index 09e0779..1a6dac7 100644
--- 
a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConfigurationServiceImpl.java
+++ 
b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConfigurationServiceImpl.java
@@ -20,12 +20,12 @@ package org.apache.syncope.core.rest.cxf.service;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.List;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.StreamingOutput;
 import org.apache.syncope.common.lib.to.AttrTO;
-import org.apache.syncope.common.lib.to.ConfTO;
 import org.apache.syncope.common.rest.api.service.ConfigurationService;
 import org.apache.syncope.core.logic.ConfigurationLogic;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -60,7 +60,7 @@ public class ConfigurationServiceImpl extends 
AbstractServiceImpl implements Con
     }
 
     @Override
-    public ConfTO list() {
+    public List<AttrTO> list() {
         return logic.list();
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/3f58b93c/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConfigurationITCase.java
----------------------------------------------------------------------
diff --git 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConfigurationITCase.java
 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConfigurationITCase.java
index 68761cd..6bc000e 100644
--- 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConfigurationITCase.java
+++ 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/ConfigurationITCase.java
@@ -28,6 +28,7 @@ import static org.junit.Assert.fail;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
+import java.util.List;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
@@ -35,7 +36,6 @@ import org.apache.commons.io.IOUtils;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.to.AttrTO;
-import org.apache.syncope.common.lib.to.ConfTO;
 import org.apache.syncope.common.lib.to.PlainSchemaTO;
 import org.apache.syncope.common.lib.types.AttrSchemaType;
 import org.apache.syncope.common.lib.types.ClientExceptionType;
@@ -89,9 +89,9 @@ public class ConfigurationITCase extends AbstractITCase {
 
     @Test
     public void list() {
-        ConfTO wholeConf = configurationService.list();
+        List<AttrTO> wholeConf = configurationService.list();
         assertNotNull(wholeConf);
-        for (AttrTO conf : wholeConf.getPlainAttrs()) {
+        for (AttrTO conf : wholeConf) {
             assertNotNull(conf);
         }
     }

Reply via email to