From 03021223bfd201408bb6ffc7f722435f2d8812c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francesco=20Chicchiricc=C3=B2?= Date: Fri, 18 Oct 2024 15:53:39 +0200 Subject: [PATCH] [SYNCOPE-1831] Fixing Core and Console to save SCIM general conf --- .../html/form/AjaxNumberFieldPanel.java | 141 +++++++++++++ .../html/form/AjaxNumberFieldPanel.html | 28 +++ .../client/console/pages/SCIMConfPage.java | 48 +---- .../panels/SCIMConfEnterpriseUserPanel.java | 199 +++++++++--------- .../panels/SCIMConfExtensionUserPanel.java | 14 +- .../console/panels/SCIMConfGeneralPanel.java | 88 +++----- .../console/panels/SCIMConfGroupPanel.java | 10 +- .../client/console/panels/SCIMConfPanel.java | 74 ++----- .../console/panels/SCIMConfTabPanel.java | 3 +- .../console/panels/SCIMConfUserPanel.java | 121 ++++++----- ...el.java => SCIMExtensionMappingPanel.java} | 8 +- .../client/console/pages/SCIMConfPage.html | 4 +- .../console/panels/SCIMConfGeneralPanel.html | 23 +- ...el.html => SCIMExtensionMappingPanel.html} | 2 +- ...s => SCIMExtensionMappingPanel.properties} | 0 ...> SCIMExtensionMappingPanel_fr.properties} | 0 ...> SCIMExtensionMappingPanel_it.properties} | 0 ...> SCIMExtensionMappingPanel_ja.properties} | 0 ...CIMExtensionMappingPanel_pt_BR.properties} | 0 ...> SCIMExtensionMappingPanel_ru.properties} | 0 .../core/logic/scim/SCIMConfManager.java | 35 +-- 21 files changed, 423 insertions(+), 375 deletions(-) create mode 100644 client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/AjaxNumberFieldPanel.java create mode 100644 client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxNumberFieldPanel.html rename ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/mapping/{SCIMExtentionMappingPanel.java => SCIMExtensionMappingPanel.java} (98%) rename ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/{SCIMExtentionMappingPanel.html => SCIMExtensionMappingPanel.html} (98%) rename ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/{SCIMExtentionMappingPanel.properties => SCIMExtensionMappingPanel.properties} (100%) rename ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/{SCIMExtentionMappingPanel_fr.properties => SCIMExtensionMappingPanel_fr.properties} (100%) rename ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/{SCIMExtentionMappingPanel_it.properties => SCIMExtensionMappingPanel_it.properties} (100%) rename ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/{SCIMExtentionMappingPanel_ja.properties => SCIMExtensionMappingPanel_ja.properties} (100%) rename ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/{SCIMExtentionMappingPanel_pt_BR.properties => SCIMExtensionMappingPanel_pt_BR.properties} (100%) rename ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/{SCIMExtentionMappingPanel_ru.properties => SCIMExtensionMappingPanel_ru.properties} (100%) diff --git a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/AjaxNumberFieldPanel.java b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/AjaxNumberFieldPanel.java new file mode 100644 index 00000000000..ff20240e401 --- /dev/null +++ b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/AjaxNumberFieldPanel.java @@ -0,0 +1,141 @@ +/* + * 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.ui.commons.markup.html.form; + +import com.googlecode.wicket.jquery.core.Options; +import com.googlecode.wicket.kendo.ui.form.NumberTextField; +import org.apache.syncope.client.ui.commons.Constants; +import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.ResourceModel; + +public final class AjaxNumberFieldPanel> extends FieldPanel { + + private static final long serialVersionUID = 6413819574530703577L; + + private final IModel model; + + private final Options options; + + private final boolean enableOnChange; + + private AjaxNumberFieldPanel( + final String id, + final String name, + final IModel model, + final Options options, + final boolean enableOnChange) { + + super(id, name, model); + + this.model = model; + this.options = options; + this.enableOnChange = enableOnChange; + + field = new NumberTextField<>("numberTextField", model, options); + + if (enableOnChange && !isReadOnly()) { + field.add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { + + private static final long serialVersionUID = -1107858522700306810L; + + @Override + protected void onUpdate(final AjaxRequestTarget target) { + // nothing to do + } + }); + } + + add(field.setLabel(new ResourceModel(name, name)).setOutputMarkupId(true)); + } + + @Override + public FieldPanel setReadOnly(final boolean readOnly) { + super.setReadOnly(readOnly); + AjaxNumberFieldPanel.class.cast(field).setEnabled(!readOnly); + return this; + } + + @Override + public AjaxNumberFieldPanel clone() { + AjaxNumberFieldPanel panel = new AjaxNumberFieldPanel<>( + getId(), name, model, options, enableOnChange); + + panel.setRequired(isRequired()); + panel.setReadOnly(isReadOnly()); + panel.setTitle(title); + + if (isRequiredLabelAdded) { + panel.addRequiredLabel(); + } + + return panel; + } + + public static class Builder> { + + private final Options options; + + private boolean enableOnChange = false; + + public Builder() { + this(new Options().set("format", "'#'").set("step", "1")); + } + + public Builder(final Options options) { + this.options = options; + options.set("format", "'#'"); + options.set("step", "1"); + } + + public Builder min(final T min) { + options.set("min", min); + return this; + } + + public Builder max(final T max) { + options.set("max", max); + return this; + } + + public Builder step(final T step) { + options.set("step", step); + return this; + } + + public Builder format(final String format) { + options.set("format", format); + return this; + } + + public Builder enableOnChange() { + enableOnChange = true; + return this; + } + + public AjaxNumberFieldPanel build( + final String id, + final String name, + final IModel model) { + + return new AjaxNumberFieldPanel<>(id, name, model, options, enableOnChange); + } + } +} diff --git a/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxNumberFieldPanel.html b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxNumberFieldPanel.html new file mode 100644 index 00000000000..aecb9b4268e --- /dev/null +++ b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxNumberFieldPanel.html @@ -0,0 +1,28 @@ + + + + + + + + + + + diff --git a/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/pages/SCIMConfPage.java b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/pages/SCIMConfPage.java index aee44651fa4..2487cc94e6c 100644 --- a/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/pages/SCIMConfPage.java +++ b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/pages/SCIMConfPage.java @@ -19,19 +19,12 @@ package org.apache.syncope.client.console.pages; import com.fasterxml.jackson.databind.json.JsonMapper; -import java.io.Serializable; import org.apache.syncope.client.console.BookmarkablePageLinkBuilder; -import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.client.console.panels.SCIMConfPanel; import org.apache.syncope.client.console.rest.SCIMConfRestClient; -import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal; -import org.apache.syncope.client.console.wizards.any.ResultPanel; -import org.apache.syncope.client.ui.commons.Constants; import org.apache.syncope.client.ui.commons.annotations.ExtPage; -import org.apache.syncope.common.lib.scim.SCIMConf; import org.apache.syncope.common.lib.scim.types.SCIMEntitlement; import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.spring.injection.annot.SpringBean; @@ -45,52 +38,15 @@ public class SCIMConfPage extends BaseExtPage { @SpringBean protected SCIMConfRestClient scimConfRestClient; - protected final WebMarkupContainer content; - public SCIMConfPage(final PageParameters parameters) { super(parameters); body.add(BookmarkablePageLinkBuilder.build("dashboard", "dashboardBr", Dashboard.class)); - content = new WebMarkupContainer("content"); - - content.add(new Label("body", "General")); + WebMarkupContainer content = new WebMarkupContainer("content"); content.setOutputMarkupId(true); body.add(content); - updateSCIMGeneralConfContent(scimConfRestClient.get()); - } - - protected WebMarkupContainer updateSCIMGeneralConfContent(final SCIMConf scimConf) { - if (scimConf == null) { - return content; - } - - content.addOrReplace(new SCIMConfPanel("body", scimConf, SCIMConfPage.this.getPageReference()) { - - private static final long serialVersionUID = 8221398624379357183L; - - @Override - protected void setWindowClosedReloadCallback(final BaseModal modal) { - modal.setWindowClosedCallback(target -> { - if (modal.getContent() instanceof ResultPanel) { - Serializable result = ResultPanel.class.cast(modal.getContent()).getResult(); - try { - scimConfRestClient.set(MAPPER.readValue(result.toString(), SCIMConf.class)); - - SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED)); - modal.show(false); - target.add(content); - } catch (Exception e) { - LOG.error("While setting SCIM configuration", e); - SyncopeConsoleSession.get().onException(e); - } - ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target); - } - }); - } - }); - - return content; + content.add(new SCIMConfPanel("scimConf", scimConfRestClient.get(), SCIMConfPage.this.getPageReference())); } } diff --git a/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfEnterpriseUserPanel.java b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfEnterpriseUserPanel.java index 2430c8cab50..df10ffd41f1 100644 --- a/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfEnterpriseUserPanel.java +++ b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfEnterpriseUserPanel.java @@ -52,94 +52,89 @@ public SCIMConfEnterpriseUserPanel(final String id, final SCIMConf scimConf) { } scimEnterpriseUserConf = scimConf.getEnterpriseUserConf(); - AjaxTextFieldPanel costCenterPanel = - new AjaxTextFieldPanel("costCenter", "costCenter", - new PropertyModel<>("costCenter", "costCenter") { - - private static final long serialVersionUID = -6427731218492117883L; - - @Override - public String getObject() { - return scimEnterpriseUserConf.getCostCenter(); - } - - @Override - public void setObject(final String object) { - scimEnterpriseUserConf.setCostCenter(object); - } - }); + AjaxTextFieldPanel costCenterPanel = new AjaxTextFieldPanel( + "costCenter", "costCenter", new PropertyModel<>("costCenter", "costCenter") { + + private static final long serialVersionUID = -6427731218492117883L; + + @Override + public String getObject() { + return scimEnterpriseUserConf.getCostCenter(); + } + + @Override + public void setObject(final String object) { + scimEnterpriseUserConf.setCostCenter(object); + } + }); costCenterPanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel departmentPanel = - new AjaxTextFieldPanel("department", "department", - new PropertyModel<>("department", "department") { + AjaxTextFieldPanel departmentPanel = new AjaxTextFieldPanel( + "department", "department", new PropertyModel<>("department", "department") { - private static final long serialVersionUID = -6427731218492117883L; + private static final long serialVersionUID = -6427731218492117883L; - @Override - public String getObject() { - return scimEnterpriseUserConf.getDepartment(); - } + @Override + public String getObject() { + return scimEnterpriseUserConf.getDepartment(); + } - @Override - public void setObject(final String object) { - scimEnterpriseUserConf.setDepartment(object); - } - }); + @Override + public void setObject(final String object) { + scimEnterpriseUserConf.setDepartment(object); + } + }); departmentPanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel divisionPanel = - new AjaxTextFieldPanel("division", "division", - new PropertyModel<>("division", "division") { + AjaxTextFieldPanel divisionPanel = new AjaxTextFieldPanel( + "division", "division", new PropertyModel<>("division", "division") { - private static final long serialVersionUID = -6427731218492117883L; + private static final long serialVersionUID = -6427731218492117883L; - @Override - public String getObject() { - return scimEnterpriseUserConf.getDivision(); - } + @Override + public String getObject() { + return scimEnterpriseUserConf.getDivision(); + } - @Override - public void setObject(final String object) { - scimEnterpriseUserConf.setDivision(object); - } - }); + @Override + public void setObject(final String object) { + scimEnterpriseUserConf.setDivision(object); + } + }); divisionPanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel employeeNumberPanel = - new AjaxTextFieldPanel("employeeNumber", "employeeNumber", - new PropertyModel<>("employeeNumber", "employeeNumber") { + AjaxTextFieldPanel employeeNumberPanel = new AjaxTextFieldPanel( + "employeeNumber", "employeeNumber", new PropertyModel<>("employeeNumber", "employeeNumber") { - private static final long serialVersionUID = -6427731218492117883L; + private static final long serialVersionUID = -6427731218492117883L; - @Override - public String getObject() { - return scimEnterpriseUserConf.getEmployeeNumber(); - } + @Override + public String getObject() { + return scimEnterpriseUserConf.getEmployeeNumber(); + } - @Override - public void setObject(final String object) { - scimEnterpriseUserConf.setEmployeeNumber(object); - } - }); + @Override + public void setObject(final String object) { + scimEnterpriseUserConf.setEmployeeNumber(object); + } + }); employeeNumberPanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel organizationPanel = - new AjaxTextFieldPanel("organization", "organization", - new PropertyModel<>("organization", "organization") { + AjaxTextFieldPanel organizationPanel = new AjaxTextFieldPanel( + "organization", "organization", new PropertyModel<>("organization", "organization") { - private static final long serialVersionUID = -6427731218492117883L; + private static final long serialVersionUID = -6427731218492117883L; - @Override - public String getObject() { - return scimEnterpriseUserConf.getOrganization(); - } + @Override + public String getObject() { + return scimEnterpriseUserConf.getOrganization(); + } - @Override - public void setObject(final String object) { - scimEnterpriseUserConf.setOrganization(object); - } - }); + @Override + public void setObject(final String object) { + scimEnterpriseUserConf.setOrganization(object); + } + }); organizationPanel.setChoices(userPlainSchemas.getObject()); // manager @@ -153,57 +148,55 @@ public void setObject(final String object) { } private void buildManagerAccordion() { - Accordion accordion = new Accordion("managerAccordion", - List.of(new AbstractTab(Model.of("manager")) { - - private static final long serialVersionUID = -5861786415855103549L; + Accordion accordion = new Accordion("managerAccordion", List.of(new AbstractTab(Model.of("manager")) { - @Override - public WebMarkupContainer getPanel(final String panelId) { - return buildNameAccordionContent(panelId); - } + private static final long serialVersionUID = -5861786415855103549L; - }), Model.of(-1)); // accordion closed at beginning + @Override + public WebMarkupContainer getPanel(final String panelId) { + return buildNameAccordionContent(panelId); + } + }), Model.of(-1)); // accordion closed at beginning add(accordion.setOutputMarkupId(true)); } private SCIMConfAccordionContainer buildNameAccordionContent(final String panelId) { List panelList = new ArrayList<>(); - AjaxTextFieldPanel managerKeyPanel = - new AjaxTextFieldPanel("accordionContent", "manager.key", - new PropertyModel<>(scimEnterpriseUserConf.getManager(), "accordionContent") { + AjaxTextFieldPanel managerKeyPanel = new AjaxTextFieldPanel( + "accordionContent", "manager.key", + new PropertyModel<>(scimEnterpriseUserConf.getManager(), "accordionContent") { - private static final long serialVersionUID = -6427731218492117883L; + private static final long serialVersionUID = -6427731218492117883L; - @Override - public String getObject() { - return scimEnterpriseUserConf.getManager().getKey(); - } + @Override + public String getObject() { + return scimEnterpriseUserConf.getManager().getKey(); + } - @Override - public void setObject(final String object) { - scimEnterpriseUserConf.getManager().setKey(object); - } - }); + @Override + public void setObject(final String object) { + scimEnterpriseUserConf.getManager().setKey(object); + } + }); managerKeyPanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel managerDisplaNamePanel = - new AjaxTextFieldPanel("accordionContent", "manager.displayName", - new PropertyModel<>(scimEnterpriseUserConf.getManager(), "accordionContent") { + AjaxTextFieldPanel managerDisplaNamePanel = new AjaxTextFieldPanel( + "accordionContent", "manager.displayName", + new PropertyModel<>(scimEnterpriseUserConf.getManager(), "accordionContent") { - private static final long serialVersionUID = -6427731218492117883L; + private static final long serialVersionUID = -6427731218492117883L; - @Override - public String getObject() { - return scimEnterpriseUserConf.getManager().getDisplayName(); - } + @Override + public String getObject() { + return scimEnterpriseUserConf.getManager().getDisplayName(); + } - @Override - public void setObject(final String object) { - scimEnterpriseUserConf.getManager().setDisplayName(object); - } - }); + @Override + public void setObject(final String object) { + scimEnterpriseUserConf.getManager().setDisplayName(object); + } + }); managerDisplaNamePanel.setChoices(userPlainSchemas.getObject()); panelList.add(managerKeyPanel); diff --git a/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfExtensionUserPanel.java b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfExtensionUserPanel.java index b3870d3a23b..b8dbb6a3770 100644 --- a/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfExtensionUserPanel.java +++ b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfExtensionUserPanel.java @@ -18,7 +18,7 @@ */ package org.apache.syncope.client.console.panels; -import org.apache.syncope.client.console.panels.mapping.SCIMExtentionMappingPanel; +import org.apache.syncope.client.console.panels.mapping.SCIMExtensionMappingPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; import org.apache.syncope.common.lib.scim.SCIMConf; import org.apache.syncope.common.lib.scim.SCIMExtensionUserConf; @@ -31,15 +31,13 @@ public class SCIMConfExtensionUserPanel extends SCIMConfTabPanel { private static final long serialVersionUID = 2459231778083046011L; - private final SCIMExtensionUserConf scimExtensionUserConf; - public SCIMConfExtensionUserPanel(final String id, final SCIMConf scimConf) { super(id); if (scimConf.getExtensionUserConf() == null) { scimConf.setExtensionUserConf(new SCIMExtensionUserConf()); } - scimExtensionUserConf = scimConf.getExtensionUserConf(); + SCIMExtensionUserConf scimExtensionUserConf = scimConf.getExtensionUserConf(); AjaxTextFieldPanel namePanel = new AjaxTextFieldPanel("name", "name", new PropertyModel<>("name", "name") { @@ -57,8 +55,8 @@ public void setObject(final String object) { }); add(namePanel); - AjaxTextFieldPanel descriptionPanel = new AjaxTextFieldPanel("description", "description", - new PropertyModel<>("description", "description") { + AjaxTextFieldPanel descriptionPanel = new AjaxTextFieldPanel( + "description", "description", new PropertyModel<>("description", "description") { private static final long serialVersionUID = -5911179251497048661L; @@ -74,10 +72,10 @@ public void setObject(final String object) { }); add(descriptionPanel); - SCIMExtentionMappingPanel extentionMappingPanel = new SCIMExtentionMappingPanel( + SCIMExtensionMappingPanel extensionMappingPanel = new SCIMExtensionMappingPanel( "mapping", new ListModel<>(scimExtensionUserConf.getAttributes())); Form form = new Form<>("form", new Model<>(scimExtensionUserConf)); - form.add(extentionMappingPanel); + form.add(extensionMappingPanel); add(form); } } diff --git a/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfGeneralPanel.java b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfGeneralPanel.java index 257d2255014..bac7fcaa7aa 100644 --- a/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfGeneralPanel.java +++ b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfGeneralPanel.java @@ -22,8 +22,7 @@ import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.syncope.client.ui.commons.DateOps; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDateTimeFieldPanel; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxSpinnerFieldPanel; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxNumberFieldPanel; import org.apache.syncope.common.lib.scim.SCIMConf; import org.apache.syncope.common.lib.scim.SCIMGeneralConf; import org.apache.wicket.model.Model; @@ -37,75 +36,46 @@ public SCIMConfGeneralPanel(final String id, final SCIMConf scimConf) { super(id); SCIMGeneralConf scimGeneralConf = scimConf.getGeneralConf(); + add(new AjaxDateTimeFieldPanel("creationDate", "creationDate", new Model<>() { - AjaxDateTimeFieldPanel creationDatePanel = - new AjaxDateTimeFieldPanel("creationDate", "creationDate", new Model<>() { + private static final long serialVersionUID = 7075312408615929880L; - private static final long serialVersionUID = 7075312408615929880L; - - @Override - public Date getObject() { - return DateOps.convert(scimGeneralConf.getCreationDate()); - } - - @Override - public void setObject(final Date object) { - scimGeneralConf.setCreationDate(DateOps.toOffsetDateTime(object)); - } - }, DateFormatUtils.ISO_8601_EXTENDED_DATETIME_TIME_ZONE_FORMAT); - creationDatePanel.setEnabled(false); - - AjaxDateTimeFieldPanel lastChangeDatePanel = - new AjaxDateTimeFieldPanel("lastChangeDate", "lastChangeDate", new Model<>() { - - private static final long serialVersionUID = 7075312408615929880L; - - @Override - public Date getObject() { - return DateOps.convert(scimGeneralConf.getLastChangeDate()); - } - - @Override - public void setObject(final Date object) { - scimGeneralConf.setLastChangeDate(DateOps.toOffsetDateTime(object)); - } - }, DateFormatUtils.ISO_8601_EXTENDED_DATETIME_TIME_ZONE_FORMAT); - lastChangeDatePanel.setEnabled(false); - - AjaxSpinnerFieldPanel bulkMaxOperationsPanel = new AjaxSpinnerFieldPanel.Builder(). - build("bulkMaxOperations", "bulkMaxOperations", Integer.class, - new PropertyModel<>(scimGeneralConf, "bulkMaxOperations")); - - AjaxSpinnerFieldPanel bulkMaxPayloadSizePanel = new AjaxSpinnerFieldPanel.Builder(). - build("bulkMaxPayloadSize", "bulkMaxPayloadSize", Integer.class, - new PropertyModel<>(scimGeneralConf, "bulkMaxPayloadSize")); + @Override + public Date getObject() { + return DateOps.convert(scimGeneralConf.getCreationDate()); + } - AjaxSpinnerFieldPanel filterMaxResultsPanel = new AjaxSpinnerFieldPanel.Builder(). - build("filterMaxResults", "filterMaxResults", Integer.class, - new PropertyModel<>(scimGeneralConf, "filterMaxResults")); + @Override + public void setObject(final Date object) { + // nothing to do + } + }, DateFormatUtils.ISO_8601_EXTENDED_DATETIME_TIME_ZONE_FORMAT).setEnabled(false)); - AjaxTextFieldPanel eTagValuePanel = new AjaxTextFieldPanel("eTagValue", "eTagValue", - new PropertyModel<>("eTagValue", "eTagValue") { + add(new AjaxDateTimeFieldPanel("lastChangeDate", "lastChangeDate", new Model<>() { - private static final long serialVersionUID = -6427731218492117883L; + private static final long serialVersionUID = 7075312408615929880L; @Override - public String getObject() { - return scimGeneralConf.getETagValue(); + public Date getObject() { + return DateOps.convert(scimGeneralConf.getLastChangeDate()); } @Override - public void setObject(final String object) { + public void setObject(final Date object) { // nothing to do } - }); - eTagValuePanel.setEnabled(false); + }, DateFormatUtils.ISO_8601_EXTENDED_DATETIME_TIME_ZONE_FORMAT).setEnabled(false)); + + add(new AjaxNumberFieldPanel.Builder().enableOnChange(). + build("bulkMaxOperations", "bulkMaxOperations", + new PropertyModel<>(scimGeneralConf, "bulkMaxOperations"))); + + add(new AjaxNumberFieldPanel.Builder().enableOnChange(). + build("bulkMaxPayloadSize", "bulkMaxPayloadSize", + new PropertyModel<>(scimGeneralConf, "bulkMaxPayloadSize"))); - add(creationDatePanel); - add(lastChangeDatePanel); - add(bulkMaxOperationsPanel); - add(bulkMaxPayloadSizePanel); - add(filterMaxResultsPanel); - add(eTagValuePanel); + add(new AjaxNumberFieldPanel.Builder().enableOnChange(). + build("filterMaxResults", "filterMaxResults", + new PropertyModel<>(scimGeneralConf, "filterMaxResults"))); } } diff --git a/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfGroupPanel.java b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfGroupPanel.java index 95b4d97ee66..d7afecee36a 100644 --- a/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfGroupPanel.java +++ b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfGroupPanel.java @@ -21,7 +21,6 @@ import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; import org.apache.syncope.common.lib.scim.SCIMConf; import org.apache.syncope.common.lib.scim.SCIMGroupConf; -import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteSettings; import org.apache.wicket.model.PropertyModel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,13 +41,8 @@ public SCIMConfGroupPanel(final String id, final SCIMConf scimConf) { } scimGroupConf = scimConf.getGroupConf(); - final AutoCompleteSettings settings = new AutoCompleteSettings(); - settings.setShowCompleteListOnFocusGain(true); - settings.setShowListOnEmptyInput(true); - settings.setCssClassName("custom-autocomplete-box"); - - AjaxTextFieldPanel externalIdPanel = new AjaxTextFieldPanel("externalId", "externalId", - new PropertyModel<>("externalId", "externalId") { + AjaxTextFieldPanel externalIdPanel = new AjaxTextFieldPanel( + "externalId", "externalId", new PropertyModel<>("externalId", "externalId") { private static final long serialVersionUID = -6427731218492117883L; diff --git a/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfPanel.java b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfPanel.java index 4ecf6db0dbf..a36c2f8d15a 100644 --- a/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfPanel.java +++ b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfPanel.java @@ -18,9 +18,7 @@ */ package org.apache.syncope.client.console.panels; -import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal; import de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel; -import java.io.Serializable; import java.util.ArrayList; import java.util.List; import org.apache.syncope.client.console.SyncopeConsoleSession; @@ -41,7 +39,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public abstract class SCIMConfPanel extends WizardMgtPanel { +public class SCIMConfPanel extends WizardMgtPanel { private static final long serialVersionUID = -1100228004207271270L; @@ -50,22 +48,19 @@ public abstract class SCIMConfPanel extends WizardMgtPanel { @SpringBean protected SCIMConfRestClient scimConfRestClient; - protected final SCIMConf scimConfTO; + protected final SCIMConf scimConf; public SCIMConfPanel( final String id, - final SCIMConf scimConfTO, + final SCIMConf scimConf, final PageReference pageRef) { super(id, true); - this.scimConfTO = scimConfTO; + this.scimConf = scimConf; this.pageRef = pageRef; - setPageRef(pageRef); - - AjaxBootstrapTabbedPanel tabbedPanel = - new AjaxBootstrapTabbedPanel<>("tabbedPanel", buildTabList()); + AjaxBootstrapTabbedPanel tabbedPanel = new AjaxBootstrapTabbedPanel<>("tabbedPanel", buildTabList()); tabbedPanel.setSelectedTab(0); addInnerObject(tabbedPanel); @@ -76,7 +71,7 @@ public SCIMConfPanel( @Override public void onClick(final AjaxRequestTarget target) { try { - scimConfRestClient.set(SCIMConfPanel.this.scimConfTO); + scimConfRestClient.set(SCIMConfPanel.this.scimConf); SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED)); } catch (Exception e) { LOG.error("While setting SCIM configuration", e); @@ -88,98 +83,61 @@ public void onClick(final AjaxRequestTarget target) { addInnerObject(saveButton); setShowResultPanel(true); - - modal.size(Modal.Size.Large); - setWindowClosedReloadCallback(modal); } protected List buildTabList() { List tabs = new ArrayList<>(); - tabs.add(new ITabComponent(new Model<>(getString("tab1"))) { + tabs.add(new ITabComponent(new Model<>(getString("tab1")), getString("tab1")) { private static final long serialVersionUID = -5861786415855103549L; @Override public Panel getPanel(final String panelId) { - return new SCIMConfGeneralPanel(panelId, scimConfTO); - } - - @Override - public boolean isVisible() { - return true; + return new SCIMConfGeneralPanel(panelId, scimConf); } }); - tabs.add(new ITabComponent( - new Model<>(getString("tab2")), getString("tab2")) { + tabs.add(new ITabComponent(new Model<>(getString("tab2")), getString("tab2")) { private static final long serialVersionUID = 1998052474181916792L; @Override public WebMarkupContainer getPanel(final String panelId) { - return new SCIMConfUserPanel(panelId, scimConfTO); - } - - @Override - public boolean isVisible() { - return true; + return new SCIMConfUserPanel(panelId, scimConf); } }); - tabs.add(new ITabComponent( - new Model<>(getString("tab3")), getString("tab3")) { + tabs.add(new ITabComponent(new Model<>(getString("tab3")), getString("tab3")) { private static final long serialVersionUID = 1998052474181916792L; @Override public WebMarkupContainer getPanel(final String panelId) { - return new SCIMConfEnterpriseUserPanel(panelId, scimConfTO); - } - - @Override - public boolean isVisible() { - return true; + return new SCIMConfEnterpriseUserPanel(panelId, scimConf); } }); - tabs.add(new ITabComponent( - new Model<>(getString("tab4")), getString("tab4")) { + tabs.add(new ITabComponent(new Model<>(getString("tab4")), getString("tab4")) { private static final long serialVersionUID = 6645614456650987567L; @Override public WebMarkupContainer getPanel(final String panelId) { - return new SCIMConfExtensionUserPanel(panelId, scimConfTO); - } - - @Override - public boolean isVisible() { - return true; + return new SCIMConfExtensionUserPanel(panelId, scimConf); } }); - tabs.add(new ITabComponent( - new Model<>(getString("tab5")), getString("tab5")) { + tabs.add(new ITabComponent(new Model<>(getString("tab5")), getString("tab5")) { private static final long serialVersionUID = 1998052474181916792L; @Override public WebMarkupContainer getPanel(final String panelId) { - return new SCIMConfGroupPanel(panelId, scimConfTO); - } - - @Override - public boolean isVisible() { - return true; + return new SCIMConfGroupPanel(panelId, scimConf); } }); return tabs; } - - @Override - protected Panel customResultBody(final String panelId, final SCIMConf item, final Serializable result) { - return null; - } } diff --git a/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfTabPanel.java b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfTabPanel.java index da68c083dc8..8ba38821735 100644 --- a/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfTabPanel.java +++ b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfTabPanel.java @@ -21,7 +21,6 @@ import java.util.List; import java.util.stream.Collectors; import org.apache.syncope.client.console.rest.SchemaRestClient; -import org.apache.syncope.client.ui.commons.panels.ModalPanel; import org.apache.syncope.common.lib.to.SchemaTO; import org.apache.syncope.common.lib.types.AnyTypeKind; import org.apache.syncope.common.lib.types.SchemaType; @@ -29,7 +28,7 @@ import org.apache.wicket.model.LoadableDetachableModel; import org.apache.wicket.spring.injection.annot.SpringBean; -public class SCIMConfTabPanel extends Panel implements ModalPanel { +public class SCIMConfTabPanel extends Panel { private static final long serialVersionUID = -4482885585790492795L; diff --git a/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfUserPanel.java b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfUserPanel.java index 938bec2684c..1d8d408b392 100644 --- a/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfUserPanel.java +++ b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/SCIMConfUserPanel.java @@ -33,7 +33,6 @@ import org.apache.syncope.common.lib.scim.types.IMCanonicalType; import org.apache.syncope.common.lib.scim.types.PhoneNumberCanonicalType; import org.apache.syncope.common.lib.scim.types.PhotoCanonicalType; -import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteSettings; import org.apache.wicket.extensions.markup.html.tabs.AbstractTab; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.basic.Label; @@ -62,13 +61,8 @@ public SCIMConfUserPanel(final String id, final SCIMConf scimConf) { } scimUserConf = scimConf.getUserConf(); - final AutoCompleteSettings settings = new AutoCompleteSettings(); - settings.setShowCompleteListOnFocusGain(true); - settings.setShowListOnEmptyInput(true); - settings.setCssClassName("custom-autocomplete-box"); - - AjaxTextFieldPanel externalIdPanel = new AjaxTextFieldPanel("externalId", "externalId", - new PropertyModel<>("externalId", "externalId") { + AjaxTextFieldPanel externalIdPanel = new AjaxTextFieldPanel( + "externalId", "externalId", new PropertyModel<>("externalId", "externalId") { private static final long serialVersionUID = -6427731218492117883L; @@ -84,8 +78,8 @@ public void setObject(final String object) { }); externalIdPanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel displayNamePanel = new AjaxTextFieldPanel("displayName", "displayName", - new PropertyModel<>("displayName", "displayName") { + AjaxTextFieldPanel displayNamePanel = new AjaxTextFieldPanel( + "displayName", "displayName", new PropertyModel<>("displayName", "displayName") { private static final long serialVersionUID = -6427731218492117883L; @@ -101,8 +95,8 @@ public void setObject(final String object) { }); displayNamePanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel localePanel = new AjaxTextFieldPanel("locale", "locale", - new PropertyModel<>("locale", "locale") { + AjaxTextFieldPanel localePanel = new AjaxTextFieldPanel( + "locale", "locale", new PropertyModel<>("locale", "locale") { private static final long serialVersionUID = -6427731218492117883L; @@ -118,8 +112,8 @@ public void setObject(final String object) { }); localePanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel nickNamePanel = new AjaxTextFieldPanel("nickName", "nickName", - new PropertyModel<>("nickName", "nickName") { + AjaxTextFieldPanel nickNamePanel = new AjaxTextFieldPanel( + "nickName", "nickName", new PropertyModel<>("nickName", "nickName") { private static final long serialVersionUID = -6427731218492117883L; @@ -135,7 +129,8 @@ public void setObject(final String object) { }); nickNamePanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel preferredLanguagePanel = new AjaxTextFieldPanel("preferredLanguage", "preferredLanguage", + AjaxTextFieldPanel preferredLanguagePanel = new AjaxTextFieldPanel( + "preferredLanguage", "preferredLanguage", new PropertyModel<>("preferredLanguage", "preferredLanguage") { private static final long serialVersionUID = -6427731218492117883L; @@ -152,8 +147,8 @@ public void setObject(final String object) { }); preferredLanguagePanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel profileUrlPanel = new AjaxTextFieldPanel("profileUrl", "profileUrl", - new PropertyModel<>("profileUrl", "profileUrl") { + AjaxTextFieldPanel profileUrlPanel = new AjaxTextFieldPanel( + "profileUrl", "profileUrl", new PropertyModel<>("profileUrl", "profileUrl") { private static final long serialVersionUID = -6427731218492117883L; @@ -169,8 +164,8 @@ public void setObject(final String object) { }); profileUrlPanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel timezonePanel = new AjaxTextFieldPanel("timezone", "timezone", - new PropertyModel<>("timezone", "timezone") { + AjaxTextFieldPanel timezonePanel = new AjaxTextFieldPanel( + "timezone", "timezone", new PropertyModel<>("timezone", "timezone") { private static final long serialVersionUID = -6427731218492117883L; @@ -186,8 +181,8 @@ public void setObject(final String object) { }); timezonePanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel titlePanel = new AjaxTextFieldPanel("title", "title", - new PropertyModel<>("title", "title") { + AjaxTextFieldPanel titlePanel = new AjaxTextFieldPanel( + "title", "title", new PropertyModel<>("title", "title") { private static final long serialVersionUID = -6427731218492117883L; @@ -203,8 +198,8 @@ public void setObject(final String object) { }); titlePanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel userTypePanel = new AjaxTextFieldPanel("userType", "userType", - new PropertyModel<>("userType", "userType") { + AjaxTextFieldPanel userTypePanel = new AjaxTextFieldPanel( + "userType", "userType", new PropertyModel<>("userType", "userType") { private static final long serialVersionUID = -6427731218492117883L; @@ -224,8 +219,8 @@ public void setObject(final String object) { buildNameAccordion(); // x509certificates - final AjaxTextFieldPanel x509CertificatesPanel = new AjaxTextFieldPanel("panel", "x509CertificatesPanel", - new Model<>(null)); + AjaxTextFieldPanel x509CertificatesPanel = new AjaxTextFieldPanel( + "panel", "x509CertificatesPanel", new Model<>(null)); x509CertificatesPanel.setChoices(userPlainSchemas.getObject()); MultiFieldPanel x509CertificatesMultiPanel = new MultiFieldPanel.Builder<>( new ListModel<>(scimUserConf.getX509Certificates())).build( @@ -349,8 +344,8 @@ public WebMarkupContainer getPanel(final String panelId) { private SCIMConfAccordionContainer buildNameAccordionContent(final String panelId) { List panelList = new ArrayList<>(); - AjaxTextFieldPanel nameFamilyNamePanel = new AjaxTextFieldPanel("accordionContent", "name.familyName", - new PropertyModel<>(scimUserConf.getName(), "accordionContent") { + AjaxTextFieldPanel nameFamilyNamePanel = new AjaxTextFieldPanel( + "accordionContent", "name.familyName", new PropertyModel<>(scimUserConf.getName(), "accordionContent") { private static final long serialVersionUID = -6427731218492117883L; @@ -366,7 +361,8 @@ public void setObject(final String object) { }); nameFamilyNamePanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel nameFormattedPanel = new AjaxTextFieldPanel("accordionContent", "name.formatted", + AjaxTextFieldPanel nameFormattedPanel = new AjaxTextFieldPanel( + "accordionContent", "name.formatted", new PropertyModel<>(scimUserConf.getName(), "accordionContent") { private static final long serialVersionUID = -6427731218492117883L; @@ -383,7 +379,8 @@ public void setObject(final String object) { }); nameFormattedPanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel nameGivenNamePanel = new AjaxTextFieldPanel("accordionContent", "name.givenName", + AjaxTextFieldPanel nameGivenNamePanel = new AjaxTextFieldPanel( + "accordionContent", "name.givenName", new PropertyModel<>(scimUserConf.getName(), "accordionContent") { private static final long serialVersionUID = -6427731218492117883L; @@ -400,7 +397,8 @@ public void setObject(final String object) { }); nameGivenNamePanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel nameHonorificPrefixPanel = new AjaxTextFieldPanel("accordionContent", "name.honorificPrefix", + AjaxTextFieldPanel nameHonorificPrefixPanel = new AjaxTextFieldPanel( + "accordionContent", "name.honorificPrefix", new PropertyModel<>(scimUserConf.getName(), "accordionContent") { private static final long serialVersionUID = -6427731218492117883L; @@ -417,7 +415,8 @@ public void setObject(final String object) { }); nameHonorificPrefixPanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel nameHonorificSuffixPanel = new AjaxTextFieldPanel("accordionContent", "name.honorificSuffix", + AjaxTextFieldPanel nameHonorificSuffixPanel = new AjaxTextFieldPanel( + "accordionContent", "name.honorificSuffix", new PropertyModel<>(scimUserConf.getName(), "accordionContent") { private static final long serialVersionUID = -6427731218492117883L; @@ -434,7 +433,8 @@ public void setObject(final String object) { }); nameHonorificSuffixPanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel nameMiddleNamePanel = new AjaxTextFieldPanel("accordionContent", "name.middleName", + AjaxTextFieldPanel nameMiddleNamePanel = new AjaxTextFieldPanel( + "accordionContent", "name.middleName", new PropertyModel<>(scimUserConf.getName(), "accordionContent") { private static final long serialVersionUID = -6427731218492117883L; @@ -469,8 +469,8 @@ private > SCIMConfAccordionContainer buildComplexAccordionCont List panelList = new ArrayList<>(); String fieldName = panelId + '.' + canonicalType.name(); - AjaxTextFieldPanel displayPanel = new AjaxTextFieldPanel("accordionContent", fieldName + ".display", - new PropertyModel<>(complex, "accordionContent") { + AjaxTextFieldPanel displayPanel = new AjaxTextFieldPanel( + "accordionContent", fieldName + ".display", new PropertyModel<>(complex, "accordionContent") { private static final long serialVersionUID = -6427731218492117883L; @@ -486,8 +486,8 @@ public void setObject(final String object) { }); displayPanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel valuePanel = new AjaxTextFieldPanel("accordionContent", fieldName + ".value", - new PropertyModel<>(complex, "accordionContent") { + AjaxTextFieldPanel valuePanel = new AjaxTextFieldPanel( + "accordionContent", fieldName + ".value", new PropertyModel<>(complex, "accordionContent") { private static final long serialVersionUID = -6427731218492117883L; @@ -503,8 +503,8 @@ public void setObject(final String object) { }); valuePanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel primaryPanel = new AjaxTextFieldPanel("accordionContent", fieldName + ".primary", - new PropertyModel<>(complex, "accordionContent") { + AjaxTextFieldPanel primaryPanel = new AjaxTextFieldPanel( + "accordionContent", fieldName + ".primary", new PropertyModel<>(complex, "accordionContent") { private static final long serialVersionUID = -6427731218492117883L; @@ -535,8 +535,8 @@ private SCIMConfAccordionContainer buildAddressAccordionContent( List panelList = new ArrayList<>(); String fieldName = "addresses." + canonicalType.name(); - AjaxTextFieldPanel addressCountryPanel = new AjaxTextFieldPanel("accordionContent", fieldName + ".country", - new PropertyModel<>(address, "accordionContent") { + AjaxTextFieldPanel addressCountryPanel = new AjaxTextFieldPanel( + "accordionContent", fieldName + ".country", new PropertyModel<>(address, "accordionContent") { private static final long serialVersionUID = -6427731218492117883L; @@ -552,8 +552,8 @@ public void setObject(final String object) { }); addressCountryPanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel addressFormattedPanel = new AjaxTextFieldPanel("accordionContent", fieldName + ".formatted", - new PropertyModel<>(address, "accordionContent") { + AjaxTextFieldPanel addressFormattedPanel = new AjaxTextFieldPanel( + "accordionContent", fieldName + ".formatted", new PropertyModel<>(address, "accordionContent") { private static final long serialVersionUID = -6427731218492117883L; @@ -569,8 +569,8 @@ public void setObject(final String object) { }); addressFormattedPanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel addressLocalityPanel = new AjaxTextFieldPanel("accordionContent", fieldName + ".locality", - new PropertyModel<>(address, "accordionContent") { + AjaxTextFieldPanel addressLocalityPanel = new AjaxTextFieldPanel( + "accordionContent", fieldName + ".locality", new PropertyModel<>(address, "accordionContent") { private static final long serialVersionUID = -6427731218492117883L; @@ -586,8 +586,8 @@ public void setObject(final String object) { }); addressLocalityPanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel addressRegionPanel = new AjaxTextFieldPanel("accordionContent", fieldName + ".region", - new PropertyModel<>(address, "accordionContent") { + AjaxTextFieldPanel addressRegionPanel = new AjaxTextFieldPanel( + "accordionContent", fieldName + ".region", new PropertyModel<>(address, "accordionContent") { private static final long serialVersionUID = -6427731218492117883L; @@ -603,26 +603,25 @@ public void setObject(final String object) { }); addressRegionPanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel addressPostalCodePanel = - new AjaxTextFieldPanel("accordionContent", fieldName + ".postalCode", - new PropertyModel<>(address, "accordionContent") { + AjaxTextFieldPanel addressPostalCodePanel = new AjaxTextFieldPanel( + "accordionContent", fieldName + ".postalCode", new PropertyModel<>(address, "accordionContent") { - private static final long serialVersionUID = -6427731218492117883L; + private static final long serialVersionUID = -6427731218492117883L; - @Override - public String getObject() { - return address.getPostalCode(); - } + @Override + public String getObject() { + return address.getPostalCode(); + } - @Override - public void setObject(final String object) { - address.setPostalCode(object); - } - }); + @Override + public void setObject(final String object) { + address.setPostalCode(object); + } + }); addressPostalCodePanel.setChoices(userPlainSchemas.getObject()); - AjaxTextFieldPanel addressPrimaryPanel = new AjaxTextFieldPanel("accordionContent", fieldName + ".primary", - new PropertyModel<>(address, "accordionContent") { + AjaxTextFieldPanel addressPrimaryPanel = new AjaxTextFieldPanel( + "accordionContent", fieldName + ".primary", new PropertyModel<>(address, "accordionContent") { private static final long serialVersionUID = -6427731218492117883L; diff --git a/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/mapping/SCIMExtentionMappingPanel.java b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/mapping/SCIMExtensionMappingPanel.java similarity index 98% rename from ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/mapping/SCIMExtentionMappingPanel.java rename to ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/mapping/SCIMExtensionMappingPanel.java index 892af3e81e4..683794130cd 100644 --- a/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/mapping/SCIMExtentionMappingPanel.java +++ b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/panels/mapping/SCIMExtensionMappingPanel.java @@ -49,7 +49,7 @@ import org.apache.wicket.model.PropertyModel; import org.apache.wicket.spring.injection.annot.SpringBean; -public class SCIMExtentionMappingPanel extends Panel { +public class SCIMExtensionMappingPanel extends Panel { private static final long serialVersionUID = -5268147603868322754L; @@ -79,7 +79,7 @@ public class SCIMExtentionMappingPanel extends Panel { protected final WebMarkupContainer mappingContainer; - public SCIMExtentionMappingPanel( + public SCIMExtensionMappingPanel( final String id, final IModel> model) { @@ -228,7 +228,7 @@ protected void populateItem(final ListItem item) { public void onClick(final AjaxRequestTarget target, final Serializable ignore) { model.getObject().remove(item.getIndex()); item.getParent().removeAll(); - target.add(SCIMExtentionMappingPanel.this); + target.add(SCIMExtensionMappingPanel.this); } }, ActionLink.ActionType.DELETE, StringUtils.EMPTY, true).hideLabel(); item.add(actions); @@ -255,7 +255,7 @@ protected void onUpdate(final AjaxRequestTarget target) { @Override protected void onSubmit(final AjaxRequestTarget target) { model.getObject().add(new SCIMItem()); - target.add(SCIMExtentionMappingPanel.this); + target.add(SCIMExtensionMappingPanel.this); } }; addMappingBtn.setDefaultFormProcessing(false); diff --git a/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConfPage.html b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConfPage.html index cbb6bdf0343..2074daed7bc 100644 --- a/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConfPage.html +++ b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConfPage.html @@ -40,9 +40,9 @@

 

-
+
- \ No newline at end of file + diff --git a/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/SCIMConfGeneralPanel.html b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/SCIMConfGeneralPanel.html index 50f310a1b30..964dad3bc93 100644 --- a/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/SCIMConfGeneralPanel.html +++ b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/SCIMConfGeneralPanel.html @@ -18,11 +18,20 @@ --> -
-
-
-
-
-
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
- \ No newline at end of file + diff --git a/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtentionMappingPanel.html b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtensionMappingPanel.html similarity index 98% rename from ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtentionMappingPanel.html rename to ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtensionMappingPanel.html index 1849e7e9ae5..b66d02ca366 100644 --- a/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtentionMappingPanel.html +++ b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtensionMappingPanel.html @@ -13,7 +13,7 @@ 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 +specific language governing permissions and limitations! under the License. --> diff --git a/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtentionMappingPanel.properties b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtensionMappingPanel.properties similarity index 100% rename from ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtentionMappingPanel.properties rename to ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtensionMappingPanel.properties diff --git a/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtentionMappingPanel_fr.properties b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtensionMappingPanel_fr.properties similarity index 100% rename from ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtentionMappingPanel_fr.properties rename to ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtensionMappingPanel_fr.properties diff --git a/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtentionMappingPanel_it.properties b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtensionMappingPanel_it.properties similarity index 100% rename from ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtentionMappingPanel_it.properties rename to ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtensionMappingPanel_it.properties diff --git a/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtentionMappingPanel_ja.properties b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtensionMappingPanel_ja.properties similarity index 100% rename from ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtentionMappingPanel_ja.properties rename to ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtensionMappingPanel_ja.properties diff --git a/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtentionMappingPanel_pt_BR.properties b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtensionMappingPanel_pt_BR.properties similarity index 100% rename from ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtentionMappingPanel_pt_BR.properties rename to ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtensionMappingPanel_pt_BR.properties diff --git a/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtentionMappingPanel_ru.properties b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtensionMappingPanel_ru.properties similarity index 100% rename from ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtentionMappingPanel_ru.properties rename to ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/panels/mapping/SCIMExtensionMappingPanel_ru.properties diff --git a/ext/scimv2/logic/src/main/java/org/apache/syncope/core/logic/scim/SCIMConfManager.java b/ext/scimv2/logic/src/main/java/org/apache/syncope/core/logic/scim/SCIMConfManager.java index 8ee044a08b6..4194a9993d4 100644 --- a/ext/scimv2/logic/src/main/java/org/apache/syncope/core/logic/scim/SCIMConfManager.java +++ b/ext/scimv2/logic/src/main/java/org/apache/syncope/core/logic/scim/SCIMConfManager.java @@ -21,6 +21,7 @@ import jakarta.ws.rs.core.MediaType; import java.time.OffsetDateTime; import java.util.Base64; +import java.util.Optional; import org.apache.syncope.common.keymaster.client.api.ConfParamOps; import org.apache.syncope.common.lib.SyncopeClientException; import org.apache.syncope.common.lib.scim.SCIMConf; @@ -53,21 +54,21 @@ public SCIMConfManager(final ConfParamOps confParamOps, final SchemaLogic schema @PreAuthorize("hasRole('" + SCIMEntitlement.SCIM_CONF_GET + "')") public SCIMConf get() { - SCIMConf conf = null; - String confString = confParamOps.get(AuthContextUtils.getDomain(), SCIMConf.KEY, null, String.class); - if (confString != null) { - try { - conf = POJOHelper.deserialize(new String(Base64.getDecoder().decode(confString)), SCIMConf.class); - } catch (Exception e) { - LOG.error("Could not deserialize, reverting to default", e); - } - } - if (conf == null) { - conf = new SCIMConf(); - set(conf); - } - - return conf; + return Optional.ofNullable(confParamOps.get(AuthContextUtils.getDomain(), SCIMConf.KEY, null, String.class)). + map(confString -> { + try { + return POJOHelper.deserialize( + new String(Base64.getDecoder().decode(confString)), SCIMConf.class); + } catch (Exception e) { + LOG.error("Could not deserialize, reverting to default", e); + return null; + } + }). + orElseGet(() -> { + SCIMConf scimConf = new SCIMConf(); + set(scimConf); + return scimConf; + }); } @PreAuthorize("hasRole('" + SCIMEntitlement.SCIM_CONF_SET + "')") @@ -81,7 +82,9 @@ public void set(final SCIMConf conf) { scimConf.setMimeType(MediaType.APPLICATION_JSON); schemaLogic.create(SchemaType.PLAIN, scimConf); } - conf.setGeneralConf(new SCIMGeneralConf()); + if (conf.getGeneralConf() == null) { + conf.setGeneralConf(new SCIMGeneralConf()); + } conf.getGeneralConf().setLastChangeDate(OffsetDateTime.now()); if (conf.getExtensionUserConf() != null) {