You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2017/08/25 12:42:00 UTC
[1/2] syncope git commit: SYNCOPE-1196 add a specific form for binary
and encrypted paramiters type and set a custom label in paramiters list
Repository: syncope
Updated Branches:
refs/heads/2_0_X d8c105e9e -> 4e6f6d0e4
refs/heads/master 126a323f5 -> a02779a2c
SYNCOPE-1196 add a specific form for binary and encrypted paramiters type and set a custom label in paramiters list
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/4e6f6d0e
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/4e6f6d0e
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/4e6f6d0e
Branch: refs/heads/2_0_X
Commit: 4e6f6d0e46f5ea5c6650c687a8f8beaf4d9e04c2
Parents: d8c105e
Author: lorenzo <lo...@tirasa.net>
Authored: Fri Aug 25 13:07:37 2017 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Aug 25 14:39:31 2017 +0200
----------------------------------------------------------------------
.../panels/ParametersCreateWizardAttrStep.java | 22 +++++++--
.../ParametersCreateWizardSchemaStep.java | 51 ++++++++++++++++++++
.../console/panels/ParametersDetailsPanel.java | 15 +++++-
.../panels/ParametersDirectoryPanel.java | 25 +++++++++-
.../console/src/main/resources/MIMETypes.json | 4 ++
.../ParametersCreateWizardSchemaStep.html | 3 ++
6 files changed, 114 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/4e6f6d0e/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardAttrStep.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardAttrStep.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardAttrStep.java
index dcdaffc..5ffc3ae 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardAttrStep.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardAttrStep.java
@@ -27,6 +27,8 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxSpinnerFiel
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDateFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDateTimeFieldPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.BinaryFieldPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.EncryptedFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.FieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.MultiFieldPanel;
import org.apache.syncope.common.lib.SyncopeConstants;
@@ -47,6 +49,8 @@ public class ParametersCreateWizardAttrStep extends WizardStep {
private static final long serialVersionUID = -7843275202297616553L;
+ private final AjaxTextFieldPanel schema;
+
public ParametersCreateWizardAttrStep(final ParametersCreateWizardPanel.ParametersForm modelObject) {
this.setOutputMarkupId(true);
@@ -54,7 +58,7 @@ public class ParametersCreateWizardAttrStep extends WizardStep {
content.setOutputMarkupId(true);
add(content);
- final AjaxTextFieldPanel schema = new AjaxTextFieldPanel(
+ schema = new AjaxTextFieldPanel(
"schema", getString("schema"), new PropertyModel<String>(modelObject.getAttrTO(), "schema"));
schema.setRequired(true);
content.add(schema);
@@ -87,7 +91,6 @@ public class ParametersCreateWizardAttrStep extends WizardStep {
@SuppressWarnings({ "rawtypes", "unchecked" })
private Panel getFieldPanel(final String id, final AttrTO attrTO, final PlainSchemaTO plainSchemaTO) {
-
final String valueHeaderName = getString("values");
final FieldPanel panel;
@@ -105,8 +108,9 @@ public class ParametersCreateWizardAttrStep extends WizardStep {
"panel", valueHeaderName, new Model<Date>(), dataPattern);
}
break;
+
case Boolean:
- panel = new AjaxDropDownChoicePanel<>(id, valueHeaderName, new Model<String>(), false);
+ panel = new AjaxDropDownChoicePanel<>(id, valueHeaderName, new Model<>(), false);
((AjaxDropDownChoicePanel<String>) panel).setChoices(Arrays.asList("true", "false"));
if (!attrTO.getValues().isEmpty()) {
@@ -133,8 +137,9 @@ public class ParametersCreateWizardAttrStep extends WizardStep {
}
((AjaxDropDownChoicePanel<String>) panel).setNullValid(false);
break;
+
case Enum:
- panel = new AjaxDropDownChoicePanel<>(id, valueHeaderName, new Model<String>(), false);
+ panel = new AjaxDropDownChoicePanel<>(id, valueHeaderName, new Model<>(), false);
((AjaxDropDownChoicePanel<String>) panel).setChoices(SchemaUtils.getEnumeratedValues(plainSchemaTO));
if (!attrTO.getValues().isEmpty()) {
@@ -173,6 +178,15 @@ public class ParametersCreateWizardAttrStep extends WizardStep {
.build(id, valueHeaderName, Double.class, new Model<Double>());
break;
+ case Binary:
+ panel = new BinaryFieldPanel(id, valueHeaderName, new Model<String>(), plainSchemaTO.getMimeType(),
+ schema.getModelObject());
+ break;
+
+ case Encrypted:
+ panel = new EncryptedFieldPanel(id, valueHeaderName, new Model<String>(), true);
+ break;
+
default:
panel = new AjaxTextFieldPanel(id, valueHeaderName, new Model<String>(), false);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4e6f6d0e/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.java
index 70ff104..afe5ab2 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.java
@@ -21,7 +21,10 @@ package org.apache.syncope.client.console.panels;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.console.SyncopeConsoleApplication;
import org.apache.syncope.client.console.commons.PropertyList;
+import org.apache.syncope.client.console.init.ConsoleInitializer;
+import org.apache.syncope.client.console.init.MIMETypesLoader;
import org.apache.syncope.client.console.wicket.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
@@ -29,6 +32,7 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPa
import org.apache.syncope.client.console.wicket.markup.html.form.MultiFieldPanel;
import org.apache.syncope.common.lib.to.PlainSchemaTO;
import org.apache.syncope.common.lib.types.AttrSchemaType;
+import org.apache.syncope.common.lib.types.CipherAlgorithm;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.wizard.WizardStep;
import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -39,6 +43,9 @@ public class ParametersCreateWizardSchemaStep extends WizardStep {
private static final long serialVersionUID = -7843275202297616553L;
+ private static final MIMETypesLoader MIME_TYPES_LOADER = (MIMETypesLoader) SyncopeConsoleApplication.get().
+ getServletContext().getAttribute(ConsoleInitializer.MIMETYPES_LOADER);
+
public ParametersCreateWizardSchemaStep(final ParametersCreateWizardPanel.ParametersForm modelObject) {
modelObject.getPlainSchemaTO().setMandatoryCondition("false");
@@ -91,6 +98,28 @@ public class ParametersCreateWizardSchemaStep extends WizardStep {
panel.setVisible(false);
content.add(panel);
+ //binary
+ final AjaxTextFieldPanel mimeType = new AjaxTextFieldPanel("mimeType",
+ "MIME-Type", new PropertyModel<String>(modelObject.getPlainSchemaTO(), "mimeType"));
+ mimeType.setVisible(false);
+ content.add(mimeType);
+
+ //encrypted
+ final AjaxTextFieldPanel secretKey = new AjaxTextFieldPanel("secretKey",
+ "Secret-key", new PropertyModel<String>(modelObject.getPlainSchemaTO(), "secretKey"));
+
+ final AjaxDropDownChoicePanel<CipherAlgorithm> cipherAlgorithm = new AjaxDropDownChoicePanel<>(
+ "cipherAlgorithm", "Cipher-algorithm",
+ new PropertyModel<CipherAlgorithm>(modelObject.getPlainSchemaTO(), "cipherAlgorithm"));
+
+ cipherAlgorithm.setChoices(Arrays.asList(CipherAlgorithm.values()));
+ secretKey.setVisible(false);
+ cipherAlgorithm.setVisible(false);
+ content.add(secretKey);
+ content.add(cipherAlgorithm);
+
+ showHide(type, secretKey, cipherAlgorithm, mimeType);
+
type.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior("onchange") {
private static final long serialVersionUID = -1107858522700306810L;
@@ -106,6 +135,7 @@ public class ParametersCreateWizardSchemaStep extends WizardStep {
content.add(panel);
target.add(content);
}
+ ParametersCreateWizardSchemaStep.this.showHide(type, secretKey, cipherAlgorithm, mimeType);
}
});
@@ -113,4 +143,25 @@ public class ParametersCreateWizardSchemaStep extends WizardStep {
new PropertyModel<Boolean>(modelObject.getPlainSchemaTO(), "multivalue"), false);
content.add(multiValue);
}
+
+ private void showHide(
+ final AjaxDropDownChoicePanel<AttrSchemaType> type,
+ final AjaxTextFieldPanel secretKey,
+ final AjaxDropDownChoicePanel<CipherAlgorithm> cipherAlgorithm,
+ final AjaxTextFieldPanel mimeType) {
+
+ final int typeOrdinal = Integer.parseInt(type.getField().getValue());
+ if (AttrSchemaType.Encrypted.ordinal() == typeOrdinal) {
+ mimeType.setVisible(false);
+ secretKey.setVisible(true);
+ secretKey.addRequiredLabel();
+ cipherAlgorithm.setVisible(true);
+ cipherAlgorithm.addRequiredLabel();
+ } else if (AttrSchemaType.Binary.ordinal() == typeOrdinal) {
+ secretKey.setVisible(false);
+ cipherAlgorithm.setVisible(false);
+ mimeType.setVisible(true);
+ mimeType.setChoices(MIME_TYPES_LOADER.getMimeTypes());
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4e6f6d0e/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDetailsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDetailsPanel.java
index 14f9abe..a5540ad 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDetailsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDetailsPanel.java
@@ -29,6 +29,8 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxSpinnerFiel
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDateFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDateTimeFieldPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.BinaryFieldPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.EncryptedFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.FieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.MultiFieldPanel;
import org.apache.syncope.common.lib.SyncopeConstants;
@@ -50,6 +52,8 @@ public class ParametersDetailsPanel extends Panel {
private final SchemaRestClient schemaRestClient = new SchemaRestClient();
+ private final AjaxTextFieldPanel schema;
+
public ParametersDetailsPanel(final String id, final AttrTO attrTO) {
super(id);
@@ -65,7 +69,7 @@ public class ParametersDetailsPanel extends Panel {
form.setModel(new CompoundPropertyModel<>(attrTO));
container.add(form);
- final AjaxTextFieldPanel schema = new AjaxTextFieldPanel(
+ schema = new AjaxTextFieldPanel(
"schema", getString("schema"), new PropertyModel<String>(attrTO, "schema"));
schema.setEnabled(false);
form.add(schema);
@@ -160,6 +164,15 @@ public class ParametersDetailsPanel extends Panel {
.build(id, valueHeaderName, Double.class, new Model<Double>());
break;
+ case Binary:
+ panel = new BinaryFieldPanel(id, valueHeaderName, new Model<String>(), schemaTO.getMimeType(),
+ schema.getModelObject());
+ break;
+
+ case Encrypted:
+ panel = new EncryptedFieldPanel(id, valueHeaderName, new Model<String>(), true);
+ break;
+
default:
panel = new AjaxTextFieldPanel(id, valueHeaderName, new Model<String>(), false);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4e6f6d0e/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDirectoryPanel.java
index dda7186..ab2eec8 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDirectoryPanel.java
@@ -39,14 +39,20 @@ import org.apache.syncope.client.console.wizards.AbstractModalPanelBuilder;
import org.apache.syncope.client.console.wizards.AjaxWizard;
import org.apache.syncope.client.console.wizards.WizardMgtPanel;
import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.types.AttrSchemaType;
import org.apache.syncope.common.lib.types.StandardEntitlement;
+import org.apache.wicket.AttributeModifier;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow.WindowClosedCallback;
+import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.ResourceModel;
@@ -135,7 +141,24 @@ public class ParametersDirectoryPanel
protected List<IColumn<AttrTO, String>> getColumns() {
final List<IColumn<AttrTO, String>> columns = new ArrayList<>();
columns.add(new PropertyColumn<AttrTO, String>(new ResourceModel("schema"), "schema"));
- columns.add(new PropertyColumn<AttrTO, String>(new ResourceModel("values"), "values"));
+ columns.add(new PropertyColumn<AttrTO, String>(new ResourceModel("values"), "values") {
+
+ private static final long serialVersionUID = -1822504503325964706L;
+
+ @Override
+ public void populateItem(final Item<ICellPopulator<AttrTO>> item,
+ final String componentId, final IModel<AttrTO> rowModel) {
+ PlainSchemaTO modelSchemaTO = (PlainSchemaTO) rowModel.getObject().getSchemaInfo();
+ AttrSchemaType type = modelSchemaTO.getType();
+ if (type == AttrSchemaType.Binary || type == AttrSchemaType.Encrypted) {
+ item.add(new Label(componentId, type.name()).
+ add(new AttributeModifier("style", "font-style:italic")));
+ } else {
+ super.populateItem(item, componentId, rowModel);
+ }
+ }
+
+ });
return columns;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4e6f6d0e/client/console/src/main/resources/MIMETypes.json
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/MIMETypes.json b/client/console/src/main/resources/MIMETypes.json
index 3c6fa8a..b49ceca 100644
--- a/client/console/src/main/resources/MIMETypes.json
+++ b/client/console/src/main/resources/MIMETypes.json
@@ -6,6 +6,10 @@
"name": "application/arj"
},
{
+ "name": "application/json",
+ "extension": "json"
+ },
+ {
"name": "application/base64"
},
{
http://git-wip-us.apache.org/repos/asf/syncope/blob/4e6f6d0e/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.html
index c707e98..1f25c57 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.html
@@ -22,6 +22,9 @@ under the License.
<span wicket:id="type">[type]</span>
<span wicket:id="values">[values]</span>
<span wicket:id="panel">[panel]</span>
+ <span wicket:id="mimeType">[mimeType]</span>
+ <span wicket:id="secretKey">[secretKey]</span>
+ <span wicket:id="cipherAlgorithm">[cipherAlgorithm]</span>
</div>
</wicket:panel>
</html>
\ No newline at end of file
[2/2] syncope git commit: SYNCOPE-1196 add a specific form for binary
and encrypted paramiters type and set a custom label in paramiters list -
This closes #62
Posted by il...@apache.org.
SYNCOPE-1196 add a specific form for binary and encrypted paramiters type and set a custom label in paramiters list - This closes #62
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/a02779a2
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/a02779a2
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/a02779a2
Branch: refs/heads/master
Commit: a02779a2ccf4ee26953468713a1d2e3722883840
Parents: 126a323
Author: lorenzo <lo...@tirasa.net>
Authored: Fri Aug 25 13:07:37 2017 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Aug 25 14:41:52 2017 +0200
----------------------------------------------------------------------
.../panels/ParametersCreateWizardAttrStep.java | 33 ++++++++----
.../ParametersCreateWizardSchemaStep.java | 55 +++++++++++++++++++-
.../console/panels/ParametersDetailsPanel.java | 24 ++++++---
.../panels/ParametersDirectoryPanel.java | 27 +++++++++-
.../console/src/main/resources/MIMETypes.json | 4 ++
.../ParametersCreateWizardSchemaStep.html | 3 ++
6 files changed, 126 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/a02779a2/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardAttrStep.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardAttrStep.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardAttrStep.java
index dcdaffc..7d6847c 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardAttrStep.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardAttrStep.java
@@ -19,7 +19,6 @@
package org.apache.syncope.client.console.panels;
import java.util.Arrays;
-import java.util.Date;
import java.util.List;
import org.apache.syncope.client.console.commons.SchemaUtils;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
@@ -27,6 +26,8 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxSpinnerFiel
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDateFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDateTimeFieldPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.BinaryFieldPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.EncryptedFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.FieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.MultiFieldPanel;
import org.apache.syncope.common.lib.SyncopeConstants;
@@ -47,6 +48,8 @@ public class ParametersCreateWizardAttrStep extends WizardStep {
private static final long serialVersionUID = -7843275202297616553L;
+ private final AjaxTextFieldPanel schema;
+
public ParametersCreateWizardAttrStep(final ParametersCreateWizardPanel.ParametersForm modelObject) {
this.setOutputMarkupId(true);
@@ -54,8 +57,8 @@ public class ParametersCreateWizardAttrStep extends WizardStep {
content.setOutputMarkupId(true);
add(content);
- final AjaxTextFieldPanel schema = new AjaxTextFieldPanel(
- "schema", getString("schema"), new PropertyModel<String>(modelObject.getAttrTO(), "schema"));
+ schema = new AjaxTextFieldPanel(
+ "schema", getString("schema"), new PropertyModel<>(modelObject.getAttrTO(), "schema"));
schema.setRequired(true);
content.add(schema);
@@ -87,7 +90,6 @@ public class ParametersCreateWizardAttrStep extends WizardStep {
@SuppressWarnings({ "rawtypes", "unchecked" })
private Panel getFieldPanel(final String id, final AttrTO attrTO, final PlainSchemaTO plainSchemaTO) {
-
final String valueHeaderName = getString("values");
final FieldPanel panel;
@@ -99,14 +101,15 @@ public class ParametersCreateWizardAttrStep extends WizardStep {
if (dataPattern.contains("H")) {
panel = new AjaxDateTimeFieldPanel(
- id, valueHeaderName, new Model<Date>(), dataPattern);
+ id, valueHeaderName, new Model<>(), dataPattern);
} else {
panel = new AjaxDateFieldPanel(
- "panel", valueHeaderName, new Model<Date>(), dataPattern);
+ "panel", valueHeaderName, new Model<>(), dataPattern);
}
break;
+
case Boolean:
- panel = new AjaxDropDownChoicePanel<>(id, valueHeaderName, new Model<String>(), false);
+ panel = new AjaxDropDownChoicePanel<>(id, valueHeaderName, new Model<>(), false);
((AjaxDropDownChoicePanel<String>) panel).setChoices(Arrays.asList("true", "false"));
if (!attrTO.getValues().isEmpty()) {
@@ -133,8 +136,9 @@ public class ParametersCreateWizardAttrStep extends WizardStep {
}
((AjaxDropDownChoicePanel<String>) panel).setNullValid(false);
break;
+
case Enum:
- panel = new AjaxDropDownChoicePanel<>(id, valueHeaderName, new Model<String>(), false);
+ panel = new AjaxDropDownChoicePanel<>(id, valueHeaderName, new Model<>(), false);
((AjaxDropDownChoicePanel<String>) panel).setChoices(SchemaUtils.getEnumeratedValues(plainSchemaTO));
if (!attrTO.getValues().isEmpty()) {
@@ -173,12 +177,21 @@ public class ParametersCreateWizardAttrStep extends WizardStep {
.build(id, valueHeaderName, Double.class, new Model<Double>());
break;
+ case Binary:
+ panel = new BinaryFieldPanel(id, valueHeaderName, new Model<>(), plainSchemaTO.getMimeType(),
+ schema.getModelObject());
+ break;
+
+ case Encrypted:
+ panel = new EncryptedFieldPanel(id, valueHeaderName, new Model<>(), true);
+ break;
+
default:
- panel = new AjaxTextFieldPanel(id, valueHeaderName, new Model<String>(), false);
+ panel = new AjaxTextFieldPanel(id, valueHeaderName, new Model<>(), false);
}
if (plainSchemaTO.isMultivalue()) {
return new MultiFieldPanel.Builder<>(
- new PropertyModel<List<String>>(attrTO, "values")).build(id, valueHeaderName, panel);
+ new PropertyModel<>(attrTO, "values")).build(id, valueHeaderName, panel);
} else {
panel.setNewModel(attrTO.getValues());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/a02779a2/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.java
index 70ff104..a0b0d7c 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.java
@@ -21,7 +21,10 @@ package org.apache.syncope.client.console.panels;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.console.SyncopeConsoleApplication;
import org.apache.syncope.client.console.commons.PropertyList;
+import org.apache.syncope.client.console.init.ConsoleInitializer;
+import org.apache.syncope.client.console.init.MIMETypesLoader;
import org.apache.syncope.client.console.wicket.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
@@ -29,6 +32,7 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPa
import org.apache.syncope.client.console.wicket.markup.html.form.MultiFieldPanel;
import org.apache.syncope.common.lib.to.PlainSchemaTO;
import org.apache.syncope.common.lib.types.AttrSchemaType;
+import org.apache.syncope.common.lib.types.CipherAlgorithm;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.wizard.WizardStep;
import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -39,6 +43,9 @@ public class ParametersCreateWizardSchemaStep extends WizardStep {
private static final long serialVersionUID = -7843275202297616553L;
+ private static final MIMETypesLoader MIME_TYPES_LOADER = (MIMETypesLoader) SyncopeConsoleApplication.get().
+ getServletContext().getAttribute(ConsoleInitializer.MIMETYPES_LOADER);
+
public ParametersCreateWizardSchemaStep(final ParametersCreateWizardPanel.ParametersForm modelObject) {
modelObject.getPlainSchemaTO().setMandatoryCondition("false");
@@ -47,7 +54,7 @@ public class ParametersCreateWizardSchemaStep extends WizardStep {
content.setOutputMarkupId(true);
add(content);
final AjaxDropDownChoicePanel<AttrSchemaType> type = new AjaxDropDownChoicePanel<>(
- "type", getString("type"), new PropertyModel<AttrSchemaType>(modelObject.getPlainSchemaTO(), "type"));
+ "type", getString("type"), new PropertyModel<>(modelObject.getPlainSchemaTO(), "type"));
type.setChoices(Arrays.asList(AttrSchemaType.values()));
content.add(type);
@@ -91,6 +98,28 @@ public class ParametersCreateWizardSchemaStep extends WizardStep {
panel.setVisible(false);
content.add(panel);
+ //binary
+ final AjaxTextFieldPanel mimeType = new AjaxTextFieldPanel("mimeType",
+ "MIME-Type", new PropertyModel<>(modelObject.getPlainSchemaTO(), "mimeType"));
+ mimeType.setVisible(false);
+ content.add(mimeType);
+
+ //encrypted
+ final AjaxTextFieldPanel secretKey = new AjaxTextFieldPanel("secretKey",
+ "Secret-key", new PropertyModel<>(modelObject.getPlainSchemaTO(), "secretKey"));
+
+ final AjaxDropDownChoicePanel<CipherAlgorithm> cipherAlgorithm = new AjaxDropDownChoicePanel<>(
+ "cipherAlgorithm", "Cipher-algorithm",
+ new PropertyModel<>(modelObject.getPlainSchemaTO(), "cipherAlgorithm"));
+
+ cipherAlgorithm.setChoices(Arrays.asList(CipherAlgorithm.values()));
+ secretKey.setVisible(false);
+ cipherAlgorithm.setVisible(false);
+ content.add(secretKey);
+ content.add(cipherAlgorithm);
+
+ showHide(type, secretKey, cipherAlgorithm, mimeType);
+
type.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior("onchange") {
private static final long serialVersionUID = -1107858522700306810L;
@@ -106,11 +135,33 @@ public class ParametersCreateWizardSchemaStep extends WizardStep {
content.add(panel);
target.add(content);
}
+ ParametersCreateWizardSchemaStep.this.showHide(type, secretKey, cipherAlgorithm, mimeType);
}
});
final AjaxCheckBoxPanel multiValue = new AjaxCheckBoxPanel("panel", getString("multivalue"),
- new PropertyModel<Boolean>(modelObject.getPlainSchemaTO(), "multivalue"), false);
+ new PropertyModel<>(modelObject.getPlainSchemaTO(), "multivalue"), false);
content.add(multiValue);
}
+
+ private void showHide(
+ final AjaxDropDownChoicePanel<AttrSchemaType> type,
+ final AjaxTextFieldPanel secretKey,
+ final AjaxDropDownChoicePanel<CipherAlgorithm> cipherAlgorithm,
+ final AjaxTextFieldPanel mimeType) {
+
+ final int typeOrdinal = Integer.parseInt(type.getField().getValue());
+ if (AttrSchemaType.Encrypted.ordinal() == typeOrdinal) {
+ mimeType.setVisible(false);
+ secretKey.setVisible(true);
+ secretKey.addRequiredLabel();
+ cipherAlgorithm.setVisible(true);
+ cipherAlgorithm.addRequiredLabel();
+ } else if (AttrSchemaType.Binary.ordinal() == typeOrdinal) {
+ secretKey.setVisible(false);
+ cipherAlgorithm.setVisible(false);
+ mimeType.setVisible(true);
+ mimeType.setChoices(MIME_TYPES_LOADER.getMimeTypes());
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/a02779a2/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDetailsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDetailsPanel.java
index 14f9abe..187b172 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDetailsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDetailsPanel.java
@@ -19,7 +19,6 @@
package org.apache.syncope.client.console.panels;
import java.util.Arrays;
-import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.console.commons.SchemaUtils;
@@ -29,6 +28,8 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxSpinnerFiel
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDateFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDateTimeFieldPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.BinaryFieldPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.EncryptedFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.FieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.MultiFieldPanel;
import org.apache.syncope.common.lib.SyncopeConstants;
@@ -50,6 +51,8 @@ public class ParametersDetailsPanel extends Panel {
private final SchemaRestClient schemaRestClient = new SchemaRestClient();
+ private final AjaxTextFieldPanel schema;
+
public ParametersDetailsPanel(final String id, final AttrTO attrTO) {
super(id);
@@ -65,8 +68,8 @@ public class ParametersDetailsPanel extends Panel {
form.setModel(new CompoundPropertyModel<>(attrTO));
container.add(form);
- final AjaxTextFieldPanel schema = new AjaxTextFieldPanel(
- "schema", getString("schema"), new PropertyModel<String>(attrTO, "schema"));
+ schema = new AjaxTextFieldPanel(
+ "schema", getString("schema"), new PropertyModel<>(attrTO, "schema"));
schema.setEnabled(false);
form.add(schema);
@@ -87,9 +90,9 @@ public class ParametersDetailsPanel extends Panel {
: schemaTO.getConversionPattern();
if (StringUtils.containsIgnoreCase(datePattern, "H")) {
- panel = new AjaxDateTimeFieldPanel("panel", schemaTO.getKey(), new Model<Date>(), datePattern);
+ panel = new AjaxDateTimeFieldPanel("panel", schemaTO.getKey(), new Model<>(), datePattern);
} else {
- panel = new AjaxDateFieldPanel("panel", schemaTO.getKey(), new Model<Date>(), datePattern);
+ panel = new AjaxDateFieldPanel("panel", schemaTO.getKey(), new Model<>(), datePattern);
}
break;
case Boolean:
@@ -160,8 +163,17 @@ public class ParametersDetailsPanel extends Panel {
.build(id, valueHeaderName, Double.class, new Model<Double>());
break;
+ case Binary:
+ panel = new BinaryFieldPanel(id, valueHeaderName, new Model<>(), schemaTO.getMimeType(),
+ schema.getModelObject());
+ break;
+
+ case Encrypted:
+ panel = new EncryptedFieldPanel(id, valueHeaderName, new Model<>(), true);
+ break;
+
default:
- panel = new AjaxTextFieldPanel(id, valueHeaderName, new Model<String>(), false);
+ panel = new AjaxTextFieldPanel(id, valueHeaderName, new Model<>(), false);
}
if (schemaTO.isMultivalue()) {
return new MultiFieldPanel.Builder<>(
http://git-wip-us.apache.org/repos/asf/syncope/blob/a02779a2/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDirectoryPanel.java
index dda7186..ea927a5 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDirectoryPanel.java
@@ -39,14 +39,20 @@ import org.apache.syncope.client.console.wizards.AbstractModalPanelBuilder;
import org.apache.syncope.client.console.wizards.AjaxWizard;
import org.apache.syncope.client.console.wizards.WizardMgtPanel;
import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.types.AttrSchemaType;
import org.apache.syncope.common.lib.types.StandardEntitlement;
+import org.apache.wicket.AttributeModifier;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow.WindowClosedCallback;
+import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.ResourceModel;
@@ -134,8 +140,25 @@ public class ParametersDirectoryPanel
@Override
protected List<IColumn<AttrTO, String>> getColumns() {
final List<IColumn<AttrTO, String>> columns = new ArrayList<>();
- columns.add(new PropertyColumn<AttrTO, String>(new ResourceModel("schema"), "schema"));
- columns.add(new PropertyColumn<AttrTO, String>(new ResourceModel("values"), "values"));
+ columns.add(new PropertyColumn<>(new ResourceModel("schema"), "schema"));
+ columns.add(new PropertyColumn<AttrTO, String>(new ResourceModel("values"), "values") {
+
+ private static final long serialVersionUID = -1822504503325964706L;
+
+ @Override
+ public void populateItem(final Item<ICellPopulator<AttrTO>> item,
+ final String componentId, final IModel<AttrTO> rowModel) {
+ PlainSchemaTO modelSchemaTO = (PlainSchemaTO) rowModel.getObject().getSchemaInfo();
+ AttrSchemaType type = modelSchemaTO.getType();
+ if (type == AttrSchemaType.Binary || type == AttrSchemaType.Encrypted) {
+ item.add(new Label(componentId, type.name()).
+ add(new AttributeModifier("style", "font-style:italic")));
+ } else {
+ super.populateItem(item, componentId, rowModel);
+ }
+ }
+
+ });
return columns;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/a02779a2/client/console/src/main/resources/MIMETypes.json
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/MIMETypes.json b/client/console/src/main/resources/MIMETypes.json
index 3c6fa8a..b49ceca 100644
--- a/client/console/src/main/resources/MIMETypes.json
+++ b/client/console/src/main/resources/MIMETypes.json
@@ -6,6 +6,10 @@
"name": "application/arj"
},
{
+ "name": "application/json",
+ "extension": "json"
+ },
+ {
"name": "application/base64"
},
{
http://git-wip-us.apache.org/repos/asf/syncope/blob/a02779a2/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.html
index c707e98..1f25c57 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ParametersCreateWizardSchemaStep.html
@@ -22,6 +22,9 @@ under the License.
<span wicket:id="type">[type]</span>
<span wicket:id="values">[values]</span>
<span wicket:id="panel">[panel]</span>
+ <span wicket:id="mimeType">[mimeType]</span>
+ <span wicket:id="secretKey">[secretKey]</span>
+ <span wicket:id="cipherAlgorithm">[cipherAlgorithm]</span>
</div>
</wicket:panel>
</html>
\ No newline at end of file