syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject svn commit: r1607045 - in /syncope/branches/1_1_X: ./ common/src/main/java/org/apache/syncope/common/types/ console/src/main/java/org/apache/syncope/console/pages/ console/src/main/java/org/apache/syncope/console/rest/ core/src/main/java/org/apache/syn...
Date Tue, 01 Jul 2014 11:27:11 GMT
Author: ilgrosso
Date: Tue Jul  1 11:27:10 2014
New Revision: 1607045

URL: http://svn.apache.org/r1607045
Log:
[SYNCOPE-519] Fixing JAX-RS problems

Modified:
    syncope/branches/1_1_X/common/src/main/java/org/apache/syncope/common/types/ConnConfPropSchema.java
    syncope/branches/1_1_X/common/src/main/java/org/apache/syncope/common/types/ConnConfProperty.java
    syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/ConnectorModalPage.java
    syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/rest/ConnectorRestClient.java
    syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ConnInstanceController.java
    syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/data/ConnInstanceDataBinder.java
    syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
    syncope/branches/1_1_X/pom.xml

Modified: syncope/branches/1_1_X/common/src/main/java/org/apache/syncope/common/types/ConnConfPropSchema.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/common/src/main/java/org/apache/syncope/common/types/ConnConfPropSchema.java?rev=1607045&r1=1607044&r2=1607045&view=diff
==============================================================================
--- syncope/branches/1_1_X/common/src/main/java/org/apache/syncope/common/types/ConnConfPropSchema.java
(original)
+++ syncope/branches/1_1_X/common/src/main/java/org/apache/syncope/common/types/ConnConfPropSchema.java
Tue Jul  1 11:27:10 2014
@@ -18,10 +18,14 @@
  */
 package org.apache.syncope.common.types;
 
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
-
 import org.apache.syncope.common.AbstractBaseBean;
+import org.codehaus.jackson.annotate.JsonProperty;
 
 @XmlRootElement
 @XmlType
@@ -43,7 +47,7 @@ public class ConnConfPropSchema extends 
 
     private boolean confidential;
 
-    private Object defaultValue;
+    private final List<Object> defaultValues = new ArrayList<Object>();
 
     public String getName() {
         return name;
@@ -101,12 +105,11 @@ public class ConnConfPropSchema extends 
         this.confidential = confidential;
     }
 
-    public Object getDefaultValue() {
-        return defaultValue;
-    }
-
-    public void setDefaultValue(final Object defaultValue) {
-        this.defaultValue = defaultValue;
+    @XmlElementWrapper(name = "defaultValues")
+    @XmlElement(name = "defaultValue")
+    @JsonProperty("defaultValues")
+    public List<Object> getDefaultValues() {
+        return defaultValues;
     }
 
     @Override

Modified: syncope/branches/1_1_X/common/src/main/java/org/apache/syncope/common/types/ConnConfProperty.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/common/src/main/java/org/apache/syncope/common/types/ConnConfProperty.java?rev=1607045&r1=1607044&r2=1607045&view=diff
==============================================================================
--- syncope/branches/1_1_X/common/src/main/java/org/apache/syncope/common/types/ConnConfProperty.java
(original)
+++ syncope/branches/1_1_X/common/src/main/java/org/apache/syncope/common/types/ConnConfProperty.java
Tue Jul  1 11:27:10 2014
@@ -20,13 +20,12 @@ package org.apache.syncope.common.types;
 
 import java.util.ArrayList;
 import java.util.List;
-
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
-
 import org.apache.syncope.common.AbstractBaseBean;
+import org.codehaus.jackson.annotate.JsonProperty;
 
 @XmlRootElement
 @XmlType
@@ -50,14 +49,11 @@ public class ConnConfProperty extends Ab
 
     @XmlElementWrapper(name = "values")
     @XmlElement(name = "value")
+    @JsonProperty("values")
     public List<Object> getValues() {
         return values;
     }
 
-    public void setValues(final List<Object> values) {
-        this.values = values;
-    }
-
     public boolean isOverridable() {
         return overridable;
     }

Modified: syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/ConnectorModalPage.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/ConnectorModalPage.java?rev=1607045&r1=1607044&r2=1607045&view=diff
==============================================================================
--- syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/ConnectorModalPage.java
(original)
+++ syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/ConnectorModalPage.java
Tue Jul  1 11:27:10 2014
@@ -20,7 +20,6 @@ package org.apache.syncope.console.pages
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.EnumSet;
 import java.util.HashMap;
@@ -487,20 +486,14 @@ public class ConnectorModalPage extends 
                     property.setOverridable(connInstanceTO.getConfigurationMap().get(key.getName()).isOverridable());
                 }
 
