syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject svn commit: r1603724 - in /syncope/trunk: build-tools/src/main/resources/ common/src/main/java/org/apache/syncope/common/to/ common/src/main/java/org/apache/syncope/common/types/ console/src/main/java/org/apache/syncope/console/commons/ console/src/mai...
Date Thu, 19 Jun 2014 06:54:13 GMT
Author: ilgrosso
Date: Thu Jun 19 06:54:11 2014
New Revision: 1603724

URL: http://svn.apache.org/r1603724
Log:
[SYNCOPE-123] Implementation provided for core and console

Added:
    syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/BinaryFieldPanel.java   (with props)
    syncope/trunk/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/BinaryFieldPanel.html
      - copied, changed from r1602881, syncope/trunk/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/AjaxTextFieldPanel.html
    syncope/trunk/core/src/test/resources/favicon.jpg   (with props)
Modified:
    syncope/trunk/build-tools/src/main/resources/content.ldif
    syncope/trunk/common/src/main/java/org/apache/syncope/common/to/AbstractSyncTaskTO.java
    syncope/trunk/common/src/main/java/org/apache/syncope/common/to/ResourceTO.java
    syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SchemaTO.java
    syncope/trunk/common/src/main/java/org/apache/syncope/common/types/AttributeSchemaType.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/commons/HttpResourceStream.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Configuration.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/ResultStatusModalPage.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/SchemaModalPage.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/ActionLink.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxCheckBoxPanel.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPasswordFieldPanel.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxTextFieldPanel.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/DateFieldPanel.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/DateTextFieldPanel.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/DateTimeFieldPanel.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/FieldPanel.java
    syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/SpinnerFieldPanel.java
    syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/SchemaModalPage.html
    syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/SchemaModalPage.properties
    syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/SchemaModalPage_it.properties
    syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/SchemaModalPage_pt_BR.properties
    syncope/trunk/core/src/main/java/org/apache/syncope/core/connid/ConnObjectUtil.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/AbstractAttrValue.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/AbstractNormalSchema.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/attrvalue/InvalidAttrValueException.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/AttrValueValidator.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/impl/DBPasswordPropagationActions.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractTransactionalController.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttrTest.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/SchemaTest.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
    syncope/trunk/core/src/test/resources/content.xml

Modified: syncope/trunk/build-tools/src/main/resources/content.ldif
URL: http://svn.apache.org/viewvc/syncope/trunk/build-tools/src/main/resources/content.ldif?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/build-tools/src/main/resources/content.ldif (original)
+++ syncope/trunk/build-tools/src/main/resources/content.ldif Thu Jun 19 06:54:11 2014
@@ -45,3 +45,13 @@ uid: syncFromLDAP
 userpassword:: cGFzc3dvcmQxMjM=
 givenname: syncFromLDAP
 registeredAddress:  5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8
+jpegPhoto:: /9j/4AAQSkZJRgABAQEBKwErAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoH
+ BwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQk
+ UDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wg
+ ARCAAEAAQDAREAAhEBAxEB/8QAFAABAAAAAAAAAAAAAAAAAAAACP/EABQBAQAAAAAAAAAAAAAAA
+ AAAAAD/2gAMAwEAAhADEAAAAUuf/8QAFhABAQEAAAAAAAAAAAAAAAAAAwAS/9oACAEBAAEFAiLV
+ /8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAgBAwEBPwF//8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/
+ aAAgBAgEBPwF//8QAGhAAAQUBAAAAAAAAAAAAAAAAAgABESEiQf/aAAgBAQAGPwI9k2orq//EAB
+ kQAAMAAwAAAAAAAAAAAAAAAAERIQBBYf/aAAgBAQABPyF20CYlpT3P/9oADAMBAAIAAwAAABCf/
+ 8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAgBAwEBPxB//8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/a
+ AAgBAgEBPxB//8QAGhABAAIDAQAAAAAAAAAAAAAAAREhAEFRYf/aAAgBAQABPxCUKGDcAUFrvhoz/9k=

Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/to/AbstractSyncTaskTO.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/AbstractSyncTaskTO.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/to/AbstractSyncTaskTO.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/to/AbstractSyncTaskTO.java Thu Jun 19 06:54:11 2014
@@ -18,8 +18,11 @@
  */
 package org.apache.syncope.common.to;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
 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.XmlSeeAlso;
 import javax.xml.bind.annotation.XmlType;
@@ -89,6 +92,9 @@ public class AbstractSyncTaskTO extends 
         this.syncStatus = syncStatus;
     }
 
+    @XmlElementWrapper(name = "actionsClassNames")
+    @XmlElement(name = "actionsClassName")
+    @JsonProperty("actionsClassNames")
     public List<String> getActionsClassNames() {
         return actionsClassNames;
     }

Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/to/ResourceTO.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/ResourceTO.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/to/ResourceTO.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/to/ResourceTO.java Thu Jun 19 06:54:11 2014
@@ -260,6 +260,9 @@ public class ResourceTO extends Abstract
         this.rsyncToken = syncToken;
     }
 
+    @XmlElementWrapper(name = "propagationActionsClassNames")
+    @XmlElement(name = "propagationActionsClassName")
+    @JsonProperty("propagationActionsClassNames")
     public List<String> getPropagationActionsClassNames() {
         return propagationActionsClassNames;
     }

Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SchemaTO.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SchemaTO.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SchemaTO.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SchemaTO.java Thu Jun 19 06:54:11 2014
@@ -35,14 +35,6 @@ public class SchemaTO extends AbstractSc
 
     private String mandatoryCondition;
 
-    private String enumerationValues;
-
-    private String enumerationKeys;
-
-    private String secretKey;
-
-    private CipherAlgorithm cipherAlgorithm;
-
     private boolean multivalue;
 
     private boolean uniqueConstraint;
@@ -53,6 +45,16 @@ public class SchemaTO extends AbstractSc
 
     private String validatorClass;
 
+    private String enumerationValues;
+
+    private String enumerationKeys;
+
+    private String secretKey;
+
+    private CipherAlgorithm cipherAlgorithm;
+
+    private String mimeType;
+
     public String getConversionPattern() {
         return conversionPattern;
     }
@@ -71,38 +73,6 @@ public class SchemaTO extends AbstractSc
         this.mandatoryCondition = mandatoryCondition;
     }
 
-    public String getEnumerationValues() {
-        return enumerationValues;
-    }
-
-    public void setEnumerationValues(final String enumerationValues) {
-        this.enumerationValues = enumerationValues;
-    }
-
-    public String getEnumerationKeys() {
-        return enumerationKeys;
-    }
-
-    public void setEnumerationKeys(final String enumerationKeys) {
-        this.enumerationKeys = enumerationKeys;
-    }
-
-    public String getSecretKey() {
-        return secretKey;
-    }
-
-    public void setSecretKey(final String secretKey) {
-        this.secretKey = secretKey;
-    }
-
-    public CipherAlgorithm getCipherAlgorithm() {
-        return cipherAlgorithm;
-    }
-
-    public void setCipherAlgorithm(final CipherAlgorithm cipherAlgorithm) {
-        this.cipherAlgorithm = cipherAlgorithm;
-    }
-
     public boolean isMultivalue() {
         return multivalue;
     }
@@ -142,4 +112,45 @@ public class SchemaTO extends AbstractSc
     public void setValidatorClass(final String validatorClass) {
         this.validatorClass = validatorClass;
     }
