provides wizard to create users, groups and any objects + several changes merged from master
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/047ac019 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/047ac019 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/047ac019 Branch: refs/heads/SYNCOPE-156 Commit: 047ac0190bf15aff81fee2d9538bd68a64305d15 Parents: 4c30ca7 Author: fmartelli <fabio.marte...@gmail.com> Authored: Fri Oct 30 12:32:48 2015 +0100 Committer: fmartelli <fabio.marte...@gmail.com> Committed: Fri Oct 30 12:32:48 2015 +0100 ---------------------------------------------------------------------- .../schema/SchemaSyncopeOperations.java | 8 +- .../client/console/PreferenceManager.java | 7 +- .../console/pages/ProvisioningModalPage.java | 4 +- .../client/console/pages/ResultStatusModal.java | 31 +- .../console/panels/AbstractModalPanel.java | 4 +- .../panels/AbstractSearchResultPanel.java | 78 ++++- .../console/panels/AjaxDataTablePanel.java | 2 +- .../console/panels/AnySearchResultPanel.java | 57 +++- .../console/panels/ConnectorConfPanel.java | 14 +- .../client/console/panels/GroupModalPanel.java | 119 ------- .../client/console/panels/GroupPanel.java | 75 ---- .../console/panels/GroupSearchResultPanel.java | 53 ++- .../client/console/panels/ListViewPanel.java | 157 ++------- .../client/console/panels/ModalPanel.java | 30 ++ .../syncope/client/console/panels/Realm.java | 58 +++- .../console/panels/ResourceConnConfPanel.java | 12 +- .../console/panels/ResourceDetailsPanel.java | 6 - .../console/panels/UserSearchResultPanel.java | 60 +++- .../client/console/rest/AnyTypeRestClient.java | 37 +- .../console/rest/ConfigurationRestClient.java | 4 +- .../client/console/rest/GroupRestClient.java | 15 +- .../client/console/rest/SchemaRestClient.java | 31 +- .../client/console/rest/UserRestClient.java | 14 +- .../markup/html/ClearIndicatingAjaxLink.java | 2 + .../markup/html/bootstrap/dialog/BaseModal.java | 18 +- .../markup/html/form/ActionLinksPanel.java | 2 + .../markup/html/form/BinaryFieldPanel.java | 7 +- .../markup/html/form/SpinnerFieldPanel.java | 4 +- .../client/console/wizards/AjaxWizard.java | 42 ++- .../console/wizards/AjaxWizardBuilder.java | 21 +- .../console/wizards/AjaxWizardButtonBar.java | 1 + .../client/console/wizards/WizardMgtPanel.java | 216 ++++++++++++ .../wizards/any/AnyObjectWizardBuilder.java | 143 ++++++++ .../console/wizards/any/AnyWizardBuilder.java | 85 +++++ .../client/console/wizards/any/DerAttrs.java | 137 ++++++++ .../console/wizards/any/GroupDetails.java | 293 ++++++++++++++++ .../console/wizards/any/GroupWizardBuilder.java | 67 ++++ .../client/console/wizards/any/PlainAttrs.java | 339 +++++++++++++++++++ .../client/console/wizards/any/UserDetails.java | 104 ++++++ .../console/wizards/any/UserWizardBuilder.java | 73 ++++ .../client/console/wizards/any/VirAttrs.java | 141 ++++++++ .../provision/ProvisionWizardBuilder.java | 9 +- .../META-INF/resources/css/syncopeConsole.css | 15 + .../panels/AbstractSearchResultPanel.html | 10 +- .../client/console/panels/GroupModalPanel.html | 52 --- .../console/panels/GroupModalPanel.properties | 48 --- .../panels/GroupModalPanel_it.properties | 50 --- .../panels/GroupModalPanel_pt_BR.properties | 48 --- .../client/console/panels/ListViewPanel.html | 22 +- .../console/panels/ResourceDetailsPanel.html | 4 - .../console/panels/ResourceModal.properties | 1 - .../console/panels/ResourceModalPage.html | 56 --- .../console/panels/ResourceModalPage.properties | 60 ---- .../console/panels/ResourceModal_it.properties | 1 - .../panels/ResourceModal_pt_BR.properties | 1 - .../console/wizards/AjaxWizard.properties | 18 + .../console/wizards/AjaxWizard_it.properties | 18 + .../console/wizards/AjaxWizard_pt_BR.properties | 18 + .../client/console/wizards/WizardMgtPanel.html | 45 +++ .../client/console/wizards/any/DerAttrs.html | 42 +++ .../console/wizards/any/DerAttrs.properties | 18 + .../console/wizards/any/DerAttrs_it.properties | 18 + .../wizards/any/DerAttrs_pt_BR.properties | 18 + .../console/wizards/any/GroupDetails.html | 56 +++ .../console/wizards/any/GroupDetails.properties | 16 + .../wizards/any/GroupDetails_it.properties | 16 + .../wizards/any/GroupDetails_pt_BR.properties | 16 + .../client/console/wizards/any/PlainAttrs.html | 40 +++ .../client/console/wizards/any/UserDetails.html | 59 ++++ .../console/wizards/any/UserDetails.properties | 19 ++ .../wizards/any/UserDetails_it.properties | 19 ++ .../wizards/any/UserDetails_pt_BR.properties | 19 ++ .../client/console/wizards/any/VirAttrs.html | 42 +++ .../console/wizards/any/VirAttrs.properties | 17 + .../console/wizards/any/VirAttrs_it.properties | 17 + .../wizards/any/VirAttrs_pt_BR.properties | 17 + .../ProvisionWizardBuilder$ConnObjectLink.html | 26 +- .../ProvisionWizardBuilder$Mapping.html | 11 +- .../ProvisionWizardBuilder$ObjectType.html | 26 +- client/enduser/pom.xml | 6 +- .../common/rest/api/service/SchemaService.java | 9 +- .../apache/syncope/core/logic/SchemaLogic.java | 17 +- .../provisioning/java/ConnectorFacadeProxy.java | 4 +- .../provisioning/java/sync/SyncJobDelegate.java | 9 +- .../rest/cxf/service/SchemaServiceImpl.java | 4 +- .../fit/core/reference/DerSchemaITCase.java | 2 +- .../syncope/fit/core/reference/GroupITCase.java | 4 +- .../fit/core/reference/MultitenancyITCase.java | 2 +- .../fit/core/reference/PlainSchemaITCase.java | 56 +-- .../fit/core/reference/VirSchemaITCase.java | 2 +- pom.xml | 6 + 91 files changed, 2763 insertions(+), 917 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java index c8f0a6d..c5e8097 100644 --- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/schema/SchemaSyncopeOperations.java @@ -33,19 +33,19 @@ public class SchemaSyncopeOperations { } public <T extends AbstractSchemaTO> List<T> list(final SchemaType schemaType) { - return schemaService.list(schemaType); + return schemaService.list(schemaType, null); } public <T extends AbstractSchemaTO> List<T> listVirtual() { - return schemaService.list(SchemaType.VIRTUAL); + return schemaService.list(SchemaType.VIRTUAL, null); } public <T extends AbstractSchemaTO> List<T> listPlain() { - return schemaService.list(SchemaType.PLAIN); + return schemaService.list(SchemaType.PLAIN, null); } public <T extends AbstractSchemaTO> List<T> listDerived() { - return schemaService.list(SchemaType.DERIVED); + return schemaService.list(SchemaType.DERIVED, null); } public void delete(final SchemaType schemaType, final String schemaName) { http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/PreferenceManager.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/PreferenceManager.java b/client/console/src/main/java/org/apache/syncope/client/console/PreferenceManager.java index c7baef2..03fab62 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/PreferenceManager.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/PreferenceManager.java @@ -21,6 +21,7 @@ package org.apache.syncope.client.console; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.core.type.TypeReference; import java.io.IOException; +import java.io.Serializable; import java.io.StringWriter; import java.util.ArrayList; import java.util.Arrays; @@ -37,7 +38,7 @@ import org.apache.wicket.util.crypt.Base64; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class PreferenceManager { +public class PreferenceManager implements Serializable { private static final Logger LOG = LoggerFactory.getLogger(PreferenceManager.class); @@ -50,9 +51,11 @@ public class PreferenceManager { private static final List<Integer> PAGINATOR_CHOICES = Arrays.asList(new Integer[] { 10, 25, 50 }); + private static final long serialVersionUID = 1L; + private final ObjectMapper mapper; - private final CookieUtils cookieUtils; + private final transient CookieUtils cookieUtils; public PreferenceManager() { this.mapper = new ObjectMapper(); http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java index db85db1..4fb3630 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java @@ -241,8 +241,8 @@ public class ProvisioningModalPage<T extends AnyTO> extends AbstractStatusModalP if (beans.isEmpty()) { modal.close(target); } else { - BulkActionResult res = resourceRestClient.bulkAssociationAction(resourceTO.getKey(), anyTypeKind.name(), - action, anyKeys); + BulkActionResult res = resourceRestClient.bulkAssociationAction( + resourceTO.getKey(), anyTypeKind.name(), action, anyKeys); ((BasePage) pageRef.getPage()).setModalResult(true); http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/pages/ResultStatusModal.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/ResultStatusModal.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/ResultStatusModal.java index 998ac60..b7c0b29 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/pages/ResultStatusModal.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/ResultStatusModal.java @@ -43,6 +43,7 @@ import org.apache.syncope.common.lib.to.AttrTO; import org.apache.syncope.common.lib.to.ConnObjectTO; import org.apache.syncope.common.lib.to.PropagationStatus; import org.apache.syncope.common.lib.to.GroupTO; +import org.apache.syncope.common.lib.to.ProvisioningResult; import org.apache.syncope.common.lib.to.UserTO; import org.apache.syncope.common.lib.types.PropagationTaskExecStatus; import org.apache.wicket.Component; @@ -72,7 +73,7 @@ public final class ResultStatusModal<T extends AnyTO> extends AbstractModalPanel private static final String IMG_PREFIX = "/img/statuses/"; - private final AnyTO subject; + private final ProvisioningResult<AnyTO> provResult; private final Mode mode; @@ -87,7 +88,7 @@ public final class ResultStatusModal<T extends AnyTO> extends AbstractModalPanel private Mode mode; - private AnyTO subject; + private ProvisioningResult<AnyTO> provResult; private final BaseModal<T> modal; @@ -96,8 +97,8 @@ public final class ResultStatusModal<T extends AnyTO> extends AbstractModalPanel public Builder( final BaseModal<T> modal, final PageReference pageRef, - final AnyTO attributable) { - this.subject = attributable; + final ProvisioningResult<AnyTO> provResult) { + this.provResult = provResult; this.modal = modal; this.pageRef = pageRef; } @@ -119,7 +120,7 @@ public final class ResultStatusModal<T extends AnyTO> extends AbstractModalPanel super(modal, pageRef); - this.subject = builder.subject; + this.provResult = builder.provResult; statusUtils = new StatusUtils(new UserRestClient()); if (builder.mode == null) { this.mode = Mode.ADMIN; @@ -145,14 +146,16 @@ public final class ResultStatusModal<T extends AnyTO> extends AbstractModalPanel List<PropagationStatus> propagations = new ArrayList<PropagationStatus>(); propagations.add(syncope); - propagations.addAll(subject.getPropagationStatusTOs()); + propagations.addAll(provResult.getPropagationStatuses()); + + AnyTO any = provResult.getAny(); fragment.add(new Label("info", - ((subject instanceof UserTO) && ((UserTO) subject).getUsername() != null) - ? ((UserTO) subject).getUsername() - : ((subject instanceof GroupTO) && ((GroupTO) subject).getName() != null) - ? ((GroupTO) subject).getName() - : String.valueOf(subject.getKey()))); + ((any instanceof UserTO) && ((UserTO) any).getUsername() != null) + ? ((UserTO) any).getUsername() + : ((any instanceof GroupTO) && ((GroupTO) any).getName() != null) + ? ((GroupTO) any).getName() + : String.valueOf(any.getKey()))); final ListView<PropagationStatus> propRes = new ListView<PropagationStatus>("resources", propagations) { @@ -267,7 +270,7 @@ public final class ResultStatusModal<T extends AnyTO> extends AbstractModalPanel // sorted in reversed presentation order final List<String> head = new ArrayList<String>(); - if (subject instanceof UserTO) { + if (provResult.getAny() instanceof UserTO) { head.add(ConnIdSpecialAttributeName.PASSWORD); head.add(ConnIdSpecialAttributeName.ENABLE); } @@ -286,7 +289,7 @@ public final class ResultStatusModal<T extends AnyTO> extends AbstractModalPanel attributes.addAll(beforeAttrMap.keySet()); attributes.addAll(afterAttrMap.keySet()); - if (!(subject instanceof UserTO)) { + if (!(provResult.getAny() instanceof UserTO)) { attributes.remove(ConnIdSpecialAttributeName.PASSWORD); attributes.remove(ConnIdSpecialAttributeName.ENABLE); } @@ -382,7 +385,7 @@ public final class ResultStatusModal<T extends AnyTO> extends AbstractModalPanel final Image image; final String alt, title; switch (statusUtils.getStatusBean( - subject, resourceName, objectTO, this.subject instanceof GroupTO).getStatus()) { + provResult.getAny(), resourceName, objectTO, this.provResult.getAny() instanceof GroupTO).getStatus()) { case ACTIVE: image = new Image("status", http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractModalPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractModalPanel.java index 2c244b2..57d34aa 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractModalPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractModalPanel.java @@ -30,7 +30,7 @@ import org.apache.wicket.markup.html.panel.Panel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class AbstractModalPanel extends Panel { +public class AbstractModalPanel extends Panel implements ModalPanel { private static final long serialVersionUID = 8611724965544132636L; @@ -66,10 +66,12 @@ public class AbstractModalPanel extends Panel { this.modal.close(target); } + @Override public void onSubmit(final AjaxRequestTarget target, final Form<?> form) { modal.getFeedbackPanel().refresh(target); } + @Override public void onError(final AjaxRequestTarget target, final Form<?> form) { modal.getFeedbackPanel().refresh(target); } http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSearchResultPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSearchResultPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSearchResultPanel.java index 68bafbe..e6bd3ed 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSearchResultPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSearchResultPanel.java @@ -18,6 +18,7 @@ */ package org.apache.syncope.client.console.panels; +import java.io.Serializable; import java.util.Collection; import java.util.List; import org.apache.syncope.client.console.PreferenceManager; @@ -27,24 +28,23 @@ import org.apache.syncope.client.console.pages.AbstractBasePage; import org.apache.syncope.client.console.rest.AbstractAnyRestClient; 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.wizards.WizardMgtPanel; import org.apache.syncope.common.lib.to.AnyTO; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; 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.extensions.markup.html.repeater.data.table.IColumn; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.form.DropDownChoice; import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.model.PropertyModel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public abstract class AbstractSearchResultPanel<T extends AnyTO> extends Panel implements IEventSource { +public abstract class AbstractSearchResultPanel<T extends AnyTO> extends WizardMgtPanel<T> { private static final long serialVersionUID = -9170191461250434024L; @@ -94,12 +94,6 @@ public abstract class AbstractSearchResultPanel<T extends AnyTO> extends Panel i private AnyDataProvider dataProvider; /** - * Modal window to be used for: user profile editing (Global visibility is required); attributes choosing to - * display in tables; user status management. - */ - protected final BaseModal<T> modal = new BaseModal<>("modal"); - - /** * Owner page. */ protected final AbstractBasePage page; @@ -114,13 +108,16 @@ public abstract class AbstractSearchResultPanel<T extends AnyTO> extends Panel i */ private final String type; - protected <T extends AnyTO> AbstractSearchResultPanel(final String id, final boolean filtered, - final String fiql, final PageReference pageRef, final AbstractAnyRestClient restClient, - final String realm, final String type) { - - super(id); + protected <T extends AnyTO> AbstractSearchResultPanel( + final String id, + final boolean filtered, + final String fiql, + final PageReference pageRef, + final AbstractAnyRestClient restClient, + final String realm, + final String type) { - add(modal); + super(id, pageRef, true); setOutputMarkupId(true); @@ -133,7 +130,7 @@ public abstract class AbstractSearchResultPanel<T extends AnyTO> extends Panel i this.restClient = restClient; // Container for user search result - container = new WebMarkupContainer("container"); + container = new WebMarkupContainer("searchContainer"); container.setOutputMarkupId(true); add(container); @@ -177,7 +174,7 @@ public abstract class AbstractSearchResultPanel<T extends AnyTO> extends Panel i paginatorForm.add(rowsChooser); // --------------------------- - setWindowClosedReloadCallback(modal); +// setWindowClosedReloadCallback(modal); } public void search(final String fiql, final AjaxRequestTarget target) { @@ -234,6 +231,7 @@ public abstract class AbstractSearchResultPanel<T extends AnyTO> extends Panel i data.getTarget().add(container); } + super.onEvent(event); } private void setWindowClosedReloadCallback(final BaseModal<?> modal) { @@ -299,4 +297,50 @@ public abstract class AbstractSearchResultPanel<T extends AnyTO> extends Panel i protected abstract <T extends AnyTO> Collection<ActionLink.ActionType> getBulkActions(); protected abstract String getPageId(); + + public abstract static class Builder<T extends Serializable> extends WizardMgtPanel.Builder<T> { + + private static final long serialVersionUID = 1L; + + /** + * Specify if results are about a filtered search or not. Using this attribute it is possible to use this panel + * to + * show results about user list and user search. + */ + protected final boolean filtered; + + /** + * Filter used in case of filtered search. + */ + protected final String fiql; + + protected final AbstractAnyRestClient restClient; + + /** + * Realm related to current panel. + */ + protected final String realm; + + /** + * Any type related to current panel. + */ + protected final String type; + + protected Builder( + final Class<T> reference, + final boolean filtered, + final String fiql, + final PageReference pageRef, + final AbstractAnyRestClient restClient, + final String realm, + final String type) { + super(reference, pageRef); + this.filtered = filtered; + this.fiql = fiql; + this.restClient = restClient; + this.realm = realm; + this.type = type; + } + + } } http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/AjaxDataTablePanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AjaxDataTablePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AjaxDataTablePanel.java index 5041c6e..0272555 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AjaxDataTablePanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AjaxDataTablePanel.java @@ -61,7 +61,7 @@ public class AjaxDataTablePanel<T, S> extends DataTablePanel<T, S> { super(id); - final BaseModal<?> bulkModalWin = new BaseModal("bulkModal"); + final BaseModal<?> bulkModalWin = new BaseModal<>("bulkModal"); add(bulkModalWin); bulkModalWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/AnySearchResultPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnySearchResultPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnySearchResultPanel.java index eacdb4f..4e3efe3 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnySearchResultPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnySearchResultPanel.java @@ -20,7 +20,6 @@ package org.apache.syncope.client.console.panels; import java.io.Serializable; import java.lang.reflect.Field; -import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Date; @@ -29,12 +28,13 @@ import org.apache.syncope.client.console.commons.Constants; import org.apache.syncope.client.console.pages.AnyDisplayAttributesModalPage; import org.apache.syncope.client.console.pages.BasePage; import org.apache.syncope.client.console.rest.AbstractAnyRestClient; -import org.apache.syncope.client.console.rest.AnyObjectRestClient; import org.apache.syncope.client.console.rest.SchemaRestClient; import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.ActionColumn; import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.AttrColumn; import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink; import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel; +import org.apache.syncope.client.console.wizards.AjaxWizard; +import org.apache.syncope.client.console.wizards.WizardMgtPanel; import org.apache.syncope.common.lib.SyncopeClientException; import org.apache.syncope.common.lib.to.AnyTO; import org.apache.syncope.common.lib.to.AnyTypeClassTO; @@ -42,12 +42,11 @@ import org.apache.syncope.common.lib.to.AnyObjectTO; import org.apache.syncope.common.lib.types.SchemaType; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.event.Broadcast; import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn; import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.model.CompoundPropertyModel; import org.apache.wicket.model.IModel; -import org.apache.wicket.model.Model; import org.apache.wicket.model.ResourceModel; import org.springframework.util.ReflectionUtils; @@ -65,9 +64,15 @@ public class AnySearchResultPanel<T extends AnyTO> extends AbstractSearchResultP private final String entitlement = "USER_LIST"; - public AnySearchResultPanel(final String type, final String parentId, final boolean filtered, - final String fiql, final PageReference callerRef, final AbstractAnyRestClient restClient, - final List<AnyTypeClassTO> anyTypeClassTOs, final String realm) { + protected AnySearchResultPanel( + final String type, + final String parentId, + final boolean filtered, + final String fiql, + final PageReference callerRef, + final AbstractAnyRestClient restClient, + final List<AnyTypeClassTO> anyTypeClassTOs, + final String realm) { super(parentId, filtered, fiql, callerRef, restClient, realm, type); //setCustomMarkupId(markupId); @@ -139,16 +144,8 @@ public class AnySearchResultPanel<T extends AnyTO> extends AbstractSearchResultP @Override public void onClick(final AjaxRequestTarget target, final AnyTO anyTO) { - final T modelObject = ((AnyObjectRestClient) restClient).<T>read(anyTO.getKey()); - - final IModel<T> model = new CompoundPropertyModel<>(modelObject); - modal.setFormModel(model); - - // still missing content - target.add(modal); - - modal.header(new Model<String>(MessageFormat.format(getString("any.edit"), anyTO.getKey()))); - modal.show(true); + send(AnySearchResultPanel.this, Broadcast.BREADTH, + new AjaxWizard.NewItemActionEvent<AnyTO>(model.getObject(), target)); } }, ActionLink.ActionType.EDIT, entitlement).add(new ActionLink<AnyTO>() { @@ -222,4 +219,30 @@ public class AnySearchResultPanel<T extends AnyTO> extends AbstractSearchResultP protected String getPageId() { return pageID; } + + public static final class Builder extends AbstractSearchResultPanel.Builder<AnyObjectTO> { + + private static final long serialVersionUID = 1L; + + private final List<AnyTypeClassTO> anyTypeClassTOs; + + public Builder( + final boolean filtered, + final String fiql, + final PageReference pageRef, + final AbstractAnyRestClient restClient, + final List<AnyTypeClassTO> anyTypeClassTOs, + final String realm, + final String type) { + super(AnyObjectTO.class, filtered, fiql, pageRef, restClient, realm, type); + this.anyTypeClassTOs = anyTypeClassTOs; + } + + @Override + protected WizardMgtPanel<AnyObjectTO> newInstance(final String parentId) { + return new AnySearchResultPanel<AnyObjectTO>( + type, parentId, filtered, fiql, pageRef, restClient, anyTypeClassTOs, realm); + } + + } } http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnectorConfPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnectorConfPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnectorConfPanel.java index 2e813ed..3447a97 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnectorConfPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ConnectorConfPanel.java @@ -43,10 +43,10 @@ public abstract class ConnectorConfPanel extends AbstractConnectorConfPanel<Conn this.bundles = bundles; final List<ConnConfProperty> properties = getConnProperties(model.getObject()); - model.getObject().getConfiguration().clear(); - model.getObject().getConfiguration().addAll(properties); + model.getObject().getConf().clear(); + model.getObject().getConf().addAll(properties); - setConfPropertyListView("configuration", true); + setConfPropertyListView("conf", true); } /** @@ -67,10 +67,10 @@ public abstract class ConnectorConfPanel extends AbstractConnectorConfPanel<Conn final ConnConfProperty property = new ConnConfProperty(); property.setSchema(key); - if (instance.getKey() != 0 && instance.getConfigurationMap().containsKey(key.getName()) - && instance.getConfigurationMap().get(key.getName()).getValues() != null) { - property.getValues().addAll(instance.getConfigurationMap().get(key.getName()).getValues()); - property.setOverridable(instance.getConfigurationMap().get(key.getName()).isOverridable()); + if (instance.getKey() != 0 && instance.getConfMap().containsKey(key.getName()) + && instance.getConfMap().get(key.getName()).getValues() != null) { + property.getValues().addAll(instance.getConfMap().get(key.getName()).getValues()); + property.setOverridable(instance.getConfMap().get(key.getName()).isOverridable()); } if (property.getValues().isEmpty() && !key.getDefaultValues().isEmpty()) { http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupModalPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupModalPanel.java deleted file mode 100644 index 9778881..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupModalPanel.java +++ /dev/null @@ -1,119 +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 org.apache.commons.lang3.SerializationUtils; -import org.apache.syncope.client.console.commons.Constants; -import org.apache.syncope.client.console.commons.Mode; -import org.apache.syncope.client.console.rest.GroupRestClient; -import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal; -import org.apache.syncope.common.lib.to.GroupTO; -import org.apache.wicket.PageReference; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.markup.html.form.AjaxButton; -import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.model.CompoundPropertyModel; -import org.apache.wicket.model.ResourceModel; - -/** - * Modal window with Group form. - */ -public class GroupModalPanel extends AbstractModalPanel { - - private static final long serialVersionUID = -1732493223434085205L; - - private final GroupRestClient groupRestClient = new GroupRestClient(); - - protected final Mode mode; - - protected final boolean createFlag; - - protected final GroupPanel groupPanel; - - protected GroupTO originalGroupTO; - - public GroupModalPanel( - final BaseModal<?> modal, final PageReference pageRef, final GroupTO groupTO) { - - this(modal, pageRef, groupTO, Mode.ADMIN); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - public GroupModalPanel( - final BaseModal<?> modal, final PageReference pageRef, final GroupTO groupTO, final Mode mode) { - - super(modal, pageRef); - - this.mode = mode; - - this.createFlag = groupTO.getKey() == 0; - if (!createFlag) { - originalGroupTO = SerializationUtils.clone(groupTO); - } - - final Form<GroupTO> form = new Form<>("groupForm"); - form.setMultiPart(true); - - add(new Label("displayName", groupTO.getKey() == 0 ? "" : groupTO.getDisplayName())); - - form.setModel(new CompoundPropertyModel<>(groupTO)); - - this.groupPanel = new GroupPanel.Builder("groupPanel"). - form(form).groupTO(groupTO).groupModalPageMode(mode).build(); - form.add(groupPanel); - - final AjaxButton submit = new IndicatingAjaxButton(SUBMIT, new ResourceModel(SUBMIT)) { - - private static final long serialVersionUID = -958724007591692537L; - - @Override - protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) { - try { - submitAction(target, form); - } catch (Exception e) { - LOG.error("Failure managing groupTO {}", groupTO, e); - error(getString(Constants.ERROR) + ": " + e.getMessage()); - modal.getFeedbackPanel().refresh(target); - } - } - - @Override - protected void onError(final AjaxRequestTarget target, final Form<?> form) { - modal.getFeedbackPanel().refresh(target); - } - }; - form.add(submit); - form.setDefaultButton(submit); - } - - protected void submitAction(final AjaxRequestTarget target, final Form<?> form) { - final GroupTO groupTO = (GroupTO) form.getDefaultModelObject(); - - GroupTO result; - if (createFlag) { - result = groupRestClient.create(groupTO); - } else { - result = groupRestClient.update(originalGroupTO.getETagValue(), groupTO); - } - - //setResponsePage(new ResultStatusModal.Builder(window, result).build()); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupPanel.java deleted file mode 100644 index 3e58e61..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupPanel.java +++ /dev/null @@ -1,75 +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.io.Serializable; -import org.apache.syncope.client.console.commons.Mode; -import org.apache.syncope.common.lib.to.GroupTO; -import org.apache.wicket.PageReference; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.panel.Panel; - -public final class GroupPanel extends Panel { - - private static final long serialVersionUID = 4216376097320768369L; - - public static class Builder implements Serializable { - - private static final long serialVersionUID = 8150440254654306070L; - - private String id; - - private Form form; - - private GroupTO groupTO; - - private Mode mode; - - private PageReference pageReference; - - public Builder(final String id) { - this.id = id; - } - - public Builder form(final Form form) { - this.form = form; - return this; - } - - public Builder groupTO(final GroupTO groupTO) { - this.groupTO = groupTO; - return this; - } - - public Builder groupModalPageMode(final Mode mode) { - this.mode = mode; - return this; - } - - public GroupPanel build() { - return new GroupPanel(this); - } - } - - private GroupPanel(final Builder builder) { - super(builder.id); - - - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSearchResultPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSearchResultPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSearchResultPanel.java index 458298b..3e94680 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSearchResultPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/GroupSearchResultPanel.java @@ -34,6 +34,8 @@ import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater. import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink; import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink.ActionType; import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel; +import org.apache.syncope.client.console.wizards.AjaxWizard; +import org.apache.syncope.client.console.wizards.WizardMgtPanel; import org.apache.syncope.common.lib.SyncopeClientException; import org.apache.syncope.common.lib.to.AnyTO; import org.apache.syncope.common.lib.to.AnyTypeClassTO; @@ -41,21 +43,28 @@ import org.apache.syncope.common.lib.to.GroupTO; import org.apache.syncope.common.lib.types.SchemaType; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.event.Broadcast; import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn; import org.apache.wicket.model.IModel; import org.apache.wicket.model.ResourceModel; import org.springframework.util.ReflectionUtils; -public class GroupSearchResultPanel extends AnySearchResultPanel<GroupTO> { +public final class GroupSearchResultPanel extends AnySearchResultPanel<GroupTO> { private static final long serialVersionUID = -1100228004207271270L; private final String entitlement = "GROUP_READ"; - public GroupSearchResultPanel(final String type, final String parentId, - final boolean filtered, final String fiql, final PageReference callerRef, - final AbstractAnyRestClient restClient, final List<AnyTypeClassTO> anyTypeClassTOs, final String realm) { + private GroupSearchResultPanel( + final String type, + final String parentId, + final boolean filtered, + final String fiql, + final PageReference callerRef, + final AbstractAnyRestClient restClient, + final List<AnyTypeClassTO> anyTypeClassTOs, + final String realm) { super(type, parentId, filtered, fiql, callerRef, restClient, anyTypeClassTOs, realm); } @@ -73,8 +82,7 @@ public class GroupSearchResultPanel extends AnySearchResultPanel<GroupTO> { } else if (field != null && field.getType().equals(Date.class)) { columns.add(new PropertyColumn<AnyTO, String>(new ResourceModel(name, name), name, name)); } else { - columns.add( - new PropertyColumn<AnyTO, String>(new ResourceModel(name, name), name, name)); + columns.add(new PropertyColumn<AnyTO, String>(new ResourceModel(name, name), name, name)); } } @@ -115,11 +123,8 @@ public class GroupSearchResultPanel extends AnySearchResultPanel<GroupTO> { @Override public void onClick(final AjaxRequestTarget target, final AnyTO anyTO) { - modal.addOrReplace(new GroupModalPanel( - modal, getPage().getPageReference(), GroupTO.class.cast(model.getObject()))); - - target.add(modal); - modal.show(target); + send(GroupSearchResultPanel.this, Broadcast.BREADTH, + new AjaxWizard.NewItemActionEvent<AnyTO>(model.getObject(), target)); } }, ActionLink.ActionType.EDIT, entitlement).add(new ActionLink<AnyTO>() { @@ -219,4 +224,30 @@ public class GroupSearchResultPanel extends AnySearchResultPanel<GroupTO> { protected String getPageId() { return pageID; } + + public static final class Builder extends AbstractSearchResultPanel.Builder<GroupTO> { + + private static final long serialVersionUID = 1L; + + private final List<AnyTypeClassTO> anyTypeClassTOs; + + public Builder( + final boolean filtered, + final String fiql, + final PageReference pageRef, + final AbstractAnyRestClient restClient, + final List<AnyTypeClassTO> anyTypeClassTOs, + final String realm, + final String type) { + super(GroupTO.class, filtered, fiql, pageRef, restClient, realm, type); + this.anyTypeClassTOs = anyTypeClassTOs; + } + + @Override + protected WizardMgtPanel<GroupTO> newInstance(final String parentId) { + return new GroupSearchResultPanel( + type, parentId, filtered, fiql, pageRef, restClient, anyTypeClassTOs, realm); + } + + } } http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java index ca67bdb..229bcca 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java @@ -27,28 +27,21 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.commons.lang3.StringUtils; -import org.apache.syncope.client.console.commons.Constants; -import org.apache.syncope.client.console.wicket.ajax.markup.html.ClearIndicatingAjaxButton; import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink; import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel; import org.apache.syncope.client.console.wizards.AjaxWizard; -import org.apache.syncope.client.console.wizards.AjaxWizardBuilder; +import org.apache.syncope.client.console.wizards.WizardMgtPanel; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.event.Broadcast; import org.apache.wicket.event.IEvent; -import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.list.ListItem; import org.apache.wicket.markup.html.list.ListView; -import org.apache.wicket.markup.html.panel.Fragment; -import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.model.ResourceModel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public final class ListViewPanel<T extends Serializable> extends Panel { +public final class ListViewPanel<T extends Serializable> extends WizardMgtPanel<T> { private static final long serialVersionUID = -7982691107029848579L; @@ -57,18 +50,8 @@ public final class ListViewPanel<T extends Serializable> extends Panel { */ private static final Logger LOG = LoggerFactory.getLogger(ListViewPanel.class); - private final ClearIndicatingAjaxButton addButton; - - private AjaxWizardBuilder<T> newItemPanelBuilder; - - private final WebMarkupContainer container; - - private final Fragment initialFragment; - private final List<T> listOfItems; - private NotificationPanel notificationPanel; - /** * Table view of a list of beans. * @@ -85,16 +68,10 @@ public final class ListViewPanel<T extends Serializable> extends Panel { final List<String> includes, final ActionLinksPanel.Builder<T> actions, final PageReference pageRef) { - super(id); + super(id, pageRef); setOutputMarkupId(true); - container = new WebMarkupContainer("container"); - add(container.setOutputMarkupId(true)); - - initialFragment = new Fragment("content", "table", this); - container.addOrReplace(initialFragment); - - initialFragment.add(new Label("caption", new ResourceModel("listview.caption", StringUtils.EMPTY))); + add(new Label("caption", new ResourceModel("listview.caption", StringUtils.EMPTY))); final List<String> toBeIncluded; if (includes == null || includes.isEmpty()) { @@ -130,7 +107,7 @@ public final class ListViewPanel<T extends Serializable> extends Panel { item.add(new Label("name", new ResourceModel(item.getModelObject(), item.getModelObject()))); } }; - initialFragment.add(names); + add(names); final ListView<T> beans = new ListView<T>("beans", listOfItems) { @@ -169,78 +146,14 @@ public final class ListViewPanel<T extends Serializable> extends Panel { beanItem.add(actions.build("actions", bean)); } }; + beans.setOutputMarkupId(true); beans.setReuseItems(true); - initialFragment.add(beans); - - addButton = new ClearIndicatingAjaxButton("add", pageRef) { - - private static final long serialVersionUID = 1L; - - @Override - protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) { - send(ListViewPanel.this, Broadcast.DEPTH, new AjaxWizard.NewItemActionEvent<T>(null, target)); - } - }; - - addButton.setEnabled(false); - addButton.setVisible(false); - - initialFragment.add(addButton); + add(beans); } - @Override - @SuppressWarnings("unchecked") - public void onEvent(final IEvent<?> event) { - if (event.getPayload() instanceof AjaxWizard.NewItemEvent) { - final AjaxRequestTarget target = AjaxWizard.NewItemEvent.class.cast(event.getPayload()).getTarget(); - - final T item = ((AjaxWizard.NewItemEvent<T>) event.getPayload()).getItem(); - - if (event.getPayload() instanceof AjaxWizard.NewItemActionEvent) { - final Fragment fragment = new Fragment("content", "wizard", ListViewPanel.this); - newItemPanelBuilder.setItem(item); - - fragment.add(newItemPanelBuilder.build( - ((AjaxWizard.NewItemActionEvent<T>) event.getPayload()).getIndex())); - - container.addOrReplace(fragment); - } else { - if (event.getPayload() instanceof AjaxWizard.NewItemFinishEvent) { - if (item != null && !this.listOfItems.contains(item)) { - this.listOfItems.add(item); - } - - if (notificationPanel != null) { - getSession().info(getString(Constants.OPERATION_SUCCEEDED)); - notificationPanel.refresh(target); - } - } - container.addOrReplace(initialFragment); - } - - target.add(container); - } - super.onEvent(event); - } - - private ListViewPanel<T> addNewItemPanelBuilder(final AjaxWizardBuilder<T> panelBuilder) { - this.newItemPanelBuilder = panelBuilder; - - if (this.newItemPanelBuilder != null) { - addButton.setEnabled(true); - addButton.setVisible(true); - } - - return this; - } - - private ListViewPanel<T> addNotificationPanel(final NotificationPanel notificationPanel) { - this.notificationPanel = notificationPanel; - return this; - } - - public static <T extends Serializable> Builder<T> builder(final Class<T> reference, final PageReference pageRef) { - return new Builder<T>(reference, pageRef); + public static <T extends Serializable> ListViewPanel.Builder<T> builder( + final Class<T> reference, final PageReference pageRef) { + return new ListViewPanel.Builder<T>(reference, pageRef); } /** @@ -248,43 +161,23 @@ public final class ListViewPanel<T extends Serializable> extends Panel { * * @param <T> list item reference type. */ - public static final class Builder<T extends Serializable> implements Serializable { + public static final class Builder<T extends Serializable> extends WizardMgtPanel.Builder<T> { private static final long serialVersionUID = 1L; - private final PageReference pageRef; - - private final Class<T> reference; - private final List<String> includes = new ArrayList<>(); private final ActionLinksPanel.Builder<T> actions; private List<T> items; - private AjaxWizardBuilder<T> newItemPanelBuilder; - - private NotificationPanel notificationPanel; - private Builder(final Class<T> reference, final PageReference pageRef) { - this.pageRef = pageRef; - this.reference = reference; + super(reference, pageRef); this.items = null; this.actions = ActionLinksPanel.<T>builder(pageRef); } /** - * Builds a list view. - * - * @param id component id. - * @return List view. - */ - public ListViewPanel<T> build(final String id) { - return new ListViewPanel<T>(id, items, reference, includes, actions, pageRef). - addNewItemPanelBuilder(newItemPanelBuilder).addNotificationPanel(notificationPanel); - } - - /** * Sets list of items. * * @param items list of items. @@ -343,14 +236,28 @@ public final class ListViewPanel<T extends Serializable> extends Panel { return this; } - public Builder<T> addNewItemPanelBuilder(final AjaxWizardBuilder<T> panelBuilder) { - this.newItemPanelBuilder = panelBuilder; - return this; + @Override + protected WizardMgtPanel<T> newInstance(final String id) { + return new ListViewPanel<T>(id, items, reference, includes, actions, pageRef); } + } - public Builder<T> addNotificationPanel(final NotificationPanel notificationPanel) { - this.notificationPanel = notificationPanel; - return this; + @Override + @SuppressWarnings("unchecked") + public void onEvent(final IEvent<?> event) { + if (event.getPayload() instanceof AjaxWizard.NewItemEvent) { + + final T item = ((AjaxWizard.NewItemEvent<T>) event.getPayload()).getItem(); + final AjaxRequestTarget target = ((AjaxWizard.NewItemEvent<T>) event.getPayload()).getTarget(); + + if (event.getPayload() instanceof AjaxWizard.NewItemFinishEvent) { + if (item != null && !this.listOfItems.contains(item)) { + this.listOfItems.add(item); + } + } + + target.add(ListViewPanel.this); } + super.onEvent(event); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/ModalPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ModalPanel.java new file mode 100644 index 0000000..681c1f2 --- /dev/null +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ModalPanel.java @@ -0,0 +1,30 @@ +/* + * 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 org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.request.component.IRequestableComponent; + +public interface ModalPanel extends IRequestableComponent { + + void onSubmit(final AjaxRequestTarget target, final Form<?> form); + + void onError(final AjaxRequestTarget target, final Form<?> form); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java index 3725019..edf35ee 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java @@ -22,12 +22,20 @@ import com.googlecode.wicket.jquery.core.panel.LabelPanel; import de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel; import java.util.ArrayList; import java.util.List; +import org.apache.syncope.client.console.pages.BasePage; import org.apache.syncope.client.console.rest.AnyObjectRestClient; import org.apache.syncope.client.console.rest.AnyTypeRestClient; import org.apache.syncope.client.console.rest.GroupRestClient; import org.apache.syncope.client.console.rest.UserRestClient; +import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal; +import org.apache.syncope.client.console.wizards.any.AnyWizardBuilder; +import org.apache.syncope.client.console.wizards.any.GroupWizardBuilder; +import org.apache.syncope.client.console.wizards.any.UserWizardBuilder; +import org.apache.syncope.common.lib.to.AnyObjectTO; import org.apache.syncope.common.lib.to.AnyTypeTO; +import org.apache.syncope.common.lib.to.GroupTO; import org.apache.syncope.common.lib.to.RealmTO; +import org.apache.syncope.common.lib.to.UserTO; import org.apache.wicket.PageReference; import org.apache.wicket.extensions.markup.html.tabs.AbstractTab; import org.apache.wicket.extensions.markup.html.tabs.ITab; @@ -54,13 +62,16 @@ public class Realm extends Panel { private final AnyObjectRestClient anyObjectRestClient = new AnyObjectRestClient(); + private final PageReference pageRef; + @SuppressWarnings({ "unchecked", "unchecked" }) - public Realm(final String id, final RealmTO realmTO, final PageReference pageReference) { + public Realm(final String id, final RealmTO realmTO, final PageReference pageRef) { super(id); this.realmTO = realmTO; this.anyTypeTOs = anyTypeRestClient.getAll(); + this.pageRef = pageRef; - add(new AjaxBootstrapTabbedPanel<>("tabbedPanel", buildTabList(pageReference))); + add(new AjaxBootstrapTabbedPanel<>("tabbedPanel", buildTabList(pageRef))); } public RealmTO getRealmTO() { @@ -103,19 +114,44 @@ public class Realm extends Panel { switch (anyTypeTO.getKind()) { case USER: - panel = new UserSearchResultPanel(anyTypeTO.getKey(), id, - false, null, pageReference, userRestClient, anyTypeRestClient.getAnyTypeClass( - anyTypeTO.getClasses()), realmTO.getFullPath()); + final UserTO userTO = new UserTO(); + userTO.setRealm(realmTO.getFullPath()); + panel = new UserSearchResultPanel.Builder( + false, null, pageReference, userRestClient, + anyTypeRestClient.getAnyTypeClass(anyTypeTO.getClasses().toArray(new String[] {})), + realmTO.getFullPath(), + anyTypeTO.getKey()). + addNewItemPanelBuilder(new UserWizardBuilder( + BaseModal.CONTENT_ID, userTO, anyTypeTO.getClasses(), pageRef)). + addNotificationPanel(BasePage.class.cast(this.pageRef.getPage()).getFeedbackPanel()). + build(id); break; case GROUP: - panel = new GroupSearchResultPanel(anyTypeTO.getKey(), id, - false, null, pageReference, groupRestClient, anyTypeRestClient.getAnyTypeClass( - anyTypeTO.getClasses()), realmTO.getFullPath()); + final GroupTO groupTO = new GroupTO(); + groupTO.setRealm(realmTO.getFullPath()); + panel = new GroupSearchResultPanel.Builder( + false, null, pageReference, groupRestClient, + anyTypeRestClient.getAnyTypeClass(anyTypeTO.getClasses().toArray(new String[] {})), + realmTO.getFullPath(), + anyTypeTO.getKey()). + addNewItemPanelBuilder(new GroupWizardBuilder( + BaseModal.CONTENT_ID, groupTO, anyTypeTO.getClasses(), pageRef)). + addNotificationPanel(BasePage.class.cast(this.pageRef.getPage()).getFeedbackPanel()). + build(id); break; case ANY_OBJECT: - panel = new AnySearchResultPanel<>(anyTypeTO.getKey(), id, - false, null, pageReference, anyObjectRestClient, anyTypeRestClient.getAnyTypeClass( - anyTypeTO.getClasses()), realmTO.getFullPath()); + final AnyObjectTO anyObjectTO = new AnyObjectTO(); + anyObjectTO.setRealm(realmTO.getFullPath()); + anyObjectTO.setType(anyTypeTO.getKey()); + panel = new AnySearchResultPanel.Builder( + false, null, pageReference, anyObjectRestClient, + anyTypeRestClient.getAnyTypeClass(anyTypeTO.getClasses().toArray(new String[] {})), + realmTO.getFullPath(), + anyTypeTO.getKey()). + addNewItemPanelBuilder(new AnyWizardBuilder<AnyObjectTO>( + BaseModal.CONTENT_ID, anyObjectTO, anyTypeTO.getClasses(), pageRef)). + addNotificationPanel(BasePage.class.cast(this.pageRef.getPage()).getFeedbackPanel()). + build(id); break; default: panel = new LabelPanel(id, null); http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java index 730b4cf..a838a47 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceConnConfPanel.java @@ -31,7 +31,7 @@ public abstract class ResourceConnConfPanel extends AbstractConnectorConfPanel<R private static final long serialVersionUID = -7982691107029848579L; - private ConnectorRestClient restClient = new ConnectorRestClient(); + private final ConnectorRestClient restClient = new ConnectorRestClient(); private final boolean createFlag; @@ -40,14 +40,14 @@ public abstract class ResourceConnConfPanel extends AbstractConnectorConfPanel<R this.createFlag = createFlag; - final List<ConnConfProperty> connConfProperties = getConnProperties(model.getObject()); + final List<ConnConfProperty> confOverride = getConnProperties(model.getObject()); model.getObject().getConfOverride().clear(); - model.getObject().getConfOverride().addAll(connConfProperties); + model.getObject().getConfOverride().addAll(confOverride); - setConfPropertyListView("connConfProperties", false); + setConfPropertyListView("confOverride", false); - check.setEnabled(!connConfProperties.isEmpty()); - check.setVisible(!connConfProperties.isEmpty()); + check.setEnabled(!confOverride.isEmpty()); + check.setVisible(!confOverride.isEmpty()); } /** http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDetailsPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDetailsPanel.java index fe33899..3e9881f 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDetailsPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDetailsPanel.java @@ -72,12 +72,6 @@ public class ResourceDetailsPanel extends Panel { new PropertyModel<Boolean>(model, "enforceMandatoryCondition"), false)); - container.add(new AjaxCheckBoxPanel( - "propagationPrimary", - new ResourceModel("propagationPrimary", "propagationPrimary").getObject(), - new PropertyModel<Boolean>(model, "propagationPrimary"), - false)); - container.add(new SpinnerFieldPanel<>( "propagationPriority", "propagationPriority", http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/panels/UserSearchResultPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/UserSearchResultPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/UserSearchResultPanel.java index 06725cf..26f638c 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/UserSearchResultPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/UserSearchResultPanel.java @@ -31,12 +31,13 @@ import org.apache.syncope.client.console.pages.BasePage; import org.apache.syncope.client.console.pages.StatusModalPage; import org.apache.syncope.client.console.pages.UserDisplayAttributesModalPage; import org.apache.syncope.client.console.rest.AbstractAnyRestClient; -import org.apache.syncope.client.console.rest.UserRestClient; import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.ActionColumn; import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.AttrColumn; import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink; import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink.ActionType; import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel; +import org.apache.syncope.client.console.wizards.AjaxWizard; +import org.apache.syncope.client.console.wizards.WizardMgtPanel; import org.apache.syncope.common.lib.SyncopeClientException; import org.apache.syncope.common.lib.to.AnyTO; import org.apache.syncope.common.lib.to.AnyTypeClassTO; @@ -44,6 +45,7 @@ import org.apache.syncope.common.lib.to.UserTO; import org.apache.syncope.common.lib.types.SchemaType; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.event.Broadcast; import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn; import org.apache.wicket.model.CompoundPropertyModel; @@ -52,15 +54,21 @@ import org.apache.wicket.model.Model; import org.apache.wicket.model.ResourceModel; import org.springframework.util.ReflectionUtils; -public class UserSearchResultPanel extends AnySearchResultPanel<UserTO> { +public final class UserSearchResultPanel extends AnySearchResultPanel<UserTO> { private static final long serialVersionUID = -1100228004207271270L; private final String entitlement = "USER_LIST"; - public UserSearchResultPanel(final String type, final String parentId, - final boolean filtered, final String fiql, final PageReference callerRef, - final AbstractAnyRestClient restClient, final List<AnyTypeClassTO> anyTypeClassTOs, final String realm) { + private UserSearchResultPanel( + final String type, + final String parentId, + final boolean filtered, + final String fiql, + final PageReference callerRef, + final AbstractAnyRestClient restClient, + final List<AnyTypeClassTO> anyTypeClassTOs, + final String realm) { super(type, parentId, filtered, fiql, callerRef, restClient, anyTypeClassTOs, realm); } @@ -78,8 +86,7 @@ public class UserSearchResultPanel extends AnySearchResultPanel<UserTO> { } else if (field != null && field.getType().equals(Date.class)) { columns.add(new PropertyColumn<AnyTO, String>(new ResourceModel(name, name), name, name)); } else { - columns.add( - new PropertyColumn<AnyTO, String>(new ResourceModel(name, name), name, name)); + columns.add(new PropertyColumn<AnyTO, String>(new ResourceModel(name, name), name, name)); } } @@ -98,8 +105,7 @@ public class UserSearchResultPanel extends AnySearchResultPanel<UserTO> { // Add defaults in case of no selection if (columns.isEmpty()) { for (String name : UserDisplayAttributesModalPage.USER_DEFAULT_SELECTION) { - columns.add( - new PropertyColumn<AnyTO, String>(new ResourceModel(name, name), name, name)); + columns.add(new PropertyColumn<AnyTO, String>(new ResourceModel(name, name), name, name)); } prefMan.setList(getRequest(), getResponse(), Constants.PREF_USERS_DETAILS_VIEW, @@ -155,15 +161,8 @@ public class UserSearchResultPanel extends AnySearchResultPanel<UserTO> { @Override public void onClick(final AjaxRequestTarget target, final AnyTO anyTO) { - final UserTO modelObject = ((UserRestClient) restClient).read(model.getObject().getKey()); - - final IModel<UserTO> model = new CompoundPropertyModel<>(modelObject); - modal.setFormModel(model); - - target.add(modal); - - modal.header(new Model<String>(MessageFormat.format(getString("any.edit"), anyTO.getKey()))); - modal.show(true); + send(UserSearchResultPanel.this, Broadcast.BREADTH, + new AjaxWizard.NewItemActionEvent<AnyTO>(model.getObject(), target)); } }, ActionLink.ActionType.EDIT, entitlement).add(new ActionLink<AnyTO>() { @@ -236,4 +235,29 @@ public class UserSearchResultPanel extends AnySearchResultPanel<UserTO> { protected String getPageId() { return pageID; } + + public static final class Builder extends AbstractSearchResultPanel.Builder<UserTO> { + + private static final long serialVersionUID = 1L; + + private final List<AnyTypeClassTO> anyTypeClassTOs; + + public Builder( + final boolean filtered, + final String fiql, + final PageReference pageRef, + final AbstractAnyRestClient restClient, + final List<AnyTypeClassTO> anyTypeClassTOs, + final String realm, + final String type) { + super(UserTO.class, filtered, fiql, pageRef, restClient, realm, type); + this.anyTypeClassTOs = anyTypeClassTOs; + } + + @Override + protected WizardMgtPanel<UserTO> newInstance(final String parentId) { + return new UserSearchResultPanel( + type, parentId, filtered, fiql, pageRef, restClient, anyTypeClassTOs, realm); + } + } } http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyTypeRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyTypeRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyTypeRestClient.java index 113e30d..85b7c88 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyTypeRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyTypeRestClient.java @@ -20,9 +20,15 @@ package org.apache.syncope.client.console.rest; import java.util.ArrayList; import java.util.List; +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; import org.apache.syncope.common.lib.SyncopeClientException; +import org.apache.syncope.common.lib.patch.AnyObjectPatch; +import org.apache.syncope.common.lib.to.AnyObjectTO; import org.apache.syncope.common.lib.to.AnyTypeClassTO; import org.apache.syncope.common.lib.to.AnyTypeTO; +import org.apache.syncope.common.lib.to.ProvisioningResult; +import org.apache.syncope.common.rest.api.service.AnyObjectService; import org.apache.syncope.common.rest.api.service.AnyTypeClassService; import org.apache.syncope.common.rest.api.service.AnyTypeService; import org.springframework.stereotype.Component; @@ -35,6 +41,18 @@ public class AnyTypeRestClient extends BaseRestClient { private static final long serialVersionUID = 1L; + public AnyTypeTO get(final String kind) { + AnyTypeTO type = null; + + try { + type = getService(AnyTypeService.class).read(kind); + } catch (SyncopeClientException e) { + LOG.error("While reading all any types", e); + } + + return type; + } + public List<AnyTypeTO> getAll() { List<AnyTypeTO> types = null; @@ -47,11 +65,28 @@ public class AnyTypeRestClient extends BaseRestClient { return types; } - public List<AnyTypeClassTO> getAnyTypeClass(final List<String> anyTypeClassNames) { + public List<AnyTypeClassTO> getAnyTypeClass(final String... anyTypeClassNames) { List<AnyTypeClassTO> anyTypeClassTOs = new ArrayList<>(); for (String anyTypeClass : anyTypeClassNames) { anyTypeClassTOs.add(getService(AnyTypeClassService.class).read(anyTypeClass)); } return anyTypeClassTOs; } + + public ProvisioningResult<AnyObjectTO> create(final AnyObjectTO anyObjectTO) { + Response response = getService(AnyObjectService.class).create(anyObjectTO); + return response.readEntity(new GenericType<ProvisioningResult<AnyObjectTO>>() { + }); + } + + public ProvisioningResult<AnyObjectTO> update(final String etag, final AnyObjectPatch anyObjectPatch) { + ProvisioningResult<AnyObjectTO> result; + synchronized (this) { + AnyObjectService service = getService(etag, AnyObjectService.class); + result = service.update(anyObjectPatch).readEntity(new GenericType<ProvisioningResult<AnyObjectTO>>() { + }); + resetClient(AnyObjectService.class); + } + return result; + } } http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfigurationRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfigurationRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfigurationRestClient.java index c24cf53..d1ec74d 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfigurationRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConfigurationRestClient.java @@ -25,7 +25,6 @@ import org.apache.syncope.client.console.commons.AttrLayoutType; import org.apache.syncope.common.lib.SyncopeClientException; import org.apache.syncope.common.lib.to.AttrTO; import org.apache.syncope.common.rest.api.service.ConfigurationService; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component @@ -33,8 +32,7 @@ public class ConfigurationRestClient extends BaseRestClient { private static final long serialVersionUID = 7692363064029538722L; - @Autowired - private SchemaRestClient schemaRestClient; + private SchemaRestClient schemaRestClient = new SchemaRestClient(); public List<AttrTO> list() { final List<AttrTO> attrTOs = getService(ConfigurationService.class).list(); http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java index a026119..fbf0ab0 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java @@ -19,13 +19,16 @@ package org.apache.syncope.client.console.rest; import java.util.List; +import javax.ws.rs.core.GenericType; import javax.ws.rs.core.Response; import org.apache.syncope.client.lib.SyncopeClient; +import org.apache.syncope.common.lib.patch.GroupPatch; import org.apache.syncope.common.lib.to.BulkAction; import org.apache.syncope.common.lib.to.BulkActionResult; import org.apache.syncope.common.lib.to.ConnObjectTO; import org.apache.syncope.common.lib.to.GroupTO; +import org.apache.syncope.common.lib.to.ProvisioningResult; import org.apache.syncope.common.lib.types.AnyTypeKind; import org.apache.syncope.common.rest.api.service.AnyService; import org.apache.syncope.common.rest.api.service.ResourceService; @@ -85,20 +88,22 @@ public class GroupRestClient extends AbstractAnyRestClient { return getService(ResourceService.class).readConnObject(resourceName, AnyTypeKind.GROUP.name(), id); } - public GroupTO create(final GroupTO groupTO) { + public ProvisioningResult<GroupTO> create(final GroupTO groupTO) { Response response = getService(GroupService.class).create(groupTO); - return response.readEntity(GroupTO.class); + return response.readEntity(new GenericType<ProvisioningResult<GroupTO>>() { + }); } public GroupTO read(final Long key) { return getService(GroupService.class).read(key); } - public GroupTO update(final String etag, final GroupTO updated) { - GroupTO result; + public ProvisioningResult<GroupTO> update(final String etag, final GroupPatch patch) { + ProvisioningResult<GroupTO> result; synchronized (this) { GroupService service = getService(etag, GroupService.class); - result = service.update(updated).readEntity(GroupTO.class); + result = service.update(patch).readEntity(new GenericType<ProvisioningResult<GroupTO>>() { + }); resetClient(GroupService.class); } return result; http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java index 6b9f244..ee95e5c 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java @@ -20,7 +20,6 @@ package org.apache.syncope.client.console.rest; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.List; import java.util.ListIterator; import org.apache.commons.collections4.CollectionUtils; @@ -60,26 +59,20 @@ public class SchemaRestClient extends BaseRestClient { } } - public List<? extends AbstractSchemaTO> getSchemas(final SchemaType schemaType) { - List<? extends AbstractSchemaTO> schemas = Collections.emptyList(); + public <T extends AbstractSchemaTO> List<T> getSchemas(final SchemaType schemaType, final String... kind) { + List<T> schemas = new ArrayList<>(); try { - schemas = getService(SchemaService.class).list(schemaType); - } catch (SyncopeClientException e) { - LOG.error("While getting all schemas for {}", schemaType, e); - } - return schemas; - } - - public List<PlainSchemaTO> getSchemas() { - List<PlainSchemaTO> schemas = null; - - try { - schemas = getService(SchemaService.class).list(SchemaType.PLAIN); + if (kind == null || kind.length == 0) { + schemas.addAll(getService(SchemaService.class).<T>list(schemaType, null)); + } else { + for (String clazz : kind) { + schemas.addAll(getService(SchemaService.class).<T>list(schemaType, clazz)); + } + } } catch (SyncopeClientException e) { - LOG.error("While getting all schemas", e); + LOG.error("While getting all {} schemas for {}", schemaType, kind, e); } - return schemas; } @@ -109,7 +102,7 @@ public class SchemaRestClient extends BaseRestClient { List<DerSchemaTO> userDerSchemas = null; try { - userDerSchemas = getService(SchemaService.class).list(SchemaType.DERIVED); + userDerSchemas = getService(SchemaService.class).list(SchemaType.DERIVED, null); } catch (SyncopeClientException e) { LOG.error("While getting all user derived schemas", e); } @@ -125,7 +118,7 @@ public class SchemaRestClient extends BaseRestClient { List<VirSchemaTO> userVirSchemas = null; try { - userVirSchemas = getService(SchemaService.class).list(SchemaType.VIRTUAL); + userVirSchemas = getService(SchemaService.class).list(SchemaType.VIRTUAL, null); } catch (SyncopeClientException e) { LOG.error("While getting all virtual schemas", e); } http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/rest/UserRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/UserRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/UserRestClient.java index cf92dad..2f148c4 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/UserRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/UserRestClient.java @@ -19,6 +19,7 @@ package org.apache.syncope.client.console.rest; import java.util.List; +import javax.ws.rs.core.GenericType; import javax.ws.rs.core.Response; import org.apache.syncope.client.console.commons.status.StatusBean; import org.apache.syncope.client.console.commons.status.StatusUtils; @@ -29,6 +30,7 @@ import org.apache.syncope.common.lib.patch.UserPatch; import org.apache.syncope.common.lib.to.BulkAction; import org.apache.syncope.common.lib.to.BulkActionResult; import org.apache.syncope.common.lib.to.ConnObjectTO; +import org.apache.syncope.common.lib.to.ProvisioningResult; import org.apache.syncope.common.lib.to.UserTO; import org.apache.syncope.common.lib.types.AnyTypeKind; import org.apache.syncope.common.lib.types.StatusPatchType; @@ -67,16 +69,18 @@ public class UserRestClient extends AbstractAnyRestClient { getResult(); } - public UserTO create(final UserTO userTO, final boolean storePassword) { + public ProvisioningResult<UserTO> create(final UserTO userTO, final boolean storePassword) { Response response = getService(UserService.class).create(userTO, storePassword); - return response.readEntity(UserTO.class); + return response.readEntity(new GenericType<ProvisioningResult<UserTO>>() { + }); } - public UserTO update(final String etag, final UserPatch userPatch) { - UserTO result; + public ProvisioningResult<UserTO> update(final String etag, final UserPatch userPatch) { + ProvisioningResult<UserTO> result; synchronized (this) { UserService service = getService(etag, UserService.class); - result = service.update(userPatch).readEntity(UserTO.class); + result = service.update(userPatch).readEntity(new GenericType<ProvisioningResult<UserTO>>() { + }); resetClient(UserService.class); } return result; http://git-wip-us.apache.org/repos/asf/syncope/blob/047ac019/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/ClearIndicatingAjaxLink.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/ClearIndicatingAjaxLink.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/ClearIndicatingAjaxLink.java index e052846..70491e2 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/ClearIndicatingAjaxLink.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/ajax/markup/html/ClearIndicatingAjaxLink.java @@ -36,11 +36,13 @@ public abstract class ClearIndicatingAjaxLink<T> extends IndicatingAjaxLink<T> { public ClearIndicatingAjaxLink(final String id, final PageReference pageRef) { super(id); this.pageRef = pageRef; + setOutputMarkupId(true); } public ClearIndicatingAjaxLink(final String id, final IModel<T> model, final PageReference pageRef) { super(id, model); this.pageRef = pageRef; + setOutputMarkupId(true); } public ClearIndicatingAjaxLink<T> feedbackPanelAutomaticReload(final boolean reloadFeedbackPanel) {