-                if (property.getValues() == null || property.getValues().isEmpty() &&
key.getDefaultValue() != null) {
-                    if (key.getDefaultValue().getClass().isArray()) {
-                        property.getValues().addAll(Arrays.asList((Object[]) key.getDefaultValue()));
-                    } else if (key.getDefaultValue() instanceof Collection<?>) {
-                        property.getValues().addAll((Collection<?>) key.getDefaultValue());
-                    } else {
-                        property.getValues().add(key.getDefaultValue());
-                    }
+                if (property.getValues().isEmpty() && !key.getDefaultValues().isEmpty())
{
+                    property.getValues().addAll(key.getDefaultValues());
                 }
 
                 props.add(property);
             }
         }
-        
+
         // re-order properties (implements Comparable)
         Collections.sort(props);
         return props;

Modified: syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/rest/ConnectorRestClient.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/rest/ConnectorRestClient.java?rev=1607045&r1=1607044&r2=1607045&view=diff
==============================================================================
--- syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/rest/ConnectorRestClient.java
(original)
+++ syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/rest/ConnectorRestClient.java
Tue Jul  1 11:27:10 2014
@@ -136,7 +136,8 @@ public class ConnectorRestClient extends
                     }
                 }
             }
-            prop.setValues(parsed);
+            prop.getValues().clear();
+            prop.getValues().addAll(parsed);
             newProperties.add(prop);
         }
         return newProperties;

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ConnInstanceController.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ConnInstanceController.java?rev=1607045&r1=1607044&r2=1607045&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ConnInstanceController.java
(original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ConnInstanceController.java
Tue Jul  1 11:27:10 2014
@@ -31,7 +31,6 @@ import org.apache.syncope.common.to.Bulk
 import org.apache.syncope.common.to.BulkActionRes;
 import org.apache.syncope.common.to.ConnBundleTO;
 import org.apache.syncope.common.to.ConnInstanceTO;
-import org.apache.syncope.common.types.ConnConfPropSchema;
 import org.apache.syncope.common.types.ConnConfProperty;
 import org.apache.syncope.common.types.SyncopeClientExceptionType;
 import org.apache.syncope.common.validation.SyncopeClientCompositeErrorException;
@@ -47,11 +46,9 @@ import org.apache.syncope.core.rest.data
 import org.apache.syncope.core.util.ConnIdBundleManager;
 import org.identityconnectors.common.l10n.CurrentLocale;
 import org.identityconnectors.framework.api.ConfigurationProperties;
-import org.identityconnectors.framework.api.ConfigurationProperty;
 import org.identityconnectors.framework.api.ConnectorInfo;
 import org.identityconnectors.framework.api.ConnectorKey;
 import org.identityconnectors.framework.common.objects.ObjectClass;
-import org.identityconnectors.framework.impl.api.ConfigurationPropertyImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -213,20 +210,7 @@ public class ConnInstanceController exte
                 ConfigurationProperties properties = ConnIdBundleManager.getConfigurationProperties(bundle);
 
                 for (String propName : properties.getPropertyNames()) {
-                    ConfigurationProperty configurationProperty = properties.getProperty(propName);
-
-                    ConnConfPropSchema connConfPropSchema = new ConnConfPropSchema();
-
-                    connConfPropSchema.setName(configurationProperty.getName());
-                    connConfPropSchema.setDisplayName(configurationProperty.getDisplayName(propName));
-                    connConfPropSchema.setHelpMessage(configurationProperty.getHelpMessage(propName));
-                    connConfPropSchema.setRequired(configurationProperty.isRequired());
-                    connConfPropSchema.setType(configurationProperty.getType().getName());
-                    connConfPropSchema.setOrder(((ConfigurationPropertyImpl) configurationProperty).getOrder());
-                    connConfPropSchema.setConfidential(configurationProperty.isConfidential());
-                    connConfPropSchema.setDefaultValue(configurationProperty.getValue());
-
-                    connBundleTO.addProperty(connConfPropSchema);
+                    connBundleTO.addProperty(binder.buildConnConfPropSchema(properties.getProperty(propName)));
                 }
 
                 LOG.debug("Connector bundle: {}", connBundleTO);

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/data/ConnInstanceDataBinder.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/data/ConnInstanceDataBinder.java?rev=1607045&r1=1607044&r2=1607045&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/data/ConnInstanceDataBinder.java
(original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/data/ConnInstanceDataBinder.java
Tue Jul  1 11:27:10 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.syncope.core.rest.data;
 
+import java.util.Arrays;
+import java.util.Collection;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
@@ -110,7 +112,7 @@ public class ConnInstanceDataBinder {
 
         BeanUtils.copyProperties(connInstanceTO, connInstance, IGNORE_PROPERTIES);
         if (connInstanceTO.getLocation() != null) {
-            connInstance.setLocation(connInstanceTO.getLocation().toString());
+            connInstance.setLocation(connInstanceTO.getLocation());
         }
 
         // Throw composite exception if there is at least one element set in the composing
exceptions
@@ -138,7 +140,7 @@ public class ConnInstanceDataBinder {
         ConnInstance connInstance = connInstanceDAO.find(connInstanceId);
 
         if (connInstanceTO.getLocation() != null) {
-            connInstance.setLocation(connInstanceTO.getLocation().toString());
+            connInstance.setLocation(connInstanceTO.getLocation());
         }
 
         if (connInstanceTO.getBundleName() != null) {
@@ -180,6 +182,30 @@ public class ConnInstanceDataBinder {
         return connInstance;
     }
 
+    public ConnConfPropSchema buildConnConfPropSchema(final ConfigurationProperty property)
{
+        ConnConfPropSchema connConfPropSchema = new ConnConfPropSchema();
+
+        connConfPropSchema.setName(property.getName());
+        connConfPropSchema.setDisplayName(property.getDisplayName(property.getName()));
+        connConfPropSchema.setHelpMessage(property.getHelpMessage(property.getName()));
+        connConfPropSchema.setRequired(property.isRequired());
+        connConfPropSchema.setType(property.getType().getName());
+        connConfPropSchema.setOrder(((ConfigurationPropertyImpl) property).getOrder());
+        connConfPropSchema.setConfidential(property.isConfidential());
+
+        if (property.getValue() != null) {
+            if (property.getValue().getClass().isArray()) {
+                connConfPropSchema.getDefaultValues().addAll(Arrays.asList((Object[]) property.getValue()));
+            } else if (property.getValue() instanceof Collection<?>) {
+                connConfPropSchema.getDefaultValues().addAll((Collection<?>) property.getValue());
+            } else {
+                connConfPropSchema.getDefaultValues().add(property.getValue());
+            }
+        }
+
+        return connConfPropSchema;
+    }
+
     public ConnInstanceTO getConnInstanceTO(final ConnInstance connInstance) {
         ConnInstanceTO connInstanceTO = new ConnInstanceTO();
         connInstanceTO.setId(connInstance.getId() == null ? 0L : connInstance.getId().longValue());
@@ -194,27 +220,17 @@ public class ConnInstanceDataBinder {
         final Map<String, ConnConfProperty> connInstanceToConfMap = connInstanceTO.getConfigurationMap();
 
         for (String propName : properties.getPropertyNames()) {
-            ConfigurationProperty configurationProperty = properties.getProperty(propName);
-
+            ConnConfPropSchema schema = buildConnConfPropSchema(properties.getProperty(propName));
+            
+            ConnConfProperty property;
             if (connInstanceToConfMap.containsKey(propName)) {
-                connInstanceToConfMap.get(propName).getSchema().setDisplayName(
-                        configurationProperty.getDisplayName(propName));
+                property = connInstanceToConfMap.get(propName);
             } else {
-                ConnConfPropSchema connConfPropSchema = new ConnConfPropSchema();
-
-                connConfPropSchema.setName(configurationProperty.getName());
-                connConfPropSchema.setDisplayName(configurationProperty.getDisplayName(propName));
-                connConfPropSchema.setHelpMessage(configurationProperty.getHelpMessage(propName));
-                connConfPropSchema.setRequired(configurationProperty.isRequired());
-                connConfPropSchema.setType(configurationProperty.getType().getName());
-                connConfPropSchema.setOrder(((ConfigurationPropertyImpl) configurationProperty).getOrder());
-                connConfPropSchema.setConfidential(configurationProperty.isConfidential());
-                connConfPropSchema.setDefaultValue(configurationProperty.getValue());
-
-                ConnConfProperty property = new ConnConfProperty();
-                property.setSchema(connConfPropSchema);
+                property = new ConnConfProperty();
                 connInstanceTO.addConfiguration(property);
             }
+            
+            property.setSchema(schema);            
         }
         return connInstanceTO;
     }

Modified: syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java?rev=1607045&r1=1607044&r2=1607045&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
(original)
+++ syncope/branches/1_1_X/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
Tue Jul  1 11:27:10 2014
@@ -360,8 +360,10 @@ public abstract class AbstractTest {
     }
 
     private static <T> T getObjectCXF(final Response response, final Class<T>
type, final Object serviceProxy) {
-        String location = response.getLocation().toString();
-        WebClient webClient = WebClient.fromClient(WebClient.client(serviceProxy));
+        final String location = response.getLocation().toString();
+        final Client client = WebClient.client(serviceProxy);
+        final WebClient webClient = WebClient.fromClient(client);
+        webClient.accept(client.getHeaders().getFirst("Accept")).to(location, false);
         webClient.to(location, false);
 
         return webClient.get(type);

Modified: syncope/branches/1_1_X/pom.xml
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/pom.xml?rev=1607045&r1=1607044&r2=1607045&view=diff
==============================================================================
--- syncope/branches/1_1_X/pom.xml (original)
+++ syncope/branches/1_1_X/pom.xml Tue Jul  1 11:27:10 2014
@@ -1093,6 +1093,7 @@ under the License.
                 <downloadDir>${settings.localRepository}/org/codehaus/cargo/cargo-container-archives</downloadDir>
                 <extractDir>${project.build.directory}/cargo/extract</extractDir>
               </zipUrlInstaller>
+              <timeout>240000</timeout>
               <log>${cargo.log}</log>
               <output>${cargo.output}</output>    
             </container>



Mime
View raw message