+
+    public String getEnumerationValues() {
+        return enumerationValues;
+    }
+
+    public void setEnumerationValues(final String enumerationValues) {
+        this.enumerationValues = enumerationValues;
+    }
+
+    public String getEnumerationKeys() {
+        return enumerationKeys;
+    }
+
+    public void setEnumerationKeys(final String enumerationKeys) {
+        this.enumerationKeys = enumerationKeys;
+    }
+
+    public String getSecretKey() {
+        return secretKey;
+    }
+
+    public void setSecretKey(final String secretKey) {
+        this.secretKey = secretKey;
+    }
+
+    public CipherAlgorithm getCipherAlgorithm() {
+        return cipherAlgorithm;
+    }
+
+    public void setCipherAlgorithm(final CipherAlgorithm cipherAlgorithm) {
+        this.cipherAlgorithm = cipherAlgorithm;
+    }
+
+    public String getMimeType() {
+        return mimeType;
+    }
+
+    public void setMimeType(final String mimeType) {
+        this.mimeType = mimeType;
+    }
+
 }

Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/types/AttributeSchemaType.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/types/AttributeSchemaType.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/types/AttributeSchemaType.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/types/AttributeSchemaType.java Thu Jun 19 06:54:11 2014
@@ -30,7 +30,8 @@ public enum AttributeSchemaType {
     Boolean(Boolean.class),
     Date(Date.class),
     Enum(Enum.class),
-    Encrypted(byte[].class);
+    Encrypted(byte[].class),
+    Binary(byte[].class);
 
     final private Class<?> type;
 

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/commons/HttpResourceStream.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/commons/HttpResourceStream.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/commons/HttpResourceStream.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/commons/HttpResourceStream.java Thu Jun 19 06:54:11 2014
@@ -96,8 +96,6 @@ public class HttpResourceStream extends 
     }
 
     public String getFilename() {
-        return filename == null
-                ? Constants.ERROR
-                : filename;
+        return filename;
     }
 }

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Configuration.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Configuration.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Configuration.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Configuration.java Thu Jun 19 06:54:11 2014
@@ -353,7 +353,7 @@ public class Configuration extends BaseP
                 "Configuration", "create"));
         add(createConfigurationLink);
 
-        Link dbExportLink = new Link<Void>("dbExportLink") {
+        Link<Void> dbExportLink = new Link<Void>("dbExportLink") {
 
             private static final long serialVersionUID = -4331619903296515985L;
 

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/ResultStatusModalPage.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/ResultStatusModalPage.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/ResultStatusModalPage.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/ResultStatusModalPage.java Thu Jun 19 06:54:11 2014
@@ -352,15 +352,16 @@ public class ResultStatusModalPage exten
             }
         }
 
-        Component label = new Label("value", value).add(new Behavior() {
+        Component label = new Label("value", value.length() > 50 ? value.substring(0, 50) + "..." : value).
+                add(new Behavior() {
 
-            private static final long serialVersionUID = 1469628524240283489L;
+                    private static final long serialVersionUID = 1469628524240283489L;
 
-            @Override
-            public void onComponentTag(final Component component, final ComponentTag tag) {
-                tag.put("title", value);
-            }
-        });
+                    @Override
+                    public void onComponentTag(final Component component, final ComponentTag tag) {
+                        tag.put("title", value);
+                    }
+                });
 
         final Fragment frag = new Fragment(id, "attrValueFrag", this);
         frag.add(label);

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/SchemaModalPage.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/SchemaModalPage.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/SchemaModalPage.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/SchemaModalPage.java Thu Jun 19 06:54:11 2014
@@ -138,10 +138,21 @@ public class SchemaModalPage extends Abs
         encryptedParams.add(cipherAlgorithm);
         schemaForm.add(encryptedParams);
 
+        // -- binary
+        final AjaxTextFieldPanel mimeType = new AjaxTextFieldPanel("mimeType",
+                getString("mimeType"), new PropertyModel<String>(schema, "mimeType"));
+
+        final WebMarkupContainer binaryParams = new WebMarkupContainer("binaryParams");
+        binaryParams.setOutputMarkupPlaceholderTag(true);
+        binaryParams.add(mimeType);
+        schemaForm.add(binaryParams);
+
+        // -- show or hide
         showHide(schema, type,
                 conversionParams, conversionPattern,
                 enumParams, enumerationValuesPanel, enumerationValues, enumerationKeys,
-                encryptedParams, secretKey, cipherAlgorithm);
+                encryptedParams, secretKey, cipherAlgorithm,
+                binaryParams, mimeType);
         type.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
 
             private static final long serialVersionUID = -1107858522700306810L;
@@ -151,7 +162,8 @@ public class SchemaModalPage extends Abs
                 SchemaModalPage.this.showHide(schema, type,
                         conversionParams, conversionPattern,
                         enumParams, enumerationValuesPanel, enumerationValues, enumerationKeys,
-                        encryptedParams, secretKey, cipherAlgorithm);
+                        encryptedParams, secretKey, cipherAlgorithm,
+                        binaryParams, mimeType);
                 target.add(schemaForm);
             }
         });
@@ -286,10 +298,12 @@ public class SchemaModalPage extends Abs
             final WebMarkupContainer enumParams, final AjaxTextFieldPanel enumerationValuesPanel,
             final MultiFieldPanel<String> enumerationValues, final MultiFieldPanel<String> enumerationKeys,
             final WebMarkupContainer encryptedParams,
-            final AjaxTextFieldPanel secretKey, final AjaxDropDownChoicePanel<CipherAlgorithm> cipherAlgorithm) {
+            final AjaxTextFieldPanel secretKey, final AjaxDropDownChoicePanel<CipherAlgorithm> cipherAlgorithm,
+            final WebMarkupContainer binaryParams, final AjaxTextFieldPanel mimeType) {
 
         final int typeOrdinal = Integer.parseInt(type.getField().getValue());
-        if (AttributeSchemaType.Long.ordinal() == typeOrdinal || AttributeSchemaType.Double.ordinal() == typeOrdinal
+        if (AttributeSchemaType.Long.ordinal() == typeOrdinal
+                || AttributeSchemaType.Double.ordinal() == typeOrdinal
                 || AttributeSchemaType.Date.ordinal() == typeOrdinal) {
 
             conversionParams.setVisible(true);
@@ -310,6 +324,9 @@ public class SchemaModalPage extends Abs
                 cipherAlgorithm.removeRequiredLabel();
             }
             cipherAlgorithm.setModelObject(null);
+
+            binaryParams.setVisible(false);
+            mimeType.setModelObject(null);
         } else if (AttributeSchemaType.Enum.ordinal() == typeOrdinal) {
             conversionParams.setVisible(false);
             conversionPattern.setModelObject(null);
@@ -330,6 +347,9 @@ public class SchemaModalPage extends Abs
                 cipherAlgorithm.removeRequiredLabel();
             }
             cipherAlgorithm.setModelObject(null);
+
+            binaryParams.setVisible(false);
+            mimeType.setModelObject(null);
         } else if (AttributeSchemaType.Encrypted.ordinal() == typeOrdinal) {
             conversionParams.setVisible(false);
             conversionPattern.setModelObject(null);
@@ -348,6 +368,31 @@ public class SchemaModalPage extends Abs
             if (cipherAlgorithm.isRequired()) {
                 cipherAlgorithm.addRequiredLabel();
             }
+
+            binaryParams.setVisible(false);
+            mimeType.setModelObject(null);
+        } else if (AttributeSchemaType.Binary.ordinal() == typeOrdinal) {
+            conversionParams.setVisible(false);
+            conversionPattern.setModelObject(null);
+
+            enumParams.setVisible(false);
+            if (enumerationValuesPanel.isRequired()) {
+                enumerationValuesPanel.removeRequiredLabel();
+            }
+            enumerationValues.setModelObject(getEnumValuesAsList(null));
+            enumerationKeys.setModelObject(getEnumValuesAsList(null));
+
+            encryptedParams.setVisible(false);
+            if (secretKey.isRequired()) {
+                secretKey.removeRequiredLabel();
+            }
+            secretKey.setModelObject(null);
+            if (cipherAlgorithm.isRequired()) {
+                cipherAlgorithm.removeRequiredLabel();
+            }
+            cipherAlgorithm.setModelObject(null);
+
+            binaryParams.setVisible(true);
         } else {
             conversionParams.setVisible(false);
             conversionPattern.setModelObject(null);
@@ -368,6 +413,9 @@ public class SchemaModalPage extends Abs
                 cipherAlgorithm.removeRequiredLabel();
             }
             cipherAlgorithm.setModelObject(null);
