Repository: syncope Updated Branches: refs/heads/master e71ebd9fc -> 920e0df4b
[SYNCOPE-156] Added the management of AnyType Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/920e0df4 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/920e0df4 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/920e0df4 Branch: refs/heads/master Commit: 920e0df4bbe6fa5387899aeb3d89e611ccce19ec Parents: e71ebd9 Author: Marco Di Sabatino Di Diodoro <[email protected]> Authored: Tue Nov 24 11:49:28 2015 +0100 Committer: Marco Di Sabatino Di Diodoro <[email protected]> Committed: Tue Nov 24 11:49:28 2015 +0100 ---------------------------------------------------------------------- .../client/console/commons/Constants.java | 6 +- .../syncope/client/console/pages/Types.java | 24 +- .../console/panels/AnyTypeDetailsPanel.java | 87 +++++++ .../console/panels/AnyTypeModalPanel.java | 65 +++++ .../client/console/panels/AnyTypePanel.java | 246 +++++++++++++++++++ .../client/console/panels/SchemasPanel.java | 7 +- .../syncope/client/console/pages/Types.html | 5 + .../client/console/pages/Types.properties | 1 + .../client/console/pages/Types_it.properties | 3 +- .../client/console/pages/Types_pt_BR.properties | 3 +- .../console/panels/AnyTypeDetailsPanel.html | 44 ++++ .../panels/AnyTypeDetailsPanel.properties | 19 ++ .../panels/AnyTypeDetailsPanel_it.properties | 19 ++ .../panels/AnyTypeDetailsPanel_pt_BR.properties | 19 ++ .../console/panels/AnyTypeModalPanel.html | 23 ++ .../client/console/panels/AnyTypePanel.html | 39 +++ .../console/panels/AnyTypePanel.properties | 18 ++ .../console/panels/AnyTypePanel_it.properties | 18 ++ .../panels/AnyTypePanel_pt_BR.properties | 18 ++ 19 files changed, 650 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/920e0df4/client/console/src/main/java/org/apache/syncope/client/console/commons/Constants.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/Constants.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/Constants.java index 804f9fe..0a8a17f 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/commons/Constants.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/Constants.java @@ -54,6 +54,8 @@ public final class Constants { public static final String PREF_USER_VIR_SCHEMA_PAGINATOR_ROWS = "user.virtual.schema.paginator.rows"; + public static final String PREF_ANYTYPE_PAGINATOR_ROWS = "anytype.paginator.rows"; + public static final String PREF_GROUP_DETAILS_VIEW = "group.details.view"; public static final String PREF_GROUP_ATTRIBUTES_VIEW = "group.attributes.view"; @@ -97,9 +99,9 @@ public final class Constants { public static final String PAGEPARAM_CURRENT_PAGE = "_current_page"; public static final String PREF_POLICY_PAGINATOR_ROWS = "policy.paginator.rows"; - + public static final String PREF_ANY_DETAILS_VIEW = "any.details.view"; - + public static final String PREF_ANY_ATTRIBUTES_VIEW = "any.attributes.view"; public static final String PREF_ANY_DERIVED_ATTRIBUTES_VIEW = "any.derived.attributes.view"; http://git-wip-us.apache.org/repos/asf/syncope/blob/920e0df4/client/console/src/main/java/org/apache/syncope/client/console/pages/Types.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/Types.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/Types.java index 8c710b7..9666847 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/pages/Types.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/Types.java @@ -18,6 +18,7 @@ */ package org.apache.syncope.client.console.pages; +import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal; import de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel; import java.util.ArrayList; import java.util.List; @@ -25,6 +26,8 @@ import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.client.console.commons.Constants; import org.apache.syncope.client.console.panels.AnyTypeClassModalPanel; import org.apache.syncope.client.console.panels.AnyTypeClassesPanel; +import org.apache.syncope.client.console.panels.AnyTypeModalPanel; +import org.apache.syncope.client.console.panels.AnyTypePanel; import org.apache.syncope.client.console.panels.ModalPanel; import org.apache.syncope.client.console.panels.SchemasPanel; import org.apache.syncope.client.console.wicket.ajax.markup.html.ClearIndicatingAjaxLink; @@ -47,7 +50,6 @@ import org.apache.syncope.common.lib.to.AnyTypeTO; import org.apache.syncope.common.lib.to.PlainSchemaTO; import org.apache.syncope.common.lib.types.StandardEntitlement; import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; -import org.apache.wicket.markup.html.panel.EmptyPanel; public class Types extends BasePage { @@ -66,6 +68,7 @@ public class Types extends BasePage { ANYTYPECLASS, ANYTYPE, RELATIONSHIPTYPE; + } public Types(final PageParameters parameters) { @@ -95,7 +98,16 @@ public class Types extends BasePage { if (SyncopeConsoleSession.get().owns(StandardEntitlement.ANYTYPECLASS_CREATE)) { MetaDataRoleAuthorizationStrategy.authorize( - createSchemaLink, ENABLE, StandardEntitlement.ANYTYPECLASS_CREATE); + createAnyTypeClassLink, ENABLE, StandardEntitlement.ANYTYPECLASS_CREATE); + } + + final AjaxLink<Void> createAnyTypeLink = + buildCreateLink("createAnyType", anyTypeModal, Type.ANYTYPE); + content.add(createAnyTypeLink); + + if (SyncopeConsoleSession.get().owns(StandardEntitlement.ANYTYPE_CREATE)) { + MetaDataRoleAuthorizationStrategy.authorize( + createAnyTypeLink, ENABLE, StandardEntitlement.ANYTYPE_CREATE); } add(content); @@ -117,8 +129,7 @@ public class Types extends BasePage { @Override public Panel getPanel(final String panelId) { - //return new AnyTypePanel(panelId, getPageReference(), anyTypeModal); - return new EmptyPanel(panelId); + return new AnyTypePanel(panelId, getPageReference(), anyTypeModal); } }); @@ -168,9 +179,14 @@ public class Types extends BasePage { switch (type) { case ANYTYPECLASS: anyTypeClassModal.setFormModel(new AnyTypeClassTO()); + anyTypeClassModal.size(Modal.Size.Large); panel = new AnyTypeClassModalPanel(anyTypeClassModal, getPageReference(), true); break; case ANYTYPE: + anyTypeModal.setFormModel(new AnyTypeTO()); + anyTypeModal.size(Modal.Size.Large); + panel = new AnyTypeModalPanel(anyTypeModal, getPageReference(), true); + break; case RELATIONSHIPTYPE: case SCHEMA: default: http://git-wip-us.apache.org/repos/asf/syncope/blob/920e0df4/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel.java new file mode 100644 index 0000000..0fe75aa --- /dev/null +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel.java @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.client.console.panels; + +import java.util.ArrayList; +import java.util.Arrays; +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.bootstrap.dialog.BaseModal; +import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel; +import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPalettePanel; +import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.common.lib.to.AnyTypeClassTO; +import org.apache.syncope.common.lib.to.AnyTypeTO; +import org.apache.syncope.common.lib.types.AnyTypeKind; +import org.apache.syncope.common.rest.api.service.AnyTypeClassService; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.panel.Panel; +import org.apache.wicket.model.CompoundPropertyModel; +import org.apache.wicket.model.PropertyModel; +import org.apache.wicket.model.util.ListModel; + +public class AnyTypeDetailsPanel extends Panel { + + private static final long serialVersionUID = 8131650329622035501L; + + private final AnyTypeTO anyTypeTO; + + public AnyTypeDetailsPanel(final String id, final BaseModal<AnyTypeTO> modal, final boolean createFlag) { + super(id); + + this.anyTypeTO = modal.getFormModel(); + + final WebMarkupContainer container = new WebMarkupContainer("container"); + container.setOutputMarkupId(true); + add(container); + + final Form<AnyTypeTO> form = new Form<>("form"); + form.setModel(new CompoundPropertyModel<>(this.anyTypeTO)); + container.add(form); + + final AjaxTextFieldPanel key = + new AjaxTextFieldPanel("key", getString("key"), new PropertyModel<String>(this.anyTypeTO, "key")); + key.addRequiredLabel(); + key.setEnabled(key.getModelObject() == null || key.getModelObject().isEmpty()); + form.add(key); + + final AjaxDropDownChoicePanel<AnyTypeKind> kind = new AjaxDropDownChoicePanel<>( + "kind", getString("kind"), new PropertyModel<AnyTypeKind>(this.anyTypeTO, "kind")); + kind.setChoices(Arrays.asList(AnyTypeKind.values())); + kind.setModelObject(AnyTypeKind.ANY_OBJECT); + kind.setOutputMarkupId(true); + kind.setEnabled(false); + form.add(kind); + + form.add(new AjaxPalettePanel.Builder<String>().setAllowOrder(true).build("classes", + new PropertyModel<List<String>>(anyTypeTO, "classes"), + new ListModel<>(CollectionUtils.collect( + SyncopeConsoleSession.get().getService(AnyTypeClassService.class).list(), + new Transformer<AnyTypeClassTO, String>() { + + @Override + public String transform(final AnyTypeClassTO input) { + return input.getKey(); + } + }, new ArrayList<String>()))).setOutputMarkupId(true)); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/920e0df4/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeModalPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeModalPanel.java new file mode 100644 index 0000000..d0ef72f --- /dev/null +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeModalPanel.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.client.console.panels; + +import org.apache.syncope.client.console.SyncopeConsoleSession; +import org.apache.syncope.client.console.commons.Constants; +import org.apache.syncope.client.console.pages.AbstractBasePage; +import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal; +import org.apache.syncope.common.lib.to.AnyTypeTO; +import org.apache.syncope.common.rest.api.service.AnyTypeService; +import org.apache.wicket.PageReference; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.markup.html.form.Form; + +public class AnyTypeModalPanel extends AbstractModalPanel { + + private static final long serialVersionUID = -4603032036433309900L; + + private final boolean createFlag; + + public AnyTypeModalPanel(final BaseModal<AnyTypeTO> modal, final PageReference pageRef, final boolean createFlag) { + super(modal, pageRef); + + this.createFlag = createFlag; + add(new AnyTypeDetailsPanel("anyTypeDetailsPanel", modal, createFlag)); + } + + @Override + public void onSubmit(final AjaxRequestTarget target, final Form<?> form) { + try { + final AnyTypeTO updateAnyTypeTO = AnyTypeTO.class.cast(form.getModelObject()); + + if (createFlag) { + SyncopeConsoleSession.get().getService(AnyTypeService.class).create(updateAnyTypeTO); + } else { + SyncopeConsoleSession.get().getService(AnyTypeService.class).update(updateAnyTypeTO); + } + + if (pageRef.getPage() instanceof AbstractBasePage) { + ((AbstractBasePage) pageRef.getPage()).setModalResult(true); + } + modal.close(target); + } catch (Exception e) { + LOG.error("While creating or updating AnyTypeTO", e); + error(getString(Constants.ERROR) + ": " + e.getMessage()); + modal.getFeedbackPanel().refresh(target); + } + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/920e0df4/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypePanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypePanel.java index bbf73a7..ab9561b 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypePanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypePanel.java @@ -18,16 +18,262 @@ */ package org.apache.syncope.client.console.panels; +import java.io.Serializable; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import org.apache.commons.lang3.StringUtils; +import org.apache.syncope.client.console.PreferenceManager; +import org.apache.syncope.client.console.SyncopeConsoleSession; +import org.apache.syncope.client.console.commons.Constants; +import org.apache.syncope.client.console.commons.SortableDataProviderComparator; +import org.apache.syncope.client.console.pages.AbstractBasePage; +import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.AjaxFallbackDataTable; 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.SelectChoiceRenderer; import org.apache.syncope.common.lib.to.AnyTypeTO; +import org.apache.syncope.common.lib.types.StandardEntitlement; +import org.apache.syncope.common.rest.api.service.AnyTypeService; import org.apache.wicket.PageReference; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; +import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; +import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder; +import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn; +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.extensions.markup.html.repeater.util.SortableDataProvider; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.form.DropDownChoice; +import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.panel.Panel; +import org.apache.wicket.markup.repeater.Item; +import org.apache.wicket.model.CompoundPropertyModel; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.Model; +import org.apache.wicket.model.PropertyModel; +import org.apache.wicket.model.ResourceModel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class AnyTypePanel extends Panel { private static final long serialVersionUID = 3905038169553185171L; + private static final Logger LOG = LoggerFactory.getLogger(AnyTypePanel.class); + + private static final String PAGINATOR_ROWS_KEYS = Constants.PREF_ANYTYPE_PAGINATOR_ROWS; + + private final PreferenceManager prefMan = new PreferenceManager(); + + private final NotificationPanel feedbackPanel; + + private final int pageRows; + + private final BaseModal<AnyTypeTO> modal; + public AnyTypePanel(final String id, final PageReference pageReference, final BaseModal<AnyTypeTO> modal) { super(id); + + this.feedbackPanel = ((AbstractBasePage) pageReference.getPage()).getFeedbackPanel(); + this.pageRows = prefMan.getPaginatorRows(getRequest(), PAGINATOR_ROWS_KEYS); + this.modal = modal; + + final WebMarkupContainer container = new WebMarkupContainer("container"); + + container.setOutputMarkupId(true); + add(container); + + final WebMarkupContainer tableContainer = new WebMarkupContainer("tableContainer"); + + tableContainer.setOutputMarkupId(true); + container.add(tableContainer); + + final List<IColumn<AnyTypeTO, String>> tableCols = getColumns(tableContainer, pageReference); + + final AjaxFallbackDataTable<AnyTypeTO, String> table = + new AjaxFallbackDataTable<>("datatable", + tableCols, new AnyTypePanel.AnyTypeProvider(), pageRows, tableContainer); + + table.setOutputMarkupId(true); + tableContainer.add(table); + container.add(getPaginatorForm(tableContainer, table, "paginator", this, PAGINATOR_ROWS_KEYS)); + } + + private <T extends AnyTypeModalPanel> List<IColumn<AnyTypeTO, String>> getColumns( + final WebMarkupContainer webContainer, final PageReference pageReference) { + + final List<IColumn<AnyTypeTO, String>> columns = new ArrayList<>(); + + for (Field field : AnyTypeTO.class.getDeclaredFields()) { + + if (field != null && !Modifier.isStatic(field.getModifiers())) { + final String fieldName = field.getName(); + if (field.getType().isArray()) { + final IColumn<AnyTypeTO, String> column = + new PropertyColumn<AnyTypeTO, String>( + new ResourceModel(field.getName()), field.getName()) { + + private static final long serialVersionUID = 3282547854226892169L; + + @Override + public String getCssClass() { + String css = super.getCssClass(); + if ("key".equals(fieldName)) { + css = StringUtils.isBlank(css) + ? "medium_fixedsize" + : css + " medium_fixedsize"; + } + return css; + } + }; + columns.add(column); + + } else { + final IColumn<AnyTypeTO, String> column = + new PropertyColumn<AnyTypeTO, String>( + new ResourceModel(field.getName()), field.getName(), field.getName()) { + + private static final long serialVersionUID = 3282547854226892169L; + + @Override + public String getCssClass() { + String css = super.getCssClass(); + if ("key".equals(fieldName)) { + css = StringUtils.isBlank(css) + ? "medium_fixedsize" + : css + " medium_fixedsize"; + } + return css; + } + }; + columns.add(column); + } + } + } + + columns.add(new AbstractColumn<AnyTypeTO, String>(new ResourceModel("actions", "")) { + + private static final long serialVersionUID = 2054811145491901166L; + + @Override + public String getCssClass() { + return "action"; + } + + @Override + public void populateItem(final Item<ICellPopulator<AnyTypeTO>> item, final String componentId, + final IModel<AnyTypeTO> model) { + + final AnyTypeTO anyTypeTO = model.getObject(); + + final ActionLinksPanel.Builder<Serializable> actionLinks = ActionLinksPanel.builder(pageReference); + actionLinks.setDisableIndicator(true); + actionLinks.addWithRoles(new ActionLink<Serializable>() { + + private static final long serialVersionUID = -3722207913631435501L; + + @Override + public void onClick(final AjaxRequestTarget target, final Serializable ignore) { + modal.header(Model.of(anyTypeTO.getKey())); + modal.setFormModel(anyTypeTO); + target.add(modal.setContent(new AnyTypeModalPanel(modal, pageReference, false))); + modal.addSumbitButton(); + modal.show(true); + } + }, ActionLink.ActionType.EDIT, StandardEntitlement.ANYTYPE_UPDATE).addWithRoles( + new ActionLink<Serializable>() { + + private static final long serialVersionUID = -3722207913631435501L; + + @Override + public void onClick(final AjaxRequestTarget target, final Serializable ignore) { + try { + SyncopeConsoleSession.get().getService(AnyTypeService.class + ).delete(anyTypeTO.getKey()); + info(getString(Constants.OPERATION_SUCCEEDED)); + feedbackPanel.refresh(target); + target.add(webContainer); + } catch (Exception e) { + LOG.error("While deleting AnyTypeTO", e); + error(getString(Constants.ERROR) + ": " + e.getMessage()); + feedbackPanel.refresh(target); + } + + } + }, ActionLink.ActionType.DELETE, StandardEntitlement.SCHEMA_DELETE); + + item.add(actionLinks.build(componentId)); + } + }); + + return columns; + + } + + private Form<Void> getPaginatorForm(final WebMarkupContainer webContainer, + final AjaxFallbackDataTable<AnyTypeTO, String> dataTable, + final String formname, final AnyTypePanel anyTypePanel, final String rowsPerPagePrefName) { + + final Form<Void> form = new Form<>(formname); + + final DropDownChoice<Integer> rowChooser = new DropDownChoice<>("rowsChooser", + new PropertyModel<Integer>(anyTypePanel, "pageRows"), prefMan.getPaginatorChoices(), + new SelectChoiceRenderer<Integer>()); + + rowChooser.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { + + private static final long serialVersionUID = -1107858522700306810L; + + @Override + protected void onUpdate(final AjaxRequestTarget target) { + prefMan.set(getRequest(), getResponse(), rowsPerPagePrefName, rowChooser.getInput()); + dataTable.setItemsPerPage(rowChooser.getModelObject()); + target.add(webContainer); + } + }); + + form.add(rowChooser); + return form; + } + + public int getPageRows() { + return pageRows; + + } + + private final class AnyTypeProvider extends SortableDataProvider<AnyTypeTO, String> { + + private static final long serialVersionUID = -185944053385660794L; + + private final SortableDataProviderComparator<AnyTypeTO> comparator; + + private AnyTypeProvider() { + super(); + setSort("key", SortOrder.ASCENDING); + comparator = new SortableDataProviderComparator<>(this); + } + + @Override + public Iterator<AnyTypeTO> iterator(final long first, final long count) { + final List<AnyTypeTO> list = SyncopeConsoleSession.get().getService(AnyTypeService.class).list(); + Collections.sort(list, comparator); + return list.subList((int) first, (int) first + (int) count).iterator(); + } + + @Override + public long size() { + return SyncopeConsoleSession.get().getService(AnyTypeService.class).list().size(); + } + + @Override + public IModel<AnyTypeTO> model(final AnyTypeTO object) { + return new CompoundPropertyModel<>(object); + } } } http://git-wip-us.apache.org/repos/asf/syncope/blob/920e0df4/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemasPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemasPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemasPanel.java index 6792b9c..f9faf8b 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemasPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemasPanel.java @@ -100,8 +100,6 @@ public class SchemasPanel extends Panel { private final NotificationPanel feedbackPanel; - private final AbstractBasePage page; - private final SchemaRestClient schemaRestClient = new SchemaRestClient(); private final PreferenceManager prefMan = new PreferenceManager(); @@ -114,8 +112,7 @@ public class SchemasPanel extends Panel { super(id); this.pageReference = pageReference; - this.page = (AbstractBasePage) pageReference.getPage(); - this.feedbackPanel = page.getFeedbackPanel(); + this.feedbackPanel = ((AbstractBasePage) pageReference.getPage()).getFeedbackPanel(); this.modal = modal; final Collapsible collapsible = new Collapsible("collapsePanel", buildTabList()); @@ -352,9 +349,7 @@ public class SchemasPanel extends Panel { @Override public Iterator<AbstractSchemaTO> iterator(final long first, final long count) { - @SuppressWarnings("unchecked") final List<AbstractSchemaTO> list = schemaRestClient.getSchemas(this.schemaType); - Collections.sort(list, comparator); return list.subList((int) first, (int) first + (int) count).iterator(); } http://git-wip-us.apache.org/repos/asf/syncope/blob/920e0df4/client/console/src/main/resources/org/apache/syncope/client/console/pages/Types.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Types.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Types.html index 3dc2364..4796461 100644 --- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Types.html +++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Types.html @@ -29,6 +29,11 @@ under the License. <div class="box-tools pull-right"> <ul class="nav navbar-nav actions"> <li> + <a wicket:message="title:createAnyType" wicket:id="createAnyType"> + <i class="glyphicon glyphicon-leaf"></i> + </a> + </li> + <li> <a wicket:message="title:createAnyTypeClass" wicket:id="createAnyTypeClass"> <i class="glyphicon glyphicon-duplicate"></i> </a> http://git-wip-us.apache.org/repos/asf/syncope/blob/920e0df4/client/console/src/main/resources/org/apache/syncope/client/console/pages/Types.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Types.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Types.properties index 9defe37..609c194 100644 --- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Types.properties +++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Types.properties @@ -16,3 +16,4 @@ # under the License. createSchema=Create new schema createAnyTypeClass=Create new AnyTypeClass +createAnyType=Create new AnyType http://git-wip-us.apache.org/repos/asf/syncope/blob/920e0df4/client/console/src/main/resources/org/apache/syncope/client/console/pages/Types_it.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Types_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Types_it.properties index e9994ec..ccafc7e 100644 --- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Types_it.properties +++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Types_it.properties @@ -14,5 +14,6 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -createSchema=Crea un nuovo schema +createSchema=Crea un nuovo Schema createAnyTypeClass=Crea un nuovo AnyTypeClass +createAnyType=Crea un nuovo AnyType http://git-wip-us.apache.org/repos/asf/syncope/blob/920e0df4/client/console/src/main/resources/org/apache/syncope/client/console/pages/Types_pt_BR.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Types_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Types_pt_BR.properties index 1d42eb5..ab8c4e0 100644 --- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Types_pt_BR.properties +++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Types_pt_BR.properties @@ -14,5 +14,6 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -createSchema=Cria um novo schema +createSchema=Cria um novo Schema createAnyTypeClass=Cria um novo AnyTypeClass +createAnyType=Cria um novo AnyType http://git-wip-us.apache.org/repos/asf/syncope/blob/920e0df4/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel.html new file mode 100644 index 0000000..24775fa --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel.html @@ -0,0 +1,44 @@ +<!-- +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. +--> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org"> + <wicket:panel> + <span wicket:id="container"> + <div class="form-group"> + <form wicket:id="form"> + <div class="form-group"> + <span wicket:id="key">[key]</span> + </div> + <div class="form-group"> + <span wicket:id="kind">[kind]</span> + </div> + <div class="box"> + <div class="box-header with-border"> + <h3 class="box-title"><wicket:message key="classes"/></h3> + </div> + <div class="box-body"> + <div class="form-group"> + <span wicket:id="classes">[classes]</span> + </div> + </div> + </div> + </form> + </div> + </span> + </wicket:panel> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/920e0df4/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel.properties new file mode 100644 index 0000000..7316662 --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel.properties @@ -0,0 +1,19 @@ +# 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. +key=Key +kind=Kind +classes=AnyTypeClasses http://git-wip-us.apache.org/repos/asf/syncope/blob/920e0df4/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel_it.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel_it.properties new file mode 100644 index 0000000..0d7f7aa --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel_it.properties @@ -0,0 +1,19 @@ +# 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. +key=Key +kind=Tipo +classes=AnyTypeClasses http://git-wip-us.apache.org/repos/asf/syncope/blob/920e0df4/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel_pt_BR.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel_pt_BR.properties new file mode 100644 index 0000000..0d7f7aa --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeDetailsPanel_pt_BR.properties @@ -0,0 +1,19 @@ +# 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. +key=Key +kind=Tipo +classes=AnyTypeClasses http://git-wip-us.apache.org/repos/asf/syncope/blob/920e0df4/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeModalPanel.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeModalPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeModalPanel.html new file mode 100644 index 0000000..6837f9a --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeModalPanel.html @@ -0,0 +1,23 @@ +<!-- +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. +--> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org"> + <wicket:extend> + <div wicket:id="anyTypeDetailsPanel">[anyTypeDetailsPanel]</div> + </wicket:extend> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/920e0df4/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypePanel.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypePanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypePanel.html new file mode 100644 index 0000000..57f1764 --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypePanel.html @@ -0,0 +1,39 @@ +<!-- +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. +--> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org"> + <wicket:panel> + <div wicket:id="container"> + <span wicket:id="tableContainer"> + <table class="table table-bordered table-hover dataTable" wicket:id="datatable">[datatable]</table> + </span> + <span style="float:right"> + <form wicket:id="paginator" style="display:inline"> + <div class="col-sm-6"> + <div class="dataTables_length"> + <label> + <wicket:message key="displayRows"/> + <select class="form-control input-sm" wicket:id="rowsChooser"/> + </label> + </div> + </div> + </form> + </span> + </div> + </wicket:panel> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/920e0df4/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypePanel.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypePanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypePanel.properties new file mode 100644 index 0000000..6344889 --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypePanel.properties @@ -0,0 +1,18 @@ +# 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. +kind=Kind +classes=AnyTypeClasses http://git-wip-us.apache.org/repos/asf/syncope/blob/920e0df4/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypePanel_it.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypePanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypePanel_it.properties new file mode 100644 index 0000000..e0d2fdc --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypePanel_it.properties @@ -0,0 +1,18 @@ +# 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. +kind=Tipo +classes=AnyTypeClasses http://git-wip-us.apache.org/repos/asf/syncope/blob/920e0df4/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypePanel_pt_BR.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypePanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypePanel_pt_BR.properties new file mode 100644 index 0000000..e0d2fdc --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypePanel_pt_BR.properties @@ -0,0 +1,18 @@ +# 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. +kind=Tipo +classes=AnyTypeClasses
