[SYNCOPE-1104] Autocomplete implemented
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/4f6c1dac Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/4f6c1dac Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/4f6c1dac Branch: refs/heads/master Commit: 4f6c1dac9579ff8d697b609742821c310849ba85 Parents: 8ff366f Author: Francesco Chicchiriccò <ilgro...@apache.org> Authored: Mon Jun 12 17:50:27 2017 +0200 Committer: Francesco Chicchiriccò <ilgro...@apache.org> Committed: Mon Jun 12 17:50:47 2017 +0200 ---------------------------------------------------------------------- .../console/rest/ConnectorRestClient.java | 21 +++++++ .../console/topology/TopologyTogglePanel.java | 65 ++++++++++++++++++++ .../markup/html/form/BinaryFieldPanel.java | 6 ++ .../html/form/IndicatingOnConfirmAjaxLink.java | 7 +++ .../client/console/wizards/any/Ownership.java | 12 ++++ .../resources/ProvisionWizardBuilder.java | 11 ++-- .../ProvisionWizardBuilder$ObjectType.html | 3 +- ...ProvisionWizardBuilder$ObjectType.properties | 3 +- ...visionWizardBuilder$ObjectType_it.properties | 7 ++- ...ionWizardBuilder$ObjectType_pt_BR.properties | 3 +- ...visionWizardBuilder$ObjectType_ru.properties | 24 ++++++++ .../syncope/fit/console/TopologyITCase.java | 2 +- 12 files changed, 152 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6c1dac/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java index 7ac3fcc..7c5c982 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java @@ -24,8 +24,10 @@ import java.util.HashSet; import java.util.List; import java.util.Set; import javax.ws.rs.core.Response; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.IterableUtils; import org.apache.commons.collections4.Predicate; +import org.apache.commons.collections4.Transformer; import org.apache.commons.lang3.tuple.Pair; import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.common.lib.SyncopeClientException; @@ -64,6 +66,25 @@ public class ConnectorRestClient extends BaseRestClient { return getObject(service, response.getLocation(), ConnInstanceTO.class); } + public List<String> getObjectClasses(final String connectorKey) { + List<String> result = new ArrayList<>(); + + ConnectorService service = getService(ConnectorService.class); + ConnInstanceTO connInstance = service.read(connectorKey, SyncopeConsoleSession.get().getLocale().getLanguage()); + if (connInstance != null) { + CollectionUtils.collect(service.buildObjectClassInfo(connInstance, true), + new Transformer<ConnIdObjectClassTO, String>() { + + @Override + public String transform(final ConnIdObjectClassTO input) { + return input.getType(); + } + }, result); + } + + return result; + } + public List<String> getExtAttrNames( final String objectClass, final String connectorKey, final Set<ConnConfProperty> conf) { http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6c1dac/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyTogglePanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyTogglePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyTogglePanel.java index ddea8ea..505b295 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyTogglePanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyTogglePanel.java @@ -186,6 +186,11 @@ public class TopologyTogglePanel extends TogglePanel<Serializable> { schedTaskModal.header(new ResourceModel("task.custom.list")); schedTaskModal.show(true); } + + @Override + public String getAjaxIndicatorMarkupId() { + return Constants.VEIL_INDICATOR_MARKUP_ID; + } }; fragment.add(tasks); MetaDataRoleAuthorizationStrategy.authorize(tasks, RENDER, StandardEntitlement.TASK_LIST); @@ -218,6 +223,12 @@ public class TopologyTogglePanel extends TogglePanel<Serializable> { modal.show(true); } + + @Override + public String getAjaxIndicatorMarkupId() { + return Constants.VEIL_INDICATOR_MARKUP_ID; + } + }; fragment.add(create); MetaDataRoleAuthorizationStrategy.authorize(create, RENDER, StandardEntitlement.CONNECTOR_CREATE); @@ -273,6 +284,12 @@ public class TopologyTogglePanel extends TogglePanel<Serializable> { modal.show(true); } + + @Override + public String getAjaxIndicatorMarkupId() { + return Constants.VEIL_INDICATOR_MARKUP_ID; + } + }; MetaDataRoleAuthorizationStrategy.authorize(create, RENDER, StandardEntitlement.RESOURCE_CREATE); fragment.add(create); @@ -298,6 +315,12 @@ public class TopologyTogglePanel extends TogglePanel<Serializable> { modal.show(true); } + + @Override + public String getAjaxIndicatorMarkupId() { + return Constants.VEIL_INDICATOR_MARKUP_ID; + } + }; MetaDataRoleAuthorizationStrategy.authorize(edit, RENDER, StandardEntitlement.CONNECTOR_UPDATE); fragment.add(edit); @@ -351,6 +374,12 @@ public class TopologyTogglePanel extends TogglePanel<Serializable> { modal.show(true); } + + @Override + public String getAjaxIndicatorMarkupId() { + return Constants.VEIL_INDICATOR_MARKUP_ID; + } + }; MetaDataRoleAuthorizationStrategy.authorize(edit, RENDER, StandardEntitlement.RESOURCE_UPDATE); fragment.add(edit); @@ -368,6 +397,12 @@ public class TopologyTogglePanel extends TogglePanel<Serializable> { node.getKey()))); propTaskModal.show(true); } + + @Override + public String getAjaxIndicatorMarkupId() { + return Constants.VEIL_INDICATOR_MARKUP_ID; + } + }; MetaDataRoleAuthorizationStrategy.authorize(status, RENDER, StandardEntitlement.USER_UPDATE); fragment.add(status); @@ -392,6 +427,12 @@ public class TopologyTogglePanel extends TogglePanel<Serializable> { provisionModal.show(true); } + + @Override + public String getAjaxIndicatorMarkupId() { + return Constants.VEIL_INDICATOR_MARKUP_ID; + } + }; MetaDataRoleAuthorizationStrategy.authorize(edit, RENDER, StandardEntitlement.RESOURCE_UPDATE); fragment.add(provision); @@ -406,6 +447,12 @@ public class TopologyTogglePanel extends TogglePanel<Serializable> { propTaskModal.header(new StringResourceModel("resource.explore.list", Model.of(node))); propTaskModal.show(true); } + + @Override + public String getAjaxIndicatorMarkupId() { + return Constants.VEIL_INDICATOR_MARKUP_ID; + } + }; MetaDataRoleAuthorizationStrategy.authorize(explore, RENDER, StandardEntitlement.RESOURCE_LIST_CONNOBJECT); fragment.add(explore); @@ -423,6 +470,12 @@ public class TopologyTogglePanel extends TogglePanel<Serializable> { new Model<>(MessageFormat.format(getString("task.propagation.list"), node.getKey()))); propTaskModal.show(true); } + + @Override + public String getAjaxIndicatorMarkupId() { + return Constants.VEIL_INDICATOR_MARKUP_ID; + } + }; MetaDataRoleAuthorizationStrategy.authorize(propagation, RENDER, StandardEntitlement.TASK_LIST); fragment.add(propagation); @@ -437,6 +490,12 @@ public class TopologyTogglePanel extends TogglePanel<Serializable> { schedTaskModal.header(new Model<>(MessageFormat.format(getString("task.pull.list"), node.getKey()))); schedTaskModal.show(true); } + + @Override + public String getAjaxIndicatorMarkupId() { + return Constants.VEIL_INDICATOR_MARKUP_ID; + } + }; MetaDataRoleAuthorizationStrategy.authorize(pull, RENDER, StandardEntitlement.TASK_LIST); fragment.add(pull); @@ -451,6 +510,12 @@ public class TopologyTogglePanel extends TogglePanel<Serializable> { schedTaskModal.header(new Model<>(MessageFormat.format(getString("task.push.list"), node.getKey()))); schedTaskModal.show(true); } + + @Override + public String getAjaxIndicatorMarkupId() { + return Constants.VEIL_INDICATOR_MARKUP_ID; + } + }; MetaDataRoleAuthorizationStrategy.authorize(push, RENDER, StandardEntitlement.TASK_LIST); fragment.add(push); http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6c1dac/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java index f60ac2e..a871d30 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java @@ -208,6 +208,12 @@ public class BinaryFieldPanel extends FieldPanel<String> { uploadForm.addOrReplace(container); target.add(uploadForm); } + + @Override + public String getAjaxIndicatorMarkupId() { + return Constants.VEIL_INDICATOR_MARKUP_ID; + } + }; uploadForm.add(resetLink); } http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6c1dac/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/IndicatingOnConfirmAjaxLink.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/IndicatingOnConfirmAjaxLink.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/IndicatingOnConfirmAjaxLink.java index b610117..a005baf 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/IndicatingOnConfirmAjaxLink.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/IndicatingOnConfirmAjaxLink.java @@ -22,6 +22,7 @@ import static de.agilecoders.wicket.jquery.JQuery.$; import de.agilecoders.wicket.jquery.function.JavaScriptInlineFunction; import java.util.ArrayList; +import org.apache.syncope.client.console.commons.Constants; import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.head.JavaScriptHeaderItem; @@ -72,4 +73,10 @@ public abstract class IndicatingOnConfirmAjaxLink<T> extends IndicatingAjaxLink< )).asDomReadyScript()); } } + + @Override + public String getAjaxIndicatorMarkupId() { + return Constants.VEIL_INDICATOR_MARKUP_ID; + } + } http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6c1dac/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java index 494ac38..43051c6 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java @@ -250,6 +250,12 @@ public class Ownership extends WizardStep implements WizardModel.ICondition { send(Ownership.this, Broadcast.EXACT, new GroupSelectionDirectoryPanel.ItemSelection<GroupTO>(target, null)); } + + @Override + public String getAjaxIndicatorMarkupId() { + return Constants.VEIL_INDICATOR_MARKUP_ID; + } + }; userSearchFragment.add(userOwnerReset); @@ -298,6 +304,12 @@ public class Ownership extends WizardStep implements WizardModel.ICondition { send(Ownership.this, Broadcast.EXACT, new GroupSelectionDirectoryPanel.ItemSelection<GroupTO>(target, null)); } + + @Override + public String getAjaxIndicatorMarkupId() { + return Constants.VEIL_INDICATOR_MARKUP_ID; + } + }; groupSearchFragment.add(groupOwnerReset); } http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6c1dac/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java index 7045013..869b87d 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java @@ -30,6 +30,7 @@ import org.apache.syncope.client.console.commons.ConnIdSpecialName; import org.apache.syncope.client.console.commons.Constants; import org.apache.syncope.client.console.panels.ProvisionAuxClassesPanel; import org.apache.syncope.client.console.rest.AnyTypeRestClient; +import org.apache.syncope.client.console.rest.ConnectorRestClient; import org.apache.syncope.client.console.wicket.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior; import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel; @@ -47,8 +48,6 @@ import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.extensions.wizard.WizardModel; import org.apache.wicket.extensions.wizard.WizardStep; import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.form.FormComponent; -import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.model.LoadableDetachableModel; import org.apache.wicket.model.Model; import org.apache.wicket.model.PropertyModel; @@ -59,6 +58,8 @@ public class ProvisionWizardBuilder extends AjaxWizardBuilder<ProvisionTO> { private static final long serialVersionUID = 3739399543837732640L; + private final ConnectorRestClient connectorRestClient = new ConnectorRestClient(); + private final ResourceTO resourceTO; private final LoadableDetachableModel<List<String>> anyTypes = new LoadableDetachableModel<List<String>>() { @@ -115,8 +116,10 @@ public class ProvisionWizardBuilder extends AjaxWizardBuilder<ProvisionTO> { setRequired(true); container.add(type); - final FormComponent<String> clazz = new TextField<>( - "class", new PropertyModel<String>(item, "objectClass")).setRequired(true); + final AjaxTextFieldPanel clazz = new AjaxTextFieldPanel( + "clazz", "clazz", new PropertyModel<String>(item, "objectClass")); + clazz.setRequired(true); + clazz.setChoices(connectorRestClient.getObjectClasses(resourceTO.getConnector())); container.add(clazz); type.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6c1dac/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType.html b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType.html index 1b951d3..285b25a 100644 --- a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType.html +++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType.html @@ -23,8 +23,7 @@ under the License. <span wicket:id="type"/> </div> <div class="form-group"> - <label>Object Class</label> - <input type="text" placeholder="Object Class ..." class="form-control" wicket:id="class"> + <span wicket:id="clazz"/> </div> </div> </wicket:panel> http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6c1dac/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType.properties index b20d6ba..d981343 100644 --- a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType.properties +++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType.properties @@ -20,5 +20,6 @@ type.summary= type=Type type.Required=Type is required -class.Required=Object class is required +clazz=Object Class +clazz.Required=Object class is required http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6c1dac/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType_it.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType_it.properties index e29b214..87079bc 100644 --- a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType_it.properties +++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType_it.properties @@ -15,9 +15,10 @@ # specific language governing permissions and limitations # under the License. -type.title=Specify the type of the provisioning object +type.title=Specifica il tipo del provisioning type.summary= type=Type -type.Required=Type is required -class.Required=Object class is required +type.Required=Type \u00e8 richiesto +clazz=Object Class +clazz.Required=Object class \u00e8 richiesto http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6c1dac/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType_pt_BR.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType_pt_BR.properties index e29b214..9d4a687 100644 --- a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType_pt_BR.properties +++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType_pt_BR.properties @@ -20,4 +20,5 @@ type.summary= type=Type type.Required=Type is required -class.Required=Object class is required +clazz=Object Class +clazz.Required=Object class is required http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6c1dac/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType_ru.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType_ru.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType_ru.properties new file mode 100644 index 0000000..9d4a687 --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder$ObjectType_ru.properties @@ -0,0 +1,24 @@ +# 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. + +type.title=Specify the type of the provisioning object +type.summary= + +type=Type +type.Required=Type is required +clazz=Object Class +clazz.Required=Object class is required http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6c1dac/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 7082bbc..a4723c7 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 @@ -204,7 +204,7 @@ public class TopologyITCase extends AbstractConsoleITCase { "body:toggle:outerObjectsRepeater:3:outer:form:content:provision:container:content:wizard:form"); formTester.setValue("view:container:type:dropDownChoiceField", "0"); - formTester.setValue("view:container:class", "__ACCOUNT__"); + formTester.setValue("view:container:clazz:textField", "__ACCOUNT__"); formTester.submit("buttons:next"); TESTER.assertNoErrorMessage(); TESTER.assertNoInfoMessage();