Repository: syncope Updated Branches: refs/heads/master 61a7fdd38 -> 3c19e3515
[SYNCOPE-774] fixes the issue by improving feature Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/3c19e351 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/3c19e351 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/3c19e351 Branch: refs/heads/master Commit: 3c19e35153170af40169fd1d42bcc2551dc73190 Parents: 61a7fdd Author: fmartelli <fabio.marte...@gmail.com> Authored: Fri Mar 11 17:11:53 2016 +0100 Committer: fmartelli <fabio.marte...@gmail.com> Committed: Fri Mar 11 17:11:53 2016 +0100 ---------------------------------------------------------------------- .../client/console/panels/ListViewPanel.java | 33 +- .../console/panels/ResourceDetailsPanel.java | 6 +- .../console/panels/ResourceMappingPanel.java | 318 ++++++++++++------- .../client/console/panels/ResourceModal.java | 39 ++- .../provision/ProvisionWizardBuilder.java | 3 +- .../META-INF/resources/css/syncopeConsole.css | 2 +- .../console/panels/ResourceDetailsPanel.html | 2 +- .../src/test/resources/core-rebel.xml | 2 +- .../syncope/fit/console/TopologyITCase.java | 16 + 9 files changed, 289 insertions(+), 132 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/3c19e351/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java index ebc0b18..e15b151 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ListViewPanel.java @@ -25,6 +25,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; +import org.apache.commons.collections4.IteratorUtils; +import org.apache.commons.collections4.Predicate; import org.apache.commons.lang3.StringUtils; import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink; import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel; @@ -76,6 +78,8 @@ public abstract class ListViewPanel<T extends Serializable> extends WizardMgtPan private final Model<CheckAvailability> check; + private final ListView<T> beans; + private final List<T> listOfItems; /** @@ -148,7 +152,7 @@ public abstract class ListViewPanel<T extends Serializable> extends WizardMgtPan addInnerObject(header(toBeIncluded)); - final ListView<T> beans = new ListView<T>("beans", listOfItems) { + beans = new ListView<T>("beans", listOfItems) { private static final long serialVersionUID = 1L; @@ -335,6 +339,18 @@ public abstract class ListViewPanel<T extends Serializable> extends WizardMgtPan : new Label("field", new ResourceModel(value.toString(), value.toString())); } + protected T getActualItem(final T item, final List<T> list) { + return item == null + ? null + : IteratorUtils.find(list.iterator(), new Predicate<T>() { + + @Override + public boolean evaluate(final T object) { + return item.equals(object); + } + }); + } + @Override protected WizardMgtPanel<T> newInstance(final String id) { return new ListViewPanel<T>(id, items, reference, includes, actions, check, reuseItem, model) { @@ -346,6 +362,10 @@ public abstract class ListViewPanel<T extends Serializable> extends WizardMgtPan return Builder.this.getValueComponent(key, bean); } + @Override + protected T getActualItem(final T item, final List<T> list) { + return Builder.this.getActualItem(item, list); + } }; } } @@ -354,14 +374,17 @@ public abstract class ListViewPanel<T extends Serializable> extends WizardMgtPan @SuppressWarnings("unchecked") public void onEvent(final IEvent<?> event) { if (event.getPayload() instanceof AjaxWizard.NewItemEvent) { - final T item = ((AjaxWizard.NewItemEvent<T>) event.getPayload()).getItem(); final AjaxRequestTarget target = ((AjaxWizard.NewItemEvent<T>) event.getPayload()).getTarget(); if (event.getPayload() instanceof AjaxWizard.NewItemFinishEvent) { - if (item != null && !this.listOfItems.contains(item)) { - this.listOfItems.add(item); + final T old = getActualItem(item, ListViewPanel.this.listOfItems); + int indexOf = ListViewPanel.this.listOfItems.size(); + if (old != null) { + indexOf = ListViewPanel.this.listOfItems.indexOf(old); + ListViewPanel.this.listOfItems.remove(old); } + ListViewPanel.this.listOfItems.add(indexOf, item); } target.add(ListViewPanel.this); @@ -373,6 +396,8 @@ public abstract class ListViewPanel<T extends Serializable> extends WizardMgtPan } } + protected abstract T getActualItem(final T item, final List<T> list); + public static class ListViewReload { private final AjaxRequestTarget target; http://git-wip-us.apache.org/repos/asf/syncope/blob/3c19e351/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDetailsPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDetailsPanel.java index 06055f4..b044ed0 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDetailsPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceDetailsPanel.java @@ -106,9 +106,9 @@ public class ResourceDetailsPanel extends Panel { setChoices(Arrays.asList(TraceLevel.values()))); container.add(new AjaxDropDownChoicePanel<>( - "syncTraceLevel", - new ResourceModel("syncTraceLevel", "syncTraceLevel").getObject(), - new PropertyModel<TraceLevel>(model, "syncTraceLevel"), + "pullTraceLevel", + new ResourceModel("pullTraceLevel", "pullTraceLevel").getObject(), + new PropertyModel<TraceLevel>(model, "pullTraceLevel"), false). setChoices(Arrays.asList(TraceLevel.values()))); http://git-wip-us.apache.org/repos/asf/syncope/blob/3c19e351/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java index 24fda22..935b800 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceMappingPanel.java @@ -21,23 +21,29 @@ package org.apache.syncope.client.console.panels; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; +import java.util.HashSet; import java.util.List; import java.util.Set; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.IterableUtils; import org.apache.commons.collections4.Predicate; +import org.apache.syncope.client.console.commons.ConnIdSpecialAttributeName; import org.apache.syncope.client.console.commons.Constants; import org.apache.syncope.client.console.commons.JexlHelpUtils; +import org.apache.syncope.client.console.rest.AnyTypeClassRestClient; +import org.apache.syncope.client.console.rest.AnyTypeRestClient; import org.apache.syncope.client.console.rest.ConnectorRestClient; -import org.apache.syncope.client.console.rest.SchemaRestClient; 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.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.FieldPanel; import org.apache.syncope.client.console.wicket.markup.html.form.MappingPurposePanel; +import org.apache.syncope.common.lib.to.AnyTypeClassTO; +import org.apache.syncope.common.lib.to.AnyTypeTO; import org.apache.syncope.common.lib.to.ConnIdObjectClassTO; import org.apache.syncope.common.lib.to.ConnInstanceTO; import org.apache.syncope.common.lib.to.MappingItemTO; @@ -77,9 +83,14 @@ public class ResourceMappingPanel extends Panel { private static final String DEF_FIELD_STYLE = ""; /** - * Schema rest client. + * Any type rest client. */ - private final SchemaRestClient schemaRestClient = new SchemaRestClient(); + private final AnyTypeRestClient anyTypeRestClient = new AnyTypeRestClient(); + + /** + * Any type class rest client. + */ + private final AnyTypeClassRestClient anyTypeClassRestClient = new AnyTypeClassRestClient(); /** * ConnInstance rest client. @@ -217,10 +228,127 @@ public class ResourceMappingPanel extends Panel { } AnyTypeKind entity = null; - if (mapItem.getIntMappingType() != null) { + if (provisionTO.getAnyType().equals(AnyTypeKind.GROUP.name())) { + // support for clone + entity = AnyTypeKind.GROUP; + } else if (mapItem.getIntMappingType() != null) { entity = mapItem.getIntMappingType().getAnyTypeKind(); } + // it will happen just in case of clone to create a new mapping for group object + if (mapItem.getIntMappingType() != null && mapItem.getIntMappingType().getAnyTypeKind() != entity) { + mapItem.setIntMappingType(null); + mapItem.setIntAttrName(null); + } + + //-------------------------------- + // Entity + // ------------------------------- + final AjaxDropDownChoicePanel<AnyTypeKind> entitiesPanel = new AjaxDropDownChoicePanel<>( + "entities", + new ResourceModel("entities", "entities").getObject(), + new Model<>(entity)); + + entitiesPanel.hideLabel(); + entitiesPanel.setChoices(provisionTO.getAnyType().equals(AnyTypeKind.GROUP.name()) + ? Collections.<AnyTypeKind>singletonList(AnyTypeKind.GROUP) + : Arrays.asList(AnyTypeKind.values())); + + entitiesPanel.setStyleSheet(false, DEF_FIELD_STYLE); + item.add(entitiesPanel); + // ------------------------------- + + //-------------------------------- + // Internal attribute type + // ------------------------------- + final List<IntMappingType> attrTypes = new ArrayList<>(getAttributeTypes(entity)); + final AjaxDropDownChoicePanel<IntMappingType> intMappingTypes = new AjaxDropDownChoicePanel<>( + "intMappingTypes", + new ResourceModel("intMappingTypes", "intMappingTypes").getObject(), + new PropertyModel<IntMappingType>(mapItem, "intMappingType"), + false); + intMappingTypes.setNullValid(true).setRequired(true).hideLabel(); + intMappingTypes.setChoices(attrTypes); + item.add(intMappingTypes); + // ------------------------------- + + //-------------------------------- + // Internal attribute + // ------------------------------- + final AjaxDropDownChoicePanel<String> intAttrNames = new AjaxDropDownChoicePanel<>( + "intAttrNames", + getString("intAttrNames"), + new PropertyModel<String>(mapItem, "intAttrName"), + false); + intAttrNames.setChoices(Collections.<String>emptyList()); + intAttrNames.setNullValid(true).setRequired(true).hideLabel(); + item.add(intAttrNames); + // ------------------------------- + + //-------------------------------- + // External attribute + // ------------------------------- + final AjaxTextFieldPanel extAttrNames = new AjaxTextFieldPanel( + "extAttrName", + new ResourceModel("extAttrNames", "extAttrNames").getObject(), + new PropertyModel<String>(mapItem, "extAttrName")); + extAttrNames.setChoices(schemaNames); + + boolean required = !mapItem.isPassword(); + extAttrNames.setRequired(required).hideLabel(); + extAttrNames.setEnabled(required); + item.add(extAttrNames); + // ------------------------------- + + //-------------------------------- + // Mandatory + // ------------------------------- + final AjaxTextFieldPanel mandatory = new AjaxTextFieldPanel( + "mandatoryCondition", + new ResourceModel("mandatoryCondition", "mandatoryCondition").getObject(), + new PropertyModel<String>(mapItem, "mandatoryCondition")); + mandatory.hideLabel(); + mandatory.setChoices(Arrays.asList(new String[] { "true", "false" })); + item.add(mandatory); + // ------------------------------- + + //-------------------------------- + // Connector object key + // ------------------------------- + final AjaxCheckBoxPanel connObjectKey = new AjaxCheckBoxPanel( + "connObjectKey", + new ResourceModel("connObjectKey", "connObjectKey").getObject(), + new PropertyModel<Boolean>(mapItem, "connObjectKey"), false); + connObjectKey.hideLabel(); + item.add(connObjectKey); + // ------------------------------- + + //-------------------------------- + // Password + // ------------------------------- + final AjaxCheckBoxPanel password = new AjaxCheckBoxPanel( + "password", + new ResourceModel("password", "password").getObject(), + new PropertyModel<Boolean>(mapItem, "password"), false); + item.add(password.hideLabel()); + // ------------------------------- + + //-------------------------------- + // Purpose + // ------------------------------- + final WebMarkupContainer purpose = new WebMarkupContainer("purpose"); + purpose.setOutputMarkupId(Boolean.TRUE); + + final MappingPurposePanel panel = new MappingPurposePanel( + "purposeActions", new PropertyModel<MappingPurpose>(mapItem, "purpose"), purpose); + + purpose.add(panel.setRenderBodyOnly(true)); + item.add(purpose); + // ------------------------------- + + //-------------------------------- + // Remove + // ------------------------------- final ActionLinksPanel.Builder<Serializable> actions = ActionLinksPanel.builder(); actions.add(new ActionLink<Serializable>() { @@ -242,47 +370,8 @@ public class ResourceMappingPanel extends Panel { } } }, ActionLink.ActionType.DELETE, StandardEntitlement.RESOURCE_UPDATE); - item.add(actions.build("toRemove")); - - final AjaxDropDownChoicePanel<String> intAttrNames = new AjaxDropDownChoicePanel<>( - "intAttrNames", - getString("intAttrNames"), - new PropertyModel<String>(mapItem, "intAttrName"), - false); - intAttrNames.setChoices(schemaNames); - intAttrNames.setRequired(true).hideLabel(); - - intAttrNames.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { - - private static final long serialVersionUID = -1107858522700306810L; - - @Override - protected void onUpdate(final AjaxRequestTarget target) { - } - }); - item.add(intAttrNames); - - final List<IntMappingType> attrTypes = new ArrayList<>(getAttributeTypes(entity)); - final AjaxDropDownChoicePanel<IntMappingType> intMappingTypes = new AjaxDropDownChoicePanel<>( - "intMappingTypes", - new ResourceModel("intMappingTypes", "intMappingTypes").getObject(), - new PropertyModel<IntMappingType>(mapItem, "intMappingType")); - intMappingTypes.setRequired(true).hideLabel(); - intMappingTypes.setChoices(attrTypes); - item.add(intMappingTypes); - - final AjaxDropDownChoicePanel<AnyTypeKind> entitiesPanel = new AjaxDropDownChoicePanel<>( - "entities", - new ResourceModel("entities", "entities").getObject(), - new Model<>(entity)); - - entitiesPanel.hideLabel(); - entitiesPanel.setChoices(provisionTO.getAnyType().equals(AnyTypeKind.GROUP.name()) - ? Collections.<AnyTypeKind>singletonList(AnyTypeKind.GROUP) - : Arrays.asList(AnyTypeKind.values())); - - entitiesPanel.setStyleSheet(false, DEF_FIELD_STYLE); + // ------------------------------- entitiesPanel.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { @@ -300,38 +389,30 @@ public class ResourceMappingPanel extends Panel { target.add(intAttrNames); } }); - item.add(entitiesPanel); - final FieldPanel<String> extAttrNames = new AjaxTextFieldPanel( - "extAttrName", - new ResourceModel("extAttrNames", "extAttrNames").getObject(), - new PropertyModel<String>(mapItem, "extAttrName")); - ((AjaxTextFieldPanel) extAttrNames).setChoices(schemaNames); + intMappingTypes.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { - boolean required = false; - if (mapItem.isPassword()) { - ((AjaxTextFieldPanel) extAttrNames).setModelObject(null); - } else { - required = true; - } - extAttrNames.setRequired(required).hideLabel(); - extAttrNames.setEnabled(required); - item.add(extAttrNames); + private static final long serialVersionUID = -1107858522700306810L; - final AjaxTextFieldPanel mandatory = new AjaxTextFieldPanel( - "mandatoryCondition", - new ResourceModel("mandatoryCondition", "mandatoryCondition").getObject(), - new PropertyModel<String>(mapItem, "mandatoryCondition")); - mandatory.hideLabel(); - mandatory.setChoices(Arrays.asList(new String[] { "true", "false" })); - item.add(mandatory); + @Override + protected void onUpdate(final AjaxRequestTarget target) { + setAttrNames(intMappingTypes.getModelObject(), intAttrNames); + target.add(intAttrNames); - final AjaxCheckBoxPanel connObjectKey = new AjaxCheckBoxPanel( - "connObjectKey", - new ResourceModel("connObjectKey", "connObjectKey").getObject(), - new PropertyModel<Boolean>(mapItem, "connObjectKey")); + setConnObjectKey(intMappingTypes.getModelObject(), connObjectKey, password); + target.add(connObjectKey); + } + }); + + intAttrNames.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { + + private static final long serialVersionUID = -1107858522700306810L; + + @Override + protected void onUpdate(final AjaxRequestTarget target) { + } + }); - connObjectKey.hideLabel(); connObjectKey.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { private static final long serialVersionUID = -1107858522700306810L; @@ -348,14 +429,7 @@ public class ResourceMappingPanel extends Panel { target.add(mandatory); } }); - item.add(connObjectKey); - - final AjaxCheckBoxPanel password = new AjaxCheckBoxPanel( - "password", - new ResourceModel("password", "password").getObject(), - new PropertyModel<Boolean>(mapItem, "password")); - password.hideLabel(); password.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { private static final long serialVersionUID = -1107858522700306810L; @@ -363,7 +437,8 @@ public class ResourceMappingPanel extends Panel { @Override protected void onUpdate(final AjaxRequestTarget target) { extAttrNames.setEnabled(!mapItem.isConnObjectKey() && !password.getModelObject()); - extAttrNames.setModelObject(null); + extAttrNames.setModelObject(password.getModelObject() + ? ConnIdSpecialAttributeName.PASSWORD : extAttrNames.getModelObject()); extAttrNames.setRequired(!password.getModelObject()); target.add(extAttrNames); @@ -371,37 +446,21 @@ public class ResourceMappingPanel extends Panel { target.add(connObjectKey); } }); - item.add(password); - if (!AnyTypeKind.USER.name().equals(provisionTO.getAnyType())) { - password.setVisible(false); - } - - final WebMarkupContainer purpose = new WebMarkupContainer("purpose"); - purpose.setOutputMarkupId(Boolean.TRUE); - final MappingPurposePanel panel = new MappingPurposePanel( - "purposeActions", new PropertyModel<MappingPurpose>(mapItem, "purpose"), purpose); - - purpose.add(panel.setRenderBodyOnly(true)); - - item.add(purpose); - - intMappingTypes.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { - - private static final long serialVersionUID = -1107858522700306810L; + setAttrNames(mapItem.getIntMappingType(), intAttrNames); + setConnObjectKey(mapItem.getIntMappingType(), connObjectKey, password); - @Override - protected void onUpdate(final AjaxRequestTarget target) { - setAttrNames(intMappingTypes.getModelObject(), intAttrNames); - target.add(intAttrNames); + if (!AnyTypeKind.USER.name().equals(provisionTO.getAnyType())) { + password.setVisible(false); - setConnObjectKey(intMappingTypes.getModelObject(), connObjectKey, password); - target.add(connObjectKey); + // Changes required by clone .... + extAttrNames.setEnabled(!mapItem.isConnObjectKey()); + if (mapItem.isPassword()) { + // re-enable if and only if cloned objec mapping item was a password + intAttrNames.setEnabled(true); } - }); - - setAttrNames(mapItem.getIntMappingType(), intAttrNames); - setConnObjectKey(mapItem.getIntMappingType(), connObjectKey, password); + mapItem.setPassword(false); + } } }; @@ -443,8 +502,9 @@ public class ResourceMappingPanel extends Panel { @Override public boolean evaluate(final String object) { - return !("__NAME__".equals(object) || "__ENABLE__".equals(object) - || "__PASSWORD__".equals(object)); + return !(ConnIdSpecialAttributeName.NAME.equals(object) + || ConnIdSpecialAttributeName.ENABLE.equals(object) + || ConnIdSpecialAttributeName.PASSWORD.equals(object)); } })); } @@ -472,30 +532,60 @@ public class ResourceMappingPanel extends Panel { * @param toBeUpdated drop down choice to be updated. */ private void setAttrNames(final IntMappingType type, final AjaxDropDownChoicePanel<String> toBeUpdated) { + toBeUpdated.setRequired(true); toBeUpdated.setEnabled(true); if (type == null || type.getAnyTypeKind() == null) { toBeUpdated.setChoices(Collections.<String>emptyList()); } else { + Collection<AnyTypeTO> anyTypeTOs = type.getAnyTypeKind() == AnyTypeKind.ANY_OBJECT + ? CollectionUtils.select(anyTypeRestClient.list(), new Predicate<AnyTypeTO>() { + + @Override + public boolean evaluate(final AnyTypeTO object) { + return object.getKind() == AnyTypeKind.ANY_OBJECT; + } + }) + : Collections.singletonList(anyTypeRestClient.get(type.getAnyTypeKind().name())); + + final List<AnyTypeClassTO> anyTypeClassTOs = new ArrayList<>(); + for (AnyTypeTO anyTypeTO : anyTypeTOs) { + anyTypeClassTOs.addAll(anyTypeClassRestClient.list(anyTypeTO.getClasses())); + } + + List<String> choices; + switch (type) { // user attribute names case UserPlainSchema: case GroupPlainSchema: case AnyObjectPlainSchema: - toBeUpdated.setChoices(schemaRestClient.getPlainSchemaNames()); + final Set<String> plains = new HashSet<>(); + for (AnyTypeClassTO anyTypeClassTO : anyTypeClassTOs) { + plains.addAll(anyTypeClassTO.getPlainSchemas()); + } + choices = new ArrayList<>(plains); break; case UserDerivedSchema: case GroupDerivedSchema: case AnyObjectDerivedSchema: - toBeUpdated.setChoices(schemaRestClient.getDerSchemaNames()); + final Set<String> deriveds = new HashSet<>(); + for (AnyTypeClassTO anyTypeClassTO : anyTypeClassTOs) { + deriveds.addAll(anyTypeClassTO.getDerSchemas()); + } + choices = new ArrayList<>(deriveds); break; case UserVirtualSchema: case GroupVirtualSchema: case AnyObjectVirtualSchema: - toBeUpdated.setChoices(schemaRestClient.getVirSchemaNames()); + final Set<String> virtuals = new HashSet<>(); + for (AnyTypeClassTO anyTypeClassTO : anyTypeClassTOs) { + virtuals.addAll(anyTypeClassTO.getVirSchemas()); + } + choices = new ArrayList<>(virtuals); break; case UserKey: @@ -507,8 +597,10 @@ public class ResourceMappingPanel extends Panel { default: toBeUpdated.setRequired(false); toBeUpdated.setEnabled(false); - toBeUpdated.setChoices(Collections.<String>emptyList()); + choices = Collections.<String>emptyList(); } + Collections.sort(choices); + toBeUpdated.setChoices(choices); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/3c19e351/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceModal.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceModal.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceModal.java index b3405b7..f9ebc9b 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceModal.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceModal.java @@ -21,7 +21,9 @@ package org.apache.syncope.client.console.panels; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import org.apache.commons.collections4.IterableUtils; +import org.apache.commons.collections4.IteratorUtils; import org.apache.commons.collections4.Predicate; import org.apache.commons.lang3.SerializationUtils; import org.apache.commons.lang3.StringUtils; @@ -90,9 +92,31 @@ public class ResourceModal<T extends Serializable> extends AbstractResourceModal //-------------------------------- // Resource provision panels //-------------------------------- - final ListViewPanel.Builder<ProvisionTO> builder = new ListViewPanel.Builder<>(ProvisionTO.class, pageRef); + final ListViewPanel.Builder<ProvisionTO> builder + = new ListViewPanel.Builder<ProvisionTO>(ProvisionTO.class, pageRef) { + + private static final long serialVersionUID = 4907732721283972943L; + + @Override + protected ProvisionTO getActualItem(final ProvisionTO item, final List<ProvisionTO> list) { + return item == null + ? null + : IteratorUtils.find(list.iterator(), new Predicate<ProvisionTO>() { + + @Override + public boolean evaluate(final ProvisionTO in) { + return ((item.getKey() == null && in.getKey() == null) + || (in.getKey() != null && in.getKey().equals(item.getKey()))) + && ((item.getAnyType() == null && in.getAnyType() == null) + || (in.getAnyType() != null && in.getAnyType().equals(item.getAnyType()))); + } + }); + } + }; + builder.setItems(model.getObject().getProvisions()); builder.includes("anyType", "objectClass"); + builder.setReuseItem(false); builder. addAction(new ActionLink<ProvisionTO>() { @@ -122,8 +146,7 @@ public class ResourceModal<T extends Serializable> extends AbstractResourceModal @Override public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO) { provisionTO.setSyncToken(null); - send(pageRef.getPage(), Broadcast.DEPTH, - new AjaxWizard.NewItemFinishEvent<>(provisionTO, target)); + send(pageRef.getPage(), Broadcast.DEPTH, new ListViewPanel.ListViewReload(target)); } }, ActionLink.ActionType.RESET_TIME, StandardEntitlement.RESOURCE_UPDATE). addAction(new ActionLink<ProvisionTO>() { @@ -132,8 +155,11 @@ public class ResourceModal<T extends Serializable> extends AbstractResourceModal @Override public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO) { - send(pageRef.getPage(), Broadcast.DEPTH, - new AjaxWizard.NewItemActionEvent<>(SerializationUtils.clone(provisionTO), target)); + final ProvisionTO clone = SerializationUtils.clone(provisionTO); + clone.setKey(0L); + clone.setAnyType(null); + clone.setObjectClass(null); + send(pageRef.getPage(), Broadcast.DEPTH, new AjaxWizard.NewItemActionEvent<>(clone, target)); } }, ActionLink.ActionType.CLONE, StandardEntitlement.RESOURCE_CREATE). addAction(new ActionLink<ProvisionTO>() { @@ -143,8 +169,7 @@ public class ResourceModal<T extends Serializable> extends AbstractResourceModal @Override public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO) { model.getObject().getProvisions().remove(provisionTO); - send(pageRef.getPage(), Broadcast.DEPTH, - new AjaxWizard.NewItemFinishEvent<ProvisionTO>(null, target)); + send(pageRef.getPage(), Broadcast.DEPTH, new ListViewPanel.ListViewReload(target)); } }, ActionLink.ActionType.DELETE, StandardEntitlement.RESOURCE_DELETE); http://git-wip-us.apache.org/repos/asf/syncope/blob/3c19e351/client/console/src/main/java/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder.java index 7c763fb..9d71413 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder.java @@ -77,7 +77,7 @@ public class ProvisionWizardBuilder extends AjaxWizardBuilder<ProvisionTO> imple final List<String> res = new ArrayList<>(); CollectionUtils.filter(CollectionUtils.collect(new AnyTypeRestClient().list(), - EntityTOUtils.<String, AnyTypeTO>keyTransformer(), res), + EntityTOUtils.<String, AnyTypeTO>keyTransformer(), res), new Predicate<String>() { @Override @@ -242,7 +242,6 @@ public class ProvisionWizardBuilder extends AjaxWizardBuilder<ProvisionTO> imple @Override protected Serializable onApplyInternal(final ProvisionTO modelObject) { - this.resourceTO.getProvisions().add(modelObject); return modelObject; } } http://git-wip-us.apache.org/repos/asf/syncope/blob/3c19e351/client/console/src/main/resources/META-INF/resources/css/syncopeConsole.css ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/META-INF/resources/css/syncopeConsole.css b/client/console/src/main/resources/META-INF/resources/css/syncopeConsole.css index c3940eb..6aec71b 100644 --- a/client/console/src/main/resources/META-INF/resources/css/syncopeConsole.css +++ b/client/console/src/main/resources/META-INF/resources/css/syncopeConsole.css @@ -471,7 +471,7 @@ div.listview-actions a { } .btn-circle, .circular-actions a { - border-radius: 15px; + border-radius: 15px !important; font-size: 12px; height: 30px; line-height: 1.42857; http://git-wip-us.apache.org/repos/asf/syncope/blob/3c19e351/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceDetailsPanel.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceDetailsPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceDetailsPanel.html index 6adb0b9..3d7486b 100644 --- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceDetailsPanel.html +++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/ResourceDetailsPanel.html @@ -57,7 +57,7 @@ under the License. </div> <div class="form-group"> - <span wicket:id="syncTraceLevel">[syncTraceLevel]</span> + <span wicket:id="pullTraceLevel">[pullTraceLevel]</span> </div> </div> http://git-wip-us.apache.org/repos/asf/syncope/blob/3c19e351/fit/console-reference/src/test/resources/core-rebel.xml ---------------------------------------------------------------------- diff --git a/fit/console-reference/src/test/resources/core-rebel.xml b/fit/console-reference/src/test/resources/core-rebel.xml index 7709811..b025aa9 100644 --- a/fit/console-reference/src/test/resources/core-rebel.xml +++ b/fit/console-reference/src/test/resources/core-rebel.xml @@ -66,7 +66,7 @@ under the License. <web> <link target="/"> - <dir name="${basedir}/../fit/core-reference/src/main/webapp"> + <dir name="${basedir}/../core-reference/src/main/webapp"> </dir> </link> <link target="/"> http://git-wip-us.apache.org/repos/asf/syncope/blob/3c19e351/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java index c9f013b..04a2808 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/TopologyITCase.java @@ -60,6 +60,22 @@ public class TopologyITCase extends AbstractConsoleITCase { } @Test + public void editProvisioning() { + wicketTester.clickLink("body:topologyLI:topology"); + wicketTester.executeAjaxEvent("body:resources:8:resources:0:res", Constants.ON_CLICK); + wicketTester.clickLink("body:toggle:togglePanelContainer:container:actions:edit"); + + wicketTester.clickLink( + "body:toggle:outerObjectsRepeater:0:outer:form:content:tabbedPanel:tabs-container:tabs:1:link"); + + wicketTester.clickLink("body:toggle:outerObjectsRepeater:0:outer:form:content:tabbedPanel:panel:container:" + + "content:group:beans:0:actions:panelMapping:mappingLink"); + + wicketTester.assertComponent("body:toggle:outerObjectsRepeater:0:outer:form:content:tabbedPanel:panel:" + + "container:content:wizard:form:view:mapping:mappingContainer:mappings:1", WebMarkupContainer.class); + } + + @Test public void executePullTask() { wicketTester.clickLink("body:topologyLI:topology"); wicketTester.executeAjaxEvent("body:resources:2:resources:0:res", Constants.ON_CLICK);