+
+            binaryParams.setVisible(false);
+            mimeType.setModelObject(null);
         }
     }
 

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java Thu Jun 19 06:54:11 2014
@@ -45,6 +45,7 @@ import org.apache.syncope.console.rest.S
 import org.apache.syncope.console.wicket.markup.html.form.AjaxCheckBoxPanel;
 import org.apache.syncope.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
 import org.apache.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
+import org.apache.syncope.console.wicket.markup.html.form.BinaryFieldPanel;
 import org.apache.syncope.console.wicket.markup.html.form.DateTextFieldPanel;
 import org.apache.syncope.console.wicket.markup.html.form.DateTimeFieldPanel;
 import org.apache.syncope.console.wicket.markup.html.form.FieldPanel;
@@ -110,7 +111,7 @@ public class AttributesPanel extends Pan
                         final AttributeTO attributeTO = (AttributeTO) item.getDefaultModelObject();
 
                         final WebMarkupContainer jexlHelp = JexlHelpUtil.getJexlHelpWebContainer("jexlHelp");
-                        
+
                         final AjaxLink<Void> questionMarkJexlHelp = JexlHelpUtil.getAjaxLink(jexlHelp,
                                 "questionMarkJexlHelp");
                         item.add(questionMarkJexlHelp);
@@ -285,6 +286,17 @@ public class AttributesPanel extends Pan
                 }
                 break;
 
+            case Binary:
+                panel = new BinaryFieldPanel("panel", schemaTO.getName(), new Model<String>(),
+                        schemas.containsKey(schemaTO.getName())
+                        ? schemas.get(schemaTO.getName()).getMimeType()
+                        : null);
+
+                if (required) {
+                    panel.addRequiredLabel();
+                }
+                break;
+
             default:
                 panel = new AjaxTextFieldPanel("panel", schemaTO.getName(), new Model<String>());
 

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/ActionLink.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/ActionLink.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/ActionLink.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/ActionLink.java Thu Jun 19 06:54:11 2014
@@ -75,7 +75,7 @@ public abstract class ActionLink impleme
         return reloadFeedbackPanel;
     }
 
