Return-Path: X-Original-To: apmail-syncope-commits-archive@www.apache.org Delivered-To: apmail-syncope-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 73BD518746 for ; Thu, 19 Nov 2015 11:18:30 +0000 (UTC) Received: (qmail 25004 invoked by uid 500); 19 Nov 2015 11:18:30 -0000 Delivered-To: apmail-syncope-commits-archive@syncope.apache.org Received: (qmail 24974 invoked by uid 500); 19 Nov 2015 11:18:30 -0000 Mailing-List: contact commits-help@syncope.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@syncope.apache.org Delivered-To: mailing list commits@syncope.apache.org Received: (qmail 24963 invoked by uid 99); 19 Nov 2015 11:18:30 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Nov 2015 11:18:30 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id EF5FFE0A83; Thu, 19 Nov 2015 11:18:29 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: fmartelli@apache.org To: commits@syncope.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: syncope git commit: [SYNCOPE-156] providing wizard step to add resources to ANY Date: Thu, 19 Nov 2015 11:18:29 +0000 (UTC) Repository: syncope Updated Branches: refs/heads/master 1ffc62e57 -> 6ea34cd36 [SYNCOPE-156] providing wizard step to add resources to ANY Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/6ea34cd3 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/6ea34cd3 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/6ea34cd3 Branch: refs/heads/master Commit: 6ea34cd36a4943537abf65eee1a94ef3982679b5 Parents: 1ffc62e Author: fmartelli Authored: Thu Nov 19 12:17:52 2015 +0100 Committer: fmartelli Committed: Thu Nov 19 12:17:52 2015 +0100 ---------------------------------------------------------------------- .../client/console/commons/AnyDataProvider.java | 4 +- .../panels/AbstractSearchResultPanel.java | 8 +- .../panels/AnyObjectSearchResultPanel.java | 250 +++++++++++++++++++ .../console/panels/AnySearchResultPanel.java | 250 ------------------- .../console/panels/GroupSearchResultPanel.java | 2 +- .../syncope/client/console/panels/Realm.java | 2 +- .../console/panels/UserSearchResultPanel.java | 2 +- .../client/console/rest/UserRestClient.java | 6 +- .../markup/html/form/AjaxPalettePanel.java | 2 +- .../console/wizards/any/AnyWizardBuilder.java | 12 +- .../client/console/wizards/any/AuxClasses.java | 5 +- .../client/console/wizards/any/Resources.java | 67 +++++ .../console/wizards/any/UserWizardBuilder.java | 1 - .../client/console/wizards/any/Resources.html | 26 ++ 14 files changed, 361 insertions(+), 276 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/6ea34cd3/client/console/src/main/java/org/apache/syncope/client/console/commons/AnyDataProvider.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/AnyDataProvider.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/AnyDataProvider.java index 6a2d226..f36d3c5 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/commons/AnyDataProvider.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/AnyDataProvider.java @@ -95,9 +95,7 @@ public class AnyDataProvider extends SortableDataProvider extends WizardM dataProvider.setFIQL(fiql); final int currentPage = resultTable != null - ? (create - ? (int) resultTable.getPageCount() - 1 - : (int) resultTable.getCurrentPage()) - : 0; + ? (create ? (int) resultTable.getPageCount() - 1 : (int) resultTable.getCurrentPage()) : 0; resultTable = new AjaxDataTablePanel<>( "resultTable", @@ -303,8 +300,7 @@ public abstract class AbstractSearchResultPanel extends WizardM /** * 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. + * to show results about user list and user search. */ protected final boolean filtered; http://git-wip-us.apache.org/repos/asf/syncope/blob/6ea34cd3/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyObjectSearchResultPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyObjectSearchResultPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyObjectSearchResultPanel.java new file mode 100644 index 0000000..0d9c7ed --- /dev/null +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyObjectSearchResultPanel.java @@ -0,0 +1,250 @@ +/* + * 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 de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal; +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.List; +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.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; +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.IModel; +import org.apache.wicket.model.ResourceModel; +import org.springframework.util.ReflectionUtils; + +public class AnyObjectSearchResultPanel extends AbstractSearchResultPanel { + + private static final long serialVersionUID = -1100228004207271270L; + + protected final SchemaRestClient schemaRestClient = new SchemaRestClient(); + + protected final List schemaNames; + + protected final List dSchemaNames; + + protected final String pageID = "Any"; + + protected final String entitlement; + + protected AnyObjectSearchResultPanel( + final String type, + final String parentId, + final boolean filtered, + final String fiql, + final PageReference callerRef, + final AbstractAnyRestClient restClient, + final List anyTypeClassTOs, + final String realm, + final String entitlement) { + + super(parentId, filtered, fiql, callerRef, restClient, realm, type); + modal.size(Modal.Size.Large); + + this.entitlement = entitlement; + + add(new Label("name", type)); + + this.schemaNames = new ArrayList<>(); + for (AnyTypeClassTO anyTypeClassTO : anyTypeClassTOs) { + this.schemaNames.addAll(anyTypeClassTO.getPlainSchemas()); + } + this.dSchemaNames = new ArrayList<>(); + for (AnyTypeClassTO anyTypeClassTO : anyTypeClassTOs) { + this.dSchemaNames.addAll(anyTypeClassTO.getDerSchemas()); + } + + initResultTable(); + } + + @Override + protected List> getColumns() { + final List> columns = new ArrayList<>(); + + for (String name : prefMan.getList(getRequest(), Constants.PREF_ANY_DETAILS_VIEW)) { + final Field field = ReflectionUtils.findField(AnyObjectTO.class, name); + + if ("token".equalsIgnoreCase(name)) { + columns.add(new PropertyColumn(new ResourceModel(name, name), name, name)); + } else if (field != null && field.getType().equals(Date.class)) { + columns.add(new PropertyColumn(new ResourceModel(name, name), name, name)); + } else { + columns.add(new PropertyColumn(new ResourceModel(name, name), name, name)); + } + } + + for (String name : prefMan.getList(getRequest(), Constants.PREF_ANY_ATTRIBUTES_VIEW)) { + if (schemaNames.contains(name)) { + columns.add(new AttrColumn(name, SchemaType.PLAIN)); + } + } + + for (String name : prefMan.getList(getRequest(), Constants.PREF_ANY_DERIVED_ATTRIBUTES_VIEW)) { + if (dSchemaNames.contains(name)) { + columns.add(new AttrColumn(name, SchemaType.DERIVED)); + } + } + + // Add defaults in case of no selection + if (columns.isEmpty()) { + for (String name : AnyDisplayAttributesModalPage.ANY_DEFAULT_SELECTION) { + columns.add(new PropertyColumn(new ResourceModel(name, name), name, name)); + } + + } + + columns.add(new ActionColumn(new ResourceModel("actions", "")) { + + private static final long serialVersionUID = -3503023501954863131L; + + @Override + public ActionLinksPanel getActions(final String componentId, final IModel model) { + final ActionLinksPanel.Builder panel = ActionLinksPanel.builder(page.getPageReference()); + + panel.add(new ActionLink() { + + private static final long serialVersionUID = -7978723352517770644L; + + @Override + public void onClick(final AjaxRequestTarget target, final AnyTO anyTO) { + send(AnyObjectSearchResultPanel.this, Broadcast.EXACT, + new AjaxWizard.EditItemActionEvent<>(model.getObject(), target)); + } + }, ActionLink.ActionType.EDIT, entitlement).add(new ActionLink() { + + private static final long serialVersionUID = -7978723352517770644L; + + @Override + public void onClick(final AjaxRequestTarget target, final T anyTO) { + try { + restClient.delete(model.getObject().getETagValue(), model.getObject().getKey()); + info(getString(Constants.OPERATION_SUCCEEDED)); + target.add(container); + } catch (SyncopeClientException e) { + error(getString(Constants.ERROR) + ": " + e.getMessage()); + LOG.error("While deleting object {}", anyTO.getKey(), e); + } + ((BasePage) getPage()).getFeedbackPanel().refresh(target); + } + }, ActionLink.ActionType.DELETE, entitlement); + + return panel.build(componentId, model.getObject()); + } + + @Override + public ActionLinksPanel getHeader(final String componentId) { + final ActionLinksPanel.Builder panel = ActionLinksPanel.builder(page.getPageReference()); + + panel.add(new ActionLink() { + + private static final long serialVersionUID = -7978723352517770644L; + + @Override + public void onClick(final AjaxRequestTarget target, final Serializable ignore) { + // still missing content + target.add(modal.setContent(new AnyDisplayAttributesModalPage<>( + modal, page.getPageReference(), schemaNames, dSchemaNames))); + + modal.header(new ResourceModel("any.attr.display", "")); + modal.show(true); + } + }, ActionLink.ActionType.CHANGE_VIEW, entitlement).add(new ActionLink() { + + private static final long serialVersionUID = -7978723352517770644L; + + @Override + public void onClick(final AjaxRequestTarget target, final Serializable ignore) { + if (target != null) { + target.add(container); + } + } + }, ActionLink.ActionType.RELOAD, entitlement); + + return panel.build(componentId); + } + }); + + return columns; + } + + @Override + protected Collection getBulkActions() { + final List bulkActions = new ArrayList<>(); + + bulkActions.add(ActionLink.ActionType.DELETE); + bulkActions.add(ActionLink.ActionType.SUSPEND); + bulkActions.add(ActionLink.ActionType.REACTIVATE); + + return bulkActions; + } + + @Override + protected String getPageId() { + return pageID; + } + + public static final class Builder extends AbstractSearchResultPanel.Builder { + + private static final long serialVersionUID = -6828423611982275640L; + + private final List anyTypeClassTOs; + + public Builder( + final boolean filtered, + final String fiql, + final PageReference pageRef, + final AbstractAnyRestClient restClient, + final List anyTypeClassTOs, + final String realm, + final String type) { + + super(AnyObjectTO.class, filtered, fiql, pageRef, restClient, realm, type); + this.anyTypeClassTOs = anyTypeClassTOs; + } + + @Override + protected WizardMgtPanel newInstance(final String parentId) { + return new AnyObjectSearchResultPanel<>( + type, parentId, filtered, fiql, pageRef, restClient, anyTypeClassTOs, realm, type + "_LIST"); + } + + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/6ea34cd3/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 deleted file mode 100644 index 77ca759..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnySearchResultPanel.java +++ /dev/null @@ -1,250 +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 de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal; -import java.io.Serializable; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.List; -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.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; -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.IModel; -import org.apache.wicket.model.ResourceModel; -import org.springframework.util.ReflectionUtils; - -public class AnySearchResultPanel extends AbstractSearchResultPanel { - - private static final long serialVersionUID = -1100228004207271270L; - - protected final SchemaRestClient schemaRestClient = new SchemaRestClient(); - - protected final List schemaNames; - - protected final List dSchemaNames; - - protected final String pageID = "Any"; - - protected final String entitlement; - - protected AnySearchResultPanel( - final String type, - final String parentId, - final boolean filtered, - final String fiql, - final PageReference callerRef, - final AbstractAnyRestClient restClient, - final List anyTypeClassTOs, - final String realm, - final String entitlement) { - - super(parentId, filtered, fiql, callerRef, restClient, realm, type); - modal.size(Modal.Size.Large); - - this.entitlement = entitlement; - - add(new Label("name", type)); - - this.schemaNames = new ArrayList<>(); - for (AnyTypeClassTO anyTypeClassTO : anyTypeClassTOs) { - this.schemaNames.addAll(anyTypeClassTO.getPlainSchemas()); - } - this.dSchemaNames = new ArrayList<>(); - for (AnyTypeClassTO anyTypeClassTO : anyTypeClassTOs) { - this.dSchemaNames.addAll(anyTypeClassTO.getDerSchemas()); - } - - initResultTable(); - } - - @Override - protected List> getColumns() { - final List> columns = new ArrayList<>(); - - for (String name : prefMan.getList(getRequest(), Constants.PREF_ANY_DETAILS_VIEW)) { - final Field field = ReflectionUtils.findField(AnyObjectTO.class, name); - - if ("token".equalsIgnoreCase(name)) { - columns.add(new PropertyColumn(new ResourceModel(name, name), name, name)); - } else if (field != null && field.getType().equals(Date.class)) { - columns.add(new PropertyColumn(new ResourceModel(name, name), name, name)); - } else { - columns.add(new PropertyColumn(new ResourceModel(name, name), name, name)); - } - } - - for (String name : prefMan.getList(getRequest(), Constants.PREF_ANY_ATTRIBUTES_VIEW)) { - if (schemaNames.contains(name)) { - columns.add(new AttrColumn(name, SchemaType.PLAIN)); - } - } - - for (String name : prefMan.getList(getRequest(), Constants.PREF_ANY_DERIVED_ATTRIBUTES_VIEW)) { - if (dSchemaNames.contains(name)) { - columns.add(new AttrColumn(name, SchemaType.DERIVED)); - } - } - - // Add defaults in case of no selection - if (columns.isEmpty()) { - for (String name : AnyDisplayAttributesModalPage.ANY_DEFAULT_SELECTION) { - columns.add(new PropertyColumn(new ResourceModel(name, name), name, name)); - } - - } - - columns.add(new ActionColumn(new ResourceModel("actions", "")) { - - private static final long serialVersionUID = -3503023501954863131L; - - @Override - public ActionLinksPanel getActions(final String componentId, final IModel model) { - final ActionLinksPanel.Builder panel = ActionLinksPanel.builder(page.getPageReference()); - - panel.add(new ActionLink() { - - private static final long serialVersionUID = -7978723352517770644L; - - @Override - public void onClick(final AjaxRequestTarget target, final AnyTO anyTO) { - send(AnySearchResultPanel.this, Broadcast.EXACT, - new AjaxWizard.EditItemActionEvent<>(model.getObject(), target)); - } - }, ActionLink.ActionType.EDIT, entitlement).add(new ActionLink() { - - private static final long serialVersionUID = -7978723352517770644L; - - @Override - public void onClick(final AjaxRequestTarget target, final T anyTO) { - try { - restClient.delete(model.getObject().getETagValue(), model.getObject().getKey()); - info(getString(Constants.OPERATION_SUCCEEDED)); - target.add(container); - } catch (SyncopeClientException e) { - error(getString(Constants.ERROR) + ": " + e.getMessage()); - LOG.error("While deleting object {}", anyTO.getKey(), e); - } - ((BasePage) getPage()).getFeedbackPanel().refresh(target); - } - }, ActionLink.ActionType.DELETE, entitlement); - - return panel.build(componentId, model.getObject()); - } - - @Override - public ActionLinksPanel getHeader(final String componentId) { - final ActionLinksPanel.Builder panel = ActionLinksPanel.builder(page.getPageReference()); - - panel.add(new ActionLink() { - - private static final long serialVersionUID = -7978723352517770644L; - - @Override - public void onClick(final AjaxRequestTarget target, final Serializable ignore) { - // still missing content - target.add(modal.setContent(new AnyDisplayAttributesModalPage<>( - modal, page.getPageReference(), schemaNames, dSchemaNames))); - - modal.header(new ResourceModel("any.attr.display", "")); - modal.show(true); - } - }, ActionLink.ActionType.CHANGE_VIEW, entitlement).add(new ActionLink() { - - private static final long serialVersionUID = -7978723352517770644L; - - @Override - public void onClick(final AjaxRequestTarget target, final Serializable ignore) { - if (target != null) { - target.add(container); - } - } - }, ActionLink.ActionType.RELOAD, entitlement); - - return panel.build(componentId); - } - }); - - return columns; - } - - @Override - protected Collection getBulkActions() { - final List bulkActions = new ArrayList<>(); - - bulkActions.add(ActionLink.ActionType.DELETE); - bulkActions.add(ActionLink.ActionType.SUSPEND); - bulkActions.add(ActionLink.ActionType.REACTIVATE); - - return bulkActions; - } - - @Override - protected String getPageId() { - return pageID; - } - - public static final class Builder extends AbstractSearchResultPanel.Builder { - - private static final long serialVersionUID = -6828423611982275640L; - - private final List anyTypeClassTOs; - - public Builder( - final boolean filtered, - final String fiql, - final PageReference pageRef, - final AbstractAnyRestClient restClient, - final List anyTypeClassTOs, - final String realm, - final String type) { - - super(AnyObjectTO.class, filtered, fiql, pageRef, restClient, realm, type); - this.anyTypeClassTOs = anyTypeClassTOs; - } - - @Override - protected WizardMgtPanel newInstance(final String parentId) { - return new AnySearchResultPanel<>( - type, parentId, filtered, fiql, pageRef, restClient, anyTypeClassTOs, realm, type + "_LIST"); - } - - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/6ea34cd3/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 186e766..86ccb13 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 @@ -51,7 +51,7 @@ import org.apache.wicket.model.IModel; import org.apache.wicket.model.ResourceModel; import org.springframework.util.ReflectionUtils; -public final class GroupSearchResultPanel extends AnySearchResultPanel { +public final class GroupSearchResultPanel extends AnyObjectSearchResultPanel { private static final long serialVersionUID = -1100228004207271270L; http://git-wip-us.apache.org/repos/asf/syncope/blob/6ea34cd3/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 edf35ee..626bcaa 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 @@ -143,7 +143,7 @@ public class Realm extends Panel { final AnyObjectTO anyObjectTO = new AnyObjectTO(); anyObjectTO.setRealm(realmTO.getFullPath()); anyObjectTO.setType(anyTypeTO.getKey()); - panel = new AnySearchResultPanel.Builder( + panel = new AnyObjectSearchResultPanel.Builder( false, null, pageReference, anyObjectRestClient, anyTypeRestClient.getAnyTypeClass(anyTypeTO.getClasses().toArray(new String[] {})), realmTO.getFullPath(), http://git-wip-us.apache.org/repos/asf/syncope/blob/6ea34cd3/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 1fd3289..3e7ce11 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 @@ -55,7 +55,7 @@ import org.apache.wicket.model.Model; import org.apache.wicket.model.ResourceModel; import org.springframework.util.ReflectionUtils; -public final class UserSearchResultPanel extends AnySearchResultPanel { +public final class UserSearchResultPanel extends AnyObjectSearchResultPanel { private static final long serialVersionUID = -1100228004207271270L; http://git-wip-us.apache.org/repos/asf/syncope/blob/6ea34cd3/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 8fb4a6e..dd79b3a 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 @@ -65,8 +65,7 @@ public class UserRestClient extends AbstractAnyRestClient { final String type) { return getService(UserService.class). list(SyncopeClient.getAnyListQueryBuilder().realm(realm).page(page).size(size). - orderBy(toOrderBy(sort)).details(false).build()). - getResult(); + orderBy(toOrderBy(sort)).details(false).build()).getResult(); } public ProvisioningResult create(final UserTO userTO, final boolean storePassword) { @@ -115,8 +114,7 @@ public class UserRestClient extends AbstractAnyRestClient { return getService(UserService.class). search(SyncopeClient.getAnySearchQueryBuilder().realm(realm).fiql(fiql).page(page).size(size). - orderBy(toOrderBy(sort)).details(false).build()). - getResult(); + orderBy(toOrderBy(sort)).details(false).build()).getResult(); } @Override http://git-wip-us.apache.org/repos/asf/syncope/blob/6ea34cd3/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxPalettePanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxPalettePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxPalettePanel.java index 97866e3..bb86e7f 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxPalettePanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxPalettePanel.java @@ -51,7 +51,7 @@ public class AjaxPalettePanel extends AbstractFieldPanel> { setOutputMarkupId(true); } - protected Palette createPalette(final IModel> model, final ListModel choices, + protected final Palette createPalette(final IModel> model, final ListModel choices, final IChoiceRenderer renderer, final boolean allowOrder, final boolean allowMoveAll) { return new NonI18nPalette<>("paletteField", model, choices, renderer, 8, allowOrder, allowMoveAll); http://git-wip-us.apache.org/repos/asf/syncope/blob/6ea34cd3/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyWizardBuilder.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyWizardBuilder.java index a722223..92ae247 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyWizardBuilder.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AnyWizardBuilder.java @@ -16,8 +16,10 @@ package org.apache.syncope.client.console.wizards.any; import java.io.Serializable; + import java.util.Collections; import java.util.List; + import org.apache.syncope.client.console.commons.Mode; import org.apache.syncope.client.console.commons.status.StatusBean; import org.apache.syncope.client.console.rest.AnyTypeRestClient; @@ -55,11 +57,13 @@ public class AnyWizardBuilder extends AjaxWizardBuilder impl @Override protected WizardModel buildModelSteps(final T modelObject, final WizardModel wizardModel) { + final String[] clazzes = anyTypeClasses.toArray(new String[] {}); addOptionalDetailsPanel(modelObject, wizardModel); - wizardModel.add(new AuxClasses(modelObject, anyTypeClasses.toArray(new String[] {}))); - wizardModel.add(new PlainAttrs(modelObject, null, Mode.ADMIN, anyTypeClasses.toArray(new String[] {}))); - wizardModel.add(new DerAttrs(modelObject, anyTypeClasses.toArray(new String[] {}))); - wizardModel.add(new VirAttrs(modelObject, anyTypeClasses.toArray(new String[] {}))); + wizardModel.add(new AuxClasses(modelObject, clazzes)); + wizardModel.add(new PlainAttrs(modelObject, null, Mode.ADMIN, clazzes)); + wizardModel.add(new DerAttrs(modelObject, clazzes)); + wizardModel.add(new VirAttrs(modelObject, clazzes)); + wizardModel.add(new Resources(modelObject)); return wizardModel; } http://git-wip-us.apache.org/repos/asf/syncope/blob/6ea34cd3/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AuxClasses.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AuxClasses.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AuxClasses.java index a33df7c..c30ad98 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AuxClasses.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/AuxClasses.java @@ -34,11 +34,8 @@ public class AuxClasses extends WizardStep { private static final long serialVersionUID = 552437609667518888L; - private final AnyTO entityTO; - public AuxClasses(final T entityTO, final String... anyTypeClass) { this.setOutputMarkupId(true); - this.entityTO = entityTO; final AnyTypeClassService service = SyncopeConsoleSession.get().getService(AnyTypeClassService.class); @@ -53,7 +50,7 @@ public class AuxClasses extends WizardStep { add(new AjaxPalettePanel<>( "auxClasses", - new PropertyModel>(this.entityTO, "auxClasses"), + new PropertyModel>(entityTO, "auxClasses"), new ListModel<>(choices), true).setOutputMarkupId(true)); } http://git-wip-us.apache.org/repos/asf/syncope/blob/6ea34cd3/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Resources.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Resources.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Resources.java new file mode 100644 index 0000000..194bbce --- /dev/null +++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Resources.java @@ -0,0 +1,67 @@ +/* + * 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.wizards.any; + +import java.util.ArrayList; +import java.util.List; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.Transformer; +import org.apache.syncope.client.console.SyncopeConsoleSession; +import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPalettePanel; +import org.apache.syncope.common.lib.to.AnyTO; +import org.apache.syncope.common.lib.to.ResourceTO; +import org.apache.syncope.common.rest.api.service.ResourceService; +import org.apache.wicket.extensions.wizard.WizardStep; +import org.apache.wicket.model.PropertyModel; +import org.apache.wicket.model.util.ListModel; + +public class Resources extends WizardStep { + + private static final long serialVersionUID = 552437609667518888L; + + public Resources(final T entityTO) { + this.setOutputMarkupId(true); + + add(new AjaxPalettePanel<>("resources", + new PropertyModel>(entityTO, "resources") { + + private static final long serialVersionUID = 1L; + + @Override + public List getObject() { + return new ArrayList<>(entityTO.getResources()); + } + + @Override + public void setObject(final List object) { + entityTO.getResources().clear(); + entityTO.getResources().addAll(object); + } + }, + new ListModel<>(CollectionUtils.collect( + SyncopeConsoleSession.get().getService(ResourceService.class).list(), + new Transformer() { + + @Override + public String transform(final ResourceTO input) { + return input.getKey(); + } + }, new ArrayList()))).setOutputMarkupId(true)); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/6ea34cd3/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserWizardBuilder.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserWizardBuilder.java index 0e15e16..f18e6dd 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserWizardBuilder.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserWizardBuilder.java @@ -60,7 +60,6 @@ public class UserWizardBuilder extends AnyWizardBuilder { actual = userRestClient.create(modelObject, StringUtils.isNotBlank(modelObject.getPassword())); } else { final UserPatch patch = AnyOperations.diff(modelObject, getOriginalItem(), true); - if (!statusModel.getObject().isEmpty()) { patch.setPassword(StatusUtils.buildPasswordPatch(modelObject.getPassword(), statusModel.getObject())); } http://git-wip-us.apache.org/repos/asf/syncope/blob/6ea34cd3/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Resources.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Resources.html b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Resources.html new file mode 100644 index 0000000..7ae16d6 --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/Resources.html @@ -0,0 +1,26 @@ + + + + + + [RESOURCES] + + + \ No newline at end of file