You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by fm...@apache.org on 2017/05/05 22:22:54 UTC
[08/10] syncope git commit: [SYNCOPE-1047] Replaces ActionLinksPanel
with TogglePanel
http://git-wip-us.apache.org/repos/asf/syncope/blob/2e7e2cee/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDirectoryPanel.java
index 403938e..d911887 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDirectoryPanel.java
@@ -38,11 +38,9 @@ import org.apache.syncope.client.console.panels.RoleDirectoryPanel.RoleDataProvi
import org.apache.syncope.client.console.rest.AnyTypeClassRestClient;
import org.apache.syncope.client.console.rest.AnyTypeRestClient;
import org.apache.syncope.client.console.rest.RoleRestClient;
-import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.ActionColumn;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
-import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink.ActionType;
-import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.JsonEditorPanel;
import org.apache.syncope.client.console.wizards.AjaxWizard;
import org.apache.syncope.client.console.wizards.WizardMgtPanel;
@@ -82,6 +80,7 @@ public class RoleDirectoryPanel extends DirectoryPanel<RoleTO, RoleWrapper, Role
MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, StandardEntitlement.ROLE_CREATE);
setReadOnly(!SyncopeConsoleSession.get().owns(StandardEntitlement.ROLE_UPDATE));
+ disableCheckBoxes();
setShowResultPage(true);
modal.size(Modal.Size.Large);
@@ -117,166 +116,149 @@ public class RoleDirectoryPanel extends DirectoryPanel<RoleTO, RoleWrapper, Role
columns.add(new PropertyColumn<RoleTO, String>(
new ResourceModel("realms"), null, "realms"));
- columns.add(new ActionColumn<RoleTO, String>(new ResourceModel("actions")) {
+ return columns;
+ }
+
+ @Override
+ public ActionsPanel<RoleTO> getActions(final IModel<RoleTO> model) {
+ final ActionsPanel<RoleTO> panel = super.getActions(model);
- private static final long serialVersionUID = -3503023501954863131L;
+ panel.add(new ActionLink<RoleTO>() {
+
+ private static final long serialVersionUID = -7978723352517770644L;
@Override
- public ActionLinksPanel<RoleTO> getActions(final String componentId, final IModel<RoleTO> model) {
- final ActionLinksPanel.Builder<RoleTO> panel = ActionLinksPanel.builder();
+ public void onClick(final AjaxRequestTarget target, final RoleTO ignore) {
+ send(RoleDirectoryPanel.this, Broadcast.EXACT,
+ new AjaxWizard.EditItemActionEvent<>(
+ new RoleWrapper(new RoleRestClient().read(model.getObject().getKey())),
+ target));
+ }
+ }, ActionLink.ActionType.EDIT, StandardEntitlement.ROLE_READ);
- panel.add(new ActionLink<RoleTO>() {
+ panel.add(new ActionLink<RoleTO>() {
- private static final long serialVersionUID = -7978723352517770644L;
+ private static final long serialVersionUID = -7978723352517770644L;
- @Override
- public void onClick(final AjaxRequestTarget target, final RoleTO ignore) {
- final String query = SyncopeClient.getUserSearchConditionBuilder().and(
- SyncopeClient.getUserSearchConditionBuilder().inRoles(model.getObject().getKey()),
- SyncopeClient.getUserSearchConditionBuilder().is("key").notNullValue()).query();
-
- final AnyTypeRestClient typeRestClient = new AnyTypeRestClient();
- final AnyTypeClassRestClient classRestClient = new AnyTypeClassRestClient();
-
- final AnyTypeTO anyTypeTO = typeRestClient.read(AnyTypeKind.USER.name());
-
- ModalPanel panel = new AnyPanel(BaseModal.CONTENT_ID, anyTypeTO, null, null, false, pageRef) {
-
- private static final long serialVersionUID = -7514498203393023415L;
-
- @Override
- protected Panel getDirectoryPanel(final String id) {
- final Panel panel = new UserDirectoryPanel.Builder(
- classRestClient.list(anyTypeTO.getClasses()), anyTypeTO.getKey(), pageRef).
- setRealm("/").
- setFiltered(true).
- setFiql(query).
- disableCheckBoxes().
- addNewItemPanelBuilder(FormLayoutInfoUtils.instantiate(
- new UserTO(),
- anyTypeTO.getClasses(),
- FormLayoutInfoUtils.fetch(typeRestClient.list()).getLeft(),
- pageRef), false).
- setWizardInModal(false).build(id);
-
- MetaDataRoleAuthorizationStrategy.authorize(
- panel,
- WebPage.RENDER,
- StandardEntitlement.USER_SEARCH);
-
- return panel;
- }
- };
-
- membersModal.header(new StringResourceModel("role.members", RoleDirectoryPanel.this, model));
- membersModal.setContent(panel);
- membersModal.show(true);
- target.add(membersModal);
- }
- }, ActionLink.ActionType.MEMBERS, StandardEntitlement.USER_SEARCH).add(new ActionLink<RoleTO>() {
+ @Override
+ public void onClick(final AjaxRequestTarget target, final RoleTO ignore) {
+ final RoleTO clone = SerializationUtils.clone(model.getObject());
+ clone.setKey(null);
+ send(RoleDirectoryPanel.this, Broadcast.EXACT,
+ new AjaxWizard.NewItemActionEvent<>(new RoleWrapper(clone), target));
+ }
+ }, ActionLink.ActionType.CLONE, StandardEntitlement.ROLE_CREATE);
- private static final long serialVersionUID = -7978723352517770644L;
+ panel.add(new ActionLink<RoleTO>() {
- @Override
- public void onClick(final AjaxRequestTarget target, final RoleTO ignore) {
- send(RoleDirectoryPanel.this, Broadcast.EXACT,
- new AjaxWizard.EditItemActionEvent<>(
- new RoleWrapper(new RoleRestClient().read(model.getObject().getKey())),
- target));
- }
- }, ActionLink.ActionType.EDIT, StandardEntitlement.ROLE_READ).add(new ActionLink<RoleTO>() {
+ private static final long serialVersionUID = -7978723352517770644L;
- private static final long serialVersionUID = -7978723352517770644L;
+ @Override
+ public void onClick(final AjaxRequestTarget target, final RoleTO ignore) {
+ final String query = SyncopeClient.getUserSearchConditionBuilder().and(
+ SyncopeClient.getUserSearchConditionBuilder().inRoles(model.getObject().getKey()),
+ SyncopeClient.getUserSearchConditionBuilder().is("key").notNullValue()).query();
- @Override
- public void onClick(final AjaxRequestTarget target, final RoleTO ignore) {
- final RoleTO clone = SerializationUtils.clone(model.getObject());
- clone.setKey(null);
- send(RoleDirectoryPanel.this, Broadcast.EXACT,
- new AjaxWizard.NewItemActionEvent<>(new RoleWrapper(clone), target));
- }
- }, ActionLink.ActionType.CLONE, StandardEntitlement.ROLE_CREATE).add(new ActionLink<RoleTO>() {
+ final AnyTypeRestClient typeRestClient = new AnyTypeRestClient();
+ final AnyTypeClassRestClient classRestClient = new AnyTypeClassRestClient();
- private static final long serialVersionUID = -7978723352517770644L;
+ final AnyTypeTO anyTypeTO = typeRestClient.read(AnyTypeKind.USER.name());
- @Override
- public void onClick(final AjaxRequestTarget target, final RoleTO ignore) {
- final ConsoleLayoutInfo info = new ConsoleLayoutInfo(model.getObject().getKey());
- info.setContent(restClient.readConsoleLayoutInfo(model.getObject().getKey()));
-
- utilityModal.header(new ResourceModel("console.layout.info", "JSON Content"));
- utilityModal.setContent(new JsonEditorPanel(
- utilityModal, new PropertyModel<String>(info, "content"), false, pageRef) {
-
- private static final long serialVersionUID = -8927036362466990179L;
-
- @Override
- public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
- try {
- restClient.setConsoleLayoutInfo(info.getKey(), info.getContent());
- SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
- modal.show(false);
- modal.close(target);
- } catch (Exception e) {
- LOG.error("While updating onsole layout info for role {}", info.getKey(), e);
- SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage())
- ? e.getClass().getName() : e.
- getMessage());
- }
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
- }
- });
- utilityModal.show(true);
- target.add(utilityModal);
- }
- }, ActionLink.ActionType.LAYOUT_EDIT, StandardEntitlement.ROLE_UPDATE).add(new ActionLink<RoleTO>() {
+ ModalPanel panel = new AnyPanel(BaseModal.CONTENT_ID, anyTypeTO, null, null, false, pageRef) {
- private static final long serialVersionUID = -7978723352517770644L;
+ private static final long serialVersionUID = -7514498203393023415L;
@Override
- public void onClick(final AjaxRequestTarget target, final RoleTO ignore) {
- try {
- restClient.delete(model.getObject().getKey());
- SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
- target.add(container);
- } catch (SyncopeClientException e) {
- LOG.error("While deleting object {}", model.getObject().getKey(), e);
- SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().
- getName() : e.getMessage());
- }
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+ protected Panel getDirectoryPanel(final String id) {
+ final Panel panel = new UserDirectoryPanel.Builder(
+ classRestClient.list(anyTypeTO.getClasses()), anyTypeTO.getKey(), pageRef).
+ setRealm("/").
+ setFiltered(true).
+ setFiql(query).
+ disableCheckBoxes().
+ addNewItemPanelBuilder(FormLayoutInfoUtils.instantiate(
+ new UserTO(),
+ anyTypeTO.getClasses(),
+ FormLayoutInfoUtils.fetch(typeRestClient.list()).getLeft(),
+ pageRef), false).
+ setWizardInModal(false).build(id);
+
+ MetaDataRoleAuthorizationStrategy.authorize(
+ panel,
+ WebPage.RENDER,
+ StandardEntitlement.USER_SEARCH);
+
+ return panel;
}
- }, ActionLink.ActionType.DELETE, StandardEntitlement.ROLE_DELETE);
+ };
- return panel.build(componentId);
+ membersModal.header(new StringResourceModel("role.members", RoleDirectoryPanel.this, model));
+ membersModal.setContent(panel);
+ membersModal.show(true);
+ target.add(membersModal);
}
+ }, ActionLink.ActionType.MEMBERS, StandardEntitlement.USER_SEARCH);
+
+ panel.add(new ActionLink<RoleTO>() {
+
+ private static final long serialVersionUID = -7978723352517770644L;
@Override
- public ActionLinksPanel<RoleTO> getHeader(final String componentId) {
- final ActionLinksPanel.Builder<RoleTO> panel = ActionLinksPanel.builder();
+ public void onClick(final AjaxRequestTarget target, final RoleTO ignore) {
+ final ConsoleLayoutInfo info = new ConsoleLayoutInfo(model.getObject().getKey());
+ info.setContent(restClient.readConsoleLayoutInfo(model.getObject().getKey()));
- return panel.add(new ActionLink<RoleTO>() {
+ utilityModal.header(new ResourceModel("console.layout.info", "JSON Content"));
+ utilityModal.setContent(new JsonEditorPanel(
+ utilityModal, new PropertyModel<String>(info, "content"), false, pageRef) {
- private static final long serialVersionUID = -7978723352517770644L;
+ private static final long serialVersionUID = -8927036362466990179L;
@Override
- public void onClick(final AjaxRequestTarget target, final RoleTO ignore) {
- if (target != null) {
- target.add(container);
+ public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
+ try {
+ restClient.setConsoleLayoutInfo(info.getKey(), info.getContent());
+ SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
+ modal.show(false);
+ modal.close(target);
+ } catch (Exception e) {
+ LOG.error("While updating onsole layout info for role {}", info.getKey(), e);
+ SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage())
+ ? e.getClass().getName() : e.
+ getMessage());
}
+ ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
- }, ActionLink.ActionType.RELOAD, StandardEntitlement.ROLE_LIST).build(componentId);
+ });
+ utilityModal.show(true);
+ target.add(utilityModal);
}
- });
+ }, ActionLink.ActionType.LAYOUT_EDIT, StandardEntitlement.ROLE_UPDATE);
+ panel.add(new ActionLink<RoleTO>() {
- return columns;
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final RoleTO ignore) {
+ try {
+ restClient.delete(model.getObject().getKey());
+ SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
+ target.add(container);
+ } catch (SyncopeClientException e) {
+ LOG.error("While deleting object {}", model.getObject().getKey(), e);
+ SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().
+ getName() : e.getMessage());
+ }
+ ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+ }
+ }, ActionLink.ActionType.DELETE, StandardEntitlement.ROLE_DELETE, true);
+
+ return panel;
}
@Override
protected Collection<ActionLink.ActionType> getBulkActions() {
- final List<ActionType> bulkActions = new ArrayList<>();
- bulkActions.add(ActionType.DELETE);
- return bulkActions;
+ return Collections.<ActionLink.ActionType>singletonList(ActionLink.ActionType.DELETE);
}
public abstract static class Builder
http://git-wip-us.apache.org/repos/asf/syncope/blob/2e7e2cee/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
index 70ed5d6..af1b84c 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
@@ -38,10 +38,9 @@ import org.apache.syncope.client.console.pages.BasePage;
import org.apache.syncope.client.console.panels.SchemaTypePanel.SchemaProvider;
import org.apache.syncope.client.console.rest.ConfRestClient;
import org.apache.syncope.client.console.rest.SchemaRestClient;
-import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.ActionColumn;
import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.BooleanPropertyColumn;
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.wicket.markup.html.form.ActionsPanel;
import org.apache.syncope.client.console.wizards.AbstractModalPanelBuilder;
import org.apache.syncope.client.console.wizards.AjaxWizard;
import org.apache.syncope.common.lib.to.AbstractSchemaTO;
@@ -180,80 +179,55 @@ public class SchemaTypePanel extends TypesDirectoryPanel<AbstractSchemaTO, Schem
}
}
- columns.add(new ActionColumn<AbstractSchemaTO, String>(new ResourceModel("actions")) {
-
- private static final long serialVersionUID = 906457126287899096L;
-
- @Override
- public ActionLinksPanel<AbstractSchemaTO> getActions(
- final String componentId, final IModel<AbstractSchemaTO> model) {
-
- ActionLinksPanel<AbstractSchemaTO> panel = ActionLinksPanel.<AbstractSchemaTO>builder().
- add(new ActionLink<AbstractSchemaTO>() {
-
- private static final long serialVersionUID = -3722207913631435501L;
+ return columns;
+ }
- @Override
- public void onClick(final AjaxRequestTarget target, final AbstractSchemaTO ignore) {
- send(SchemaTypePanel.this, Broadcast.EXACT,
- new AjaxWizard.EditItemActionEvent<>(model.getObject(), target));
- }
- }, ActionLink.ActionType.EDIT, StandardEntitlement.SCHEMA_UPDATE).
- add(new ActionLink<AbstractSchemaTO>() {
-
- private static final long serialVersionUID = -3722207913631435501L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final AbstractSchemaTO ignore) {
- try {
- switch (schemaType) {
- case DERIVED:
- restClient.deleteDerSchema(model.getObject().getKey());
- break;
-
- case VIRTUAL:
- restClient.deleteVirSchema(model.getObject().getKey());
- break;
-
- default:
- restClient.deletePlainSchema(model.getObject().getKey());
- break;
- }
-
- SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
- target.add(container);
- } catch (Exception e) {
- LOG.error("While deleting {}", model.getObject(), e);
- SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage())
- ? e.getClass().getName() : e.getMessage());
- }
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
- }
- }, ActionLink.ActionType.DELETE, StandardEntitlement.SCHEMA_DELETE).
- build(componentId);
+ @Override
+ public ActionsPanel<AbstractSchemaTO> getActions(final IModel<AbstractSchemaTO> model) {
+ final ActionsPanel<AbstractSchemaTO> panel = super.getActions(model);
+ panel.add(new ActionLink<AbstractSchemaTO>() {
- return panel;
- }
+ private static final long serialVersionUID = -3722207913631435501L;
@Override
- public ActionLinksPanel<AbstractSchemaTO> getHeader(final String componentId) {
- final ActionLinksPanel.Builder<AbstractSchemaTO> panel = ActionLinksPanel.builder();
-
- return panel.add(new ActionLink<AbstractSchemaTO>() {
+ public void onClick(final AjaxRequestTarget target, final AbstractSchemaTO ignore) {
+ send(SchemaTypePanel.this, Broadcast.EXACT,
+ new AjaxWizard.EditItemActionEvent<>(model.getObject(), target));
+ }
+ }, ActionLink.ActionType.EDIT, StandardEntitlement.SCHEMA_UPDATE);
+ panel.add(new ActionLink<AbstractSchemaTO>() {
- private static final long serialVersionUID = -1140254463922516111L;
+ private static final long serialVersionUID = -3722207913631435501L;
- @Override
- public void onClick(final AjaxRequestTarget target, final AbstractSchemaTO ignore) {
- if (target != null) {
- target.add(container);
- }
+ @Override
+ public void onClick(final AjaxRequestTarget target, final AbstractSchemaTO ignore) {
+ try {
+ switch (schemaType) {
+ case DERIVED:
+ restClient.deleteDerSchema(model.getObject().getKey());
+ break;
+
+ case VIRTUAL:
+ restClient.deleteVirSchema(model.getObject().getKey());
+ break;
+
+ default:
+ restClient.deletePlainSchema(model.getObject().getKey());
+ break;
}
- }, ActionLink.ActionType.RELOAD).build(componentId);
+
+ SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
+ target.add(container);
+ } catch (Exception e) {
+ LOG.error("While deleting {}", model.getObject(), e);
+ SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage())
+ ? e.getClass().getName() : e.getMessage());
+ }
+ ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
- });
+ }, ActionLink.ActionType.DELETE, StandardEntitlement.SCHEMA_DELETE, true);
- return columns;
+ return panel;
}
protected final class SchemaProvider extends DirectoryDataProvider<AbstractSchemaTO> {
http://git-wip-us.apache.org/repos/asf/syncope/blob/2e7e2cee/client/console/src/main/java/org/apache/syncope/client/console/panels/SecurityQuestionsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SecurityQuestionsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/SecurityQuestionsPanel.java
index 312c409..c7748d0 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/SecurityQuestionsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SecurityQuestionsPanel.java
@@ -32,10 +32,9 @@ import org.apache.syncope.client.console.commons.SortableDataProviderComparator;
import org.apache.syncope.client.console.pages.BasePage;
import org.apache.syncope.client.console.panels.SecurityQuestionsPanel.SecurityQuestionsProvider;
import org.apache.syncope.client.console.rest.SecurityQuestionRestClient;
-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.KeyPropertyColumn;
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.wicket.markup.html.form.ActionsPanel;
import org.apache.syncope.client.console.wizards.AbstractModalPanelBuilder;
import org.apache.syncope.client.console.wizards.AjaxWizard;
import org.apache.syncope.client.console.wizards.WizardMgtPanel;
@@ -50,7 +49,6 @@ 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;
import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.ResourceModel;
import org.apache.wicket.model.StringResourceModel;
public class SecurityQuestionsPanel extends DirectoryPanel<
@@ -129,72 +127,47 @@ public class SecurityQuestionsPanel extends DirectoryPanel<
List<IColumn<SecurityQuestionTO, String>> columns = new ArrayList<>();
columns.add(new KeyPropertyColumn<SecurityQuestionTO>(
- new StringResourceModel("key", this), "key", "key"));
-
+ new StringResourceModel("key", this), "key"));
columns.add(new PropertyColumn<SecurityQuestionTO, String>(
new StringResourceModel("content", this), "content", "content"));
- columns.add(new ActionColumn<SecurityQuestionTO, String>(new ResourceModel("actions")) {
+ return columns;
+ }
- private static final long serialVersionUID = -8089193528195091515L;
+ @Override
+ public ActionsPanel<SecurityQuestionTO> getActions(final IModel<SecurityQuestionTO> model) {
+ final ActionsPanel<SecurityQuestionTO> panel = super.getActions(model);
- @Override
- public ActionLinksPanel<SecurityQuestionTO> getActions(
- final String componentId, final IModel<SecurityQuestionTO> model) {
-
- ActionLinksPanel<SecurityQuestionTO> panel = ActionLinksPanel.<SecurityQuestionTO>builder().
- add(new ActionLink<SecurityQuestionTO>() {
-
- private static final long serialVersionUID = -3722207913631435501L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final SecurityQuestionTO ignore) {
- send(SecurityQuestionsPanel.this, Broadcast.EXACT,
- new AjaxWizard.EditItemActionEvent<>(model.getObject(), target));
- }
- }, ActionLink.ActionType.EDIT, StandardEntitlement.SECURITY_QUESTION_UPDATE).
- add(new ActionLink<SecurityQuestionTO>() {
-
- private static final long serialVersionUID = -3722207913631435501L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final SecurityQuestionTO ignore) {
- try {
- restClient.delete(model.getObject().getKey());
- SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
- target.add(container);
- } catch (Exception e) {
- LOG.error("While deleting {}", model.getObject(), e);
- SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage())
- ? e.getClass().getName() : e.getMessage());
- }
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
- }
- }, ActionLink.ActionType.DELETE, StandardEntitlement.TASK_DELETE).
- build(componentId);
-
- return panel;
- }
+ panel.add(new ActionLink<SecurityQuestionTO>() {
- @Override
- public ActionLinksPanel<SecurityQuestionTO> getHeader(final String componentId) {
- final ActionLinksPanel.Builder<SecurityQuestionTO> panel = ActionLinksPanel.builder();
+ private static final long serialVersionUID = -3722207913631435501L;
- return panel.add(new ActionLink<SecurityQuestionTO>() {
+ @Override
+ public void onClick(final AjaxRequestTarget target, final SecurityQuestionTO ignore) {
+ send(SecurityQuestionsPanel.this, Broadcast.EXACT,
+ new AjaxWizard.EditItemActionEvent<>(model.getObject(), target));
+ }
+ }, ActionLink.ActionType.EDIT, StandardEntitlement.SECURITY_QUESTION_UPDATE);
+ panel.add(new ActionLink<SecurityQuestionTO>() {
- private static final long serialVersionUID = -1140254463922516111L;
+ private static final long serialVersionUID = -3722207913631435501L;
- @Override
- public void onClick(final AjaxRequestTarget target, final SecurityQuestionTO ignore) {
- if (target != null) {
- target.add(container);
- }
- }
- }, ActionLink.ActionType.RELOAD).build(componentId);
+ @Override
+ public void onClick(final AjaxRequestTarget target, final SecurityQuestionTO ignore) {
+ try {
+ restClient.delete(model.getObject().getKey());
+ SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
+ target.add(container);
+ } catch (Exception e) {
+ LOG.error("While deleting {}", model.getObject(), e);
+ SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage())
+ ? e.getClass().getName() : e.getMessage());
+ }
+ ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
- });
+ }, ActionLink.ActionType.DELETE, StandardEntitlement.TASK_DELETE, true);
- return columns;
+ return panel;
}
protected final class SecurityQuestionsProvider extends DirectoryDataProvider<SecurityQuestionTO> {
http://git-wip-us.apache.org/repos/asf/syncope/blob/2e7e2cee/client/console/src/main/java/org/apache/syncope/client/console/panels/TogglePanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/TogglePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/TogglePanel.java
index 52ad84d..436d332 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/TogglePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/TogglePanel.java
@@ -118,8 +118,7 @@ public abstract class TogglePanel<T extends Serializable> extends WizardMgtPanel
target.add(this.header);
}
- protected void close(final AjaxRequestTarget target) {
- status = Status.INACTIVE;
+ public void close(final AjaxRequestTarget target) {
toggle(target, false);
}
@@ -136,13 +135,13 @@ public abstract class TogglePanel<T extends Serializable> extends WizardMgtPanel
target.add(TogglePanel.this.container);
target.appendJavaScript(
selector + ".toggle(\"slow\");"
- + selector + ".attr(\"class\", \"topology-menu active-topology-menu\");");
+ + selector + ".attr(\"class\", \"toggle-menu active-toggle-menu\");");
status = Status.ACTIVE;
}
} else if (status == Status.ACTIVE) {
target.appendJavaScript(
selector + ".toggle(\"slow\");"
- + selector + ".attr(\"class\", \"topology-menu inactive-topology-menu\");");
+ + selector + ".attr(\"class\", \"toggle-menu inactive-toggle-menu\");");
status = Status.INACTIVE;
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/2e7e2cee/client/console/src/main/java/org/apache/syncope/client/console/panels/TypeExtensionDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/TypeExtensionDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/TypeExtensionDirectoryPanel.java
index 2eefdfc..7b5f682 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/TypeExtensionDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/TypeExtensionDirectoryPanel.java
@@ -24,6 +24,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.commons.DirectoryDataProvider;
@@ -31,10 +32,9 @@ import org.apache.syncope.client.console.pages.BasePage;
import org.apache.syncope.client.console.panels.TypeExtensionDirectoryPanel.TypeExtensionDataProvider;
import org.apache.syncope.client.console.rest.BaseRestClient;
import org.apache.syncope.client.console.rest.GroupRestClient;
-import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.ActionColumn;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
-import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
import org.apache.syncope.client.console.wizards.AjaxWizard;
import org.apache.syncope.client.console.wizards.any.TypeExtensionWizardBuilder;
import org.apache.syncope.common.lib.patch.GroupPatch;
@@ -50,7 +50,6 @@ import org.apache.wicket.markup.html.form.Form;
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.apache.wicket.model.StringResourceModel;
public class TypeExtensionDirectoryPanel
@@ -131,40 +130,36 @@ public class TypeExtensionDirectoryPanel
columns.add(new PropertyColumn<TypeExtensionTO, String>(
new StringResourceModel("auxClasses", this), "auxClasses", "auxClasses"));
- columns.add(new ActionColumn<TypeExtensionTO, String>(new ResourceModel("actions", "")) {
-
- private static final long serialVersionUID = 2054811145491901166L;
-
- @Override
- public ActionLinksPanel<TypeExtensionTO> getActions(
- final String componentId, final IModel<TypeExtensionTO> model) {
+ return columns;
+ }
- final TypeExtensionTO typeExtension = model.getObject();
+ @Override
+ public ActionsPanel<TypeExtensionTO> getActions(final IModel<TypeExtensionTO> model) {
+ final ActionsPanel<TypeExtensionTO> panel = super.getActions(model);
+ final TypeExtensionTO typeExtension = model.getObject();
- return ActionLinksPanel.<TypeExtensionTO>builder().add(new ActionLink<TypeExtensionTO>() {
+ panel.add(new ActionLink<TypeExtensionTO>() {
- private static final long serialVersionUID = -3722207913631435501L;
+ private static final long serialVersionUID = -3722207913631435501L;
- @Override
- public void onClick(final AjaxRequestTarget target, final TypeExtensionTO ignore) {
- send(TypeExtensionDirectoryPanel.this, Broadcast.EXACT,
- new AjaxWizard.EditItemActionEvent<>(typeExtension, target));
- }
- }, ActionLink.ActionType.EDIT).add(new ActionLink<TypeExtensionTO>() {
+ @Override
+ public void onClick(final AjaxRequestTarget target, final TypeExtensionTO ignore) {
+ send(TypeExtensionDirectoryPanel.this, Broadcast.EXACT,
+ new AjaxWizard.EditItemActionEvent<>(typeExtension, target));
+ }
+ }, ActionLink.ActionType.EDIT, StringUtils.EMPTY);
+ panel.add(new ActionLink<TypeExtensionTO>() {
- private static final long serialVersionUID = -3722207913631435501L;
+ private static final long serialVersionUID = -3722207913631435501L;
- @Override
- public void onClick(final AjaxRequestTarget target, final TypeExtensionTO ignore) {
- groupTO.getTypeExtensions().remove(
- groupTO.getTypeExtension(typeExtension.getAnyType()));
- target.add(container);
- }
- }, ActionLink.ActionType.DELETE).build(componentId);
+ @Override
+ public void onClick(final AjaxRequestTarget target, final TypeExtensionTO ignore) {
+ groupTO.getTypeExtensions().remove(
+ groupTO.getTypeExtension(typeExtension.getAnyType()));
+ target.add(container);
}
- });
-
- return columns;
+ }, ActionLink.ActionType.DELETE, StringUtils.EMPTY, true);
+ return panel;
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/2e7e2cee/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDirectoryPanel.java
index 80c958f..ad8bbec 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDirectoryPanel.java
@@ -33,11 +33,11 @@ import org.apache.syncope.client.console.rest.UserRestClient;
import org.apache.syncope.client.console.status.AnyStatusModal;
import org.apache.syncope.client.console.status.ChangePasswordModal;
import org.apache.syncope.client.console.tasks.AnyPropagationTasks;
-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.extensions.markup.html.repeater.data.table.KeyPropertyColumn;
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.wicket.markup.html.form.ActionsPanel;
import org.apache.syncope.client.console.wizards.AjaxWizard;
import org.apache.syncope.client.console.wizards.WizardMgtPanel;
import org.apache.syncope.client.console.wizards.any.AnyWrapper;
@@ -100,246 +100,251 @@ public class UserDirectoryPanel extends AnyDirectoryPanel<UserTO, UserRestClient
}
@Override
+ public ActionsPanel<Serializable> getHeader(final String componentId) {
+ final ActionsPanel<Serializable> panel = super.getHeader(componentId);
+
+ panel.add(new ActionLink<Serializable>() {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
+ target.add(displayAttributeModal.setContent(new UserDisplayAttributesModalPanel<>(
+ displayAttributeModal, page.getPageReference(), pSchemaNames, dSchemaNames)));
+
+ displayAttributeModal.header(new ResourceModel("any.attr.display"));
+ displayAttributeModal.addSubmitButton();
+ displayAttributeModal.show(true);
+ }
+
+ @Override
+ protected boolean statusCondition(final Serializable modelObject) {
+ return wizardInModal;
+ }
+ }, ActionType.CHANGE_VIEW, StandardEntitlement.USER_READ).hideLabel();
+ return panel;
+ }
+
+ @Override
protected List<IColumn<UserTO, String>> getColumns() {
final List<IColumn<UserTO, String>> columns = new ArrayList<>();
+ final List<IColumn<UserTO, String>> prefcolumns = new ArrayList<IColumn<UserTO, String>>();
+
+ columns.add(new KeyPropertyColumn<UserTO>(
+ new ResourceModel(Constants.KEY_FIELD_NAME, Constants.KEY_FIELD_NAME), Constants.KEY_FIELD_NAME));
for (String name : prefMan.getList(getRequest(), Constants.PREF_USERS_DETAILS_VIEW)) {
- addPropertyColumn(name, ReflectionUtils.findField(UserTO.class, name), columns);
+ if (!Constants.KEY_FIELD_NAME.equalsIgnoreCase(name)) {
+ addPropertyColumn(name, ReflectionUtils.findField(UserTO.class, name), prefcolumns);
+ }
}
for (String name : prefMan.getList(getRequest(), Constants.PREF_USERS_PLAIN_ATTRS_VIEW)) {
if (pSchemaNames.contains(name)) {
- columns.add(new AttrColumn<UserTO>(name, SchemaType.PLAIN));
+ prefcolumns.add(new AttrColumn<UserTO>(name, SchemaType.PLAIN));
}
}
for (String name : prefMan.getList(getRequest(), Constants.PREF_USERS_DER_ATTRS_VIEW)) {
if (dSchemaNames.contains(name)) {
- columns.add(new AttrColumn<UserTO>(name, SchemaType.DERIVED));
+ prefcolumns.add(new AttrColumn<UserTO>(name, SchemaType.DERIVED));
}
}
// Add defaults in case of no selection
- if (columns.isEmpty()) {
+ if (prefcolumns.isEmpty()) {
for (String name : UserDisplayAttributesModalPanel.DEFAULT_SELECTION) {
- addPropertyColumn(name, ReflectionUtils.findField(UserTO.class, name), columns);
+ addPropertyColumn(name, ReflectionUtils.findField(UserTO.class, name), prefcolumns);
}
prefMan.setList(getRequest(), getResponse(), Constants.PREF_USERS_DETAILS_VIEW,
Arrays.asList(UserDisplayAttributesModalPanel.DEFAULT_SELECTION));
}
- columns.add(new ActionColumn<UserTO, String>(new ResourceModel("actions")) {
+ columns.addAll(prefcolumns);
+ return columns;
+ }
+
+ @Override
+ public ActionsPanel<UserTO> getActions(final IModel<UserTO> model) {
+ final ActionsPanel<UserTO> panel = super.getActions(model);
+
+ panel.add(new ActionLink<UserTO>() {
- private static final long serialVersionUID = -3503023501954863131L;
+ private static final long serialVersionUID = -7978723352517770644L;
@Override
- public ActionLinksPanel<UserTO> getActions(final String componentId, final IModel<UserTO> model) {
- final ActionLinksPanel.Builder<UserTO> panel = ActionLinksPanel.builder();
-
- panel.add(new ActionLink<UserTO>() {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final UserTO ignore) {
- try {
- UserRestClient.class.cast(restClient).mustChangePassword(
- model.getObject().getETagValue(),
- !model.getObject().isMustChangePassword(),
- model.getObject().getKey());
- SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
- target.add(container);
- } catch (Exception e) {
- LOG.error("While deleting object {}", model.getObject().getKey(), e);
- SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().
- getName() : e.getMessage());
- }
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
- }
- }, ActionType.MUSTCHANGEPASSWORD, StandardEntitlement.USER_UPDATE).add(new ActionLink<UserTO>() {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final UserTO ignore) {
- send(UserDirectoryPanel.this, Broadcast.EXACT,
- new AjaxWizard.EditItemActionEvent<>(
- new UserWrapper(new UserRestClient().read(model.getObject().getKey())),
- target));
- }
- }, ActionType.EDIT, new StringBuilder().append(StandardEntitlement.USER_READ).append(",").
- append(StandardEntitlement.USER_UPDATE).toString()).add(new ActionLink<UserTO>() {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final UserTO ignore) {
- UserTO clone = SerializationUtils.clone(model.getObject());
- clone.setKey(null);
- clone.setUsername(model.getObject().getUsername() + "_clone");
- send(UserDirectoryPanel.this, Broadcast.EXACT,
- new AjaxWizard.NewItemActionEvent<>(new UserWrapper(clone), target));
- }
-
- @Override
- protected boolean statusCondition(final UserTO modelObject) {
- return addAjaxLink.isVisibleInHierarchy();
- }
-
- }, ActionType.CLONE, StandardEntitlement.USER_CREATE).add(new ActionLink<UserTO>() {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final UserTO ignore) {
- try {
- restClient.delete(model.getObject().getETagValue(), model.getObject().getKey());
- SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
- target.add(container);
- } catch (Exception e) {
- LOG.error("While deleting object {}", model.getObject().getKey(), e);
- SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().
- getName() : e.getMessage());
- }
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
- }
- }, ActionType.DELETE, StandardEntitlement.USER_DELETE);
-
- if (wizardInModal) {
- panel.add(new ActionLink<UserTO>() {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final UserTO ignore) {
- IModel<AnyWrapper<UserTO>> formModel = new CompoundPropertyModel<>(
- new AnyWrapper<>(model.getObject()));
- altDefaultModal.setFormModel(formModel);
-
- target.add(altDefaultModal.setContent(new AnyStatusModal<>(
- altDefaultModal,
- pageRef,
- formModel.getObject().getInnerObject(),
- "resourceName",
- false)));
-
- altDefaultModal.header(new Model<>(
- getString("any.edit", new Model<>(new AnyWrapper<>(model.getObject())))));
-
- altDefaultModal.show(true);
- }
- }, ActionType.MANAGE_RESOURCES, StandardEntitlement.USER_UPDATE).add(new ActionLink<UserTO>() {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final UserTO ignore) {
- IModel<AnyWrapper<UserTO>> formModel = new CompoundPropertyModel<>(
- new AnyWrapper<>(model.getObject()));
- altDefaultModal.setFormModel(formModel);
-
- target.add(altDefaultModal.setContent(new AnyStatusModal<>(
- altDefaultModal,
- pageRef,
- formModel.getObject().getInnerObject(),
- "resourceName",
- true)));
-
- altDefaultModal.header(new Model<>(
- getString("any.edit", new Model<>(new AnyWrapper<>(model.getObject())))));
-
- altDefaultModal.show(true);
- }
- }, ActionType.ENABLE, StandardEntitlement.USER_UPDATE).add(new ActionLink<UserTO>() {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final UserTO ignore) {
- target.add(utilityModal.setContent(new AnyPropagationTasks(
- utilityModal, AnyTypeKind.USER, model.getObject().getKey(), pageRef)));
-
- utilityModal.header(new StringResourceModel("any.propagation.tasks", model));
- utilityModal.show(true);
- }
- }, ActionType.PROPAGATION_TASKS, StandardEntitlement.TASK_LIST).add(new ActionLink<UserTO>() {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final UserTO ignore) {
- target.add(utilityModal.setContent(
- new NotificationTasks(AnyTypeKind.USER, model.getObject().getKey(), pageRef)));
- utilityModal.header(new StringResourceModel("any.notification.tasks", model));
- utilityModal.show(true);
- target.add(utilityModal);
- }
- }, ActionType.NOTIFICATION_TASKS, StandardEntitlement.TASK_LIST).add(new ActionLink<UserTO>() {
-
- private static final long serialVersionUID = -4875218360625971340L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final UserTO ignore) {
- IModel<AnyWrapper<UserTO>> formModel = new CompoundPropertyModel<>(
- new AnyWrapper<>(model.getObject()));
- displayAttributeModal.setFormModel(formModel);
-
- target.add(displayAttributeModal.setContent(new ChangePasswordModal(
- displayAttributeModal,
- pageRef,
- new UserWrapper(model.getObject()))));
-
- displayAttributeModal.header(new Model<>(
- getString("any.edit", new Model<>(new AnyWrapper<>(model.getObject())))));
-
- displayAttributeModal.show(true);
- }
- }, ActionType.PASSWORD_RESET,
- new StringBuilder().append(StandardEntitlement.USER_UPDATE).toString());
- }
+ public void onClick(final AjaxRequestTarget target, final UserTO ignore) {
+ send(UserDirectoryPanel.this, Broadcast.EXACT,
+ new AjaxWizard.EditItemActionEvent<>(
+ new UserWrapper(new UserRestClient().read(model.getObject().getKey())),
+ target));
+ }
+ }, ActionType.EDIT, new StringBuilder().append(StandardEntitlement.USER_READ).append(",").
+ append(StandardEntitlement.USER_UPDATE).toString());
+
+ panel.add(new ActionLink<UserTO>() {
- return panel.build(componentId, model.getObject());
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final UserTO ignore) {
+ UserTO clone = SerializationUtils.clone(model.getObject());
+ clone.setKey(null);
+ clone.setUsername(model.getObject().getUsername() + "_clone");
+ send(UserDirectoryPanel.this, Broadcast.EXACT,
+ new AjaxWizard.NewItemActionEvent<>(new UserWrapper(clone), target));
}
@Override
- public ActionLinksPanel<Serializable> getHeader(final String componentId) {
- final ActionLinksPanel.Builder<Serializable> panel = ActionLinksPanel.builder();
-
- return panel.add(new ActionLink<Serializable>() {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
- target.add(displayAttributeModal.setContent(new UserDisplayAttributesModalPanel<>(
- displayAttributeModal, page.getPageReference(), pSchemaNames, dSchemaNames)));
-
- displayAttributeModal.header(new ResourceModel("any.attr.display"));
- displayAttributeModal.addSubmitButton();
- displayAttributeModal.show(true);
- }
-
- @Override
- protected boolean statusCondition(final Serializable modelObject) {
- return wizardInModal;
- }
- }, ActionType.CHANGE_VIEW, StandardEntitlement.USER_READ).add(
- new ActionLink<Serializable>() {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
- if (target != null) {
- target.add(container);
- }
- }
- }, ActionType.RELOAD, StandardEntitlement.USER_SEARCH).build(componentId);
+ protected boolean statusCondition(final UserTO modelObject) {
+ return addAjaxLink.isVisibleInHierarchy();
}
- });
- return columns;
+ }, ActionType.CLONE, StandardEntitlement.USER_CREATE);
+
+ panel.add(new ActionLink<UserTO>() {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final UserTO ignore) {
+ try {
+ UserRestClient.class.cast(restClient).mustChangePassword(
+ model.getObject().getETagValue(),
+ !model.getObject().isMustChangePassword(),
+ model.getObject().getKey());
+ SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
+ target.add(container);
+ } catch (Exception e) {
+ LOG.error("While deleting object {}", model.getObject().getKey(), e);
+ SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().
+ getName() : e.getMessage());
+ }
+ ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+ }
+ }, ActionType.MUSTCHANGEPASSWORD, StandardEntitlement.USER_UPDATE);
+
+ if (wizardInModal) {
+ panel.add(new ActionLink<UserTO>() {
+
+ private static final long serialVersionUID = -4875218360625971340L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final UserTO ignore) {
+ IModel<AnyWrapper<UserTO>> formModel = new CompoundPropertyModel<>(
+ new AnyWrapper<>(model.getObject()));
+ displayAttributeModal.setFormModel(formModel);
+
+ target.add(displayAttributeModal.setContent(new ChangePasswordModal(
+ displayAttributeModal,
+ pageRef,
+ new UserWrapper(model.getObject()))));
+
+ displayAttributeModal.header(new Model<>(
+ getString("any.edit", new Model<>(new AnyWrapper<>(model.getObject())))));
+
+ displayAttributeModal.show(true);
+ }
+ }, ActionType.PASSWORD_RESET,
+ new StringBuilder().append(StandardEntitlement.USER_UPDATE).toString());
+
+ panel.add(new ActionLink<UserTO>() {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final UserTO ignore) {
+ IModel<AnyWrapper<UserTO>> formModel = new CompoundPropertyModel<>(
+ new AnyWrapper<>(model.getObject()));
+ altDefaultModal.setFormModel(formModel);
+
+ target.add(altDefaultModal.setContent(new AnyStatusModal<>(
+ altDefaultModal,
+ pageRef,
+ formModel.getObject().getInnerObject(),
+ "resourceName",
+ true)));
+
+ altDefaultModal.header(new Model<>(
+ getString("any.edit", new Model<>(new AnyWrapper<>(model.getObject())))));
+
+ altDefaultModal.show(true);
+ }
+ }, ActionType.ENABLE, StandardEntitlement.USER_UPDATE);
+
+ panel.add(new ActionLink<UserTO>() {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final UserTO ignore) {
+ IModel<AnyWrapper<UserTO>> formModel = new CompoundPropertyModel<>(
+ new AnyWrapper<>(model.getObject()));
+ altDefaultModal.setFormModel(formModel);
+
+ target.add(altDefaultModal.setContent(new AnyStatusModal<>(
+ altDefaultModal,
+ pageRef,
+ formModel.getObject().getInnerObject(),
+ "resourceName",
+ false)));
+
+ altDefaultModal.header(new Model<>(
+ getString("any.edit", new Model<>(new AnyWrapper<>(model.getObject())))));
+
+ altDefaultModal.show(true);
+ }
+ }, ActionType.MANAGE_RESOURCES, StandardEntitlement.USER_UPDATE);
+
+ panel.add(new ActionLink<UserTO>() {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final UserTO ignore) {
+ target.add(utilityModal.setContent(new AnyPropagationTasks(
+ utilityModal, AnyTypeKind.USER, model.getObject().getKey(), pageRef)));
+
+ utilityModal.header(new StringResourceModel("any.propagation.tasks", model));
+ utilityModal.show(true);
+ }
+ }, ActionType.PROPAGATION_TASKS, StandardEntitlement.TASK_LIST);
+ panel.add(new ActionLink<UserTO>() {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final UserTO ignore) {
+ target.add(utilityModal.setContent(
+ new NotificationTasks(AnyTypeKind.USER, model.getObject().getKey(), pageRef)));
+ utilityModal.header(new StringResourceModel("any.notification.tasks", model));
+ utilityModal.show(true);
+ target.add(utilityModal);
+ }
+ }, ActionType.NOTIFICATION_TASKS, StandardEntitlement.TASK_LIST);
+ }
+
+ panel.add(new ActionLink<UserTO>() {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final UserTO ignore) {
+ try {
+ restClient.delete(model.getObject().getETagValue(), model.getObject().getKey());
+ SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
+ target.add(container);
+ } catch (Exception e) {
+ LOG.error("While deleting object {}", model.getObject().getKey(), e);
+ SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().
+ getName() : e.getMessage());
+ }
+ ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+ }
+ }, ActionType.DELETE, StandardEntitlement.USER_DELETE, true);
+
+ return panel;
}
public static class Builder extends AnyDirectoryPanel.Builder<UserTO, UserRestClient> {
http://git-wip-us.apache.org/repos/asf/syncope/blob/2e7e2cee/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDisplayAttributesModalPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDisplayAttributesModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDisplayAttributesModalPanel.java
index 1ef96ca..513ec9d 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDisplayAttributesModalPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/UserDisplayAttributesModalPanel.java
@@ -35,7 +35,7 @@ public class UserDisplayAttributesModalPanel<T extends Serializable> extends Dis
private static final long serialVersionUID = 5194630813773543054L;
- public static final String[] DEFAULT_SELECTION = { "key", "username", "status", "mustChangePassword" };
+ public static final String[] DEFAULT_SELECTION = { "username", "status", "mustChangePassword" };
public UserDisplayAttributesModalPanel(
final BaseModal<T> modal,
http://git-wip-us.apache.org/repos/asf/syncope/blob/2e7e2cee/client/console/src/main/java/org/apache/syncope/client/console/panels/WorkflowDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/WorkflowDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/WorkflowDirectoryPanel.java
index 8b5eece..2217da0 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/WorkflowDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/WorkflowDirectoryPanel.java
@@ -37,12 +37,11 @@ import org.apache.syncope.client.console.pages.BasePage;
import org.apache.syncope.client.console.pages.ModelerPopupPage;
import org.apache.syncope.client.console.panels.WorkflowDirectoryPanel.WorkflowDefinitionDataProvider;
import org.apache.syncope.client.console.rest.WorkflowRestClient;
-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.BooleanPropertyColumn;
import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.KeyPropertyColumn;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
-import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.ImageModalPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.XMLEditorPanel;
import org.apache.syncope.client.console.wizards.AjaxWizardBuilder;
@@ -155,142 +154,130 @@ public class WorkflowDirectoryPanel extends DirectoryPanel<
protected List<IColumn<WorkflowDefinitionTO, String>> getColumns() {
List<IColumn<WorkflowDefinitionTO, String>> columns = new ArrayList<>();
- columns.add(new KeyPropertyColumn<WorkflowDefinitionTO>(new ResourceModel("key"), "key", "key"));
+ columns.add(new KeyPropertyColumn<WorkflowDefinitionTO>(new ResourceModel("key"), "key"));
columns.add(new PropertyColumn<WorkflowDefinitionTO, String>(new ResourceModel("name"), "name", "name"));
columns.add(new BooleanPropertyColumn<WorkflowDefinitionTO>(new ResourceModel("main"), null, "main"));
- columns.add(new ActionColumn<WorkflowDefinitionTO, String>(new ResourceModel("actions")) {
-
- private static final long serialVersionUID = 906457126287899096L;
+ return columns;
+ }
- @Override
- public ActionLinksPanel<?> getActions(final String componentId, final IModel<WorkflowDefinitionTO> model) {
- final ActionLinksPanel.Builder<WorkflowDefinitionTO> panel = ActionLinksPanel.builder();
+ @Override
+ public ActionsPanel<WorkflowDefinitionTO> getActions(final IModel<WorkflowDefinitionTO> model) {
+ final ActionsPanel<WorkflowDefinitionTO> panel = super.getActions(model);
- panel.add(new ActionLink<WorkflowDefinitionTO>() {
+ panel.add(new ActionLink<WorkflowDefinitionTO>() {
- private static final long serialVersionUID = 3109256773218160485L;
+ private static final long serialVersionUID = -184018732772021627L;
- @Override
- public void onClick(final AjaxRequestTarget target, final WorkflowDefinitionTO ignore) {
- modal.header(Model.of(model.getObject().getKey()));
- modal.setContent(new ImageModalPanel<>(
- modal, restClient.getDiagram(model.getObject().getKey()), pageRef));
- modal.show(target);
- target.add(modal);
- }
- }, ActionLink.ActionType.VIEW, StandardEntitlement.WORKFLOW_DEF_GET);
+ @Override
+ public void onClick(final AjaxRequestTarget target, final WorkflowDefinitionTO ignore) {
+ final IModel<String> wfDefinition = new Model<>();
+ try {
+ wfDefinition.setObject(IOUtils.toString(restClient.getDefinition(
+ MediaType.APPLICATION_XML_TYPE, model.getObject().getKey())));
+ } catch (IOException e) {
+ LOG.error("Could not get workflow definition", e);
+ }
- panel.add(new ActionLink<WorkflowDefinitionTO>() {
+ utility.header(Model.of(model.getObject().getKey()));
+ utility.setContent(new XMLEditorPanel(utility, wfDefinition, false, pageRef) {
- private static final long serialVersionUID = -184018732772021627L;
+ private static final long serialVersionUID = -7688359318035249200L;
@Override
- public void onClick(final AjaxRequestTarget target, final WorkflowDefinitionTO ignore) {
- final IModel<String> wfDefinition = new Model<>();
- try {
- wfDefinition.setObject(IOUtils.toString(restClient.getDefinition(
- MediaType.APPLICATION_XML_TYPE, model.getObject().getKey())));
- } catch (IOException e) {
- LOG.error("Could not get workflow definition", e);
- }
-
- utility.header(Model.of(model.getObject().getKey()));
- utility.setContent(new XMLEditorPanel(utility, wfDefinition, false, pageRef) {
-
- private static final long serialVersionUID = -7688359318035249200L;
-
- @Override
- public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
- if (StringUtils.isNotBlank(wfDefinition.getObject())) {
- try {
- restClient.setDefinition(MediaType.APPLICATION_XML_TYPE,
- model.getObject().getKey(), wfDefinition.getObject());
- SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
-
- target.add(container);
- utility.show(false);
- utility.close(target);
- } catch (SyncopeClientException e) {
- SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage())
- ? e.getClass().getName() : e.getMessage());
- }
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
- }
+ public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
+ if (StringUtils.isNotBlank(wfDefinition.getObject())) {
+ try {
+ restClient.setDefinition(MediaType.APPLICATION_XML_TYPE,
+ model.getObject().getKey(), wfDefinition.getObject());
+ SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
+
+ target.add(container);
+ utility.show(false);
+ utility.close(target);
+ } catch (SyncopeClientException e) {
+ SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage())
+ ? e.getClass().getName() : e.getMessage());
}
- });
- utility.show(target);
- target.add(utility);
+ ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+ }
}
- }, ActionLink.ActionType.EDIT, StandardEntitlement.WORKFLOW_DEF_SET);
-
- panel.add(new ActionLink<WorkflowDefinitionTO>() {
+ });
+ utility.show(target);
+ target.add(utility);
+ }
+ }, ActionLink.ActionType.EDIT, StandardEntitlement.WORKFLOW_DEF_SET);
- private static final long serialVersionUID = -184018732772021627L;
+ panel.add(new ActionLink<WorkflowDefinitionTO>() {
- @Override
- public Class<? extends Page> getPageClass() {
- return ModelerPopupPage.class;
- }
+ private static final long serialVersionUID = 3109256773218160485L;
- @Override
- public PageParameters getPageParameters() {
- PageParameters parameters = new PageParameters();
- if (modelerCtx != null) {
- parameters.add(Constants.MODELER_CONTEXT, modelerCtx);
- }
- parameters.add(Constants.MODEL_ID_PARAM, model.getObject().getModelId());
+ @Override
+ public void onClick(final AjaxRequestTarget target, final WorkflowDefinitionTO ignore) {
+ modal.header(Model.of(model.getObject().getKey()));
+ modal.setContent(new ImageModalPanel<>(
+ modal, restClient.getDiagram(model.getObject().getKey()), pageRef));
+ modal.show(target);
+ target.add(modal);
+ }
+ }, ActionLink.ActionType.VIEW, StandardEntitlement.WORKFLOW_DEF_GET);
- return parameters;
- }
+ panel.add(new ActionLink<WorkflowDefinitionTO>() {
- @Override
- public void onClick(final AjaxRequestTarget target, final WorkflowDefinitionTO ignore) {
- // do nothing
- }
- }, ActionLink.ActionType.WORKFLOW_MODELER, StandardEntitlement.WORKFLOW_DEF_SET, modelerCtx != null);
+ private static final long serialVersionUID = -184018732772021627L;
- panel.add(new ActionLink<WorkflowDefinitionTO>() {
+ @Override
+ public Class<? extends Page> getPageClass() {
+ return ModelerPopupPage.class;
+ }
- private static final long serialVersionUID = -7978723352517770644L;
+ @Override
+ public PageParameters getPageParameters() {
+ PageParameters parameters = new PageParameters();
+ if (modelerCtx != null) {
+ parameters.add(Constants.MODELER_CONTEXT, modelerCtx);
+ }
+ parameters.add(Constants.MODEL_ID_PARAM, model.getObject().getModelId());
- @Override
- public void onClick(final AjaxRequestTarget target, final WorkflowDefinitionTO ignore) {
- try {
- restClient.deleteDefinition(model.getObject().getKey());
- SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
- target.add(container);
- } catch (SyncopeClientException e) {
- LOG.error("While deleting workflow definition {}", model.getObject().getName(), e);
- SyncopeConsoleSession.get().error(
- StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage());
- }
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
- }
- }, ActionLink.ActionType.DELETE, StandardEntitlement.WORKFLOW_DEF_DELETE, !model.getObject().isMain());
+ return parameters;
+ }
- return panel.build(componentId);
+ @Override
+ protected boolean statusCondition(final WorkflowDefinitionTO modelObject) {
+ return modelerCtx != null;
}
@Override
- public ActionLinksPanel<WorkflowDefinitionTO> getHeader(final String componentId) {
- final ActionLinksPanel.Builder<WorkflowDefinitionTO> panel = ActionLinksPanel.builder();
+ public void onClick(final AjaxRequestTarget target, final WorkflowDefinitionTO ignore) {
+ // do nothing
+ }
+ }, ActionLink.ActionType.WORKFLOW_MODELER, StandardEntitlement.WORKFLOW_DEF_SET);
- return panel.add(new ActionLink<WorkflowDefinitionTO>() {
+ panel.add(new ActionLink<WorkflowDefinitionTO>() {
- private static final long serialVersionUID = -184018732772021627L;
+ private static final long serialVersionUID = -7978723352517770644L;
- @Override
- public void onClick(final AjaxRequestTarget target, final WorkflowDefinitionTO ignore) {
- if (target != null) {
- target.add(container);
- }
- }
- }, ActionLink.ActionType.RELOAD, StandardEntitlement.WORKFLOW_DEF_LIST).build(componentId);
+ @Override
+ protected boolean statusCondition(final WorkflowDefinitionTO modelObject) {
+ return !modelObject.isMain();
}
- });
- return columns;
+ @Override
+ public void onClick(final AjaxRequestTarget target, final WorkflowDefinitionTO ignore) {
+ try {
+ restClient.deleteDefinition(model.getObject().getKey());
+ SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
+ target.add(container);
+ } catch (SyncopeClientException e) {
+ LOG.error("While deleting workflow definition {}", model.getObject().getName(), e);
+ SyncopeConsoleSession.get().error(
+ StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage());
+ }
+ ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+ }
+ }, ActionLink.ActionType.DELETE, StandardEntitlement.WORKFLOW_DEF_DELETE, true);
+
+ return panel;
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/2e7e2cee/client/console/src/main/java/org/apache/syncope/client/console/panels/search/AnyObjectSelectionDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/search/AnyObjectSelectionDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/search/AnyObjectSelectionDirectoryPanel.java
index d89b3ea..8276be9 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/search/AnyObjectSelectionDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/search/AnyObjectSelectionDirectoryPanel.java
@@ -20,7 +20,6 @@ package org.apache.syncope.client.console.panels.search;
import java.util.List;
import org.apache.syncope.client.console.commons.Constants;
-import org.apache.syncope.client.console.panels.AnyObjectDisplayAttributesModalPanel;
import org.apache.syncope.client.console.rest.AnyObjectRestClient;
import org.apache.syncope.client.console.wizards.WizardMgtPanel;
import org.apache.syncope.client.console.wizards.any.AnyWrapper;
@@ -43,11 +42,6 @@ public final class AnyObjectSelectionDirectoryPanel
}
@Override
- protected String[] getDisplayAttributes() {
- return AnyObjectDisplayAttributesModalPanel.DEFAULT_SELECTION;
- }
-
- @Override
public String getPrefDetailsView() {
return String.format(Constants.PREF_ANY_OBJECT_DETAILS_VIEW, type);
}