-    public ActionLink feedbackPanelAutomaticReload(boolean reloadFeedbackPanel) {
+    public ActionLink feedbackPanelAutomaticReload(final boolean reloadFeedbackPanel) {
         this.reloadFeedbackPanel = reloadFeedbackPanel;
         return this;
     }

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxCheckBoxPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxCheckBoxPanel.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxCheckBoxPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxCheckBoxPanel.java Thu Jun 19 06:54:11 2014
@@ -33,8 +33,7 @@ public class AjaxCheckBoxPanel extends F
     private static final long serialVersionUID = 5664138233103884310L;
 
     public AjaxCheckBoxPanel(final String id, final String name, final IModel<Boolean> model) {
-
-        super(id, name, model);
+        super(id, model);
 
         field = new CheckBox("checkboxField", model);
         add(field.setLabel(new Model<String>(name)).setOutputMarkupId(true));

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java Thu Jun 19 06:54:11 2014
@@ -39,11 +39,10 @@ public class AjaxDropDownChoicePanel<T e
     }
 
     public AjaxDropDownChoicePanel(final String id, final String name, final IModel<T> model, boolean enableOnBlur) {
-        super(id, name, model);
+        super(id, model);
 
         field = new DropDownChoice<T>(
                 "dropDownChoiceField", model, Collections.<T>emptyList(), new ChoiceRenderer<T>());
-
         add(field.setLabel(new Model<String>(name)).setOutputMarkupId(true));
 
         if (enableOnBlur) {

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPasswordFieldPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPasswordFieldPanel.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPasswordFieldPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPasswordFieldPanel.java Thu Jun 19 06:54:11 2014
@@ -30,13 +30,10 @@ public class AjaxPasswordFieldPanel exte
     private static final long serialVersionUID = -5490115280336667460L;
 
     public AjaxPasswordFieldPanel(final String id, final String name, final IModel<String> model) {
-        super(id, name, model);
+        super(id, model);
 
         field = new PasswordTextField("passwordField", model);
-
-        field.setRequired(false);
-
-        add(field.setLabel(new Model<String>(name)).setOutputMarkupId(true));
+        add(field.setLabel(new Model<String>(name)).setRequired(false).setOutputMarkupId(true));
 
         if (!isReadOnly()) {
             field.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxTextFieldPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxTextFieldPanel.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxTextFieldPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxTextFieldPanel.java Thu Jun 19 06:54:11 2014
@@ -24,7 +24,6 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.regex.Pattern;
 import org.apache.syncope.console.commons.Constants;
-
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
 import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteSettings;
@@ -40,7 +39,7 @@ public class AjaxTextFieldPanel extends 
     private List<String> choices = Collections.emptyList();
 
     public AjaxTextFieldPanel(final String id, final String name, final IModel<String> model) {
-        super(id, name, model);
+        super(id, model);
 
         final AutoCompleteSettings settings = new AutoCompleteSettings();
         settings.setShowCompleteListOnFocusGain(true);
@@ -65,7 +64,6 @@ public class AjaxTextFieldPanel extends 
                 return result.iterator();
             }
         };
-
         add(field.setLabel(new Model<String>(name)).setOutputMarkupId(true));
 
         if (!isReadOnly()) {

Added: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/BinaryFieldPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/BinaryFieldPanel.java?rev=1603724&view=auto
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/BinaryFieldPanel.java (added)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/BinaryFieldPanel.java Thu Jun 19 06:54:11 2014
@@ -0,0 +1,150 @@
+/*
+ * 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.console.wicket.markup.html.form;
+
+import java.io.ByteArrayInputStream;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.SyncopeConstants;
+import org.apache.syncope.console.commons.Constants;
+import org.apache.syncope.console.commons.HttpResourceStream;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.form.AjaxFormSubmitBehavior;
+import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.StatelessForm;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.markup.html.form.upload.FileUpload;
+import org.apache.wicket.markup.html.form.upload.FileUploadField;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler;
+import org.apache.wicket.request.resource.ContentDisposition;
+import org.apache.wicket.util.crypt.Base64;
+import org.apache.wicket.util.lang.Bytes;
+
+public class BinaryFieldPanel extends FieldPanel<String> {
+
+    private static final long serialVersionUID = 6264462604183088931L;
+
+    private final String mimeType;
+
+    public BinaryFieldPanel(final String id, final String name, final IModel<String> model, final String mimeType) {
+        super(id, model);
+        this.mimeType = mimeType;
+
+        field = new TextField<String>("textField", model);
+        add(field.setLabel(new Model<String>(name)).setOutputMarkupId(true));
+
+        add(new Label("preview", StringUtils.isBlank(mimeType) ? StringUtils.EMPTY : "(" + mimeType + ")"));
+
+        Link<Void> downloadLink = new Link<Void>("downloadLink") {
+
+            private static final long serialVersionUID = -4331619903296515985L;
+
+            @Override
+            public void onClick() {
+                try {
+                    HttpResourceStream stream = new HttpResourceStream(buildResponse());
+
+                    ResourceStreamRequestHandler rsrh = new ResourceStreamRequestHandler(stream);
+                    rsrh.setFileName(stream.getFilename() == null ? name : stream.getFilename());
+                    rsrh.setContentDisposition(ContentDisposition.ATTACHMENT);
+
+                    getRequestCycle().scheduleRequestHandlerAfterCurrent(rsrh);
+                } catch (Exception e) {
+                    error(getString(Constants.ERROR) + ": " + e.getMessage());
+                }
+            }
+
+        };
+        add(downloadLink);
+
+        Form<?> uploadForm = new StatelessForm<Void>("uploadForm");
+        uploadForm.setMultiPart(true);
+        uploadForm.setMaxSize(Bytes.megabytes(4));
+        add(uploadForm);
+
+        @SuppressWarnings("unchecked")
+        final FileUploadField fileUpload = new FileUploadField("fileUpload", new Model());
+        fileUpload.setOutputMarkupId(true);
+        fileUpload.add(new AjaxFormSubmitBehavior(Constants.ON_BLUR) {
+
+            private static final long serialVersionUID = -1107858522700306810L;
+
+            @Override
+            protected void onSubmit(final AjaxRequestTarget target) {
+                final FileUpload uploadedFile = fileUpload.getFileUpload();
+                if (uploadedFile != null) {
+                    try {
+                        final String uploaded = new String(
+                                Base64.encodeBase64(uploadedFile.getBytes()),
+                                SyncopeConstants.DEFAULT_ENCODING);
+                        field.setModelObject(uploaded);
+                        target.add(field);
+
+                        fileUpload.setModelObject(null);
+                        target.add(fileUpload);
+                    } catch (Exception e) {
+                        error(getString(Constants.ERROR) + ": " + e.getMessage());
+                        LOG.error("While saving uploaded file", e);
+                    }
+                }
+            }
+        });
+
+        uploadForm.add(fileUpload);
+
+        IndicatingAjaxLink<Void> uploadLink = new IndicatingAjaxLink<Void>("uploadLink") {
+
+            private static final long serialVersionUID = -7978723352517770644L;
+
+            @Override
+            public void onClick(final AjaxRequestTarget target) {
+            }
+        };
+        add(uploadLink);
+
+        IndicatingAjaxLink<Void> resetLink = new IndicatingAjaxLink<Void>("resetLink") {
+
+            private static final long serialVersionUID = -7978723352517770644L;
+
+            @Override
+            public void onClick(final AjaxRequestTarget target) {
+                field.setModelObject(null);
+                target.add(field);
+            }
+        };
+        add(resetLink);
+    }
+
+    private Response buildResponse() {
+        return Response.ok(new ByteArrayInputStream(Base64.decodeBase64(getModelObject()))).
+                type(StringUtils.isBlank(mimeType) ? MediaType.APPLICATION_OCTET_STREAM : mimeType).build();
+    }
+
+    @Override
+    public BinaryFieldPanel clone() {
+        return (BinaryFieldPanel) super.clone();
+    }
+
+}

Propchange: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/BinaryFieldPanel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/BinaryFieldPanel.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/BinaryFieldPanel.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/DateFieldPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/DateFieldPanel.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/DateFieldPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/DateFieldPanel.java Thu Jun 19 06:54:11 2014
@@ -35,10 +35,13 @@ public class DateFieldPanel extends Fiel
 
     private static final long serialVersionUID = -428975732068281726L;
 
+    protected final String name;
+    
     protected final String datePattern;
 
     protected DateFieldPanel(final String id, final String name, final IModel<Date> model, final String datePattern) {
-        super(id, name, model);
+        super(id, model);
+        this.name = name;
         this.datePattern = datePattern;
     }
 

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/DateTextFieldPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/DateTextFieldPanel.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/DateTextFieldPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/DateTextFieldPanel.java Thu Jun 19 06:54:11 2014
@@ -33,7 +33,6 @@ public class DateTextFieldPanel extends 
     private static final long serialVersionUID = 1919852712185883648L;
 
     public DateTextFieldPanel(final String id, final String name, final IModel<Date> model, final String datePattern) {
-
         super(id, name, model, datePattern);
 
         field = DateTextField.forDatePattern("field", model, datePattern);
@@ -76,7 +75,7 @@ public class DateTextFieldPanel extends 
 
     @Override
     public FieldPanel<Date> clone() {
-        final FieldPanel<Date> panel = new DateTextFieldPanel(id, name, new Model<Date>(), datePattern);
+        final FieldPanel<Date> panel = new DateTextFieldPanel(getId(), name, new Model<Date>(), datePattern);
         panel.setRequired(isRequired());
         panel.setReadOnly(isReadOnly());
         panel.setTitle(title);

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/DateTimeFieldPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/DateTimeFieldPanel.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/DateTimeFieldPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/DateTimeFieldPanel.java Thu Jun 19 06:54:11 2014
@@ -40,7 +40,6 @@ public class DateTimeFieldPanel extends 
     private Form form = null;
 
     public DateTimeFieldPanel(final String id, final String name, final IModel<Date> model, final String datePattern) {
-
         super(id, name, model, datePattern);
 
         field = new DateTimeField("field", model);
@@ -179,7 +178,7 @@ public class DateTimeFieldPanel extends 
 
     @Override
     public FieldPanel<Date> clone() {
-        final FieldPanel<Date> panel = new DateTimeFieldPanel(id, name, new Model<Date>(null), datePattern);
+        final FieldPanel<Date> panel = new DateTimeFieldPanel(getId(), name, new Model<Date>(null), datePattern);
 
         panel.setRequired(isRequired());
         panel.setReadOnly(isReadOnly());

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/FieldPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/FieldPanel.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/FieldPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/FieldPanel.java Thu Jun 19 06:54:11 2014
@@ -35,20 +35,13 @@ public abstract class FieldPanel<T> exte
 
     protected FormComponent<T> field = null;
 
-    protected final String id;
-
-    protected final String name;
-
     protected String title = null;
 
     protected boolean isRequiredLabelAdded = false;
 
-    public FieldPanel(final String id, final String name, final IModel<T> model) {
+    public FieldPanel(final String id, final IModel<T> model) {
         super(id, model);
 
-        this.id = id;
-        this.name = name;
-
         final Fragment fragment = new Fragment("required", "notRequiredFragment", this);
         add(fragment);
 

Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/SpinnerFieldPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/SpinnerFieldPanel.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/SpinnerFieldPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/SpinnerFieldPanel.java Thu Jun 19 06:54:11 2014
@@ -36,6 +36,8 @@ public class SpinnerFieldPanel<T extends
 
     private static final long serialVersionUID = 6413819574530703577L;
 
+    private final String name;
+
     private final Class<T> reference;
 
     private final IModel<T> model;
@@ -48,7 +50,8 @@ public class SpinnerFieldPanel<T extends
     public SpinnerFieldPanel(final String id, final String name, final Class<T> reference, final IModel<T> model,
             final T min, final T max) {
 
-        super(id, name, model);
+        super(id, model);
+        this.name = name;
         this.reference = reference;
         this.model = model;
         this.min = min;
@@ -178,7 +181,7 @@ public class SpinnerFieldPanel<T extends
 
     @Override
     public SpinnerFieldPanel<T> clone() {
-        SpinnerFieldPanel<T> panel = new SpinnerFieldPanel<T>(id, name, reference, model, min, max);
+        SpinnerFieldPanel<T> panel = new SpinnerFieldPanel<T>(getId(), name, reference, model, min, max);
 
         panel.setRequired(isRequired());
         panel.setReadOnly(isReadOnly());

Modified: syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/SchemaModalPage.html
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/SchemaModalPage.html?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/SchemaModalPage.html (original)
+++ syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/SchemaModalPage.html Thu Jun 19 06:54:11 2014
@@ -89,6 +89,17 @@ under the License.
             </div>
           </div>
 
+          <div wicket:id="binaryParams">
+            <div class="tablerow alt">
+              <div class="tablecolumn_label short_dynamicsize">
+                <label for="mimeType"><wicket:message key="mimeType"/></label>
+              </div>
+              <div class="tablecolumn_field medium_dynamicsize">
+                <span wicket:id="mimeType">[mimeType]</span>
+              </div>
+            </div>
+          </div>
+
           <div class="tablerow">
             <div class="tablecolumn_label short_dynamicsize">
               <label for="validatorClass"><wicket:message key="validatorClass"/></label>

Modified: syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/SchemaModalPage.properties
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/SchemaModalPage.properties?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/SchemaModalPage.properties (original)
+++ syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/SchemaModalPage.properties Thu Jun 19 06:54:11 2014
@@ -36,3 +36,4 @@ title=Schema
 readonly=Read-only
 secretKey=Secret key
 cipherAlgorithm=Cipher algorithm
+mimeType=MIME Type

Modified: syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/SchemaModalPage_it.properties
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/SchemaModalPage_it.properties?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/SchemaModalPage_it.properties (original)
+++ syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/SchemaModalPage_it.properties Thu Jun 19 06:54:11 2014
@@ -36,3 +36,4 @@ uniqueConstraint=Univoco
 multivalueAndUniqueConstr.validation=Le opzioni 'Multivalore' e 'Vincolo unique' non possono essere entrambe impostate
 secretKey=Chiave segreta
 cipherAlgorithm=Algoritmo di cifratura
+mimeType=MIME Type

Modified: syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/SchemaModalPage_pt_BR.properties
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/SchemaModalPage_pt_BR.properties?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/SchemaModalPage_pt_BR.properties (original)
+++ syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/SchemaModalPage_pt_BR.properties Thu Jun 19 06:54:11 2014
@@ -36,3 +36,4 @@ title=Esquema
 readonly=Apenas leitura
 secretKey=Chave secreta
 cipherAlgorithm=Algoritmo de criptografia
+mimeType=MIME Type

Copied: syncope/trunk/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/BinaryFieldPanel.html (from r1602881, syncope/trunk/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/AjaxTextFieldPanel.html)
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/BinaryFieldPanel.html?p2=syncope/trunk/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/BinaryFieldPanel.html&p1=syncope/trunk/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/AjaxTextFieldPanel.html&r1=1602881&r2=1603724&rev=1603724&view=diff
==============================================================================
--- syncope/trunk/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/AjaxTextFieldPanel.html (original)
+++ syncope/trunk/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/BinaryFieldPanel.html Thu Jun 19 06:54:11 2014
@@ -18,6 +18,19 @@ under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
   <wicket:extend>
-    <input type="text" class="ui-widget-content ui-corner-all long_dynamicsize" wicket:id="textField"/>
+    <input style="display: none;" wicket:id="textField"/>
+    <span style="margin-right: 20px;">
+      <div style="display: table-cell;">
+        <form wicket:id="uploadForm">
+          <input wicket:id="fileUpload" type="file"/>
+        </form>
+      </div>
+      <div style="display: table-cell; vertical-align: middle;">
+        <a href="#" wicket:id="uploadLink"><img src="img/up-icon.png" alt="upload" title="upload" style="vertical-align: middle;"/></a>
+        <a href="#" wicket:id="downloadLink"><img src="img/down-icon.png" alt="download" title="download" style="vertical-align: middle;"/></a>
+        <a href="#" wicket:id="resetLink"><img src="img/disable.png" alt="disable" title="remove value" style="vertical-align: middle;"/></a>
+        <span wicket:id="preview"/>
+      </div>
+    </span>
   </wicket:extend>
 </html>

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/connid/ConnObjectUtil.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/connid/ConnObjectUtil.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/connid/ConnObjectUtil.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/connid/ConnObjectUtil.java Thu Jun 19 06:54:11 2014
@@ -35,12 +35,15 @@ import org.apache.syncope.common.to.Memb
 import org.apache.syncope.common.to.RoleTO;
 import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.common.types.AttributableType;
+import org.apache.syncope.common.types.AttributeSchemaType;
 import org.apache.syncope.common.types.IntMappingType;
 import org.apache.syncope.common.types.MappingPurpose;
 import org.apache.syncope.common.types.PasswordPolicySpec;
 import org.apache.syncope.common.util.AttributableOperations;
+import org.apache.syncope.core.persistence.beans.AbstractAttrValue;
 import org.apache.syncope.core.persistence.beans.AbstractAttributable;
 import org.apache.syncope.core.persistence.beans.AbstractMappingItem;
+import org.apache.syncope.core.persistence.beans.AbstractNormalSchema;
 import org.apache.syncope.core.persistence.beans.AbstractVirAttr;
 import org.apache.syncope.core.persistence.beans.ExternalResource;
 import org.apache.syncope.core.persistence.beans.PasswordPolicy;
@@ -52,19 +55,22 @@ import org.apache.syncope.core.persisten
 import org.apache.syncope.core.persistence.dao.PolicyDAO;
 import org.apache.syncope.core.persistence.dao.ResourceDAO;
 import org.apache.syncope.core.persistence.dao.RoleDAO;
+import org.apache.syncope.core.persistence.dao.SchemaDAO;
 import org.apache.syncope.core.persistence.dao.UserDAO;
-import org.apache.syncope.core.propagation.ConnectorFactory;
+import org.apache.syncope.core.persistence.validation.attrvalue.ParsingValidationException;
 import org.apache.syncope.core.propagation.Connector;
+import org.apache.syncope.core.propagation.ConnectorFactory;
 import org.apache.syncope.core.rest.controller.UnauthorizedRoleException;
 import org.apache.syncope.core.rest.data.UserDataBinder;
 import org.apache.syncope.core.util.ApplicationContextProvider;
 import org.apache.syncope.core.util.AttributableUtil;
 import org.apache.syncope.core.util.InvalidPasswordPolicySpecException;
-import org.apache.syncope.core.util.jexl.JexlUtil;
 import org.apache.syncope.core.util.MappingUtil;
 import org.apache.syncope.core.util.SecureRandomUtil;
 import org.apache.syncope.core.util.VirAttrCache;
 import org.apache.syncope.core.util.VirAttrCacheValue;
+import org.apache.syncope.core.util.jexl.JexlUtil;
+import org.identityconnectors.common.Base64;
 import org.identityconnectors.common.security.GuardedByteArray;
 import org.identityconnectors.common.security.GuardedString;
 import org.identityconnectors.framework.common.objects.Attribute;
@@ -106,6 +112,9 @@ public class ConnObjectUtil {
     private ResourceDAO resourceDAO;
 
     @Autowired
+    private SchemaDAO schemaDAO;
+
+    @Autowired
     private PasswordGenerator pwdGen;
 
     /**
@@ -303,11 +312,28 @@ public class ConnObjectUtil {
                     attributeTO = new AttributeTO();
                     attributeTO.setSchema(item.getIntAttrName());
 
+                    AbstractNormalSchema schema = schemaDAO.find(item.getIntAttrName(), attrUtil.schemaClass());
+
                     for (Object value : attribute == null || attribute.getValue() == null
                             ? Collections.emptyList()
                             : attribute.getValue()) {
+
                         if (value != null) {
-                            attributeTO.getValues().add(value.toString());
+                            final AbstractAttrValue attrValue = attrUtil.newAttrValue();
+                            if (schema == null) {
+                                attrValue.setStringValue(value.toString());
+                            } else if (schema.getType() == AttributeSchemaType.Binary) {
+                                attrValue.setBinaryValue((byte[]) value);
+                            } else {
+                                try {
+                                    attrValue.parseValue(schema, value.toString());
+                                } catch (ParsingValidationException e) {
+                                    LOG.error("While parsing provided value {}", value, e);
+                                    attrValue.setStringValue(value.toString());
+                                }
+                            }
+                            attributeTO.getValues().add(attrValue.getValueAsString(
+                                    schema == null ? AttributeSchemaType.String : schema.getType()));
                         }
                     }
 
@@ -486,6 +512,8 @@ public class ConnObjectUtil {
                     if (value != null) {
                         if (value instanceof GuardedString || value instanceof GuardedByteArray) {
                             attrTO.getValues().add(getPassword(value));
+                        } else if (value instanceof byte[]) {
+                            attrTO.getValues().add(Base64.encode((byte[]) value));
                         } else {
                             attrTO.getValues().add(value.toString());
                         }
@@ -625,9 +653,9 @@ public class ConnObjectUtil {
                 }
             }
 
-                virAttrCache.put(attrUtil.getType(), owner.getId(), schemaName, toBeCached);
-            }
+            virAttrCache.put(attrUtil.getType(), owner.getId(), schemaName, toBeCached);
         }
+    }
 
     private Set<ExternalResource> getTargetResource(
             final AbstractVirAttr attr, final IntMappingType type, final AttributableUtil attrUtil) {

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/AbstractAttrValue.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/AbstractAttrValue.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/AbstractAttrValue.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/AbstractAttrValue.java Thu Jun 19 06:54:11 2014
@@ -18,20 +18,26 @@
  */
 package org.apache.syncope.core.persistence.beans;
 
+import java.io.UnsupportedEncodingException;
 import java.util.Date;
 import javax.persistence.Basic;
+import javax.persistence.Lob;
 import javax.persistence.MappedSuperclass;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.syncope.common.SyncopeConstants;
 import org.apache.syncope.common.types.AttributeSchemaType;
+import org.apache.syncope.core.persistence.validation.attrvalue.InvalidAttrValueException;
 import org.apache.syncope.core.persistence.validation.attrvalue.ParsingValidationException;
 import org.apache.syncope.core.persistence.validation.entity.AttrValueCheck;
 import org.apache.syncope.core.util.DataFormat;
 import org.apache.syncope.core.util.Encryptor;
+import org.springframework.security.crypto.codec.Base64;
 
 @MappedSuperclass
 @AttrValueCheck
@@ -53,6 +59,9 @@ public abstract class AbstractAttrValue 
 
     private Double doubleValue;
 
+    @Lob
+    private byte[] binaryValue;
+
     public abstract Long getId();
 
     public Boolean getBooleanValue() {
@@ -103,7 +112,15 @@ public abstract class AbstractAttrValue 
         this.stringValue = stringValue;
     }
 
-    public <T extends AbstractAttrValue> void parseValue(final AbstractNormalSchema schema, final String value)
+    public byte[] getBinaryValue() {
+        return binaryValue;
+    }
+
+    public void setBinaryValue(final byte[] binaryValue) {
+        this.binaryValue = ArrayUtils.clone(binaryValue);
+    }
+
+    public void parseValue(final AbstractNormalSchema schema, final String value)
             throws ParsingValidationException {
 
         Exception exception = null;
@@ -153,6 +170,14 @@ public abstract class AbstractAttrValue 
                 }
                 break;
 
+            case Binary:
+                try {
+                    this.setBinaryValue(Base64.decode(value.getBytes(SyncopeConstants.DEFAULT_ENCODING)));
+                } catch (UnsupportedEncodingException pe) {
+                    exception = pe;
+                }
+                break;
+
             case String:
             case Enum:
             default:
@@ -169,23 +194,31 @@ public abstract class AbstractAttrValue 
     public <T> T getValue() {
         return (T) (booleanValue != null
                 ? getBooleanValue()
-                : (dateValue != null
+                : dateValue != null
                 ? getDateValue()
-                : (doubleValue != null
+                : doubleValue != null
                 ? getDoubleValue()
-                : (longValue != null
+                : longValue != null
                 ? getLongValue()
-                : stringValue))));
+                : binaryValue != null
+                ? getBinaryValue()
+                : stringValue);
     }
 
     public String getValueAsString() {
-        String result = null;
-
         final AttributeSchemaType type = getAttribute() == null || getAttribute().getSchema() == null
                 || getAttribute().getSchema().getType() == null
                 ? AttributeSchemaType.String
                 : getAttribute().getSchema().getType();
 
+        return getValueAsString(type);
+    }
+
+    public String getValueAsString(final AttributeSchemaType type) {
+        Exception exception = null;
+
+        String result = null;
+
         switch (type) {
 
             case Boolean:
@@ -193,23 +226,34 @@ public abstract class AbstractAttrValue 
                 break;
 
             case Long:
-                result = getAttribute().getSchema().getConversionPattern() == null
+                result = getAttribute() == null || getAttribute().getSchema() == null
+                        || getAttribute().getSchema().getConversionPattern() == null
                         ? getLongValue().toString()
                         : DataFormat.format(getLongValue(), getAttribute().getSchema().getConversionPattern());
                 break;
 
             case Double:
-                result = getAttribute().getSchema().getConversionPattern() == null
+                result = getAttribute() == null || getAttribute().getSchema() == null
+                        || getAttribute().getSchema().getConversionPattern() == null
                         ? getDoubleValue().toString()
                         : DataFormat.format(getDoubleValue(), getAttribute().getSchema().getConversionPattern());
                 break;
 
             case Date:
-                result = getAttribute().getSchema().getConversionPattern() == null
+                result = getAttribute() == null || getAttribute().getSchema() == null
+                        || getAttribute().getSchema().getConversionPattern() == null
                         ? DataFormat.format(getDateValue())
                         : DataFormat.format(getDateValue(), false, getAttribute().getSchema().getConversionPattern());
                 break;
 
+            case Binary:
+                try {
+                    result = new String(Base64.encode(getBinaryValue()), SyncopeConstants.DEFAULT_ENCODING);
+                } catch (UnsupportedEncodingException fe) {
+                    exception = fe;
+                }
+                break;
+
             case String:
             case Enum:
             case Encrypted:
@@ -218,6 +262,11 @@ public abstract class AbstractAttrValue 
                 break;
         }
 
+        if (exception != null) {
+            throw new InvalidAttrValueException("While trying to format '" + getValue() + "' as " + type,
+                    exception);
+        }
+
         return result;
     }
 

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/AbstractNormalSchema.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/AbstractNormalSchema.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/AbstractNormalSchema.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/AbstractNormalSchema.java Thu Jun 19 06:54:11 2014
@@ -89,6 +89,9 @@ public abstract class AbstractNormalSche
     @Enumerated(EnumType.STRING)
     private CipherAlgorithm cipherAlgorithm;
 
+    @Column(nullable = true)
+    private String mimeType;
+
     @Transient
     private AbstractValidator validator;
 
@@ -231,4 +234,12 @@ public abstract class AbstractNormalSche
         this.cipherAlgorithm = cipherAlgorithm;
     }
 
+    public String getMimeType() {
+        return mimeType;
+    }
+
+    public void setMimeType(final String mimeType) {
+        this.mimeType = mimeType;
+    }
+
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/attrvalue/InvalidAttrValueException.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/attrvalue/InvalidAttrValueException.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/attrvalue/InvalidAttrValueException.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/attrvalue/InvalidAttrValueException.java Thu Jun 19 06:54:11 2014
@@ -23,11 +23,13 @@ import javax.validation.ValidationExcept
 import org.apache.syncope.core.persistence.beans.AbstractAttrValue;
 
 public class InvalidAttrValueException extends ValidationException {
-    
+
+    private static final long serialVersionUID = -5023202610580202148L;
+
     public InvalidAttrValueException(final String errorMessage) {
         super(errorMessage);
     }
-    
+
     public InvalidAttrValueException(final String errorMessage, final Throwable t) {
         super(errorMessage, t);
     }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/AttrValueValidator.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/AttrValueValidator.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/AttrValueValidator.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/AttrValueValidator.java Thu Jun 19 06:54:11 2014
@@ -46,6 +46,9 @@ public class AttrValueValidator extends 
             if (object.getLongValue() != null) {
                 nonNullVales++;
             }
+            if (object.getBinaryValue()!= null) {
+                nonNullVales++;
+            }
             if (object.getStringValue() != null) {
                 nonNullVales++;
             }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/impl/DBPasswordPropagationActions.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/impl/DBPasswordPropagationActions.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/impl/DBPasswordPropagationActions.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/impl/DBPasswordPropagationActions.java Thu Jun 19 06:54:11 2014
@@ -49,7 +49,7 @@ public class DBPasswordPropagationAction
     @Autowired
     private UserDAO userDAO;
 
-    @Transactional
+    @Transactional(readOnly = true)
     @Override
     public void before(final PropagationTask task, final ConnectorObject beforeObj) {
         super.before(task, beforeObj);

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractTransactionalController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractTransactionalController.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractTransactionalController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractTransactionalController.java Thu Jun 19 06:54:11 2014
@@ -22,10 +22,9 @@ import org.apache.syncope.common.Abstrac
 import org.springframework.transaction.annotation.Transactional;
 
 /**
- * Adds Spring's transactional support to <tt>AbstractController</tt>.
+ * Adds Spring's transactional support to {@link AbstractController}.
  *
  * @param <T> transfer object used for input / output
- * @see AbstractController
  */
 @Transactional(rollbackFor = { Throwable.class })
 abstract class AbstractTransactionalController<T extends AbstractBaseBean> extends AbstractController<T> {

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java Thu Jun 19 06:54:11 2014
@@ -252,8 +252,7 @@ public class UserController extends Abst
         LOG.debug("Transformed: {}", actual);
 
         // SYNCOPE-501: check if there are memberships to be removed with virtual attributes assigned
-        Boolean removeMemberships = Boolean.FALSE;
-
+        boolean removeMemberships = false;
         for (Long membershipId : actual.getMembershipsToRemove()) {
             if (!binder.fillMembershipVirtual(
                     null,
@@ -261,8 +260,9 @@ public class UserController extends Abst
                     membershipId,
                     Collections.<String>emptySet(),
                     Collections.<AttributeMod>emptySet(),
-                    Boolean.TRUE).isEmpty()) {
-                removeMemberships = Boolean.TRUE;
+                    true).isEmpty()) {
+
+                removeMemberships = true;
             }
         }
         //Actual operations: workflow, propagation, notification
@@ -277,7 +277,7 @@ public class UserController extends Abst
                     actual.getVirAttrsToUpdate());
             // SYNCOPE-501: update only virtual attributes (if any of them changed), password propagation is
             // not required, take care also of membership virtual attributes
-            Boolean addOrUpdateMemberships = Boolean.FALSE;
+            boolean addOrUpdateMemberships = false;
             for (MembershipMod membershipMod : actual.getMembershipsToAdd()) {
                 if (!binder.fillMembershipVirtual(
                         updated.getResult().getKey().getId(),
@@ -285,8 +285,9 @@ public class UserController extends Abst
                         null,
                         membershipMod.getVirAttrsToRemove(),
                         membershipMod.getVirAttrsToUpdate(),
-                        Boolean.FALSE).isEmpty()) {
-                    addOrUpdateMemberships = Boolean.TRUE;
+                        false).isEmpty()) {
+
+                    addOrUpdateMemberships = true;
                 }
             }
             tasks.addAll(!propByResVirAttr.isEmpty() || addOrUpdateMemberships || removeMemberships

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java Thu Jun 19 06:54:11 2014
@@ -480,11 +480,12 @@ public class UserDataBinder extends Abst
      * @param vAttrsToBeRemoved virtual attributes to be removed.
      * @param vAttrsToBeUpdated virtual attributes to be updated.
      * @param isRemoval flag to check if fill is on removed or added membership
-     * @return operations to be performed on external resources formembership virtual attributes changes
+     * @return operations to be performed on external resources for membership virtual attributes changes
      */
     public PropagationByResource fillMembershipVirtual(
             final Long userId, final Long roleId, final Long membershipId, final Set<String> vAttrsToBeRemoved,
-            final Set<AttributeMod> vAttrsToBeUpdated, final Boolean isRemoval) {
+            final Set<AttributeMod> vAttrsToBeUpdated, final boolean isRemoval) {
+
         final Membership membership = membershipId == null
                 ? getUserFromId(userId).getMembership(roleId)
                 : getMembershipFromId(membershipId);
@@ -505,7 +506,7 @@ public class UserDataBinder extends Abst
     }
 
     private Set<String> getAttributeNames(final List<? extends AbstractVirAttr> virAttrs) {
-        final HashSet<String> virAttrNames = new HashSet<String>();
+        final Set<String> virAttrNames = new HashSet<String>();
         for (AbstractVirAttr attr : virAttrs) {
             virAttrNames.add(attr.getSchema().getName());
         }

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttrTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttrTest.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttrTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttrTest.java Thu Jun 19 06:54:11 2014
@@ -24,7 +24,11 @@ import static org.junit.Assert.assertNul
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
+import java.util.Random;
 import javax.validation.ValidationException;
+import org.apache.syncope.common.SyncopeConstants;
 import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.common.types.EntityViolationType;
 import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
@@ -36,6 +40,7 @@ import org.apache.syncope.core.util.Attr
 import org.apache.syncope.core.util.Encryptor;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.crypto.codec.Base64;
 import org.springframework.transaction.annotation.Transactional;
 
 @Transactional
@@ -191,6 +196,32 @@ public class AttrTest extends AbstractDA
     }
 
     @Test
+    public void saveWithBinary() throws UnsupportedEncodingException {
+        SyncopeUser user = userDAO.find(1L);
+
+        final USchema photoSchema = userSchemaDAO.find("photo", USchema.class);
+        assertNotNull(photoSchema);
+        assertNotNull(photoSchema.getMimeType());
+
+        final byte[] bytes = new byte[20];
+        new Random().nextBytes(bytes);
+        final String photoB64Value = new String(Base64.encode(bytes), SyncopeConstants.DEFAULT_ENCODING);
+
+        UAttr attribute = new UAttr();
+        attribute.setSchema(photoSchema);
+        attribute.addValue(photoB64Value, AttributableUtil.getInstance(AttributableType.USER));
+        attribute.setOwner(user);
+        user.addAttr(attribute);
+
+        userDAO.save(user);
+
+        UAttr obscure = user.getAttr("photo");
+        assertNotNull(obscure);
+        assertEquals(1, obscure.getValues().size());
+        assertTrue(Arrays.equals(bytes, obscure.getValues().get(0).getBinaryValue()));
+    }
+
+    @Test
     public void delete() {
         UAttr attribute = attrDAO.find(104L, UAttr.class);
         String attrSchemaName = attribute.getSchema().getName();

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/SchemaTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/SchemaTest.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/SchemaTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/SchemaTest.java Thu Jun 19 06:54:11 2014
@@ -31,7 +31,6 @@ import org.apache.syncope.common.Syncope
 import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.common.types.AttributeSchemaType;
 import org.apache.syncope.common.types.EntityViolationType;
-import org.apache.syncope.core.persistence.beans.AbstractNormalSchema;
 import org.apache.syncope.core.persistence.beans.role.RAttr;
 import org.apache.syncope.core.persistence.beans.role.RSchema;
 import org.apache.syncope.core.persistence.beans.user.USchema;
@@ -50,7 +49,7 @@ public class SchemaTest extends Abstract
     @Test
     public void findAll() {
         List<USchema> userList = schemaDAO.findAll(USchema.class);
-        assertEquals(14, userList.size());
+        assertEquals(15, userList.size());
 
         List<RSchema> roleList = schemaDAO.findAll(RSchema.class);
         assertEquals(5, roleList.size());

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/SchemaTestITCase.java Thu Jun 19 06:54:11 2014
@@ -131,6 +131,16 @@ public class SchemaTestITCase extends Ab
     }
 
     @Test
+    public void createBinary() {
+        SchemaTO schemaTO = new SchemaTO();
+        schemaTO.setName("x509certificate");
+        schemaTO.setType(AttributeSchemaType.Binary);
+        schemaTO.setMimeType("application/x-x509-ca-cert");
+
+        createSchema(AttributableType.ROLE, SchemaType.NORMAL, schemaTO);
+    }
+
+    @Test
     public void delete() {
         SchemaTO schemaTO = buildSchemaTO("todelete", AttributeSchemaType.String);
         schemaTO.setMandatoryCondition("false");

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java Thu Jun 19 06:54:11 2014
@@ -487,6 +487,8 @@ public class TaskTestITCase extends Abst
                 matchingUsers.getResult().get(0).getVirAttrMap().get("virtualReadOnly").getValues().get(0));
         // Check for SYNCOPE-270
         assertNotNull(matchingUsers.getResult().get(0).getAttrMap().get("obscure"));
+        // Check for SYNCOPE-123
+        assertNotNull(matchingUsers.getResult().get(0).getAttrMap().get("photo"));
 
         final RoleTO roleTO = matchingRoles.getResult().iterator().next();
         assertNotNull(roleTO);

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java Thu Jun 19 06:54:11 2014
@@ -76,6 +76,7 @@ import javax.naming.NamingException;
 import javax.ws.rs.core.EntityTag;
 import javax.xml.ws.WebServiceException;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.syncope.client.SyncopeClient;
 import org.apache.syncope.common.mod.ResourceAssociationMod;
@@ -1743,7 +1744,7 @@ public class UserTestITCase extends Abst
     }
 
     @Test
-    public void issueSYNCOPE357() {
+    public void issueSYNCOPE357() throws IOException {
         // 1. create role with LDAP resource
         RoleTO roleTO = new RoleTO();
         roleTO.setName("SYNCOPE357-" + getUUIDString());
@@ -1756,6 +1757,8 @@ public class UserTestITCase extends Abst
         // 2. create user with membership of the above role
         UserTO userTO = getUniqueSampleTO("syncope357@syncope.apache.org");
         userTO.getAttrs().add(attributeTO("obscure", "valueToBeObscured"));
+        userTO.getAttrs().add(attributeTO("photo",
+                Base64Utility.encode(IOUtils.readBytesFromStream(getClass().getResourceAsStream("/favicon.jpg")))));
         MembershipTO membershipTO = new MembershipTO();
         membershipTO.setRoleId(roleTO.getId());
         userTO.getMemberships().add(membershipTO);
@@ -1763,6 +1766,7 @@ public class UserTestITCase extends Abst
         userTO = createUser(userTO);
         assertTrue(userTO.getResources().contains(RESOURCE_NAME_LDAP));
         assertNotNull(userTO.getAttrMap().get("obscure"));
+        assertNotNull(userTO.getAttrMap().get("photo"));
 
         // 3. read user on resource
         ConnObjectTO connObj = resourceService.getConnectorObject(
@@ -1771,6 +1775,9 @@ public class UserTestITCase extends Abst
         AttributeTO registeredAddress = connObj.getAttrMap().get("registeredAddress");
         assertNotNull(registeredAddress);
         assertEquals(userTO.getAttrMap().get("obscure").getValues(), registeredAddress.getValues());
+        AttributeTO jpegPhoto = connObj.getAttrMap().get("jpegPhoto");
+        assertNotNull(jpegPhoto);
+        assertEquals(userTO.getAttrMap().get("photo").getValues(), jpegPhoto.getValues());
 
         // 4. remove role
         roleService.delete(roleTO.getId());

Modified: syncope/trunk/core/src/test/resources/content.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/resources/content.xml?rev=1603724&r1=1603723&r2=1603724&view=diff
==============================================================================
--- syncope/trunk/core/src/test/resources/content.xml (original)
+++ syncope/trunk/core/src/test/resources/content.xml Thu Jun 19 06:54:11 2014
@@ -176,6 +176,9 @@ under the License.
   <USchema name="obscure" type="Encrypted"
            mandatoryCondition="false" multivalue="0" uniqueConstraint="0" readonly="0"
            secretKey="7abcdefghilmnopqrstuvz9#" cipherAlgorithm="SHA"/>
+  <USchema name="photo" type="Binary"
+           mandatoryCondition="false" multivalue="0" uniqueConstraint="0" readonly="0"
+           mimeType="application/jpg"/>
 
   <UDerSchema name="csvuserid" expression="firstname + ',' + surname"/>
   <UDerSchema name="cn" expression="surname + ', ' + firstname"/>
@@ -760,6 +763,9 @@ under the License.
   <UMappingItem id="320" accountid="0" password="0" mapping_id="11"
                 extAttrName="registeredAddress" intAttrName="obscure" intMappingType="UserSchema"
                 mandatoryCondition="false" purpose="BOTH"/>
+  <UMappingItem id="321" accountid="0" password="0" mapping_id="11"
+                extAttrName="jpegPhoto" intAttrName="photo" intMappingType="UserSchema"
+                mandatoryCondition="false" purpose="BOTH"/>
   
   <RMapping id="1" resource_name="resource-ldap"
             accountlink="&apos;cn=&apos; + name + &apos;,ou=groups,o=isp&apos;"/>
@@ -777,22 +783,22 @@ under the License.
                 accountid="0" password="0" purpose="BOTH"/>
         
   <UMapping id="16" resource_name="resource-db-sync"/>
-  <UMappingItem id="321" accountid="0" mapping_id="16"
+  <UMappingItem id="322" accountid="0" mapping_id="16"
                 extAttrName="EMAIL" intAttrName="email" intMappingType="UserSchema" 
                 mandatoryCondition="false" password="0" purpose="BOTH"/>
-  <UMappingItem id="322" accountid="0" mapping_id="16"
+  <UMappingItem id="323" accountid="0" mapping_id="16"
                 extAttrName="SURNAME" intAttrName="fullname" intMappingType="UserSchema" 
                 mandatoryCondition="false" password="0" purpose="BOTH"/>
-  <UMappingItem id="323" accountid="1" mapping_id="16"
+  <UMappingItem id="324" accountid="1" mapping_id="16"
                 extAttrName="__NAME__" intAttrName="aLong" intMappingType="UserSchema" 
                 mandatoryCondition="false" password="0" purpose="BOTH"/>
-  <UMappingItem id="324" accountid="0" mapping_id="16"
+  <UMappingItem id="325" accountid="0" mapping_id="16"
                 extAttrName="SURNAME" intAttrName="surname" intMappingType="UserSchema" 
                 mandatoryCondition="false" password="0" purpose="BOTH"/>
-  <UMappingItem id="325" accountid="0" mapping_id="16"
+  <UMappingItem id="326" accountid="0" mapping_id="16"
                 extAttrName="USERNAME" intAttrName="Username" intMappingType="Username" 
                 mandatoryCondition="false" password="0" purpose="BOTH"/>
-  <UMappingItem id="326" accountid="0" mapping_id="16"
+  <UMappingItem id="327" accountid="0" mapping_id="16"
                 extAttrName="EMAIL" intAttrName="userId" intMappingType="UserSchema" 
                 mandatoryCondition="false" password="0" purpose="BOTH"/>
               

Added: syncope/trunk/core/src/test/resources/favicon.jpg
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/resources/favicon.jpg?rev=1603724&view=auto
==============================================================================
Binary file - no diff available.

Propchange: syncope/trunk/core/src/test/resources/favicon.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg



Mime
View raw message