You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2018/06/22 15:35:06 UTC
[5/5] syncope git commit: [SYNCOPE-681] Core, Console and Enduser
[SYNCOPE-681] Core, Console and Enduser
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/d7d06bc0
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/d7d06bc0
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/d7d06bc0
Branch: refs/heads/master
Commit: d7d06bc088adebaae3fd7608a8c0ea3639916910
Parents: 6a9d557
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Jun 22 16:06:40 2018 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Jun 22 17:29:38 2018 +0200
----------------------------------------------------------------------
.../NotificationWizardBuilder.java | 3 +-
.../syncope/client/console/pages/Realms.java | 33 +-
.../panels/AbstractSchemaDetailsPanel.java | 31 +-
.../console/panels/AnyTypeClassesPanel.java | 2 +-
.../client/console/panels/AnyTypesPanel.java | 2 +-
.../client/console/panels/DerSchemaDetails.java | 12 +-
.../console/panels/ParametersDetailsPanel.java | 4 +-
.../console/panels/PlainSchemaDetails.java | 38 +-
.../console/panels/RelationshipTypesPanel.java | 2 +-
.../client/console/panels/SchemaModalPanel.java | 95 ---
.../client/console/panels/SchemaTypePanel.java | 68 +-
.../console/panels/SchemaTypeWizardBuilder.java | 242 +++++++
.../console/panels/TypesDirectoryPanel.java | 9 +-
.../client/console/panels/VirSchemaDetails.java | 24 +-
.../markup/html/form/AbstractFieldPanel.java | 2 +-
.../markup/html/form/AjaxTextFieldPanel.java | 14 +-
.../markup/html/form/MultiFieldPanel.java | 2 +-
.../console/wizards/AbstractMappingPanel.java | 2 +-
.../client/console/wizards/WizardMgtPanel.java | 11 +-
.../client/console/wizards/any/DerAttrs.java | 25 +-
.../client/console/wizards/any/PlainAttrs.java | 76 ++-
.../client/console/wizards/any/VirAttrs.java | 41 +-
.../client/console/panels/DerSchemaDetails.html | 20 +-
.../console/panels/PlainSchemaDetails.html | 86 ++-
.../client/console/panels/SchemaModalPanel.html | 28 -
.../console/panels/SchemaModalPanel.properties | 18 -
.../panels/SchemaModalPanel_it.properties | 18 -
.../panels/SchemaModalPanel_ja.properties | 18 -
.../panels/SchemaModalPanel_pt_BR.properties | 18 -
.../panels/SchemaModalPanel_ru.properties | 21 -
.../panels/SchemaTypeWizardBuilder$Details.html | 26 +
.../SchemaTypeWizardBuilder$Details.properties | 18 +
...chemaTypeWizardBuilder$Details_it.properties | 18 +
...chemaTypeWizardBuilder$Details_ja.properties | 18 +
...maTypeWizardBuilder$Details_pt_BR.properties | 18 +
...chemaTypeWizardBuilder$Details_ru.properties | 21 +
.../panels/SchemaTypeWizardBuilder$Labels.html | 53 ++
.../SchemaTypeWizardBuilder$Labels.properties | 18 +
...SchemaTypeWizardBuilder$Labels_it.properties | 18 +
...SchemaTypeWizardBuilder$Labels_ja.properties | 18 +
...emaTypeWizardBuilder$Labels_pt_BR.properties | 18 +
...SchemaTypeWizardBuilder$Labels_ru.properties | 18 +
.../client/console/panels/VirSchemaDetails.html | 34 +-
.../console/wizards/AbstractMappingPanel.html | 6 +-
.../resources/META-INF/resources/app/js/app.js | 3 +-
.../js/directives/dynamicDerivedAttributes.js | 3 +-
.../app/js/directives/dynamicPlainAttributes.js | 3 +-
.../js/directives/dynamicVirtualAttributes.js | 3 +-
.../resources/app/languages/de/dynamic.json | 26 -
.../resources/app/languages/de/static.json | 13 +-
.../resources/app/languages/en/dynamic.json | 24 -
.../resources/app/languages/en/static.json | 13 +-
.../resources/app/languages/it/dynamic.json | 24 -
.../resources/app/languages/it/static.json | 17 +-
.../resources/app/languages/ja/dynamic.json | 24 -
.../resources/app/languages/ja/static.json | 13 +-
.../app/views/dynamicDerivedAttributes.html | 4 +-
.../app/views/dynamicPlainAttributes.html | 4 +-
.../app/views/dynamicVirtualAttributes.html | 4 +-
.../app/views/user-derived-schemas.html | 2 +-
.../resources/app/views/user-groups.html | 2 +-
.../resources/app/views/user-plain-schemas.html | 2 +-
.../app/views/user-virtual-schemas.html | 2 +-
.../syncope/common/lib/patch/AnyPatch.java | 2 +-
.../syncope/common/lib/policy/PolicyTO.java | 2 +-
.../org/apache/syncope/common/lib/to/AnyTO.java | 2 +-
.../apache/syncope/common/lib/to/SchemaTO.java | 20 +-
.../apache/syncope/common/lib/to/TaskTO.java | 2 +-
.../apache/syncope/core/logic/SchemaLogic.java | 39 +-
.../core/persistence/api/entity/Schema.java | 8 +
.../persistence/api/entity/SchemaLabel.java | 36 ++
.../persistence/jpa/dao/AbstractAnyDAO.java | 5 +-
.../persistence/jpa/dao/JPADerSchemaDAO.java | 6 +-
.../persistence/jpa/dao/JPAPlainSchemaDAO.java | 10 +-
.../core/persistence/jpa/dao/JPATaskDAO.java | 2 +-
.../persistence/jpa/dao/JPAVirSchemaDAO.java | 6 +-
.../persistence/jpa/entity/AbstractEntity.java | 18 -
.../jpa/entity/AbstractPlainAttrValue.java | 16 +-
.../persistence/jpa/entity/AbstractSchema.java | 26 +
.../jpa/entity/JPAEntityFactory.java | 3 +
.../persistence/jpa/entity/JPANotification.java | 38 +-
.../persistence/jpa/entity/JPAPlainSchema.java | 44 +-
.../core/persistence/jpa/entity/JPAReport.java | 12 +-
.../persistence/jpa/entity/JPASchemaLabel.java | 78 +++
.../persistence/jpa/entity/JPAVirSchema.java | 22 +-
.../jpa/entity/policy/JPAAccountPolicy.java | 14 +-
.../jpa/entity/policy/JPAPasswordPolicy.java | 14 +-
.../jpa/entity/resource/AbstractItem.java | 32 +-
.../entity/resource/JPAExternalResource.java | 60 +-
.../jpa/entity/resource/JPAOrgUnit.java | 13 +-
.../jpa/entity/resource/JPAOrgUnitItem.java | 5 +
.../jpa/entity/resource/JPAProvision.java | 10 +-
.../entity/task/AbstractProvisioningTask.java | 43 +-
.../jpa/entity/task/JPANotificationTask.java | 13 +-
.../jpa/entity/task/JPAPullTask.java | 14 +-
.../jpa/entity/task/JPASchedTask.java | 12 +-
.../entity/user/JPAUPlainAttrUniqueValue.java | 1 -
.../persistence/jpa/entity/user/JPAUser.java | 29 +-
.../jpa/openjpa/BooleanValueHandler.java | 69 ++
.../jpa/openjpa/LocaleValueHandler.java | 70 +++
.../src/main/resources/domains.xml | 5 +-
.../persistence/jpa/inner/PlainSchemaTest.java | 8 +-
.../persistence/jpa/outer/PlainSchemaTest.java | 18 +-
.../test/resources/domains/MasterContent.xml | 90 +--
.../provisioning/api/data/SchemaDataBinder.java | 11 +-
.../provisioning/java/DerAttrHandlerImpl.java | 8 +-
.../java/data/AbstractAnyDataBinder.java | 34 +-
.../java/data/ConfigurationDataBinderImpl.java | 10 +-
.../java/data/SchemaDataBinderImpl.java | 58 +-
.../persistence/jpa/entity/JPAOIDCProvider.java | 33 +-
.../persistence/jpa/entity/JPASAML2IdP.java | 53 +-
.../client/console/pages/SCIMConfPage.java | 38 +-
.../console/panels/SCIMConfUserPanel.java | 625 +++++++++----------
.../src/main/resources/jboss/domains.xml | 5 +-
.../syncope/fit/core/DerSchemaITCase.java | 6 +
.../syncope/fit/core/PlainSchemaITCase.java | 3 +
.../syncope/fit/core/VirSchemaITCase.java | 5 +
117 files changed, 1772 insertions(+), 1487 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java
index 83f948f..733aaab 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java
@@ -287,8 +287,7 @@ public class NotificationWizardBuilder extends AjaxWizardBuilder<NotificationWra
aboutContainer.setOutputMarkupId(true);
add(aboutContainer);
- final IModel<List<Pair<String, List<SearchClause>>>> model =
- new PropertyModel<>(modelObject, "aboutClauses");
+ IModel<List<Pair<String, List<SearchClause>>>> model = new PropertyModel<>(modelObject, "aboutClauses");
aboutContainer.add(new MultiPanel<Pair<String, List<SearchClause>>>("abouts", "abouts", model) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
index b87ab2c..b113144 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/Realms.java
@@ -39,7 +39,6 @@ import org.apache.syncope.common.lib.to.TemplatableTO;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.event.Broadcast;
import org.apache.wicket.event.IEvent;
-import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow.WindowClosedCallback;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
@@ -187,26 +186,20 @@ public class Realms extends BasePage {
@Override
protected void setWindowClosedReloadCallback(final BaseModal<?> modal) {
- modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
-
- private static final long serialVersionUID = 8804221891699487139L;
-
- @Override
- public void onClose(final AjaxRequestTarget target) {
- if (modal.getContent() instanceof ResultPage) {
- Serializable result = ResultPage.class.cast(modal.getContent()).getResult();
-
- RealmTO newRealmTO = RealmTO.class.cast(ProvisioningResult.class.cast(result).getEntity());
- // reload realmChoicePanel label too - SYNCOPE-1151
- target.add(realmChoicePanel.reloadRealmTree(target, Model.of(newRealmTO)));
- realmChoicePanel.setCurrentRealm(newRealmTO);
- send(Realms.this, Broadcast.DEPTH, new ChosenRealm<>(newRealmTO, target));
- } else {
- target.add(realmChoicePanel.reloadRealmTree(target));
- }
- target.add(content);
- modal.show(false);
+ modal.setWindowClosedCallback(target -> {
+ if (modal.getContent() instanceof ResultPage) {
+ Serializable result = ResultPage.class.cast(modal.getContent()).getResult();
+
+ RealmTO newRealmTO = RealmTO.class.cast(ProvisioningResult.class.cast(result).getEntity());
+ // reload realmChoicePanel label too - SYNCOPE-1151
+ target.add(realmChoicePanel.reloadRealmTree(target, Model.of(newRealmTO)));
+ realmChoicePanel.setCurrentRealm(newRealmTO);
+ send(Realms.this, Broadcast.DEPTH, new ChosenRealm<>(newRealmTO, target));
+ } else {
+ target.add(realmChoicePanel.reloadRealmTree(target));
}
+ target.add(content);
+ modal.show(false);
});
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSchemaDetailsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSchemaDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSchemaDetailsPanel.java
index ff39d88..c3a4bb7 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSchemaDetailsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSchemaDetailsPanel.java
@@ -20,10 +20,7 @@ package org.apache.syncope.client.console.panels;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.common.lib.to.SchemaTO;
-import org.apache.wicket.PageReference;
-import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.PropertyModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -34,30 +31,12 @@ public abstract class AbstractSchemaDetailsPanel extends Panel {
protected static final Logger LOG = LoggerFactory.getLogger(AbstractSchemaDetailsPanel.class);
- protected static final String FORM = "form";
-
- protected final Form<SchemaTO> schemaForm;
-
- protected final SchemaTO schemaTO;
-
- public AbstractSchemaDetailsPanel(
- final String id,
- final PageReference pageReference,
- final SchemaTO schemaTO) {
+ public AbstractSchemaDetailsPanel(final String id, final SchemaTO schemaTO) {
super(id);
- this.schemaTO = schemaTO;
-
- schemaForm = new Form<>(FORM);
- schemaForm.setModel(new CompoundPropertyModel<>(schemaTO));
- schemaForm.setOutputMarkupId(true);
-
- final AjaxTextFieldPanel name =
- new AjaxTextFieldPanel("key", getString("key"), new PropertyModel<>(schemaTO, "key"));
- name.addRequiredLabel();
- name.setEnabled(schemaTO == null || schemaTO.getKey() == null || schemaTO.getKey().isEmpty());
-
- schemaForm.add(name);
- add(schemaForm);
+ AjaxTextFieldPanel key = new AjaxTextFieldPanel("key", getString("key"), new PropertyModel<>(schemaTO, "key"));
+ key.addRequiredLabel();
+ key.setEnabled(schemaTO == null || schemaTO.getKey() == null || schemaTO.getKey().isEmpty());
+ add(key);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassesPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassesPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassesPanel.java
index fcfe82d..8754d01 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassesPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassesPanel.java
@@ -56,7 +56,7 @@ public class AnyTypeClassesPanel extends TypesDirectoryPanel<
private static final long serialVersionUID = -2356760296223908382L;
public AnyTypeClassesPanel(final String id, final PageReference pageRef) {
- super(id, pageRef);
+ super(id, false, pageRef);
this.restClient = new AnyTypeClassRestClient();
disableCheckBoxes();
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypesPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypesPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypesPanel.java
index 22cdb72..132a05a 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypesPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypesPanel.java
@@ -55,7 +55,7 @@ public class AnyTypesPanel extends TypesDirectoryPanel<AnyTypeTO, AnyTypesPanel.
private static final long serialVersionUID = 3905038169553185171L;
public AnyTypesPanel(final String id, final PageReference pageRef) {
- super(id, pageRef);
+ super(id, false, pageRef);
this.restClient = new AnyTypeRestClient();
disableCheckBoxes();
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/panels/DerSchemaDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/DerSchemaDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/DerSchemaDetails.java
index eae157c..2f7d7ea 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/DerSchemaDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/DerSchemaDetails.java
@@ -21,7 +21,6 @@ package org.apache.syncope.client.console.panels;
import de.agilecoders.wicket.core.markup.html.bootstrap.components.TooltipConfig;
import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.common.lib.to.DerSchemaTO;
-import org.apache.wicket.PageReference;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.model.PropertyModel;
@@ -29,16 +28,13 @@ public class DerSchemaDetails extends AbstractSchemaDetailsPanel {
private static final long serialVersionUID = 6668789770131753386L;
- public DerSchemaDetails(final String id,
- final PageReference pageReference,
- final DerSchemaTO schemaTO) {
-
- super(id, pageReference, schemaTO);
+ public DerSchemaDetails(final String id, final DerSchemaTO schemaTO) {
+ super(id, schemaTO);
TextField<String> expression = new TextField<>("expression", new PropertyModel<>(schemaTO, "expression"));
expression.setRequired(true);
- schemaForm.add(expression);
+ add(expression);
- schemaForm.add(Constants.getJEXLPopover(this, TooltipConfig.Placement.right));
+ add(Constants.getJEXLPopover(this, TooltipConfig.Placement.right));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/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 187b172..c7e01fb 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
@@ -155,12 +155,12 @@ public class ParametersDetailsPanel extends Panel {
case Long:
panel = new AjaxSpinnerFieldPanel.Builder<Long>()
- .build(id, valueHeaderName, Long.class, new Model<Long>());
+ .build(id, valueHeaderName, Long.class, new Model<>());
break;
case Double:
panel = new AjaxSpinnerFieldPanel.Builder<Double>()
- .build(id, valueHeaderName, Double.class, new Model<Double>());
+ .build(id, valueHeaderName, Double.class, new Model<>());
break;
case Binary:
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java
index 3ec3c62..310864d 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java
@@ -42,7 +42,6 @@ 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.syncope.common.lib.types.ImplementationType;
-import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField;
import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -67,33 +66,28 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
private final MultiFieldPanel<String> enumerationKeys;
private final AjaxDropDownChoicePanel<String> validator;
-
+
private final AjaxDropDownChoicePanel<AttrSchemaType> type;
- public PlainSchemaDetails(
- final String id,
- final PageReference pageReference,
- final PlainSchemaTO schemaTO) {
+ public PlainSchemaDetails(final String id, final PlainSchemaTO schemaTO) {
+ super(id, schemaTO);
- super(id, pageReference, schemaTO);
-
- type = new AjaxDropDownChoicePanel<>(
- "type", getString("type"), new PropertyModel<AttrSchemaType>(schemaTO, "type"));
+ type = new AjaxDropDownChoicePanel<>("type", getString("type"), new PropertyModel<>(schemaTO, "type"));
type.setChoices(Arrays.asList(AttrSchemaType.values()));
type.setEnabled(schemaTO == null || schemaTO.getKey() == null || schemaTO.getKey().isEmpty());
type.addRequiredLabel();
- schemaForm.add(type);
+ add(type);
// long, double, date
final AjaxTextFieldPanel conversionPattern = new AjaxTextFieldPanel("conversionPattern",
getString("conversionPattern"), new PropertyModel<>(schemaTO, "conversionPattern"));
- schemaForm.add(conversionPattern);
+ add(conversionPattern);
final WebMarkupContainer conversionParams = new WebMarkupContainer("conversionParams");
conversionParams.setOutputMarkupPlaceholderTag(true);
conversionParams.add(conversionPattern);
- schemaForm.add(conversionParams);
+ add(conversionParams);
final WebMarkupContainer typeParams = new WebMarkupContainer("typeParams");
typeParams.setOutputMarkupPlaceholderTag(true);
@@ -211,7 +205,7 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
binaryParams.setOutputMarkupPlaceholderTag(true);
binaryParams.add(mimeType);
typeParams.add(binaryParams);
- schemaForm.add(typeParams);
+ add(typeParams);
// show or hide
showHide(schemaTO, type,
@@ -252,9 +246,10 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
validator.setOutputMarkupId(true);
((DropDownChoice) validator.getField()).setNullValid(true);
validator.setChoices(validators.getObject());
- schemaForm.add(validator);
+ add(validator);
- AutoCompleteTextField<String> mandatoryCondition = new AutoCompleteTextField<String>("mandatoryCondition") {
+ AutoCompleteTextField<String> mandatoryCondition = new AutoCompleteTextField<String>(
+ "mandatoryCondition", new PropertyModel<>(schemaTO, "mandatoryCondition")) {
private static final long serialVersionUID = -2428903969518079100L;
@@ -281,19 +276,18 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
protected void onUpdate(final AjaxRequestTarget target) {
}
});
- schemaForm.add(mandatoryCondition);
+ add(mandatoryCondition);
- schemaForm.add(Constants.getJEXLPopover(this, TooltipConfig.Placement.right));
+ add(Constants.getJEXLPopover(this, TooltipConfig.Placement.right));
- schemaForm.add(new AjaxCheckBoxPanel(
+ add(new AjaxCheckBoxPanel(
"multivalue", getString("multivalue"), new PropertyModel<>(schemaTO, "multivalue")));
- schemaForm.add(new AjaxCheckBoxPanel(
+ add(new AjaxCheckBoxPanel(
"readonly", getString("readonly"), new PropertyModel<>(schemaTO, "readonly")));
- schemaForm.add(new AjaxCheckBoxPanel("uniqueConstraint",
+ add(new AjaxCheckBoxPanel("uniqueConstraint",
getString("uniqueConstraint"), new PropertyModel<>(schemaTO, "uniqueConstraint")));
-
}
private void showHide(final PlainSchemaTO schema, final AjaxDropDownChoicePanel<AttrSchemaType> type,
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/panels/RelationshipTypesPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RelationshipTypesPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RelationshipTypesPanel.java
index 1f35056..939ac8c 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RelationshipTypesPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/RelationshipTypesPanel.java
@@ -57,7 +57,7 @@ public class RelationshipTypesPanel extends TypesDirectoryPanel<
private static final long serialVersionUID = -3731778000138547357L;
public RelationshipTypesPanel(final String id, final PageReference pageRef) {
- super(id, pageRef);
+ super(id, false, pageRef);
this.restClient = new RelationshipTypeRestClient();
disableCheckBoxes();
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java
deleted file mode 100644
index 8cb1817..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.console.panels;
-
-import java.util.Arrays;
-import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
-import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
-import org.apache.syncope.common.lib.to.SchemaTO;
-import org.apache.syncope.common.lib.to.DerSchemaTO;
-import org.apache.syncope.common.lib.to.PlainSchemaTO;
-import org.apache.syncope.common.lib.to.VirSchemaTO;
-import org.apache.syncope.common.lib.types.SchemaType;
-import org.apache.wicket.PageReference;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.model.Model;
-
-public class SchemaModalPanel extends AbstractModalPanel<SchemaTO> {
-
- private static final long serialVersionUID = -4681998932778822125L;
-
- private final AbstractSchemaDetailsPanel schemaPanel;
-
- private final SchemaTO schemaTO;
-
- public SchemaModalPanel(
- final BaseModal<SchemaTO> modal,
- final SchemaTO schemaTO,
- final PageReference pageRef) {
- super(modal, pageRef);
-
- this.schemaTO = schemaTO;
-
- final Form<SchemaType> kindForm = new Form<>("kindForm");
- add(kindForm);
-
- final AjaxDropDownChoicePanel<SchemaType> kind = new AjaxDropDownChoicePanel<>(
- "kind", getString("kind"), new Model<>());
- kind.setChoices(Arrays.asList(SchemaType.values()));
- kind.setOutputMarkupId(true);
-
- kind.setModelObject(SchemaType.fromToClass(schemaTO.getClass()));
- kind.setEnabled(false);
- kindForm.add(kind);
-
- schemaPanel = getSchemaPanel("details", SchemaType.fromToClass(schemaTO.getClass()), modal);
- schemaPanel.setOutputMarkupId(true);
- addOrReplace(schemaPanel);
- }
-
- private AbstractSchemaDetailsPanel getSchemaPanel(final String id,
- final SchemaType schemaType, final BaseModal<SchemaTO> modal) {
- final AbstractSchemaDetailsPanel panel;
-
- if (schemaTO.getKey() != null) {
- try {
- final Class<? extends SchemaTO> schemaTOClass = schemaType.getToClass();
- modal.setFormModel((SchemaTO) schemaTOClass.newInstance());
- } catch (InstantiationException | IllegalAccessException ex) {
- LOG.error("SchemaType not found", ex);
- }
- }
-
- switch (schemaType) {
- case DERIVED:
- panel = new DerSchemaDetails(id, pageRef, (DerSchemaTO) schemaTO);
- break;
-
- case VIRTUAL:
- panel = new VirSchemaDetails(id, pageRef, (VirSchemaTO) schemaTO);
- break;
-
- case PLAIN:
- default:
- panel = new PlainSchemaDetails(id, pageRef, (PlainSchemaTO) schemaTO);
- }
- panel.setOutputMarkupId(true);
- return panel;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
index 654fec9..e3737ec 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
@@ -39,9 +39,9 @@ import org.apache.syncope.client.console.panels.SchemaTypePanel.SchemaProvider;
import org.apache.syncope.client.console.rest.ConfRestClient;
import org.apache.syncope.client.console.rest.SchemaRestClient;
import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.BooleanPropertyColumn;
+import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
-import org.apache.syncope.client.console.wizards.AbstractModalPanelBuilder;
import org.apache.syncope.client.console.wizards.AjaxWizard;
import org.apache.syncope.common.lib.to.SchemaTO;
import org.apache.syncope.common.lib.to.AttrTO;
@@ -83,55 +83,29 @@ public class SchemaTypePanel extends TypesDirectoryPanel<SchemaTO, SchemaProvide
private String keyword;
public SchemaTypePanel(final String id, final SchemaType schemaType, final PageReference pageRef) {
- super(id, pageRef);
- this.restClient = new SchemaRestClient();
- disableCheckBoxes();
-
+ super(id, true, pageRef);
this.schemaType = schemaType;
- try {
- this.addNewItemPanelBuilder(
- new AbstractModalPanelBuilder<SchemaTO>(schemaType.getToClass().newInstance(), pageRef) {
-
- private static final long serialVersionUID = -6388405037134399367L;
-
- @Override
- public WizardModalPanel<SchemaTO> build(
- final String id, final int index, final AjaxWizard.Mode mode) {
+ disableCheckBoxes();
- final SchemaTO modelObject = newModelObject();
- return new SchemaModalPanel(modal, modelObject, pageRef) {
+ try {
+ addNewItemPanelBuilder(new SchemaTypeWizardBuilder(schemaType.getToClass().newInstance(), pageRef), true);
+ } catch (IllegalAccessException | InstantiationException e) {
+ LOG.error("Error creating instance of {}", schemaType, e);
+ }
- private static final long serialVersionUID = -6227956682141146095L;
+ this.restClient = new SchemaRestClient();
- @Override
- public void onSubmit(final AjaxRequestTarget target) {
- try {
- if (getOriginalItem() == null || StringUtils.isBlank(getOriginalItem().getKey())) {
- restClient.create(schemaType, modelObject);
- } else {
- restClient.update(schemaType, modelObject);
- }
-
- SchemaTypePanel.this.updateResultTable(target);
- SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
- modal.close(target);
- } catch (Exception e) {
- LOG.error("While creating or updating {}", modelObject, e);
- SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().
- getName() : e.getMessage());
- }
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
- }
- };
- }
- }, true);
+ initResultTable();
+ MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, StandardEntitlement.SCHEMA_CREATE);
+ }
- initResultTable();
- MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, StandardEntitlement.SCHEMA_CREATE);
- } catch (InstantiationException | IllegalAccessException e) {
- LOG.error("Error create new schema", e);
- }
+ @Override
+ protected void setWindowClosedReloadCallback(final BaseModal<?> modal) {
+ modal.setWindowClosedCallback(target -> {
+ target.add(SchemaTypePanel.this);
+ modal.show(false);
+ });
}
@Override
@@ -153,14 +127,14 @@ public class SchemaTypePanel extends TypesDirectoryPanel<SchemaTO, SchemaProvide
protected List<IColumn<SchemaTO, String>> getColumns() {
final List<IColumn<SchemaTO, String>> columns = new ArrayList<>();
- for (final String field : COL_NAMES.get(schemaType)) {
- final Field clazzField = ReflectionUtils.findField(schemaType.getToClass(), field);
+ for (String field : COL_NAMES.get(schemaType)) {
+ Field clazzField = ReflectionUtils.findField(schemaType.getToClass(), field);
if (clazzField != null) {
if (clazzField.getType().equals(Boolean.class) || clazzField.getType().equals(boolean.class)) {
columns.add(new BooleanPropertyColumn<>(new ResourceModel(field), field, field));
} else {
- final IColumn<SchemaTO, String> column = new PropertyColumn<SchemaTO, String>(
+ IColumn<SchemaTO, String> column = new PropertyColumn<SchemaTO, String>(
new ResourceModel(field), field, field) {
private static final long serialVersionUID = 3282547854226892169L;
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypeWizardBuilder.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypeWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypeWizardBuilder.java
new file mode 100644
index 0000000..099cb25
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypeWizardBuilder.java
@@ -0,0 +1,242 @@
+/*
+ * 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.client.console.panels;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Locale;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import org.apache.commons.lang3.LocaleUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.MutablePair;
+import org.apache.syncope.client.console.SyncopeConsoleApplication;
+import org.apache.syncope.client.console.rest.SchemaRestClient;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
+import org.apache.syncope.client.console.wizards.AjaxWizardBuilder;
+import org.apache.syncope.common.lib.to.DerSchemaTO;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.to.SchemaTO;
+import org.apache.syncope.common.lib.to.VirSchemaTO;
+import org.apache.syncope.common.lib.types.SchemaType;
+import org.apache.syncope.common.lib.types.StandardEntitlement;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
+import org.apache.wicket.extensions.wizard.WizardModel;
+import org.apache.wicket.extensions.wizard.WizardStep;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.model.util.ListModel;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.validation.ValidationError;
+
+public class SchemaTypeWizardBuilder extends AjaxWizardBuilder<SchemaTO> {
+
+ private static final long serialVersionUID = -3893521796674873644L;
+
+ private final SchemaRestClient restClient = new SchemaRestClient();
+
+ private final SchemaType schemaType;
+
+ private final ListModel<MutablePair<Locale, String>> translations = new ListModel<>(new ArrayList<>());
+
+ public SchemaTypeWizardBuilder(final SchemaTO schemaTO, final PageReference pageRef) {
+ super(schemaTO, pageRef);
+ this.schemaType = SchemaType.fromToClass(schemaTO.getClass());
+ }
+
+ @Override
+ protected Serializable onApplyInternal(final SchemaTO modelObject) {
+ modelObject.getLabels().clear();
+ modelObject.getLabels().putAll(translations.getObject().stream().
+ filter(Objects::nonNull).
+ filter(translation -> translation.getKey() != null).
+ filter(translation -> translation.getValue() != null).
+ collect(Collectors.toMap(MutablePair::getKey, MutablePair::getValue)));
+
+ if (getOriginalItem() == null || StringUtils.isBlank(getOriginalItem().getKey())) {
+ restClient.create(schemaType, modelObject);
+ } else {
+ restClient.update(schemaType, modelObject);
+ }
+
+ return null;
+ }
+
+ @Override
+ protected WizardModel buildModelSteps(final SchemaTO modelObject, final WizardModel wizardModel) {
+ wizardModel.add(new Details(modelObject));
+ wizardModel.add(new Labels(modelObject));
+ return wizardModel;
+ }
+
+ public class Details extends WizardStep {
+
+ private static final long serialVersionUID = 382498949020534783L;
+
+ public Details(final SchemaTO modelObject) {
+ AjaxDropDownChoicePanel<SchemaType> kind =
+ new AjaxDropDownChoicePanel<>("kind", getString("kind"), new Model<>());
+ kind.setChoices(Arrays.asList(SchemaType.values()));
+ kind.setOutputMarkupId(true);
+ kind.setModelObject(schemaType);
+ kind.setEnabled(false);
+ add(kind);
+
+ AbstractSchemaDetailsPanel detailsPanel;
+ switch (schemaType) {
+ case DERIVED:
+ detailsPanel = new DerSchemaDetails("details", (DerSchemaTO) modelObject);
+ break;
+
+ case VIRTUAL:
+ detailsPanel = new VirSchemaDetails("details", (VirSchemaTO) modelObject);
+ break;
+
+ case PLAIN:
+ default:
+ detailsPanel = new PlainSchemaDetails("details", (PlainSchemaTO) modelObject);
+ }
+ detailsPanel.setOutputMarkupId(true);
+ add(detailsPanel);
+ }
+ }
+
+ public class Labels extends WizardStep {
+
+ private static final long serialVersionUID = -3130973642912822270L;
+
+ public Labels(final SchemaTO modelObject) {
+ setTitleModel(new ResourceModel("translations"));
+ setOutputMarkupId(true);
+
+ translations.getObject().clear();
+ modelObject.getLabels().forEach((locale, display) -> {
+ translations.getObject().add(MutablePair.of(locale, display));
+ });
+
+ ListView<MutablePair<Locale, String>> labels =
+ new ListView<MutablePair<Locale, String>>("labels", translations) {
+
+ private static final long serialVersionUID = -8746795666847966508L;
+
+ @Override
+ protected void populateItem(final ListItem<MutablePair<Locale, String>> item) {
+ MutablePair<Locale, String> entry = item.getModelObject();
+
+ AjaxTextFieldPanel locale = new AjaxTextFieldPanel("locale", "locale", new Model<>(), true);
+ locale.getField().setModel(new IModel<String>() {
+
+ private static final long serialVersionUID = 1500045101360533133L;
+
+ @Override
+ public String getObject() {
+ return entry.getLeft() == null ? null : entry.getLeft().toString();
+ }
+
+ @Override
+ public void setObject(final String object) {
+ entry.setLeft(LocaleUtils.toLocale(object));
+ }
+ });
+ locale.setRequired(true).hideLabel();
+ locale.setChoices(SyncopeConsoleApplication.SUPPORTED_LOCALES.stream().
+ map(Objects::toString).collect(Collectors.toList()));
+ locale.addValidator(validatable -> {
+ try {
+ LocaleUtils.toLocale(validatable.getValue());
+ } catch (Exception e) {
+ LOG.error("Invalid Locale: {}", validatable.getValue(), e);
+ validatable.error(new ValidationError("Invalid Locale: " + validatable.getValue()));
+
+ RequestCycle.get().find(AjaxRequestTarget.class).ifPresent(target -> {
+ target.add(Labels.this);
+ });
+ }
+ });
+ item.add(locale);
+
+ AjaxTextFieldPanel display = new AjaxTextFieldPanel("display", "display", new Model<>());
+ display.getField().setModel(new IModel<String>() {
+
+ private static final long serialVersionUID = 1500045101360533133L;
+
+ @Override
+ public String getObject() {
+ return entry.getRight();
+ }
+
+ @Override
+ public void setObject(final String object) {
+ entry.setRight(object);
+ }
+ });
+ display.setRequired(true).hideLabel();
+ item.add(display);
+
+ ActionsPanel<Serializable> actions = new ActionsPanel<>("toRemove", null);
+ actions.add(new ActionLink<Serializable>() {
+
+ private static final long serialVersionUID = -3722207913631435501L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
+ int index = -1;
+ for (int i = 0; i < translations.getObject().size() && index == -1; i++) {
+ if (entry.equals(translations.getObject().get(i))) {
+ index = i;
+ }
+ }
+
+ if (index != -1) {
+ translations.getObject().remove(index);
+ item.getParent().removeAll();
+ target.add(Labels.this);
+ }
+ }
+ }, ActionLink.ActionType.DELETE, StandardEntitlement.SCHEMA_UPDATE, true).hideLabel();
+ item.add(actions);
+ }
+ };
+ labels.setReuseItems(true);
+ add(labels);
+
+ IndicatingAjaxButton addLabel = new IndicatingAjaxButton("addLabel") {
+
+ private static final long serialVersionUID = -4804368561204623354L;
+
+ @Override
+ protected void onSubmit(final AjaxRequestTarget target) {
+ translations.getObject().add(MutablePair.of(null, null));
+ target.add(Labels.this);
+ }
+ };
+ addLabel.setDefaultFormProcessing(false);
+ add(addLabel);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/panels/TypesDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/TypesDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/TypesDirectoryPanel.java
index 119af0a..8aa4b80 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/TypesDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/TypesDirectoryPanel.java
@@ -30,10 +30,13 @@ public abstract class TypesDirectoryPanel<
private static final long serialVersionUID = 7890071604330629259L;
- public TypesDirectoryPanel(final String id, final PageReference pageRef) {
+ public TypesDirectoryPanel(final String id, final boolean withWizard, final PageReference pageRef) {
super(id, pageRef);
- setFooterVisibility(true);
- modal.addSubmitButton();
+
+ if (!withWizard) {
+ setFooterVisibility(true);
+ modal.addSubmitButton();
+ }
modal.size(Modal.Size.Large);
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
index ef30352..5b27c83 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
@@ -39,7 +39,6 @@ import org.apache.syncope.common.lib.to.EntityTO;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.to.VirSchemaTO;
import org.apache.syncope.common.lib.types.StandardEntitlement;
-import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.model.PropertyModel;
@@ -47,6 +46,8 @@ public class VirSchemaDetails extends AbstractSchemaDetailsPanel {
private static final long serialVersionUID = 5979623248182851337L;
+ private final ConnectorRestClient connectorRestClient = new ConnectorRestClient();
+
private final ResourceRestClient resourceRestClient = new ResourceRestClient();
private final ConnectorRestClient connRestClient = new ConnectorRestClient();
@@ -57,15 +58,12 @@ public class VirSchemaDetails extends AbstractSchemaDetailsPanel {
private ResourceTO selectedResource;
- public VirSchemaDetails(final String id,
- final PageReference pageReference,
- final VirSchemaTO schemaTO) {
-
- super(id, pageReference, schemaTO);
+ public VirSchemaDetails(final String id, final VirSchemaTO schemaTO) {
+ super(id, schemaTO);
AjaxCheckBoxPanel readonly = new AjaxCheckBoxPanel("readonly", getString("readonly"),
new PropertyModel<>(schemaTO, "readonly"));
- schemaForm.add(readonly);
+ add(readonly);
final AjaxDropDownChoicePanel<String> resource = new AjaxDropDownChoicePanel<>(
"resource", getString("resource"), new PropertyModel<String>(schemaTO, "resource"), false).
@@ -76,7 +74,7 @@ public class VirSchemaDetails extends AbstractSchemaDetailsPanel {
if (resource.getModelObject() != null) {
populateAnyTypes(resource.getModelObject());
}
- schemaForm.add(resource);
+ add(resource);
anyType = new AjaxDropDownChoicePanel<>(
"anyType", getString("anyType"), new PropertyModel<String>(schemaTO, "anyType"), false).
@@ -88,7 +86,7 @@ public class VirSchemaDetails extends AbstractSchemaDetailsPanel {
if (resource.getModelObject() == null) {
anyType.setEnabled(false);
}
- schemaForm.add(anyType);
+ add(anyType);
final AjaxTextFieldPanel extAttrName = new AjaxTextFieldPanel(
"extAttrName", getString("extAttrName"), new PropertyModel<>(schemaTO, "extAttrName"));
@@ -97,9 +95,7 @@ public class VirSchemaDetails extends AbstractSchemaDetailsPanel {
if (selectedResource != null) {
extAttrName.setChoices(getExtAttrNames());
}
- schemaForm.add(extAttrName);
-
- add(schemaForm);
+ add(extAttrName);
resource.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
@@ -125,7 +121,7 @@ public class VirSchemaDetails extends AbstractSchemaDetailsPanel {
@Override
protected void onUpdate(final AjaxRequestTarget target) {
if (selectedResource != null) {
- String adminRealm = getAdminRealm(selectedResource.getKey());
+ String adminRealm = getAdminRealm(selectedResource.getConnector());
if (SyncopeConsoleSession.get().owns(StandardEntitlement.CONNECTOR_READ, adminRealm)) {
extAttrName.setChoices(getExtAttrNames());
@@ -139,7 +135,7 @@ public class VirSchemaDetails extends AbstractSchemaDetailsPanel {
private String getAdminRealm(final String connectorKey) {
String adminRealm = null;
try {
- adminRealm = new ConnectorRestClient().read(connectorKey).getAdminRealm();
+ adminRealm = connectorRestClient.read(connectorKey).getAdminRealm();
} catch (Exception e) {
LOG.error("Could not read Admin Realm for External Resource {}", selectedResource.getKey());
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AbstractFieldPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AbstractFieldPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AbstractFieldPanel.java
index 305a97b..115349b 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AbstractFieldPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AbstractFieldPanel.java
@@ -34,7 +34,7 @@ public abstract class AbstractFieldPanel<T> extends Panel {
private static final long serialVersionUID = 5958017546318855690L;
- private static final String LABEL = "field-label";
+ public static final String LABEL = "field-label";
protected boolean isRequiredLabelAdded = false;
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxTextFieldPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxTextFieldPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxTextFieldPanel.java
index 16b7db5..8d0c665 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxTextFieldPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxTextFieldPanel.java
@@ -19,7 +19,6 @@
package org.apache.syncope.client.console.wicket.markup.html.form;
import de.agilecoders.wicket.core.markup.html.bootstrap.components.TooltipConfig;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -115,17 +114,8 @@ public class AjaxTextFieldPanel extends FieldPanel<String> implements Cloneable
}
protected Iterator<String> getChoices(final String input) {
- final Pattern pattern = Pattern.compile(".*" + Pattern.quote(input) + ".*", Pattern.CASE_INSENSITIVE);
-
- final List<String> result = new ArrayList<>();
-
- for (String choice : choices) {
- if (pattern.matcher(choice).matches()) {
- result.add(choice);
- }
- }
-
- return result.iterator();
+ Pattern pattern = Pattern.compile(".*" + Pattern.quote(input) + ".*", Pattern.CASE_INSENSITIVE);
+ return choices.stream().filter(choice -> pattern.matcher(choice).matches()).iterator();
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/MultiFieldPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/MultiFieldPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/MultiFieldPanel.java
index 2da1fa7..367591e 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/MultiFieldPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/MultiFieldPanel.java
@@ -41,7 +41,7 @@ public abstract class MultiFieldPanel<E extends Serializable> extends AbstractMu
public static class Builder<E extends Serializable> implements Serializable {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -5304396077613727937L;
private final IModel<List<E>> model;
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/wizards/AbstractMappingPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AbstractMappingPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/AbstractMappingPanel.java
index 18170d7..5e96300 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AbstractMappingPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/AbstractMappingPanel.java
@@ -365,7 +365,7 @@ public abstract class AbstractMappingPanel extends Panel {
mappings.setReuseItems(true);
mappingContainer.add(mappings);
- addMappingBtn = new IndicatingAjaxButton("addMappingBtn", new ResourceModel("add")) {
+ addMappingBtn = new IndicatingAjaxButton("addMappingBtn") {
private static final long serialVersionUID = -4804368561204623354L;
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/wizards/WizardMgtPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/WizardMgtPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/WizardMgtPanel.java
index 7f52dd1..9cca5ae 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/WizardMgtPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/WizardMgtPanel.java
@@ -37,7 +37,6 @@ import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.event.Broadcast;
import org.apache.wicket.event.IEvent;
import org.apache.wicket.event.IEventSource;
-import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
@@ -360,14 +359,8 @@ public abstract class WizardMgtPanel<T extends Serializable> extends Panel imple
* @param modal target modal.
*/
protected void setWindowClosedReloadCallback(final BaseModal<?> modal) {
- modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
-
- private static final long serialVersionUID = 8804221891699487139L;
-
- @Override
- public void onClose(final AjaxRequestTarget target) {
- modal.show(false);
- }
+ modal.setWindowClosedCallback(target -> {
+ modal.show(false);
});
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DerAttrs.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DerAttrs.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DerAttrs.java
index ccb378e..f064402 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DerAttrs.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DerAttrs.java
@@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.tabs.Accordion;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.common.lib.EntityTOUtils;
@@ -64,13 +65,13 @@ public class DerAttrs extends AbstractAttrs<DerSchemaTO> {
@Override
public WebMarkupContainer getPanel(final String panelId) {
- return new DerAttrs.DerSchemas(panelId, attrTOs);
+ return new DerAttrs.DerSchemas(panelId, schemas, attrTOs);
}
}), Model.of(0)).setOutputMarkupId(true));
add(new ListView<MembershipTO>("membershipsDerSchemas", membershipTOs) {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 6741044372185745296L;
@Override
protected void populateItem(final ListItem<MembershipTO> item) {
@@ -85,7 +86,10 @@ public class DerAttrs extends AbstractAttrs<DerSchemaTO> {
@Override
public WebMarkupContainer getPanel(final String panelId) {
- return new DerAttrs.DerSchemas(panelId, new ListModel<>(getAttrsFromTO(membershipTO)));
+ return new DerAttrs.DerSchemas(
+ panelId,
+ membershipSchemas.get(membershipTO.getGroupKey()),
+ new ListModel<>(getAttrsFromTO(membershipTO)));
}
}), Model.of(-1)).setOutputMarkupId(true));
}
@@ -133,7 +137,7 @@ public class DerAttrs extends AbstractAttrs<DerSchemaTO> {
Map<String, AttrTO> attrMap = EntityTOUtils.buildAttrMap(anyTO.getDerAttrs());
- for (DerSchemaTO schema : membershipSchemas.get(membershipTO.getGroupKey()).values()) {
+ membershipSchemas.get(membershipTO.getGroupKey()).values().forEach(schema -> {
AttrTO attrTO = new AttrTO();
attrTO.setSchema(schema.getKey());
if (attrMap.containsKey(schema.getKey())) {
@@ -141,7 +145,7 @@ public class DerAttrs extends AbstractAttrs<DerSchemaTO> {
}
attrs.add(attrTO);
- }
+ });
membershipTO.getDerAttrs().clear();
membershipTO.getDerAttrs().addAll(attrs);
@@ -151,7 +155,10 @@ public class DerAttrs extends AbstractAttrs<DerSchemaTO> {
private static final long serialVersionUID = -4730563859116024676L;
- public DerSchemas(final String id, final IModel<List<AttrTO>> attrTOs) {
+ public DerSchemas(
+ final String id,
+ final Map<String, DerSchemaTO> schemas,
+ final IModel<List<AttrTO>> attrTOs) {
super(id);
add(new ListView<AttrTO>("schemas", attrTOs) {
@@ -176,7 +183,11 @@ public class DerAttrs extends AbstractAttrs<DerSchemaTO> {
model = new Model<>(values.get(0));
}
- AjaxTextFieldPanel panel = new AjaxTextFieldPanel("panel", attrTO.getSchema(), model, false);
+ AjaxTextFieldPanel panel = new AjaxTextFieldPanel(
+ "panel",
+ schemas.get(attrTO.getSchema()).getLabel(SyncopeConsoleSession.get().getLocale()),
+ model,
+ false);
panel.setEnabled(false);
panel.setRequired(true);
panel.setOutputMarkupId(true);
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java
index d25d0f0..3fcecf5 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java
@@ -25,6 +25,7 @@ import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.commons.SchemaUtils;
import org.apache.syncope.client.console.wicket.ajax.markup.html.LabelInfo;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.tabs.Accordion;
@@ -166,7 +167,7 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
Map<String, AttrTO> attrMap = EntityTOUtils.buildAttrMap(anyTO.getPlainAttrs());
- schemas.values().stream().map(schema -> {
+ attrs.addAll(schemas.values().stream().map(schema -> {
AttrTO attrTO = new AttrTO();
attrTO.setSchema(schema.getKey());
if (attrMap.get(schema.getKey()) == null || attrMap.get(schema.getKey()).getValues().isEmpty()) {
@@ -178,9 +179,7 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
attrTO = attrMap.get(schema.getKey());
}
return attrTO;
- }).forEachOrdered(attrTO -> {
- attrs.add(attrTO);
- });
+ }).collect(Collectors.toList()));
anyTO.getPlainAttrs().clear();
anyTO.getPlainAttrs().addAll(attrs);
@@ -192,7 +191,7 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
Map<String, AttrTO> attrMap = EntityTOUtils.buildAttrMap(membershipTO.getPlainAttrs());
- membershipSchemas.get(membershipTO.getGroupKey()).values().stream().
+ attrs.addAll(membershipSchemas.get(membershipTO.getGroupKey()).values().stream().
map(schema -> {
AttrTO attrTO = new AttrTO();
attrTO.setSchema(schema.getKey());
@@ -205,9 +204,7 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
attrTO.getValues().addAll(attrMap.get(schema.getKey()).getValues());
}
return attrTO;
- }).forEachOrdered(attrTO -> {
- attrs.add(attrTO);
- });
+ }).collect(Collectors.toList()));
membershipTO.getPlainAttrs().clear();
membershipTO.getPlainAttrs().addAll(attrs);
@@ -236,19 +233,31 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
FieldPanel panel;
switch (type) {
case Boolean:
- panel = new AjaxCheckBoxPanel("panel", schemaTO.getKey(), new Model<>(), true);
+ panel = new AjaxCheckBoxPanel(
+ "panel",
+ schemaTO.getLabel(SyncopeConsoleSession.get().getLocale()),
+ new Model<>(),
+ true);
panel.setRequired(required);
break;
case Date:
- String dataPattern = schemaTO.getConversionPattern() == null
+ String datePattern = schemaTO.getConversionPattern() == null
? SyncopeConstants.DEFAULT_DATE_PATTERN
: schemaTO.getConversionPattern();
- if (dataPattern.contains("H")) {
- panel = new AjaxDateTimeFieldPanel("panel", schemaTO.getKey(), new Model<>(), dataPattern);
+ if (datePattern.contains("H")) {
+ panel = new AjaxDateTimeFieldPanel(
+ "panel",
+ schemaTO.getLabel(SyncopeConsoleSession.get().getLocale()),
+ new Model<>(),
+ datePattern);
} else {
- panel = new AjaxDateFieldPanel("panel", schemaTO.getKey(), new Model<>(), dataPattern);
+ panel = new AjaxDateFieldPanel(
+ "panel",
+ schemaTO.getLabel(SyncopeConsoleSession.get().getLocale()),
+ new Model<>(),
+ datePattern);
}
if (required) {
@@ -258,7 +267,8 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
break;
case Enum:
- panel = new AjaxDropDownChoicePanel<>("panel", schemaTO.getKey(), new Model<>(), true);
+ panel = new AjaxDropDownChoicePanel<>("panel",
+ schemaTO.getLabel(SyncopeConsoleSession.get().getLocale()), new Model<>(), true);
((AjaxDropDownChoicePanel<String>) panel).setChoices(SchemaUtils.getEnumeratedValues(schemaTO));
if (StringUtils.isNotBlank(schemaTO.getEnumerationKeys())) {
@@ -292,8 +302,11 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
break;
case Long:
- panel = new AjaxSpinnerFieldPanel.Builder<Long>().enableOnChange().
- build("panel", schemaTO.getKey(), Long.class, new Model<Long>());
+ panel = new AjaxSpinnerFieldPanel.Builder<Long>().enableOnChange().build(
+ "panel",
+ schemaTO.getLabel(SyncopeConsoleSession.get().getLocale()),
+ Long.class,
+ new Model<>());
if (required) {
panel.addRequiredLabel();
@@ -301,8 +314,11 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
break;
case Double:
- panel = new AjaxSpinnerFieldPanel.Builder<Double>().enableOnChange().step(0.1).
- build("panel", schemaTO.getKey(), Double.class, new Model<Double>());
+ panel = new AjaxSpinnerFieldPanel.Builder<Double>().enableOnChange().step(0.1).build(
+ "panel",
+ schemaTO.getLabel(SyncopeConsoleSession.get().getLocale()),
+ Double.class,
+ new Model<>());
if (required) {
panel.addRequiredLabel();
@@ -310,15 +326,19 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
break;
case Binary:
- final PageReference pageReference = getPageReference();
- panel = new BinaryFieldPanel("panel", schemaTO.getKey(), new Model<>(), schemaTO.getMimeType(),
+ final PageReference pageRef = getPageReference();
+ panel = new BinaryFieldPanel(
+ "panel",
+ schemaTO.getLabel(SyncopeConsoleSession.get().getLocale()),
+ new Model<>(),
+ schemaTO.getMimeType(),
fileKey) {
private static final long serialVersionUID = -3268213909514986831L;
@Override
protected PageReference getPageReference() {
- return pageReference;
+ return pageRef;
}
};
@@ -328,7 +348,8 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
break;
case Encrypted:
- panel = new EncryptedFieldPanel("panel", schemaTO.getKey(), new Model<>(), true);
+ panel = new EncryptedFieldPanel("panel",
+ schemaTO.getLabel(SyncopeConsoleSession.get().getLocale()), new Model<>(), true);
if (required) {
panel.addRequiredLabel();
@@ -336,7 +357,8 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
break;
default:
- panel = new AjaxTextFieldPanel("panel", schemaTO.getKey(), new Model<>(), true);
+ panel = new AjaxTextFieldPanel("panel",
+ schemaTO.getLabel(SyncopeConsoleSession.get().getLocale()), new Model<>(), true);
if (jexlHelp) {
AjaxTextFieldPanel.class.cast(panel).enableJexlHelp();
@@ -358,7 +380,7 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
public PlainSchemas(
final String id,
- final Map<String, PlainSchemaTO> availableSchemas,
+ final Map<String, PlainSchemaTO> schemas,
final IModel<List<AttrTO>> attrTOs) {
super(id);
@@ -371,9 +393,9 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
protected void populateItem(final ListItem<AttrTO> item) {
AttrTO attrTO = item.getModelObject();
- AbstractFieldPanel<?> panel = getFieldPanel(availableSchemas.get(attrTO.getSchema()));
+ AbstractFieldPanel<?> panel = getFieldPanel(schemas.get(attrTO.getSchema()));
if (mode == AjaxWizard.Mode.TEMPLATE
- || !availableSchemas.get(attrTO.getSchema()).isMultivalue()) {
+ || !schemas.get(attrTO.getSchema()).isMultivalue()) {
FieldPanel.class.cast(panel).setNewModel(attrTO.getValues());
} else {
panel = new MultiFieldPanel.Builder<>(
@@ -382,7 +404,7 @@ public class PlainAttrs extends AbstractAttrs<PlainSchemaTO> {
attrTO.getSchema(),
FieldPanel.class.cast(panel));
// SYNCOPE-1215 the entire multifield panel must be readonly, not only its field
- ((MultiFieldPanel) panel).setReadOnly(availableSchemas.get(attrTO.getSchema()).isReadonly());
+ ((MultiFieldPanel) panel).setReadOnly(schemas.get(attrTO.getSchema()).isReadonly());
}
item.add(panel);
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/VirAttrs.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/VirAttrs.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/VirAttrs.java
index ebea4b7..7850fe9 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/VirAttrs.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/VirAttrs.java
@@ -23,8 +23,8 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
-import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.wicket.ajax.markup.html.LabelInfo;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.tabs.Accordion;
import org.apache.syncope.client.console.wicket.markup.html.form.AbstractFieldPanel;
@@ -76,7 +76,7 @@ public class VirAttrs extends AbstractAttrs<VirSchemaTO> {
@Override
public WebMarkupContainer getPanel(final String panelId) {
- return new VirAttrs.VirSchemas(panelId, attrTOs);
+ return new VirAttrs.VirSchemas(panelId, schemas, attrTOs);
}
}), Model.of(0)).setOutputMarkupId(true));
@@ -95,7 +95,10 @@ public class VirAttrs extends AbstractAttrs<VirSchemaTO> {
@Override
public WebMarkupContainer getPanel(final String panelId) {
- return new VirAttrs.VirSchemas(panelId, new ListModel<>(getAttrsFromTO(membershipTO)));
+ return new VirAttrs.VirSchemas(
+ panelId,
+ membershipSchemas.get(membershipTO.getGroupKey()),
+ new ListModel<>(getAttrsFromTO(membershipTO)));
}
}), Model.of(-1)).setOutputMarkupId(true));
}
@@ -123,7 +126,7 @@ public class VirAttrs extends AbstractAttrs<VirSchemaTO> {
Map<String, AttrTO> attrMap = EntityTOUtils.buildAttrMap(anyTO.getVirAttrs());
- schemas.values().stream().map(schema -> {
+ attrs.addAll(schemas.values().stream().map(schema -> {
AttrTO attrTO = new AttrTO();
attrTO.setSchema(schema.getKey());
if (attrMap.containsKey(schema.getKey())) {
@@ -132,9 +135,7 @@ public class VirAttrs extends AbstractAttrs<VirSchemaTO> {
attrTO.getValues().add(StringUtils.EMPTY);
}
return attrTO;
- }).forEachOrdered(attrTO -> {
- attrs.add(attrTO);
- });
+ }).collect(Collectors.toList()));
anyTO.getVirAttrs().clear();
anyTO.getVirAttrs().addAll(attrs);
@@ -146,7 +147,7 @@ public class VirAttrs extends AbstractAttrs<VirSchemaTO> {
Map<String, AttrTO> attrMap = EntityTOUtils.buildAttrMap(anyTO.getVirAttrs());
- membershipSchemas.get(membershipTO.getGroupKey()).values().stream().map(schema -> {
+ attrs.addAll(membershipSchemas.get(membershipTO.getGroupKey()).values().stream().map(schema -> {
AttrTO attrTO = new AttrTO();
attrTO.setSchema(schema.getKey());
if (attrMap.containsKey(schema.getKey())) {
@@ -155,9 +156,7 @@ public class VirAttrs extends AbstractAttrs<VirSchemaTO> {
attrTO.getValues().add(StringUtils.EMPTY);
}
return attrTO;
- }).forEachOrdered(attrTO -> {
- attrs.add(attrTO);
- });
+ }).collect(Collectors.toList()));
membershipTO.getVirAttrs().clear();
membershipTO.getVirAttrs().addAll(attrs);
@@ -167,7 +166,10 @@ public class VirAttrs extends AbstractAttrs<VirSchemaTO> {
private static final long serialVersionUID = -4730563859116024676L;
- public VirSchemas(final String id, final IModel<List<AttrTO>> attrTOs) {
+ public VirSchemas(
+ final String id,
+ final Map<String, VirSchemaTO> schemas,
+ final IModel<List<AttrTO>> attrTOs) {
super(id);
add(new ListView<AttrTO>("schemas", attrTOs) {
@@ -179,8 +181,11 @@ public class VirAttrs extends AbstractAttrs<VirSchemaTO> {
protected void populateItem(final ListItem<AttrTO> item) {
AttrTO attrTO = item.getModelObject();
- AbstractFieldPanel<?> panel =
- new AjaxTextFieldPanel("panel", attrTO.getSchema(), new Model<>(), false);
+ AbstractFieldPanel<?> panel = new AjaxTextFieldPanel(
+ "panel",
+ schemas.get(attrTO.getSchema()).getLabel(SyncopeConsoleSession.get().getLocale()),
+ new Model<>(),
+ false);
boolean readonly = attrTO.getSchemaInfo() == null
? false
@@ -192,21 +197,21 @@ public class VirAttrs extends AbstractAttrs<VirSchemaTO> {
panel = new MultiFieldPanel.Builder<>(
new PropertyModel<List<String>>(attrTO, "values")).build(
"panel",
- attrTO.getSchema(),
+ schemas.get(attrTO.getSchema()).getLabel(SyncopeConsoleSession.get().getLocale()),
AjaxTextFieldPanel.class.cast(panel));
panel.setEnabled(!readonly);
}
item.add(panel);
- if (CollectionUtils.isNotEmpty(attrTO.getValues())
+ if (!attrTO.getValues().isEmpty()
&& VirAttrs.this.modelObject instanceof UserWrapper
&& UserWrapper.class.cast(VirAttrs.this.modelObject).getPreviousUserTO() != null) {
+
panel.showExternAction(new LabelInfo("externalAction", StringUtils.EMPTY));
}
}
- }
- );
+ });
}
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/resources/org/apache/syncope/client/console/panels/DerSchemaDetails.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/DerSchemaDetails.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/DerSchemaDetails.html
index 2e8e59f..f78b16f 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/DerSchemaDetails.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/DerSchemaDetails.html
@@ -18,19 +18,13 @@ under the License.
-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
- <div style="margin: 5px;">
- <form wicket:id="form">
- <div id="formtable">
- <div class="form-group">
- <span wicket:id="key">[name]</span>
- </div>
- <div class="form-group">
- <label for="expression"><wicket:message key="expression"/> *</label>
- <input type="text" id="expression" class="form-control col-xs-4" wicket:id="expression"/>
- <span id="popover" wicket:id="jexlInfo" class="glyphicon glyphicon-info-sign"></span>
- </div>
- </div>
- </form>
+ <div class="form-group">
+ <span wicket:id="key">[name]</span>
+ </div>
+ <div class="form-group">
+ <label for="expression"><wicket:message key="expression"/> *</label>
+ <input type="text" id="expression" class="form-control col-xs-4" wicket:id="expression"/>
+ <span id="popover" wicket:id="jexlInfo" class="glyphicon glyphicon-info-sign"></span>
</div>
</wicket:panel>
</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/d7d06bc0/client/console/src/main/resources/org/apache/syncope/client/console/panels/PlainSchemaDetails.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/PlainSchemaDetails.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/PlainSchemaDetails.html
index d4fff44..ac334de 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/PlainSchemaDetails.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/PlainSchemaDetails.html
@@ -18,62 +18,60 @@ under the License.
-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
- <form wicket:id="form">
- <div class="form-group">
- <span wicket:id="key">[name]</span>
- </div>
- <div class="form-group">
- <span wicket:id="type">[type]</span>
- </div>
+ <div class="form-group">
+ <span wicket:id="key">[name]</span>
+ </div>
+ <div class="form-group">
+ <span wicket:id="type">[type]</span>
+ </div>
- <div class="form-group" wicket:id="conversionParams">
- <span wicket:id="conversionPattern">[conversionPattern]</span>
- </div>
+ <div class="form-group" wicket:id="conversionParams">
+ <span wicket:id="conversionPattern">[conversionPattern]</span>
+ </div>
- <div class="form-group" wicket:id="typeParams">
- <div wicket:id="enumParams">
- <div class="form-group">
- <span wicket:id="enumerationValues">[enumerationValues]</span>
- </div>
- <div class="form-group">
- <span wicket:id="enumerationKeys">[enumerationKeys]</span>
- </div>
+ <div class="form-group" wicket:id="typeParams">
+ <div wicket:id="enumParams">
+ <div class="form-group">
+ <span wicket:id="enumerationValues">[enumerationValues]</span>
+ </div>
+ <div class="form-group">
+ <span wicket:id="enumerationKeys">[enumerationKeys]</span>
+ </div>
+ </div>
+ <div wicket:id="encryptedParams">
+ <div class="form-group">
+ <span wicket:id="secretKey">[secretKey]</span>
</div>
- <div wicket:id="encryptedParams">
- <div class="form-group">
- <span wicket:id="secretKey">[secretKey]</span>
- </div>
- <div class="form-group">
- <span wicket:id="cipherAlgorithm">[cipherAlgorithm]</span>
- </div>
+ <div class="form-group">
+ <span wicket:id="cipherAlgorithm">[cipherAlgorithm]</span>
</div>
- <div wicket:id="binaryParams">
- <div class="form-group">
- <span wicket:id="mimeType">[mimeType]</span>
- </div>
+ </div>
+ <div wicket:id="binaryParams">
+ <div class="form-group">
+ <span wicket:id="mimeType">[mimeType]</span>
</div>
</div>
+ </div>
+ <div class="form-group">
+ <span wicket:id="validator">[validator]</span>
+ </div>
+
+ <div class="form-group">
+ <label for="mandatoryCondition"><wicket:message key="mandatoryCondition"/></label>
+ <input type="text" id="mandatoryCondition" class="form-control col-xs-4" wicket:id="mandatoryCondition"/>
+ <span id="popover" wicket:id="jexlInfo" class="glyphicon glyphicon-info-sign"></span>
+ </div>
+ <div class="form-group">
<div class="form-group">
- <span wicket:id="validator">[validator]</span>
+ <span wicket:id="uniqueConstraint">[uniqueConstraint]</span>
</div>
-
<div class="form-group">
- <label for="mandatoryCondition"><wicket:message key="mandatoryCondition"/></label>
- <input type="text" id="mandatoryCondition" class="form-control col-xs-4" wicket:id="mandatoryCondition"/>
- <span id="popover" wicket:id="jexlInfo" class="glyphicon glyphicon-info-sign"></span>
+ <span wicket:id="multivalue">[multivalue]</span>
</div>
<div class="form-group">
- <div class="form-group">
- <span wicket:id="uniqueConstraint">[uniqueConstraint]</span>
- </div>
- <div class="form-group">
- <span wicket:id="multivalue">[multivalue]</span>
- </div>
- <div class="form-group">
- <span wicket:id="readonly">[readonly]</span>
- </div>
+ <span wicket:id="readonly">[readonly]</span>
</div>
- </form>
+ </div>
</wicket:panel>
</html>