You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by md...@apache.org on 2016/01/12 16:19:52 UTC
[1/2] syncope git commit: [SYNCOPE-156] Refactoring Schemas panel and
AnyTypesClasses panel
Repository: syncope
Updated Branches:
refs/heads/master c8a536186 -> d5296cadd
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/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
new file mode 100644
index 0000000..d8809f2
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java
@@ -0,0 +1,359 @@
+/*
+ * 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 static org.apache.syncope.client.console.panels.AbstractModalPanel.LOG;
+
+import java.io.Serializable;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+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.SearchableDataProvider;
+import org.apache.syncope.client.console.commons.SortableDataProviderComparator;
+import org.apache.syncope.client.console.pages.AbstractBasePage;
+import org.apache.syncope.client.console.panels.SchemaTypePanel.SchemaProvider;
+import org.apache.syncope.client.console.rest.BaseRestClient;
+import org.apache.syncope.client.console.rest.SchemaRestClient;
+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.wizards.AbstractModalPanelBuilder;
+import org.apache.syncope.client.console.wizards.AjaxWizard;
+import org.apache.syncope.client.console.wizards.WizardMgtPanel;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.types.SchemaType;
+import org.apache.syncope.common.lib.types.StandardEntitlement;
+import org.apache.syncope.common.rest.api.service.SchemaService;
+import org.apache.wicket.AttributeModifier;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
+import org.apache.wicket.event.Broadcast;
+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.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.repeater.Item;
+import org.apache.wicket.model.CompoundPropertyModel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.ResourceModel;
+import org.springframework.beans.BeanWrapper;
+import org.springframework.beans.BeanWrapperImpl;
+import org.springframework.util.ReflectionUtils;
+
+public class SchemaTypePanel extends AbstractTypesPanel<AbstractSchemaTO, SchemaProvider> {
+
+ private static final long serialVersionUID = 3905038169553185171L;
+
+ private static final Map<SchemaType, List<String>> COL_NAMES = new HashMap<SchemaType, List<String>>() {
+
+ private static final long serialVersionUID = 3109256773218160485L;
+
+ {
+ put(SchemaType.PLAIN, Arrays.asList(new String[] { "key", "type",
+ "mandatoryCondition", "uniqueConstraint", "multivalue", "readonly" }));
+ put(SchemaType.DERIVED, Arrays.asList(new String[] { "key", "expression" }));
+ put(SchemaType.VIRTUAL, Arrays.asList(new String[] { "key", "provision", "extAttrName", "readonly" }));
+ }
+ };
+
+ private final String pageID = "Schema";
+
+ private final SchemaRestClient schemaRestClient = new SchemaRestClient();
+
+ private final SchemaType schemaType;
+
+ public SchemaTypePanel(final String id, final SchemaType schemaType,
+ final AbstractSearchResultPanel.Builder<AbstractSchemaTO, AbstractSchemaTO, BaseRestClient> builder) {
+ super(id, builder);
+
+ this.schemaType = schemaType;
+ }
+
+ public SchemaTypePanel(final String id, final SchemaType schemaType, final PageReference pageRef) {
+ super(id, new AbstractSearchResultPanel.Builder<AbstractSchemaTO, AbstractSchemaTO, BaseRestClient>(null,
+ pageRef) {
+
+ private static final long serialVersionUID = 8769126634538601689L;
+
+ @Override
+ protected WizardMgtPanel<AbstractSchemaTO> newInstance(final String id) {
+ return new SchemaTypePanel(id, schemaType, this);
+ }
+ });
+
+ this.schemaType = schemaType;
+
+ try {
+ this.addNewItemPanelBuilder(new AbstractModalPanelBuilder<AbstractSchemaTO>(
+ BaseModal.CONTENT_ID, schemaType.getToClass().newInstance(), pageRef) {
+
+ private static final long serialVersionUID = -6388405037134399367L;
+
+ @Override
+ public ModalPanel<AbstractSchemaTO> build(final int index, final boolean edit) {
+ final AbstractSchemaTO modelObject = newModelObject();
+ return new SchemaModalPanel(modal, modelObject, pageRef) {
+
+ private static final long serialVersionUID = -6227956682141146095L;
+
+ @Override
+ public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
+ try {
+ if (getOriginalItem() == null || StringUtils.isBlank(getOriginalItem().getKey())) {
+ SyncopeConsoleSession.get().getService(
+ SchemaService.class).create(schemaType, modelObject);
+ } else {
+ SyncopeConsoleSession.get().getService(
+ SchemaService.class).update(schemaType, modelObject);
+ }
+ info(getString(Constants.OPERATION_SUCCEEDED));
+ modal.close(target);
+ } catch (Exception e) {
+ LOG.error("While creating or updating schema", e);
+ error(getString(Constants.ERROR) + ": " + e.getMessage());
+ }
+ modal.getNotificationPanel().refresh(target);
+ }
+ };
+ }
+
+ @Override
+ protected void onCancelInternal(final AbstractSchemaTO modelObject) {
+ }
+
+ @Override
+ protected void onApplyInternal(final AbstractSchemaTO modelObject) {
+ }
+ }, true);
+
+ initResultTable();
+ MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, ENABLE, StandardEntitlement.SCHEMA_LIST);
+ } catch (InstantiationException | IllegalAccessException e) {
+ LOG.error("Error create new schema", e);
+ }
+ }
+
+ @Override
+ protected SchemaProvider dataProvider() {
+ return new SchemaProvider(rows, schemaType);
+ }
+
+ @Override
+ protected String paginatorRowsKey() {
+ return Constants.PREF_ANYTYPE_PAGINATOR_ROWS;
+ }
+
+ @Override
+ protected Collection<ActionLink.ActionType> getBulkActions() {
+ return Collections.<ActionLink.ActionType>emptyList();
+ }
+
+ @Override
+ protected String getPageId() {
+ return pageID;
+ }
+
+ @Override
+ protected List<IColumn<AbstractSchemaTO, String>> getColumns() {
+
+ final List<IColumn<AbstractSchemaTO, String>> columns = new ArrayList<>();
+
+ for (final String field : COL_NAMES.get(schemaType)) {
+ final Field clazzField = ReflectionUtils.findField(schemaType.getToClass(), field);
+
+ if (clazzField != null) {
+ if (clazzField.getType().equals(Boolean.class
+ ) || clazzField.getType().equals(boolean.class
+ )) {
+ columns.add(new AbstractColumn<AbstractSchemaTO, String>(new ResourceModel(field)) {
+
+ private static final long serialVersionUID = 8263694778917279290L;
+
+ @Override
+ public void populateItem(final Item<ICellPopulator<AbstractSchemaTO>> item,
+ final String componentId, final IModel<AbstractSchemaTO> model) {
+
+ BeanWrapper bwi = new BeanWrapperImpl(model.getObject());
+ Object obj = bwi.getPropertyValue(field);
+
+ item.add(new Label(componentId, StringUtils.EMPTY));
+ if (Boolean.valueOf(obj.toString())) {
+ item.add(new AttributeModifier("class", "glyphicon glyphicon-ok"));
+ item.add(new AttributeModifier("style", "display: table-cell; text-align: center;"));
+ }
+ }
+
+ @Override
+ public String getCssClass() {
+ return "short_fixedsize";
+ }
+ });
+ } else {
+ final IColumn<AbstractSchemaTO, String> column = new PropertyColumn<AbstractSchemaTO, String>(
+ new ResourceModel(field), field, field) {
+
+ private static final long serialVersionUID = 3282547854226892169L;
+
+ @Override
+ public String getCssClass() {
+ String css = super.getCssClass();
+ if ("key".equals(field)) {
+ css = StringUtils.isBlank(css)
+ ? "medium_fixedsize"
+ : css + " medium_fixedsize";
+ }
+ return css;
+ }
+ };
+ columns.add(column);
+ }
+ }
+ }
+
+ columns.add(new AbstractColumn<AbstractSchemaTO, String>(new ResourceModel("actions", "")) {
+
+ private static final long serialVersionUID = 2054811145491901166L;
+
+ @Override
+ public String getCssClass() {
+ return "action";
+ }
+
+ @Override
+ public void populateItem(final Item<ICellPopulator<AbstractSchemaTO>> item, final String componentId,
+ final IModel<AbstractSchemaTO> model) {
+
+ final AbstractSchemaTO schemaTO = model.getObject();
+
+ final ActionLinksPanel.Builder<Serializable> actionLinks =
+ ActionLinksPanel.builder(page.getPageReference());
+ actionLinks.setDisableIndicator(true);
+ actionLinks.setDisableIndicator(true);
+ actionLinks.addWithRoles(new ActionLink<Serializable>() {
+
+ private static final long serialVersionUID = -3722207913631435501L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
+ send(SchemaTypePanel.this, Broadcast.EXACT,
+ new AjaxWizard.EditItemActionEvent<>(model.getObject(), target));
+ }
+ }, ActionLink.ActionType.EDIT, StandardEntitlement.SCHEMA_UPDATE).addWithRoles(
+ new ActionLink<Serializable>() {
+
+ private static final long serialVersionUID = -3722207913631435501L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
+ try {
+ switch (schemaType) {
+ case DERIVED:
+ schemaRestClient.deleteDerSchema(schemaTO.getKey());
+ break;
+
+ case VIRTUAL:
+ schemaRestClient.deleteVirSchema(schemaTO.getKey());
+ break;
+
+ default:
+ schemaRestClient.deletePlainSchema(schemaTO.getKey());
+ break;
+ }
+
+ info(getString(Constants.OPERATION_SUCCEEDED));
+ target.add(container);
+ } catch (Exception e) {
+ error(getString(Constants.ERROR) + ": " + e.getMessage());
+ }
+ ((AbstractBasePage) getPage()).getNotificationPanel().refresh(target);
+ }
+ }, ActionLink.ActionType.DELETE, StandardEntitlement.SCHEMA_DELETE);
+
+ item.add(actionLinks.build(componentId));
+ }
+ });
+
+ return columns;
+ }
+
+ private String getEnumValuesAsString(final List<String> enumerationValues) {
+ final StringBuilder builder = new StringBuilder();
+
+ for (String str : enumerationValues) {
+ if (StringUtils.isNotBlank(str)) {
+ if (builder.length() > 0) {
+ builder.append(SyncopeConstants.ENUM_VALUES_SEPARATOR);
+ }
+
+ builder.append(str.trim());
+ }
+ }
+
+ return builder.toString();
+ }
+
+ protected final class SchemaProvider extends SearchableDataProvider<AbstractSchemaTO> {
+
+ private static final long serialVersionUID = -185944053385660794L;
+
+ private final SortableDataProviderComparator<AbstractSchemaTO> comparator;
+
+ private final SchemaType schemaType;
+
+ private SchemaProvider(final int paginatorRows, final SchemaType schemaType) {
+ super(paginatorRows);
+ this.schemaType = schemaType;
+
+ // Default sorting
+ setSort("key", SortOrder.ASCENDING);
+ comparator = new SortableDataProviderComparator<>(this);
+ }
+
+ @Override
+ public Iterator<AbstractSchemaTO> iterator(final long first, final long count) {
+ final List<AbstractSchemaTO> list = schemaRestClient.getSchemas(this.schemaType);
+ Collections.sort(list, comparator);
+ return list.subList((int) first, (int) first + (int) count).iterator();
+ }
+
+ @Override
+ public long size() {
+ return schemaRestClient.getSchemas(this.schemaType).size();
+ }
+
+ @Override
+ public IModel<AbstractSchemaTO> model(final AbstractSchemaTO object) {
+ return new CompoundPropertyModel<>(object);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/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 48cdd9d..ca15926 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
@@ -18,124 +18,30 @@
*/
package org.apache.syncope.client.console.panels;
-import static org.apache.wicket.Component.ENABLE;
-
import de.agilecoders.wicket.core.markup.html.bootstrap.tabs.Collapsible;
-import java.io.Serializable;
-import java.lang.reflect.Field;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.client.console.PreferenceManager;
-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.rest.SchemaRestClient;
-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.AbstractSchemaTO;
-import org.apache.syncope.common.lib.to.PlainSchemaTO;
import org.apache.syncope.common.lib.types.SchemaType;
-import org.apache.syncope.common.lib.types.StandardEntitlement;
-import org.apache.wicket.AttributeModifier;
import org.apache.wicket.PageReference;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
-import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
-import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink;
-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.extensions.markup.html.tabs.AbstractTab;
import org.apache.wicket.extensions.markup.html.tabs.ITab;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-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.springframework.beans.BeanWrapper;
-import org.springframework.beans.BeanWrapperImpl;
-import org.springframework.util.ReflectionUtils;
public class SchemasPanel extends Panel {
private static final long serialVersionUID = -1140213992451232279L;
- private static final Map<SchemaType, String> PAGINATOR_ROWS_KEYS = new HashMap<SchemaType, String>() {
-
- private static final long serialVersionUID = 3109256773218160485L;
-
- {
- put(SchemaType.PLAIN, Constants.PREF_CONF_SCHEMA_PAGINATOR_ROWS);
- put(SchemaType.DERIVED, Constants.PREF_CONF_SCHEMA_PAGINATOR_ROWS);
- put(SchemaType.VIRTUAL, Constants.PREF_CONF_SCHEMA_PAGINATOR_ROWS);
- }
- };
-
- private static final Map<SchemaType, List<String>> COL_NAMES = new HashMap<SchemaType, List<String>>() {
-
- private static final long serialVersionUID = 3109256773218160485L;
-
- {
- put(SchemaType.PLAIN, Arrays.asList(new String[] { "key", "type",
- "mandatoryCondition", "uniqueConstraint", "multivalue", "readonly" }));
- put(SchemaType.DERIVED, Arrays.asList(new String[] { "key", "expression" }));
- put(SchemaType.VIRTUAL, Arrays.asList(new String[] { "key", "provision", "extAttrName", "readonly" }));
- }
- };
-
- private final SchemaRestClient schemaRestClient = new SchemaRestClient();
-
- private final PreferenceManager prefMan = new PreferenceManager();
-
private final PageReference pageReference;
- private final BaseModal<AbstractSchemaTO> modal;
-
- public SchemasPanel(final String id, final PageReference pageRef, final BaseModal<AbstractSchemaTO> modal) {
+ public SchemasPanel(final String id, final PageReference pageRef) {
super(id);
this.pageReference = pageRef;
- this.modal = modal;
final Collapsible collapsible = new Collapsible("collapsePanel", buildTabList());
collapsible.setOutputMarkupId(true);
add(collapsible);
-
- final IndicatingAjaxLink<Void> schemaLink = new IndicatingAjaxLink<Void>("createSchema") {
-
- private static final long serialVersionUID = -7978723352517770644L;
-
- @Override
- public void onClick(final AjaxRequestTarget target) {
- modal.header(new ResourceModel("createSchema"));
- modal.setFormModel(new PlainSchemaTO());
- target.add(modal.setContent(new SchemaModalPanel(modal, pageRef, true)));
- modal.addSumbitButton();
- modal.show(true);
- }
- };
-
- add(schemaLink);
- MetaDataRoleAuthorizationStrategy.authorize(schemaLink, ENABLE, StandardEntitlement.SCHEMA_CREATE);
}
private List<ITab> buildTabList() {
@@ -149,239 +55,10 @@ public class SchemasPanel extends Panel {
@Override
public Panel getPanel(final String panelId) {
- return new SchemaTypePanel(panelId, schemaType);
+ return new SchemaTypePanel(panelId, schemaType, pageReference);
}
});
}
return tabs;
}
-
- private <T extends SchemaModalPanel> List<IColumn<AbstractSchemaTO, String>> getColumns(
- final WebMarkupContainer webContainer,
- final SchemaType schemaType,
- final Collection<String> fields) {
-
- final List<IColumn<AbstractSchemaTO, String>> columns = new ArrayList<>();
-
- for (final String field : fields) {
- final Field clazzField = ReflectionUtils.findField(schemaType.getToClass(), field);
-
- if (clazzField != null) {
- if (clazzField.getType().equals(Boolean.class) || clazzField.getType().equals(boolean.class)) {
- columns.add(new AbstractColumn<AbstractSchemaTO, String>(new ResourceModel(field)) {
-
- private static final long serialVersionUID = 8263694778917279290L;
-
- @Override
- public void populateItem(final Item<ICellPopulator<AbstractSchemaTO>> item,
- final String componentId, final IModel<AbstractSchemaTO> model) {
-
- BeanWrapper bwi = new BeanWrapperImpl(model.getObject());
- Object obj = bwi.getPropertyValue(field);
-
- item.add(new Label(componentId, StringUtils.EMPTY));
- if (Boolean.valueOf(obj.toString())) {
- item.add(new AttributeModifier("class", "glyphicon glyphicon-ok"));
- item.add(new AttributeModifier("style", "display: table-cell; text-align: center;"));
- }
- }
-
- @Override
- public String getCssClass() {
- return "short_fixedsize";
- }
- });
- } else {
- final IColumn<AbstractSchemaTO, String> column = new PropertyColumn<AbstractSchemaTO, String>(
- new ResourceModel(field), field, field) {
-
- private static final long serialVersionUID = 3282547854226892169L;
-
- @Override
- public String getCssClass() {
- String css = super.getCssClass();
- if ("key".equals(field)) {
- css = StringUtils.isBlank(css)
- ? "medium_fixedsize"
- : css + " medium_fixedsize";
- }
- return css;
- }
- };
- columns.add(column);
- }
- }
- }
-
- columns.add(new AbstractColumn<AbstractSchemaTO, String>(new ResourceModel("actions", "")) {
-
- private static final long serialVersionUID = 2054811145491901166L;
-
- @Override
- public String getCssClass() {
- return "action";
- }
-
- @Override
- public void populateItem(final Item<ICellPopulator<AbstractSchemaTO>> item, final String componentId,
- final IModel<AbstractSchemaTO> model) {
-
- final AbstractSchemaTO schemaTO = 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(schemaTO.getKey()));
- modal.setFormModel(schemaTO);
- modal.addSumbitButton();
- modal.show(true);
- target.add(modal.setContent(new SchemaModalPanel(modal, pageReference, false)));
- }
- }, ActionLink.ActionType.EDIT, StandardEntitlement.SCHEMA_UPDATE).addWithRoles(
- new ActionLink<Serializable>() {
-
- private static final long serialVersionUID = -3722207913631435501L;
-
- @Override
- public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
- try {
- switch (schemaType) {
- case DERIVED:
- schemaRestClient.deleteDerSchema(schemaTO.getKey());
- break;
-
- case VIRTUAL:
- schemaRestClient.deleteVirSchema(schemaTO.getKey());
- break;
-
- default:
- schemaRestClient.deletePlainSchema(schemaTO.getKey());
- break;
- }
-
- info(getString(Constants.OPERATION_SUCCEEDED));
- target.add(webContainer);
-
- } catch (Exception e) {
- error(getString(Constants.ERROR) + ": " + e.getMessage());
- }
- ((AbstractBasePage) getPage()).getNotificationPanel().refresh(target);
- }
- }, ActionLink.ActionType.DELETE, StandardEntitlement.SCHEMA_DELETE);
-
- item.add(actionLinks.build(componentId));
- }
- });
-
- return columns;
- }
-
- private final class SchemaTypePanel extends Panel {
-
- private static final long serialVersionUID = 2854050613688773575L;
-
- private int pageRows;
-
- private SchemaTypePanel(final String id, final SchemaType schemaType) {
- super(id);
- setup(schemaType);
- }
-
- private void setup(final SchemaType schemaType) {
-
- final WebMarkupContainer schemaWrapContainer = new WebMarkupContainer("schemaWrapContainer");
- schemaWrapContainer.setOutputMarkupId(true);
- add(schemaWrapContainer);
-
- if (schemaType != SchemaType.VIRTUAL) {
- schemaWrapContainer.add(new AttributeModifier("style", "width:auto;"));
- }
-
- final WebMarkupContainer schemaContainer = new WebMarkupContainer("schemaContainer");
- schemaContainer.setOutputMarkupId(true);
- schemaWrapContainer.add(schemaContainer);
-
- final String paginatorRowsKey = PAGINATOR_ROWS_KEYS.get(schemaType);
- pageRows = prefMan.getPaginatorRows(getRequest(), paginatorRowsKey);
-
- final List<IColumn<AbstractSchemaTO, String>> tableCols = getColumns(schemaContainer,
- schemaType, COL_NAMES.get(schemaType));
-
- final AjaxFallbackDataTable<AbstractSchemaTO, String> table = new AjaxFallbackDataTable<>("datatable",
- tableCols, new SchemaProvider(schemaType), pageRows, schemaContainer);
- table.setOutputMarkupId(true);
- schemaContainer.add(table);
-
- schemaWrapContainer.add(getPaginatorForm(schemaContainer, table, "paginator", this, paginatorRowsKey));
- }
- }
-
- private Form<Void> getPaginatorForm(final WebMarkupContainer webContainer,
- final AjaxFallbackDataTable<AbstractSchemaTO, String> dataTable,
- final String formname, final SchemaTypePanel schemaTypePanel, final String rowsPerPagePrefName) {
-
- final Form<Void> form = new Form<>(formname);
-
- final DropDownChoice<Integer> rowChooser = new DropDownChoice<>("rowsChooser",
- new PropertyModel<Integer>(schemaTypePanel, "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;
- }
-
- private final class SchemaProvider extends SortableDataProvider<AbstractSchemaTO, String> {
-
- private static final long serialVersionUID = -185944053385660794L;
-
- private final SortableDataProviderComparator<AbstractSchemaTO> comparator;
-
- private final SchemaType schemaType;
-
- private SchemaProvider(final SchemaType schemaType) {
- super();
-
- this.schemaType = schemaType;
-
- // Default sorting
- setSort("key", SortOrder.ASCENDING);
- comparator = new SortableDataProviderComparator<>(this);
- }
-
- @Override
- public Iterator<AbstractSchemaTO> iterator(final long first, final long count) {
- final List<AbstractSchemaTO> list = schemaRestClient.getSchemas(this.schemaType);
- Collections.sort(list, comparator);
- return list.subList((int) first, (int) first + (int) count).iterator();
- }
-
- @Override
- public long size() {
- return schemaRestClient.getSchemas(this.schemaType).size();
- }
-
- @Override
- public IModel<AbstractSchemaTO> model(final AbstractSchemaTO object) {
- return new CompoundPropertyModel<>(object);
- }
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
index 54c6688..69bf8a3 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/VirSchemaDetails.java
@@ -25,19 +25,16 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Transformer;
import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.rest.ResourceRestClient;
-import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.common.lib.to.AbstractSchemaTO;
import org.apache.syncope.common.lib.to.ProvisionTO;
import org.apache.syncope.common.lib.to.ResourceTO;
-import org.apache.syncope.common.lib.to.VirSchemaTO;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.markup.html.form.ChoiceRenderer;
-import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.PropertyModel;
public class VirSchemaDetails extends AbstractSchemaDetailsPanel {
@@ -52,8 +49,8 @@ public class VirSchemaDetails extends AbstractSchemaDetailsPanel {
public VirSchemaDetails(final String id,
final PageReference pageReference,
- final BaseModal<AbstractSchemaTO> modal) {
- super(id, pageReference, modal);
+ final AbstractSchemaTO schemaTO) {
+ super(id, pageReference, schemaTO);
final AjaxCheckBoxPanel readonly = new AjaxCheckBoxPanel("readonly", getString("readonly"),
new PropertyModel<Boolean>(schemaTO, "readonly"));
@@ -113,28 +110,6 @@ public class VirSchemaDetails extends AbstractSchemaDetailsPanel {
});
}
- @Override
- public void getOnSubmit(final AjaxRequestTarget target,
- final BaseModal<?> modal, final Form<?> form, final PageReference pageReference, final boolean createFlag) {
-
- try {
- final VirSchemaTO updatedVirSchemaTO = VirSchemaTO.class.cast(form.getModelObject());
-
- if (createFlag) {
- schemaRestClient.createVirSchema(updatedVirSchemaTO);
- } else {
- schemaRestClient.updateVirSchema(updatedVirSchemaTO);
- }
-
- info(getString(Constants.OPERATION_SUCCEEDED));
- modal.close(target);
- } catch (Exception e) {
- LOG.error("While creating or updating VirSchema", e);
- error(getString(Constants.ERROR) + ": " + e.getMessage());
- modal.getNotificationPanel().refresh(target);
- }
- }
-
private class AnyTypeRenderer extends ChoiceRenderer<Long> {
private static final long serialVersionUID = 2840364232128308553L;
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/bootstrap/dialog/BaseModal.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/bootstrap/dialog/BaseModal.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/bootstrap/dialog/BaseModal.java
index 69d35a1..774d143 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/bootstrap/dialog/BaseModal.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/bootstrap/dialog/BaseModal.java
@@ -25,6 +25,7 @@ import de.agilecoders.wicket.extensions.markup.html.bootstrap.behavior.Resizable
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
+import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.commons.NotificationAwareComponent;
import org.apache.syncope.client.console.panels.AbstractModalPanel;
import org.apache.syncope.client.console.panels.ModalPanel;
@@ -85,6 +86,10 @@ public class BaseModal<T extends Serializable> extends Modal<T> implements Notif
};
+ notificationPanel = new NotificationPanel(Constants.FEEDBACK);
+ notificationPanel.setOutputMarkupId(true);
+ addOrReplace(notificationPanel);
+
content.setOutputMarkupId(true);
form.add(content);
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/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 49062b3..96913f1 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
@@ -37,7 +37,5 @@ under the License.
</div>
</div>
</div>
- <div wicket:id="schemaModal"></div>
- <div wicket:id="anyTypeClassModal"></div>
</wicket:extend>
</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetails.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetails.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetails.html
deleted file mode 100644
index cfa9d7e..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetails.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE html>
-<!--
-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.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
- <wicket:panel>
- <span wicket:id="container">
- <div class="box">
- <div class="box-header with-border">
- <h3 class="box-title"><wicket:message key="plainSchemas"/></h3>
- </div>
- <div class="box-body">
- <div id="group-forum">
- <span wicket:id="plainSchemas">[plainSchemas]</span>
- </div>
- </div>
- </div>
- <div class="box">
- <div class="box-header with-border">
- <h3 class="box-title"><wicket:message key="derSchemas"/></h3>
- </div>
- <div class="box-body">
- <div id="group-forum">
- <span wicket:id="derSchemas">[derSchemas]</span>
- </div>
- </div>
- </div>
- <div class="box">
- <div class="box-header with-border">
- <h3 class="box-title"><wicket:message key="virSchemas"/></h3>
- </div>
- <div class="box-body">
- <div id="group-forum">
- <span wicket:id="virSchemas">[virSchemas]</span>
- </div>
- </div>
- </div>
- </span>
- </wicket:panel>
-</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetails.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetails.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetails.properties
deleted file mode 100644
index 835d123..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetails.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-plainSchemas=Plain Schemas
-derSchemas=Derived Schemas
-virSchemas=Virtual Schemas
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel.html
new file mode 100644
index 0000000..1c042ac
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<!--
+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.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
+ <wicket:panel>
+ <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="container">
+ <div class="box">
+ <div class="box-header with-border">
+ <h3 class="box-title"><wicket:message key="plainSchemas"/></h3>
+ </div>
+ <div class="box-body">
+ <div id="group-forum">
+ <span wicket:id="plainSchemas">[plainSchemas]</span>
+ </div>
+ </div>
+ </div>
+ <div class="box">
+ <div class="box-header with-border">
+ <h3 class="box-title"><wicket:message key="derSchemas"/></h3>
+ </div>
+ <div class="box-body">
+ <div id="group-forum">
+ <span wicket:id="derSchemas">[derSchemas]</span>
+ </div>
+ </div>
+ </div>
+ <div class="box">
+ <div class="box-header with-border">
+ <h3 class="box-title"><wicket:message key="virSchemas"/></h3>
+ </div>
+ <div class="box-body">
+ <div id="group-forum">
+ <span wicket:id="virSchemas">[virSchemas]</span>
+ </div>
+ </div>
+ </div>
+ </span>
+ </div>
+ </form>
+ </div>
+ </wicket:panel>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel.properties
new file mode 100644
index 0000000..e5b9884
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel.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.
+plainSchemas=Plain Schemas
+derSchemas=Derived Schemas
+virSchemas=Virtual Schemas
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel_it.properties
new file mode 100644
index 0000000..e5b9884
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel_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.
+plainSchemas=Plain Schemas
+derSchemas=Derived Schemas
+virSchemas=Virtual Schemas
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel_pt_BR.properties
new file mode 100644
index 0000000..e5b9884
--- /dev/null
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel_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.
+plainSchemas=Plain Schemas
+derSchemas=Derived Schemas
+virSchemas=Virtual Schemas
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetails_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetails_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetails_it.properties
deleted file mode 100644
index 835d123..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetails_it.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-plainSchemas=Plain Schemas
-derSchemas=Derived Schemas
-virSchemas=Virtual Schemas
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetails_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetails_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetails_pt_BR.properties
deleted file mode 100644
index 835d123..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassDetails_pt_BR.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-plainSchemas=Plain Schemas
-derSchemas=Derived Schemas
-virSchemas=Virtual Schemas
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassModalPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassModalPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassModalPanel.html
index ea82eb3..6de84eb 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassModalPanel.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassModalPanel.html
@@ -17,16 +17,7 @@ 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 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="details">[details]</span>
- </div>
- </form>
- </div>
- </wicket:panel>
+ <wicket:extend>
+ <div wicket:id="anyTypeClassDetailsPanel">[anyTypeDetailsPanel]</div>
+ </wicket:extend>
</html>
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassesPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassesPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassesPanel.html
deleted file mode 100644
index 0fec0c7..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassesPanel.html
+++ /dev/null
@@ -1,56 +0,0 @@
-<!DOCTYPE html>
-<!--
-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.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://xmlns.jcp.org/jsf/composite">
- <body>
- <wicket:panel>
- <span wicket:id="container">
- <div class="col-md-4">
- <div class="box">
- <div class="box-header with-border">
- <h3 class="box-title"><wicket:message key="anyTypeClasses"/></h3>
- </div>
- <div class="box-body">
- <div class="row">
- <div class="col-md-8">
- <div class="form-group">
- <label><wicket:message key="select"/></label>
- <select wicket:id="anyTypeClasses" class="form-control"></select>
- </div>
- </div>
- <div class="col-md-1" style="padding-top: 20px">
- <div class="form-group">
- <div id="actionButtons" style="padding-top: 5px;">
- <span wicket:id="editRemove"/>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="col-md-8" style="float:right">
- <span wicket:id="anyTypeClassesDetails">[anyTypeClassesDetails]</span>
- </div>
- </span>
- </wicket:panel>
- </body>
-</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassesPanel.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassesPanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassesPanel.properties
index 6438ab9..2c503c4 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassesPanel.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassesPanel.properties
@@ -14,6 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-select=Select
-
+any.edit=Edit AnyTypeClass ${key}
+any.new=New AnyTypeClass
anyTypeClasses=AnyTypeClasses
+plainSchemas=Plain Schemas
+derSchemas=Derived Schemas
+virSchemas=Virtual Schemas
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassesPanel_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassesPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassesPanel_it.properties
index 8b1b519..7622557 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassesPanel_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassesPanel_it.properties
@@ -14,6 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-select=Seleziona
-
+any.edit=Modifica AnyTypeClass ${key}
+any.new=Nuovo AnyTypeClass
anyTypeClasses=AnyTypeClasses
+plainSchemas=Plain Schemas
+derSchemas=Derived Schemas
+virSchemas=Virtual Schemas
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassesPanel_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassesPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassesPanel_pt_BR.properties
index a47ed9b..c8a828c 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassesPanel_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyTypeClassesPanel_pt_BR.properties
@@ -14,6 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-select=Selecionar
-
+any.edit=Alterar AnyTypeClass ${key}
+any.new=Novo AnyTypeClass
anyTypeClasses=AnyTypeClasses
+plainSchemas=Plain Schemas
+derSchemas=Derived Schemas
+virSchemas=Virtual Schemas
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel$SchemaTypePanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel$SchemaTypePanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel$SchemaTypePanel.html
deleted file mode 100644
index 47be190..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel$SchemaTypePanel.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
- <wicket:panel>
- <div wicket:id="schemaWrapContainer">
- <span wicket:id="schemaContainer">
- <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>
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel.html
index 2cea30f..fe2037e 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel.html
@@ -23,11 +23,11 @@ under the License.
<body>
<wicket:panel>
<div wicket:id="collapsePanel"></div>
- <div class="modal-footer">
+<!-- <div class="modal-footer">
<a wicket:message="title:createSchema" wicket:id="createSchema">
<i class="glyphicon glyphicon-duplicate"></i>
</a>
- </div>
+ </div>-->
</wicket:panel>
</body>
</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel.properties
index f9b8e4b..25e0f29 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel.properties
@@ -14,6 +14,8 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+any.edit=Edit Schema ${key}
+any.new=New Schema
mandatoryCondition=Mandatory
enumerationValues= Enumeration values
enumerationKeys= Enumeration labels
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel_it.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel_it.properties
index d6f5f25..d859636 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel_it.properties
@@ -14,6 +14,8 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+any.edit=Modifica Schema ${key}
+any.new=Nuovo Schema
mandatoryCondition=Obbligatorio
enumerationValues= Valori enumeration
enumerationKeys= Label enumeration
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel_pt_BR.properties
index 9700c5b..7fef998 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/SchemasPanel_pt_BR.properties
@@ -14,6 +14,8 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+any.edit=Alterar Schema ${key}
+any.new=Novo Schema
mandatoryCondition=obrigat\u00f3rio
enumerationValues= Valores enumerados
enumerationKeys= R\u00f3tulos de enumera\u00e7\u00e3o
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/bootstrap/dialog/BaseModal.html
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/bootstrap/dialog/BaseModal.html b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/bootstrap/dialog/BaseModal.html
index 8c7cfb5..dc18040 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/bootstrap/dialog/BaseModal.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/bootstrap/dialog/BaseModal.html
@@ -35,6 +35,7 @@ under the License.
<h4 wicket:id="header-label" class="modal-title">Modal header</h4>
</div>
<div class="modal-body">
+ <div wicket:id="feedback"/>
<form data-example-id="simple-input-groups" class="bs-example bs-example-form" wicket:id="form">
<span wicket:id="content">[modal content]</span>
</form>
[2/2] syncope git commit: [SYNCOPE-156] Refactoring Schemas panel and
AnyTypesClasses panel
Posted by md...@apache.org.
[SYNCOPE-156] Refactoring Schemas panel and AnyTypesClasses panel
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/d5296cad
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/d5296cad
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/d5296cad
Branch: refs/heads/master
Commit: d5296cadd09eec9dbd2e945709ea02c5162df56e
Parents: c8a5361
Author: Marco Di Sabatino Di Diodoro <md...@apache.org>
Authored: Tue Jan 12 16:19:25 2016 +0100
Committer: Marco Di Sabatino Di Diodoro <md...@apache.org>
Committed: Tue Jan 12 16:19:25 2016 +0100
----------------------------------------------------------------------
.../client/console/commons/PropertyList.java | 213 +++++++++++
.../syncope/client/console/pages/BasePage.java | 3 +-
.../syncope/client/console/pages/Types.java | 36 +-
.../panels/AbstractSchemaDetailsPanel.java | 24 +-
.../panels/AbstractSearchResultPanel.java | 2 +-
.../console/panels/AnyTypeClassDetails.java | 104 ------
.../panels/AnyTypeClassDetailsPanel.java | 114 ++++++
.../console/panels/AnyTypeClassModalPanel.java | 52 +--
.../console/panels/AnyTypeClassesPanel.java | 291 +++++++++------
.../client/console/panels/DerSchemaDetails.java | 30 +-
.../console/panels/NotificationPanel.java | 1 +
.../console/panels/PlainSchemaDetails.java | 170 ++++-----
.../client/console/panels/SchemaModalPanel.java | 53 +--
.../client/console/panels/SchemaTypePanel.java | 359 +++++++++++++++++++
.../client/console/panels/SchemasPanel.java | 327 +----------------
.../client/console/panels/VirSchemaDetails.java | 29 +-
.../markup/html/bootstrap/dialog/BaseModal.java | 5 +
.../syncope/client/console/pages/Types.html | 2 -
.../console/panels/AnyTypeClassDetails.html | 57 ---
.../panels/AnyTypeClassDetails.properties | 20 --
.../panels/AnyTypeClassDetailsPanel.html | 66 ++++
.../panels/AnyTypeClassDetailsPanel.properties | 19 +
.../AnyTypeClassDetailsPanel_it.properties | 19 +
.../AnyTypeClassDetailsPanel_pt_BR.properties | 19 +
.../panels/AnyTypeClassDetails_it.properties | 20 --
.../panels/AnyTypeClassDetails_pt_BR.properties | 20 --
.../console/panels/AnyTypeClassModalPanel.html | 15 +-
.../console/panels/AnyTypeClassesPanel.html | 56 ---
.../panels/AnyTypeClassesPanel.properties | 7 +-
.../panels/AnyTypeClassesPanel_it.properties | 7 +-
.../panels/AnyTypeClassesPanel_pt_BR.properties | 7 +-
.../panels/SchemasPanel$SchemaTypePanel.html | 39 --
.../client/console/panels/SchemasPanel.html | 4 +-
.../console/panels/SchemasPanel.properties | 2 +
.../console/panels/SchemasPanel_it.properties | 2 +
.../panels/SchemasPanel_pt_BR.properties | 2 +
.../markup/html/bootstrap/dialog/BaseModal.html | 1 +
37 files changed, 1151 insertions(+), 1046 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/java/org/apache/syncope/client/console/commons/PropertyList.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/PropertyList.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/PropertyList.java
new file mode 100644
index 0000000..46a61d7
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/PropertyList.java
@@ -0,0 +1,213 @@
+/*
+ * 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.commons;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
+
+public abstract class PropertyList<T> implements List<String> {
+
+ private final T objectTO;
+
+ public PropertyList(final T objectTO) {
+ this.objectTO = objectTO;
+ }
+
+ @Override
+ public boolean add(final String item) {
+ final List<String> list = getEnumValuesAsList(getValues());
+ final boolean res = list.add(item);
+ setValues(list);
+ return res;
+ }
+
+ @Override
+ public int size() {
+ return getEnumValuesAsList(getValues()).size();
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return getEnumValuesAsList(getValues()).isEmpty();
+ }
+
+ @Override
+ public boolean contains(final Object o) {
+ return getEnumValuesAsList(getValues()).contains(o);
+ }
+
+ @Override
+ public Iterator<String> iterator() {
+ return getEnumValuesAsList(getValues()).iterator();
+ }
+
+ @Override
+ public Object[] toArray() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public <T> T[] toArray(final T[] a) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean remove(final Object o) {
+ final List<String> list = getEnumValuesAsList(getValues());
+ final boolean res = list.remove(o);
+ setValues(list);
+ return res;
+ }
+
+ @Override
+ public boolean containsAll(final Collection<?> c) {
+ return getEnumValuesAsList(getValues()).containsAll(c);
+ }
+
+ @Override
+ public boolean addAll(final Collection<? extends String> c) {
+ final List<String> list = getEnumValuesAsList(getValues());
+ boolean res = list.addAll(c);
+ setValues(list);
+ return res;
+ }
+
+ @Override
+ public boolean addAll(final int index, final Collection<? extends String> c) {
+ final List<String> list = getEnumValuesAsList(getValues());
+ final boolean res = list.addAll(index, c);
+ setValues(list);
+ return res;
+ }
+
+ @Override
+ public boolean removeAll(final Collection<?> c) {
+ final List<String> list = getEnumValuesAsList(getValues());
+ final boolean res = list.removeAll(c);
+ setValues(list);
+ return res;
+ }
+
+ @Override
+ public boolean retainAll(final Collection<?> c) {
+ final List<String> list = getEnumValuesAsList(getValues());
+ final boolean res = list.retainAll(c);
+ setValues(list);
+ return res;
+ }
+
+ @Override
+ public void clear() {
+ final List<String> list = getEnumValuesAsList(getValues());
+ list.clear();
+ setValues(list);
+ }
+
+ @Override
+ public String get(final int index) {
+ final List<String> list = getEnumValuesAsList(getValues());
+ return list.get(index);
+ }
+
+ @Override
+ public String set(final int index, final String element) {
+ final List<String> list = getEnumValuesAsList(getValues());
+ final String res = list.set(index, element);
+ setValues(list);
+ return res;
+ }
+
+ @Override
+ public void add(final int index, final String element) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public String remove(final int index) {
+ final List<String> list = getEnumValuesAsList(getValues());
+ final String res = list.remove(index);
+ setValues(list);
+ return res;
+ }
+
+ @Override
+ public int indexOf(final Object o) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public int lastIndexOf(final Object o) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public ListIterator<String> listIterator() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public ListIterator<String> listIterator(final int index) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public List<String> subList(final int fromIndex, final int toIndex) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public static String getEnumValuesAsString(final List<String> enumerationValues) {
+ final StringBuilder builder = new StringBuilder();
+ int index = 0;
+ for (String str : enumerationValues) {
+ if (str != null) {
+ if (index > 0) {
+ builder.append(SyncopeConstants.ENUM_VALUES_SEPARATOR);
+ }
+ index++;
+ builder.append(str.trim());
+ }
+ }
+ return builder.toString();
+ }
+
+ public static List<String> getEnumValuesAsList(final String enumerationValues) {
+ final List<String> values = new ArrayList<>();
+ if (StringUtils.isNotBlank(enumerationValues)) {
+ for (String value : enumerationValues.split(SyncopeConstants.ENUM_VALUES_SEPARATOR)) {
+ values.add(value.trim());
+ }
+ if (enumerationValues.trim().endsWith(SyncopeConstants.ENUM_VALUES_SEPARATOR)) {
+ values.add(StringUtils.EMPTY);
+ }
+ } else {
+ values.add(StringUtils.EMPTY);
+ }
+
+ return values;
+ }
+
+ public abstract String getValues();
+
+ public abstract void setValues(final List<String> list);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java
index 6c91a91..c4f4f13 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java
@@ -20,6 +20,7 @@ package org.apache.syncope.client.console.pages;
import org.apache.syncope.client.console.SyncopeConsoleApplication;
import org.apache.syncope.client.console.SyncopeConsoleSession;
+import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.panels.NotificationPanel;
import org.apache.syncope.client.console.rest.UserWorkflowRestClient;
import org.apache.syncope.client.console.topology.Topology;
@@ -52,7 +53,7 @@ public class BasePage extends AbstractBasePage implements IAjaxIndicatorAware {
public BasePage(final PageParameters parameters) {
super(parameters);
- notificationPanel = new NotificationPanel("feedback");
+ notificationPanel = new NotificationPanel(Constants.FEEDBACK);
notificationPanel.setOutputMarkupId(true);
addOrReplace(notificationPanel);
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/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 4869a98..0d9fcc1 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
@@ -25,9 +25,6 @@ import org.apache.syncope.client.console.panels.AnyTypeClassesPanel;
import org.apache.syncope.client.console.panels.AnyTypePanel;
import org.apache.syncope.client.console.panels.RelationshipTypePanel;
import org.apache.syncope.client.console.panels.SchemasPanel;
-import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
-import org.apache.syncope.common.lib.to.AbstractSchemaTO;
-import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
import org.apache.wicket.extensions.markup.html.tabs.ITab;
import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -35,17 +32,11 @@ import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.Model;
import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.syncope.common.lib.to.AnyTypeClassTO;
-import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
public class Types extends BasePage {
private static final long serialVersionUID = 8091922398776299403L;
- private final BaseModal<AbstractSchemaTO> schemaModal;
-
- private final BaseModal<AnyTypeClassTO> anyTypeClassModal;
-
private final AjaxBootstrapTabbedPanel<ITab> tabbedPanel;
private enum Type {
@@ -59,20 +50,12 @@ public class Types extends BasePage {
public Types(final PageParameters parameters) {
super(parameters);
- this.schemaModal = new BaseModal<>("schemaModal");
- this.anyTypeClassModal = new BaseModal<>("anyTypeClassModal");
-
final WebMarkupContainer content = new WebMarkupContainer("content");
content.add(new Label("header", "Types"));
content.setOutputMarkupId(true);
tabbedPanel = new AjaxBootstrapTabbedPanel<>("tabbedPanel", buildTabList());
content.add(tabbedPanel);
-
add(content);
- addWindowWindowClosedCallback(schemaModal);
- addWindowWindowClosedCallback(anyTypeClassModal);
- add(schemaModal);
- add(anyTypeClassModal);
}
private List<ITab> buildTabList() {
@@ -105,7 +88,7 @@ public class Types extends BasePage {
@Override
public Panel getPanel(final String panelId) {
- return new AnyTypeClassesPanel(panelId, getPageReference(), anyTypeClassModal);
+ return new AnyTypeClassesPanel(panelId, getPageReference());
}
});
@@ -115,25 +98,10 @@ public class Types extends BasePage {
@Override
public Panel getPanel(final String panelId) {
- return new SchemasPanel(panelId, getPageReference(), schemaModal);
+ return new SchemasPanel(panelId, getPageReference());
}
});
return tabs;
}
-
- private void addWindowWindowClosedCallback(final BaseModal<?> modal) {
- modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
-
- private static final long serialVersionUID = 8804221891699487139L;
-
- @Override
- public void onClose(final AjaxRequestTarget target) {
- tabbedPanel.setSelectedTab(tabbedPanel.getSelectedTab());
- target.add(tabbedPanel);
- modal.show(false);
- notificationPanel.refresh(target);
- }
- });
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSchemaDetailsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSchemaDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSchemaDetailsPanel.java
index 6faced0..ebddc5b 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSchemaDetailsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSchemaDetailsPanel.java
@@ -18,13 +18,9 @@
*/
package org.apache.syncope.client.console.panels;
-import org.apache.syncope.client.console.pages.AbstractBasePage;
-import org.apache.syncope.client.console.rest.SchemaRestClient;
-import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.common.lib.to.AbstractSchemaTO;
import org.apache.wicket.PageReference;
-import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.CompoundPropertyModel;
@@ -39,29 +35,18 @@ public abstract class AbstractSchemaDetailsPanel extends Panel {
protected static final Logger LOG = LoggerFactory.getLogger(AbstractSchemaDetailsPanel.class);
protected static final String FORM = "form";
-
- /**
- * Schema rest client for create and update operations
- */
- protected final SchemaRestClient schemaRestClient = new SchemaRestClient();
- /**
- * Schema form
- */
protected final Form<AbstractSchemaTO> schemaForm;
protected final AbstractSchemaTO schemaTO;
- private final AbstractBasePage page;
-
public AbstractSchemaDetailsPanel(
final String id,
final PageReference pageReference,
- final BaseModal<AbstractSchemaTO> modal) {
+ final AbstractSchemaTO schemaTO) {
super(id);
- this.page = (AbstractBasePage) pageReference.getPage();
- this.schemaTO = modal.getFormModel();
+ this.schemaTO = schemaTO;
schemaForm = new Form<>(FORM);
schemaForm.setModel(new CompoundPropertyModel<>(schemaTO));
@@ -70,12 +55,9 @@ public abstract class AbstractSchemaDetailsPanel extends Panel {
final AjaxTextFieldPanel name =
new AjaxTextFieldPanel("key", getString("key"), new PropertyModel<String>(schemaTO, "key"));
name.addRequiredLabel();
- name.setEnabled(schemaTO.getKey() == null || schemaTO.getKey().isEmpty());
+ name.setEnabled(schemaTO == null || schemaTO.getKey() == null || schemaTO.getKey().isEmpty());
schemaForm.add(name);
add(schemaForm);
}
-
- public abstract void getOnSubmit(final AjaxRequestTarget target, final BaseModal<?> modal, final Form<?> form,
- final PageReference pageReference, final boolean createFlag);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSearchResultPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSearchResultPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSearchResultPanel.java
index c633a4f..a744d0a 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSearchResultPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AbstractSearchResultPanel.java
@@ -217,7 +217,7 @@ public abstract class AbstractSearchResultPanel<
data.setRows(rows);
send(getParent(), Broadcast.BREADTH, data);
- ((AbstractBasePage) getPage()).getNotificationPanel().refresh(target);
+ page.getNotificationPanel().refresh(target);
}
});
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassDetails.java
deleted file mode 100644
index 1b0206e..0000000
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassDetails.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.console.panels;
-
-import java.util.List;
-import org.apache.syncope.client.console.SyncopeConsoleSession;
-import org.apache.syncope.client.console.rest.SchemaRestClient;
-import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPalettePanel;
-import org.apache.syncope.common.lib.to.AnyTypeClassTO;
-import org.apache.syncope.common.rest.api.service.AnyTypeClassService;
-import org.apache.wicket.markup.html.TransparentWebMarkupContainer;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.model.util.ListModel;
-
-public class AnyTypeClassDetails extends Panel {
-
- private static final long serialVersionUID = 3321861543207340469L;
-
- private final AnyTypeClassTO anyTypeClassTO;
-
- private final SchemaRestClient schemaRestClient = new SchemaRestClient();
-
- private final List<String> availablePlainSchemas = schemaRestClient.getPlainSchemaNames();
-
- private final List<String> availableDerSchemas = schemaRestClient.getDerSchemaNames();
-
- private final List<String> availableVirSchemas = schemaRestClient.getVirSchemaNames();
-
- public AnyTypeClassDetails(final String id,
- final AnyTypeClassTO anyTypeClassTO, final boolean edit) {
- super(id);
-
- this.anyTypeClassTO = anyTypeClassTO;
- buildAvailableSchemas(anyTypeClassTO.getKey());
-
- final TransparentWebMarkupContainer container = new TransparentWebMarkupContainer("container");
- container.setOutputMarkupId(true);
- add(container);
-
- final AjaxPalettePanel<String> plainSchema =
- new AjaxPalettePanel.Builder<String>()
- .setAllowOrder(true)
- .setAllowMoveAll(true)
- .build("plainSchemas",
- new PropertyModel<List<String>>(this.anyTypeClassTO, "plainSchemas"),
- new ListModel<>(availablePlainSchemas));
-
- plainSchema.setOutputMarkupId(true);
- plainSchema.setEnabled(edit);
- container.add(plainSchema);
-
- final AjaxPalettePanel<String> derSchema =
- new AjaxPalettePanel.Builder<String>()
- .setAllowOrder(true)
- .setAllowMoveAll(true)
- .build("derSchemas",
- new PropertyModel<List<String>>(this.anyTypeClassTO, "derSchemas"),
- new ListModel<>(availableDerSchemas));
-
- derSchema.setOutputMarkupId(true);
- derSchema.setEnabled(edit);
- container.add(derSchema);
-
- final AjaxPalettePanel<String> virSchema =
- new AjaxPalettePanel.Builder<String>()
- .setAllowOrder(true)
- .setAllowMoveAll(true)
- .build("virSchemas",
- new PropertyModel<List<String>>(this.anyTypeClassTO, "virSchemas"),
- new ListModel<>(availableVirSchemas));
-
- virSchema.setOutputMarkupId(true);
- virSchema.setEnabled(edit);
- container.add(virSchema);
- }
-
- private void buildAvailableSchemas(final String key) {
-
- for (AnyTypeClassTO item : SyncopeConsoleSession.get().getService(AnyTypeClassService.class).list()) {
- if (key == null || !item.getKey().equals(key)) {
- availablePlainSchemas.removeAll(item.getPlainSchemas());
- availableDerSchemas.removeAll(item.getDerSchemas());
- availableVirSchemas.removeAll(item.getVirSchemas());
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel.java
new file mode 100644
index 0000000..a06c0dd
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassDetailsPanel.java
@@ -0,0 +1,114 @@
+/*
+ * 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.List;
+import org.apache.syncope.client.console.SyncopeConsoleSession;
+import org.apache.syncope.client.console.rest.SchemaRestClient;
+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.rest.api.service.AnyTypeClassService;
+import org.apache.wicket.markup.html.TransparentWebMarkupContainer;
+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 AnyTypeClassDetailsPanel extends Panel {
+
+ private static final long serialVersionUID = 3321861543207340469L;
+
+ private final AnyTypeClassTO anyTypeClassTO;
+
+ private final SchemaRestClient schemaRestClient = new SchemaRestClient();
+
+ private final List<String> availablePlainSchemas = schemaRestClient.getPlainSchemaNames();
+
+ private final List<String> availableDerSchemas = schemaRestClient.getDerSchemaNames();
+
+ private final List<String> availableVirSchemas = schemaRestClient.getVirSchemaNames();
+
+ public AnyTypeClassDetailsPanel(final String id, final AnyTypeClassTO anyTypeClassTO) {
+ super(id);
+
+ this.anyTypeClassTO = anyTypeClassTO;
+ buildAvailableSchemas(anyTypeClassTO.getKey());
+
+ final Form<AnyTypeClassTO> antTypeClassForm = new Form<>("form");
+ antTypeClassForm.setModel(new CompoundPropertyModel<>(anyTypeClassTO));
+ antTypeClassForm.setOutputMarkupId(true);
+ add(antTypeClassForm);
+
+ final AjaxTextFieldPanel key = new AjaxTextFieldPanel("key", getString("key"), new PropertyModel<String>(
+ this.anyTypeClassTO, "key"));
+ key.addRequiredLabel();
+ key.setEnabled(anyTypeClassTO.getKey() == null || this.anyTypeClassTO.getKey().isEmpty());
+ antTypeClassForm.add(key);
+
+ final TransparentWebMarkupContainer container = new TransparentWebMarkupContainer("container");
+ container.setOutputMarkupId(true);
+ antTypeClassForm.add(container);
+
+ final AjaxPalettePanel<String> plainSchema =
+ new AjaxPalettePanel.Builder<String>()
+ .setAllowOrder(true)
+ .setAllowMoveAll(true)
+ .build("plainSchemas",
+ new PropertyModel<List<String>>(this.anyTypeClassTO, "plainSchemas"),
+ new ListModel<>(availablePlainSchemas));
+
+ plainSchema.setOutputMarkupId(true);
+ container.add(plainSchema);
+
+ final AjaxPalettePanel<String> derSchema =
+ new AjaxPalettePanel.Builder<String>()
+ .setAllowOrder(true)
+ .setAllowMoveAll(true)
+ .build("derSchemas",
+ new PropertyModel<List<String>>(this.anyTypeClassTO, "derSchemas"),
+ new ListModel<>(availableDerSchemas));
+
+ derSchema.setOutputMarkupId(true);
+ container.add(derSchema);
+
+ final AjaxPalettePanel<String> virSchema =
+ new AjaxPalettePanel.Builder<String>()
+ .setAllowOrder(true)
+ .setAllowMoveAll(true)
+ .build("virSchemas",
+ new PropertyModel<List<String>>(this.anyTypeClassTO, "virSchemas"),
+ new ListModel<>(availableVirSchemas));
+
+ virSchema.setOutputMarkupId(true);
+ container.add(virSchema);
+ }
+
+ private void buildAvailableSchemas(final String key) {
+
+ for (AnyTypeClassTO item : SyncopeConsoleSession.get().getService(AnyTypeClassService.class).list()) {
+ if (key == null || !item.getKey().equals(key)) {
+ availablePlainSchemas.removeAll(item.getPlainSchemas());
+ availableDerSchemas.removeAll(item.getDerSchemas());
+ availableVirSchemas.removeAll(item.getVirSchemas());
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassModalPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassModalPanel.java
index 02063f3..64faa9e 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassModalPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassModalPanel.java
@@ -18,17 +18,9 @@
*/
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.wicket.markup.html.bootstrap.dialog.BaseModal;
-import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.common.lib.to.AnyTypeClassTO;
-import org.apache.syncope.common.rest.api.service.AnyTypeClassService;
import org.apache.wicket.PageReference;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.model.CompoundPropertyModel;
-import org.apache.wicket.model.PropertyModel;
public class AnyTypeClassModalPanel extends AbstractModalPanel<AnyTypeClassTO> {
@@ -36,49 +28,13 @@ public class AnyTypeClassModalPanel extends AbstractModalPanel<AnyTypeClassTO> {
private final AnyTypeClassTO anyTypeClassTO;
- private final boolean createFlag;
-
public AnyTypeClassModalPanel(
final BaseModal<AnyTypeClassTO> modal,
- final PageReference pageRef,
- final boolean createFlag) {
+ final AnyTypeClassTO anyTypeClassTO,
+ final PageReference pageRef) {
super(modal, pageRef);
- this.anyTypeClassTO = modal.getFormModel();
- this.createFlag = createFlag;
-
- final Form<AnyTypeClassTO> antTypeClassForm = new Form<>("form");
- antTypeClassForm.setModel(new CompoundPropertyModel<>(anyTypeClassTO));
- antTypeClassForm.setOutputMarkupId(true);
-
- final AjaxTextFieldPanel key = new AjaxTextFieldPanel("key", getString("key"), new PropertyModel<String>(
- anyTypeClassTO, "key"));
- key.addRequiredLabel();
- key.setEnabled(anyTypeClassTO.getKey() == null || anyTypeClassTO.getKey().isEmpty());
- antTypeClassForm.add(key);
-
- antTypeClassForm.add(new AnyTypeClassDetails("details", anyTypeClassTO, true));
- add(antTypeClassForm);
- }
-
- @Override
- public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
-
- try {
- final AnyTypeClassTO updatedAnyTypeClassTO = AnyTypeClassTO.class.cast(form.getModelObject());
-
- if (createFlag) {
- SyncopeConsoleSession.get().getService(AnyTypeClassService.class).create(updatedAnyTypeClassTO);
- } else {
- SyncopeConsoleSession.get().getService(AnyTypeClassService.class).update(updatedAnyTypeClassTO);
- }
-
- info(getString(Constants.OPERATION_SUCCEEDED));
- modal.close(target);
- } catch (Exception e) {
- LOG.error("While creating or updating AnyTypeClass", e);
- error(getString(Constants.ERROR) + ": " + e.getMessage());
- modal.getNotificationPanel().refresh(target);
- }
+ this.anyTypeClassTO = anyTypeClassTO;
+ add(new AnyTypeClassDetailsPanel("anyTypeClassDetailsPanel", this.anyTypeClassTO));
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassesPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassesPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassesPanel.java
index 1948904..4ece79e 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassesPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyTypeClassesPanel.java
@@ -18,136 +18,206 @@
*/
package org.apache.syncope.client.console.panels;
-import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
import java.io.Serializable;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+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.SearchableDataProvider;
+import org.apache.syncope.client.console.commons.SortableDataProviderComparator;
import org.apache.syncope.client.console.pages.AbstractBasePage;
+import org.apache.syncope.client.console.rest.BaseRestClient;
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.wizards.AbstractModalPanelBuilder;
+import org.apache.syncope.client.console.wizards.AjaxWizard;
+import org.apache.syncope.client.console.wizards.WizardMgtPanel;
import org.apache.syncope.common.lib.to.AnyTypeClassTO;
import org.apache.syncope.common.lib.types.StandardEntitlement;
import org.apache.syncope.common.rest.api.service.AnyTypeClassService;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.form.IChoiceRenderer;
-import org.apache.wicket.markup.html.form.ListChoice;
-import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
+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.markup.html.form.Form;
+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.ResourceModel;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-public class AnyTypeClassesPanel extends Panel {
+public class AnyTypeClassesPanel extends AbstractTypesPanel<AnyTypeClassTO, AnyTypeClassesPanel.AnyTypeClassProvider> {
private static final long serialVersionUID = -2356760296223908382L;
- private static final Logger LOG = LoggerFactory.getLogger(AnyTypeClassesPanel.class);
+ private final String pageID = "AnyTypesClasses";
- private final ListChoice<AnyTypeClassTO> anyTypeClasses;
-
- private AnyTypeClassDetails anyTypeClassesDetails;
-
- public AnyTypeClassesPanel(final String id, final PageReference pageRef, final BaseModal<AnyTypeClassTO> modal) {
- super(id);
- this.setOutputMarkupId(true);
-
- final WebMarkupContainer container = new WebMarkupContainer("container");
- container.setOutputMarkupId(true);
- add(container);
+ public AnyTypeClassesPanel(final String id,
+ final AbstractSearchResultPanel.Builder<AnyTypeClassTO, AnyTypeClassTO, BaseRestClient> builder) {
+ super(id, builder);
+ }
- anyTypeClasses = new ListChoice<AnyTypeClassTO>(
- "anyTypeClasses", new Model<AnyTypeClassTO>(),
- SyncopeConsoleSession.get().getService(AnyTypeClassService.class).list()) {
+ public AnyTypeClassesPanel(final String id, final PageReference pageRef) {
+ super(id, new AbstractSearchResultPanel.Builder<AnyTypeClassTO, AnyTypeClassTO, BaseRestClient>(null, pageRef) {
- private static final long serialVersionUID = 4022366881854379834L;
+ private static final long serialVersionUID = 8769126634538601689L;
@Override
- protected CharSequence getDefaultChoice(final String selectedValue) {
- return null;
+ protected WizardMgtPanel<AnyTypeClassTO> newInstance(final String id) {
+ return new AnyTypeClassesPanel(id, this);
}
- };
+ });
- anyTypeClasses.setChoiceRenderer(new IChoiceRenderer<AnyTypeClassTO>() {
+ this.addNewItemPanelBuilder(new AbstractModalPanelBuilder<AnyTypeClassTO>(
+ BaseModal.CONTENT_ID, new AnyTypeClassTO(), pageRef) {
- private static final long serialVersionUID = 1048000918946220007L;
+ private static final long serialVersionUID = -6388405037134399367L;
@Override
- public Object getDisplayValue(final AnyTypeClassTO object) {
- return object.getKey();
+ public ModalPanel<AnyTypeClassTO> build(final int index, final boolean edit) {
+ final AnyTypeClassTO modelObject = newModelObject();
+ return new AnyTypeClassModalPanel(modal, modelObject, pageRef) {
+
+ private static final long serialVersionUID = -6227956682141146095L;
+
+ @Override
+ public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
+ try {
+ if (getOriginalItem() == null || StringUtils.isBlank(getOriginalItem().getKey())) {
+ SyncopeConsoleSession.get().getService(AnyTypeClassService.class).create(modelObject);
+ } else {
+ SyncopeConsoleSession.get().getService(AnyTypeClassService.class).update(modelObject);
+ }
+ info(getString(Constants.OPERATION_SUCCEEDED));
+ modal.close(target);
+ } catch (Exception e) {
+ LOG.error("While creating or updating AnyTypeClassTO", e);
+ error(getString(Constants.ERROR) + ": " + e.getMessage());
+ modal.getNotificationPanel().refresh(target);
+ }
+ }
+ };
}
@Override
- public String getIdValue(final AnyTypeClassTO object, final int index) {
- return object.getKey();
+ protected void onCancelInternal(final AnyTypeClassTO modelObject) {
}
@Override
- public AnyTypeClassTO getObject(final String id,
- final IModel<? extends List<? extends AnyTypeClassTO>> choices) {
- for (AnyTypeClassTO item : choices.getObject()) {
- if (item.getKey().equals(id)) {
- return item;
- }
- }
- return null;
+ protected void onApplyInternal(final AnyTypeClassTO modelObject) {
}
- });
+ }, true);
- anyTypeClasses.setNullValid(true);
- container.add(anyTypeClasses);
+ initResultTable();
+ MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, ENABLE, StandardEntitlement.ANYTYPE_CREATE);
+ }
- updateAnyTypeClassDetails(new AnyTypeClassTO(), false);
- container.add(anyTypeClassesDetails);
+ @Override
+ protected AnyTypeClassesPanel.AnyTypeClassProvider dataProvider() {
+ return new AnyTypeClassesPanel.AnyTypeClassProvider(rows);
+ }
- anyTypeClasses.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+ @Override
+ protected String paginatorRowsKey() {
+ return Constants.PREF_ANYTYPE_PAGINATOR_ROWS;
+ }
- private static final long serialVersionUID = -1107858522700306810L;
+ @Override
+ protected Collection<ActionLink.ActionType> getBulkActions() {
+ return Collections.<ActionLink.ActionType>emptyList();
+ }
- @Override
- protected void onUpdate(final AjaxRequestTarget target) {
- updateAnyTypeClassDetails(anyTypeClasses.getModelObject(), true);
- container.addOrReplace(anyTypeClassesDetails);
- target.add(container);
- }
- });
+ @Override
+ protected String getPageId() {
+ return pageID;
+ }
- final ActionLinksPanel.Builder<Serializable> actionLinks = ActionLinksPanel.builder(pageRef);
- actionLinks.setDisableIndicator(true);
- actionLinks.addWithRoles(new ActionLink<Serializable>() {
+ @Override
+ protected List<IColumn<AnyTypeClassTO, String>> getColumns() {
- private static final long serialVersionUID = -3722207913631435501L;
+ final List<IColumn<AnyTypeClassTO, String>> columns = new ArrayList<>();
- @Override
- public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
- modal.header(new ResourceModel("createAnyTypeClass"));
- modal.setFormModel(new AnyTypeClassTO());
- modal.size(Modal.Size.Large);
- target.add(modal.setContent(new AnyTypeClassModalPanel(modal, pageRef, true)));
- modal.addSumbitButton();
- modal.show(true);
+ for (Field field : AnyTypeClassTO.class.getDeclaredFields()) {
+
+ if (field != null && !Modifier.isStatic(field.getModifiers())) {
+ final String fieldName = field.getName();
+ if (field.getType().isArray()) {
+ final IColumn<AnyTypeClassTO, String> column = new PropertyColumn<AnyTypeClassTO, 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<AnyTypeClassTO, String> column = new PropertyColumn<AnyTypeClassTO, 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);
+ }
}
- }, ActionLink.ActionType.CREATE, StandardEntitlement.ANYTYPECLASS_CREATE).addWithRoles(
- new ActionLink<Serializable>() {
+ }
+
+ columns.add(new AbstractColumn<AnyTypeClassTO, String>(new ResourceModel("actions", "")) {
- private static final long serialVersionUID = -3722207913631435501L;
+ private static final long serialVersionUID = 2054811145491901166L;
@Override
- public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
- if (anyTypeClasses != null && anyTypeClasses.getModelObject() != null) {
- modal.header(Model.of(anyTypeClasses.getModelObject().getKey()));
- modal.setFormModel(anyTypeClasses.getModelObject());
- modal.addSumbitButton();
- modal.show(true);
- target.add(modal.setContent(new AnyTypeClassModalPanel(modal, pageRef, false)));
- }
+ public String getCssClass() {
+ return "action";
}
- }, ActionLink.ActionType.EDIT, StandardEntitlement.ANYTYPECLASS_UPDATE).addWithRoles(
+
+ @Override
+ public void populateItem(final Item<ICellPopulator<AnyTypeClassTO>> item, final String componentId,
+ final IModel<AnyTypeClassTO> model) {
+
+ final ActionLinksPanel.Builder<Serializable> actionLinks =
+ ActionLinksPanel.builder(page.getPageReference());
+ actionLinks.setDisableIndicator(true);
+ actionLinks.addWithRoles(new ActionLink<Serializable>() {
+
+ private static final long serialVersionUID = -3722207913631435501L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
+ send(AnyTypeClassesPanel.this, Broadcast.EXACT,
+ new AjaxWizard.EditItemActionEvent<>(model.getObject(), target));
+ }
+ }, ActionLink.ActionType.EDIT, StandardEntitlement.ANYTYPECLASS_UPDATE).addWithRoles(
new ActionLink<Serializable>() {
private static final long serialVersionUID = -3722207913631435501L;
@@ -155,35 +225,52 @@ public class AnyTypeClassesPanel extends Panel {
@Override
public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
try {
- if (anyTypeClasses != null && anyTypeClasses.getModelObject() != null) {
- SyncopeConsoleSession.get()
- .getService(AnyTypeClassService.class).delete(anyTypeClasses.getModelObject().
- getKey());
- anyTypeClasses.setModelObject(null);
- anyTypeClasses.setChoices(SyncopeConsoleSession.get().getService(
- AnyTypeClassService.class).
- list());
- target.add(anyTypeClasses);
- target.add(updateAnyTypeClassDetails(new AnyTypeClassTO(), true));
- info(getString(Constants.OPERATION_SUCCEEDED));
- }
+ SyncopeConsoleSession.get().
+ getService(AnyTypeClassService.class).delete(model.getObject().getKey());
+ info(getString(Constants.OPERATION_SUCCEEDED));
+ target.add(container);
} catch (Exception e) {
- LOG.error("While deleting AnyTypeClass", e);
+ LOG.error("While deleting AnyTypeClassTO", e);
error(getString(Constants.ERROR) + ": " + e.getMessage());
}
((AbstractBasePage) getPage()).getNotificationPanel().refresh(target);
}
}, ActionLink.ActionType.DELETE, StandardEntitlement.ANYTYPECLASS_DELETE);
- container.add(actionLinks.build("editRemove"));
+ item.add(actionLinks.build(componentId));
+ }
+ });
+
+ return columns;
+
}
- private Panel updateAnyTypeClassDetails(final AnyTypeClassTO anyTypeClassTO, final boolean visible) {
- anyTypeClassesDetails = new AnyTypeClassDetails("anyTypeClassesDetails", anyTypeClassTO, false);
- anyTypeClassesDetails.setOutputMarkupId(true);
- anyTypeClassesDetails.setOutputMarkupPlaceholderTag(true);
- anyTypeClassesDetails.setVisible(visible);
- anyTypeClassesDetails.setEnabled(false);
- return anyTypeClassesDetails;
+ protected final class AnyTypeClassProvider extends SearchableDataProvider<AnyTypeClassTO> {
+
+ private static final long serialVersionUID = -185944053385660794L;
+
+ private final SortableDataProviderComparator<AnyTypeClassTO> comparator;
+
+ private AnyTypeClassProvider(final int paginatorRows) {
+ super(paginatorRows);
+ comparator = new SortableDataProviderComparator<>(this);
+ }
+
+ @Override
+ public Iterator<AnyTypeClassTO> iterator(final long first, final long count) {
+ final List<AnyTypeClassTO> list = SyncopeConsoleSession.get().getService(AnyTypeClassService.class).list();
+ Collections.sort(list, comparator);
+ return list.subList((int) first, (int) first + (int) count).iterator();
+ }
+
+ @Override
+ public long size() {
+ return SyncopeConsoleSession.get().getService(AnyTypeClassService.class).list().size();
+ }
+
+ @Override
+ public IModel<AnyTypeClassTO> model(final AnyTypeClassTO object) {
+ return new CompoundPropertyModel<>(object);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/java/org/apache/syncope/client/console/panels/DerSchemaDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/DerSchemaDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/DerSchemaDetails.java
index e013dcb..5c4b7d0 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/DerSchemaDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/DerSchemaDetails.java
@@ -18,17 +18,12 @@
*/
package org.apache.syncope.client.console.panels;
-import org.apache.syncope.client.console.commons.Constants;
import org.apache.syncope.client.console.commons.JexlHelpUtils;
-import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.common.lib.to.AbstractSchemaTO;
-import org.apache.syncope.common.lib.to.DerSchemaTO;
import org.apache.wicket.PageReference;
-import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.PropertyModel;
public class DerSchemaDetails extends AbstractSchemaDetailsPanel {
@@ -37,8 +32,8 @@ public class DerSchemaDetails extends AbstractSchemaDetailsPanel {
public DerSchemaDetails(final String id,
final PageReference pageReference,
- final BaseModal<AbstractSchemaTO> modal) {
- super(id, pageReference, modal);
+ final AbstractSchemaTO schemaTO) {
+ super(id, pageReference, schemaTO);
final AjaxTextFieldPanel expression = new AjaxTextFieldPanel("expression", getString("expression"),
new PropertyModel<String>(schemaTO, "expression"));
@@ -51,25 +46,4 @@ public class DerSchemaDetails extends AbstractSchemaDetailsPanel {
schemaForm.add(questionMarkJexlHelp);
questionMarkJexlHelp.add(jexlHelp);
}
-
- @Override
- public void getOnSubmit(final AjaxRequestTarget target,
- final BaseModal<?> modal, final Form<?> form, final PageReference pageReference, final boolean createFlag) {
-
- try {
- final DerSchemaTO updatedDerSchemaTO = DerSchemaTO.class.cast(form.getModelObject());
- if (createFlag) {
- schemaRestClient.createDerSchema(updatedDerSchemaTO);
- } else {
- schemaRestClient.updateDerSchema(updatedDerSchemaTO);
- }
-
- info(getString(Constants.OPERATION_SUCCEEDED));
- modal.close(target);
- } catch (Exception e) {
- LOG.error("While creating or updating derived schema", e);
- error(getString(Constants.ERROR) + ": " + e.getMessage());
- modal.getNotificationPanel().refresh(target);
- }
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/java/org/apache/syncope/client/console/panels/NotificationPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/NotificationPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/NotificationPanel.java
index 2583a86..ce41387 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/NotificationPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/NotificationPanel.java
@@ -37,6 +37,7 @@ public class NotificationPanel extends FeedbackPanel {
public NotificationPanel(final String id) {
super(id);
+ //element.kendoNotification.widget.fn.options.autoHideAfter
final Options options = new Options();
options.set("position", "{ pinned: true }");
options.set("templates",
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java
index f556680..2f6ed23 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java
@@ -24,15 +24,15 @@ 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.JexlHelpUtils;
+import org.apache.syncope.client.console.commons.PropertyList;
import org.apache.syncope.client.console.init.MIMETypesLoader;
-import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.MultiFieldPanel;
-import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.to.AbstractSchemaTO;
import org.apache.syncope.common.lib.to.PlainSchemaTO;
import org.apache.syncope.common.lib.types.AttrSchemaType;
@@ -44,12 +44,10 @@ import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField;
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.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.model.util.ListModel;
import org.apache.wicket.util.string.Strings;
public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
@@ -65,14 +63,14 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
public PlainSchemaDetails(
final String id,
final PageReference pageReference,
- final BaseModal<AbstractSchemaTO> modal) {
- super(id, pageReference, modal);
+ final AbstractSchemaTO schemaTO) {
+ super(id, pageReference, schemaTO);
final AjaxDropDownChoicePanel<AttrSchemaType> type = new AjaxDropDownChoicePanel<>(
"type", getString("type"), new PropertyModel<AttrSchemaType>(schemaTO, "type"));
type.setChoices(Arrays.asList(AttrSchemaType.values()));
- type.setEnabled(schemaTO.getKey() == null || schemaTO.getKey().isEmpty());
+ type.setEnabled(schemaTO == null || schemaTO.getKey() == null || schemaTO.getKey().isEmpty());
type.addRequiredLabel();
schemaForm.add(type);
@@ -97,14 +95,80 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
final AjaxTextFieldPanel enumerationValuesPanel = new AjaxTextFieldPanel("panel", "enumerationValues",
new Model<String>(null));
- enumerationValues = new MultiFieldPanel.Builder<>(
- new ListModel<String>(getEnumValuesAsList(((PlainSchemaTO) schemaTO).getEnumerationValues()))).build(
+ enumerationValues = new MultiFieldPanel.Builder<String>(
+ new PropertyModel<List<String>>(schemaTO, "enumerationValues") {
+
+ private static final long serialVersionUID = -4953564762272833993L;
+
+ @Override
+ public PropertyList<PlainSchemaTO> getObject() {
+ return new PropertyList<PlainSchemaTO>(PlainSchemaTO.class.cast(schemaTO)) {
+
+ @Override
+ public String getValues() {
+ return PlainSchemaTO.class.cast(schemaTO).getEnumerationValues();
+ }
+
+ @Override
+ public void setValues(final List<String> list) {
+ PlainSchemaTO.class.cast(schemaTO).setEnumerationValues(getEnumValuesAsString(list));
+ }
+ };
+ }
+
+ @Override
+ public void setObject(final List<String> object) {
+ PlainSchemaTO.class.cast(schemaTO).setEnumerationValues(PropertyList.getEnumValuesAsString(object));
+ }
+ }) {
+
+ private static final long serialVersionUID = -8752965211744734798L;
+
+ @Override
+ protected String newModelObject() {
+ return StringUtils.EMPTY;
+ }
+
+ }.build(
"enumerationValues",
"enumerationValues",
enumerationValuesPanel);
- enumerationKeys = new MultiFieldPanel.Builder<>(
- new ListModel<String>(getEnumValuesAsList(((PlainSchemaTO) schemaTO).getEnumerationKeys()))).build(
+ enumerationKeys = new MultiFieldPanel.Builder<String>(
+ new PropertyModel<List<String>>(schemaTO, "enumerationKeys") {
+
+ private static final long serialVersionUID = -4953564762272833993L;
+
+ @Override
+ public PropertyList<PlainSchemaTO> getObject() {
+ return new PropertyList<PlainSchemaTO>(PlainSchemaTO.class.cast(schemaTO)) {
+
+ @Override
+ public String getValues() {
+ return PlainSchemaTO.class.cast(schemaTO).getEnumerationKeys();
+ }
+
+ @Override
+ public void setValues(final List<String> list) {
+ PlainSchemaTO.class.cast(schemaTO).setEnumerationKeys(PropertyList.getEnumValuesAsString(list));
+ }
+ };
+ }
+
+ @Override
+ public void setObject(final List<String> object) {
+ PlainSchemaTO.class.cast(schemaTO).setEnumerationKeys(PropertyList.getEnumValuesAsString(object));
+ }
+ }) {
+
+ private static final long serialVersionUID = -8752965211744734798L;
+
+ @Override
+ protected String newModelObject() {
+ return StringUtils.EMPTY;
+ }
+
+ }.build(
"enumerationKeys",
"enumerationKeys",
new AjaxTextFieldPanel("panel", "enumerationKeys", new Model<String>()));
@@ -172,7 +236,7 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
@Override
protected List<String> load() {
- return schemaRestClient.getAllValidatorClasses();
+ return new ArrayList<>(SyncopeConsoleSession.get().getSyncopeTO().getValidators());
}
};
@@ -182,8 +246,8 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
validatorClass.setChoices(validatorsList.getObject());
schemaForm.add(validatorClass);
- final AutoCompleteTextField<String> mandatoryCondition
- = new AutoCompleteTextField<String>("mandatoryCondition") {
+ final AutoCompleteTextField<String> mandatoryCondition =
+ new AutoCompleteTextField<String>("mandatoryCondition") {
private static final long serialVersionUID = -2428903969518079100L;
@@ -251,8 +315,8 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
if (enumerationValuesPanel.isRequired()) {
enumerationValuesPanel.removeRequiredLabel();
}
- enumerationValues.setModelObject(getEnumValuesAsList(null));
- enumerationKeys.setModelObject(getEnumValuesAsList(null));
+ enumerationValues.setModelObject(PropertyList.getEnumValuesAsList(null));
+ enumerationKeys.setModelObject(PropertyList.getEnumValuesAsList(null));
encryptedParams.setVisible(false);
if (secretKey.isRequired()) {
@@ -275,8 +339,10 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
if (!enumerationValuesPanel.isRequired()) {
enumerationValuesPanel.addRequiredLabel();
}
- enumerationValues.setModelObject(getEnumValuesAsList(((PlainSchemaTO) schema).getEnumerationValues()));
- enumerationKeys.setModelObject(getEnumValuesAsList(((PlainSchemaTO) schema).getEnumerationKeys()));
+ enumerationValues.setModelObject(PropertyList.getEnumValuesAsList(((PlainSchemaTO) schema).
+ getEnumerationValues()));
+ enumerationKeys.setModelObject(PropertyList.getEnumValuesAsList(((PlainSchemaTO) schema).
+ getEnumerationKeys()));
encryptedParams.setVisible(false);
if (secretKey.isRequired()) {
@@ -299,8 +365,8 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
if (enumerationValuesPanel.isRequired()) {
enumerationValuesPanel.removeRequiredLabel();
}
- enumerationValues.setModelObject(getEnumValuesAsList(null));
- enumerationKeys.setModelObject(getEnumValuesAsList(null));
+ enumerationValues.setModelObject(PropertyList.getEnumValuesAsList(null));
+ enumerationKeys.setModelObject(PropertyList.getEnumValuesAsList(null));
encryptedParams.setVisible(true);
if (!secretKey.isRequired()) {
@@ -321,8 +387,8 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
if (enumerationValuesPanel.isRequired()) {
enumerationValuesPanel.removeRequiredLabel();
}
- enumerationValues.setModelObject(getEnumValuesAsList(null));
- enumerationKeys.setModelObject(getEnumValuesAsList(null));
+ enumerationValues.setModelObject(PropertyList.getEnumValuesAsList(null));
+ enumerationKeys.setModelObject(PropertyList.getEnumValuesAsList(null));
encryptedParams.setVisible(false);
if (secretKey.isRequired()) {
@@ -345,8 +411,8 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
if (enumerationValuesPanel.isRequired()) {
enumerationValuesPanel.removeRequiredLabel();
}
- enumerationValues.setModelObject(getEnumValuesAsList(null));
- enumerationKeys.setModelObject(getEnumValuesAsList(null));
+ enumerationValues.setModelObject(PropertyList.getEnumValuesAsList(null));
+ enumerationKeys.setModelObject(PropertyList.getEnumValuesAsList(null));
encryptedParams.setVisible(false);
if (secretKey.isRequired()) {
@@ -363,60 +429,4 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel {
mimeType.setChoices(null);
}
}
-
- private String getEnumValuesAsString(final List<String> enumerationValues) {
- final StringBuilder builder = new StringBuilder();
-
- for (String str : enumerationValues) {
- if (StringUtils.isNotBlank(str)) {
- if (builder.length() > 0) {
- builder.append(SyncopeConstants.ENUM_VALUES_SEPARATOR);
- }
-
- builder.append(str.trim());
- }
- }
-
- return builder.toString();
- }
-
- private List<String> getEnumValuesAsList(final String enumerationValues) {
- final List<String> values = new ArrayList<>();
-
- if (StringUtils.isNotBlank(enumerationValues)) {
- for (String value : enumerationValues.split(SyncopeConstants.ENUM_VALUES_SEPARATOR)) {
- values.add(value.trim());
- }
- } else {
- values.add(StringUtils.EMPTY);
- }
-
- return values;
- }
-
- @Override
- public void getOnSubmit(final AjaxRequestTarget target, final BaseModal<?> modal,
- final Form<?> form, final PageReference pageReference, final boolean createFlag) {
-
- try {
- final PlainSchemaTO updatedPlainSchemaTO = PlainSchemaTO.class.cast(form.getModelObject());
-
- updatedPlainSchemaTO.setEnumerationValues(
- getEnumValuesAsString(enumerationValues.getView().getModelObject()));
- updatedPlainSchemaTO.setEnumerationKeys(getEnumValuesAsString(enumerationKeys.getView().getModelObject()));
-
- if (createFlag) {
- schemaRestClient.createPlainSchema(updatedPlainSchemaTO);
- } else {
- schemaRestClient.updatePlainSchema(updatedPlainSchemaTO);
- }
-
- info(getString(Constants.OPERATION_SUCCEEDED));
- modal.close(target);
- } catch (Exception e) {
- LOG.error("While creating or updating plain schema", e);
- error(getString(Constants.ERROR) + ": " + e.getMessage());
- modal.getNotificationPanel().refresh(target);
- }
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5296cad/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java
index bb30f7b..dabeb85 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SchemaModalPanel.java
@@ -19,36 +19,30 @@
package org.apache.syncope.client.console.panels;
import java.util.Arrays;
-import org.apache.syncope.client.console.commons.Constants;
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.common.lib.to.AbstractSchemaTO;
import org.apache.syncope.common.lib.types.SchemaType;
import org.apache.wicket.PageReference;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
-import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.Model;
public class SchemaModalPanel extends AbstractModalPanel<AbstractSchemaTO> {
private static final long serialVersionUID = -4681998932778822125L;
- private AbstractSchemaDetailsPanel schemaPanel;
+ private final AbstractSchemaDetailsPanel schemaPanel;
- private final boolean createFlag;
+ private final AbstractSchemaTO schemaTO;
public SchemaModalPanel(
final BaseModal<AbstractSchemaTO> modal,
- final PageReference pageRef, final boolean createFlag) {
+ final AbstractSchemaTO schemaTO,
+ final PageReference pageRef) {
super(modal, pageRef);
- this.createFlag = createFlag;
- final BaseModal<AbstractSchemaTO> schemaModal = modal;
+ this.schemaTO = schemaTO;
- final Panel panel = this;
final Form<SchemaType> kindForm = new Form<>("kindForm");
add(kindForm);
@@ -57,29 +51,11 @@ public class SchemaModalPanel extends AbstractModalPanel<AbstractSchemaTO> {
kind.setChoices(Arrays.asList(SchemaType.values()));
kind.setOutputMarkupId(true);
- SchemaType schemaType = SchemaType.PLAIN;
- if (!createFlag) {
- schemaType = SchemaType.fromToClass(schemaModal.getFormModel().getClass());
- kind.setModelObject(schemaType);
- kind.setEnabled(false);
- }
-
- ((DropDownChoice) kind.getField()).setNullValid(false);
+ kind.setModelObject(SchemaType.fromToClass(schemaTO.getClass()));
+ kind.setEnabled(false);
kindForm.add(kind);
- kind.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
-
- private static final long serialVersionUID = -1107858522700306810L;
-
- @Override
- protected void onUpdate(final AjaxRequestTarget target) {
- schemaPanel = getSchemaPanel("details", kind.getModelObject(), modal);
- panel.addOrReplace(schemaPanel);
- target.add(panel);
- }
- });
-
- schemaPanel = getSchemaPanel("details", schemaType, modal);
+ schemaPanel = getSchemaPanel("details", SchemaType.fromToClass(schemaTO.getClass()), modal);
schemaPanel.setOutputMarkupId(true);
addOrReplace(schemaPanel);
}
@@ -88,7 +64,7 @@ public class SchemaModalPanel extends AbstractModalPanel<AbstractSchemaTO> {
final SchemaType schemaType, final BaseModal<AbstractSchemaTO> modal) {
final AbstractSchemaDetailsPanel panel;
- if (createFlag) {
+ if (schemaTO.getKey() != null) {
try {
final Class<? extends AbstractSchemaTO> schemaTOClass = schemaType.getToClass();
modal.setFormModel((AbstractSchemaTO) schemaTOClass.newInstance());
@@ -99,21 +75,16 @@ public class SchemaModalPanel extends AbstractModalPanel<AbstractSchemaTO> {
switch (schemaType) {
case DERIVED:
- panel = new DerSchemaDetails(id, pageRef, modal);
+ panel = new DerSchemaDetails(id, pageRef, schemaTO);
break;
case VIRTUAL:
- panel = new VirSchemaDetails(id, pageRef, modal);
+ panel = new VirSchemaDetails(id, pageRef, schemaTO);
break;
case PLAIN:
default:
- panel = new PlainSchemaDetails(id, pageRef, modal);
+ panel = new PlainSchemaDetails(id, pageRef, schemaTO);
}
panel.setOutputMarkupId(true);
return panel;
}
-
- @Override
- public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
- schemaPanel.getOnSubmit(target, modal, form, pageRef, createFlag);
- }
}