http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/client/cli/src/main/java/org/apache/syncope/client/cli/view/Table.java ---------------------------------------------------------------------- diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/view/Table.java b/client/cli/src/main/java/org/apache/syncope/client/cli/view/Table.java index d0ce110..9264798 100644 --- a/client/cli/src/main/java/org/apache/syncope/client/cli/view/Table.java +++ b/client/cli/src/main/java/org/apache/syncope/client/cli/view/Table.java @@ -95,13 +95,13 @@ public final class Table { } } - for (final List<String> value : values) { + values.forEach(value -> { for (int j = 0; j < columnsSize.length; j++) { if (value.get(j) != null && value.get(j).length() > columnsSize[j]) { columnsSize[j] = value.get(j).length(); } } - } + }); } private void countTableWidth() { @@ -146,7 +146,7 @@ public final class Table { private void printeContent() { printColumnSpace(); - for (final List<String> value : values) { + values.forEach(value -> { for (int j = 0; j < columnsNumber; j++) { if (value.get(j) == null) { tmpValuesArray[j] = StringUtils.center("null", columnsSize[j]); @@ -155,7 +155,7 @@ public final class Table { } } System.out.format(tableContentFormat, tmpValuesArray); - } + }); printColumnSpace(); }
http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/client/cli/src/test/resources/log4j2.xml ---------------------------------------------------------------------- diff --git a/client/cli/src/test/resources/log4j2.xml b/client/cli/src/test/resources/log4j2.xml index 5eebd1a..b8da090 100644 --- a/client/cli/src/test/resources/log4j2.xml +++ b/client/cli/src/test/resources/log4j2.xml @@ -19,12 +19,19 @@ under the License. --> <configuration status="WARN" shutdownHook="disable"> <appenders> - <console name="main" target="SYSTEM_OUT"> + <RollingRandomAccessFile name="main" fileName="${log.directory}/cli-test.log" + filePattern="${log.directory}/cli-test-%d{yyyy-MM-dd}.log.gz" + immediateFlush="false" append="true"> <PatternLayout> <pattern>%d{HH:mm:ss.SSS} %-5level %logger - %msg%n</pattern> </PatternLayout> - </console> + <Policies> + <TimeBasedTriggeringPolicy/> + <SizeBasedTriggeringPolicy size="250 MB"/> + </Policies> + </RollingRandomAccessFile> </appenders> + <loggers> <root level="ERROR"> <appenderRef ref="main"/> http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java index d3063d4..9e9097a 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; import org.apache.commons.lang3.tuple.Pair; import org.apache.syncope.client.console.SyncopeConsoleSession; @@ -43,12 +44,14 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPa import org.apache.syncope.client.console.wicket.markup.html.form.MultiFieldPanel; import org.apache.syncope.client.console.wicket.markup.html.form.MultiPanel; import org.apache.syncope.client.console.wizards.AjaxWizardBuilder; +import org.apache.syncope.common.lib.info.JavaImplInfo; import org.apache.syncope.common.lib.to.DerSchemaTO; import org.apache.syncope.common.lib.to.EntityTO; import org.apache.syncope.common.lib.to.NotificationTO; import org.apache.syncope.common.lib.to.PlainSchemaTO; import org.apache.syncope.common.lib.to.VirSchemaTO; import org.apache.syncope.common.lib.types.AnyTypeKind; +import org.apache.syncope.common.lib.types.ImplementationType; import org.apache.syncope.common.lib.types.SchemaType; import org.apache.syncope.common.lib.types.TraceLevel; import org.apache.wicket.PageReference; @@ -329,8 +332,13 @@ public class NotificationWizardBuilder extends AjaxWizardBuilder<NotificationWra @Override protected List<String> load() { - return new ArrayList<>( - SyncopeConsoleSession.get().getPlatformInfo().getNotificationRecipientsProviders()); + Optional<JavaImplInfo> providers = SyncopeConsoleSession.get().getPlatformInfo(). + getJavaImplInfo(ImplementationType.RECIPIENTS_PROVIDER); + List<String> load = providers.isPresent() + ? new ArrayList<>(providers.get().getClasses()) + : new ArrayList<>(); + Collections.sort(load); + return load; } }; http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/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 795b8df..ceff741 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,6 +24,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; +import java.util.Optional; import org.apache.commons.lang3.StringUtils; import org.apache.syncope.client.console.SyncopeConsoleApplication; import org.apache.syncope.client.console.SyncopeConsoleSession; @@ -36,10 +37,12 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPan 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.info.JavaImplInfo; import org.apache.syncope.common.lib.to.AbstractSchemaTO; import org.apache.syncope.common.lib.to.PlainSchemaTO; import org.apache.syncope.common.lib.types.AttrSchemaType; import org.apache.syncope.common.lib.types.CipherAlgorithm; +import org.apache.syncope.common.lib.types.ImplementationType; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField; @@ -238,7 +241,13 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel { @Override protected List<String> load() { - return new ArrayList<>(SyncopeConsoleSession.get().getPlatformInfo().getValidators()); + Optional<JavaImplInfo> validators = SyncopeConsoleSession.get().getPlatformInfo(). + getJavaImplInfo(ImplementationType.VALIDATOR); + List<String> load = validators.isPresent() + ? new ArrayList<>(validators.get().getClasses()) + : new ArrayList<>(); + Collections.sort(load); + return load; } }; final AjaxDropDownChoicePanel<String> validatorClass = new AjaxDropDownChoicePanel<>("validatorClass", http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmDetails.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmDetails.java index ddd903a..0c7c3dc 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmDetails.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmDetails.java @@ -19,9 +19,10 @@ package org.apache.syncope.client.console.panels; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.stream.Collectors; import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.client.console.rest.PolicyRestClient; @@ -33,9 +34,10 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPa import org.apache.syncope.client.console.wicket.markup.html.form.FieldPanel; import org.apache.syncope.client.console.wicket.markup.html.form.PolicyRenderer; import org.apache.syncope.common.lib.SyncopeConstants; -import org.apache.syncope.common.lib.policy.AbstractPolicyTO; +import org.apache.syncope.common.lib.info.JavaImplInfo; import org.apache.syncope.common.lib.to.EntityTO; import org.apache.syncope.common.lib.to.RealmTO; +import org.apache.syncope.common.lib.types.ImplementationType; import org.apache.syncope.common.lib.types.PolicyType; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.form.DropDownChoice; @@ -63,11 +65,8 @@ public class RealmDetails extends Panel { @Override protected Map<String, String> load() { - Map<String, String> res = new LinkedHashMap<>(); - for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.ACCOUNT)) { - res.put(policyTO.getKey(), policyTO.getDescription()); - } - return res; + return policyRestClient.getPolicies(PolicyType.ACCOUNT).stream(). + collect(Collectors.toMap(policyTO -> policyTO.getKey(), policyTO -> policyTO.getDescription())); } }; @@ -77,11 +76,8 @@ public class RealmDetails extends Panel { @Override protected Map<String, String> load() { - Map<String, String> res = new LinkedHashMap<>(); - for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.PASSWORD)) { - res.put(policyTO.getKey(), policyTO.getDescription()); - } - return res; + return policyRestClient.getPolicies(PolicyType.PASSWORD).stream(). + collect(Collectors.toMap(policyTO -> policyTO.getKey(), policyTO -> policyTO.getDescription())); } }; @@ -91,7 +87,13 @@ public class RealmDetails extends Panel { @Override protected List<String> load() { - return new ArrayList<>(SyncopeConsoleSession.get().getPlatformInfo().getLogicActions()); + Optional<JavaImplInfo> actions = SyncopeConsoleSession.get().getPlatformInfo(). + getJavaImplInfo(ImplementationType.LOGIC_ACTIONS); + List<String> load = actions.isPresent() + ? new ArrayList<>(actions.get().getClasses()) + : new ArrayList<>(); + Collections.sort(load); + return load; } }; http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java index 6375bac..8b06630 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleDirectoryPanel.java @@ -24,7 +24,6 @@ import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; -import java.util.stream.Collectors; import org.apache.commons.lang3.SerializationUtils; import org.apache.commons.lang3.StringUtils; import org.apache.syncope.client.console.SyncopeConsoleSession; @@ -34,7 +33,6 @@ import org.apache.syncope.client.console.commons.SortableDataProviderComparator; import org.apache.syncope.client.console.pages.BasePage; import org.apache.syncope.client.console.panels.DirectoryPanel; import org.apache.syncope.client.console.panels.ModalPanel; -import org.apache.syncope.client.console.policies.PolicyRuleDirectoryPanel.PolicyRuleWrapper; import org.apache.syncope.client.console.rest.PolicyRestClient; import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal; import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink; @@ -44,12 +42,12 @@ import org.apache.syncope.client.console.wizards.AjaxWizard; import org.apache.syncope.common.lib.types.StandardEntitlement; import org.apache.syncope.common.lib.SyncopeClientException; import org.apache.syncope.common.lib.policy.AbstractPolicyTO; +import org.apache.syncope.common.lib.policy.ComposablePolicy; import org.apache.syncope.common.lib.policy.RuleConf; import org.apache.syncope.common.lib.types.PolicyType; 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.core.util.lang.PropertyResolver; import org.apache.wicket.event.Broadcast; import org.apache.wicket.event.IEvent; import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; @@ -134,7 +132,7 @@ public class PolicyRuleDirectoryPanel<T extends AbstractPolicyTO> extends Direct PolicyRuleDirectoryPanel.this.getTogglePanel().close(target); send(PolicyRuleDirectoryPanel.this, Broadcast.EXACT, new AjaxWizard.EditItemActionEvent<>( - new PolicyRuleWrapper().setConf(clone), + new PolicyRuleWrapper().setConf(clone).setName(null), target)); } }, ActionLink.ActionType.CLONE, StandardEntitlement.POLICY_CREATE); @@ -155,15 +153,16 @@ public class PolicyRuleDirectoryPanel<T extends AbstractPolicyTO> extends Direct @Override public void onClick(final AjaxRequestTarget target, final PolicyRuleWrapper ignore) { - final RuleConf rule = model.getObject().getConf(); + RuleConf rule = model.getObject().getConf(); try { - final T actual = restClient.getPolicy(policy); - List<RuleConf> conf = getRuleConf(actual); - conf.removeAll(conf.stream(). - filter(object -> object.getName().equals(rule.getName())).collect(Collectors.toList())); - restClient.updatePolicy(actual); - SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED)); - customActionOnFinishCallback(target); + T actual = restClient.getPolicy(policy); + if (actual instanceof ComposablePolicy) { + ((ComposablePolicy) actual).getRules().remove(model.getObject().getImplementationKey()); + restClient.updatePolicy(actual); + + SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED)); + customActionOnFinishCallback(target); + } } catch (SyncopeClientException e) { LOG.error("While deleting {}", rule.getName(), e); SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) @@ -220,7 +219,7 @@ public class PolicyRuleDirectoryPanel<T extends AbstractPolicyTO> extends Direct public PolicyRuleDataProvider(final int paginatorRows) { super(paginatorRows); - //Default sorting + // Default sorting setSort("name", SortOrder.ASCENDING); comparator = new SortableDataProviderComparator<>(this); } @@ -229,9 +228,7 @@ public class PolicyRuleDirectoryPanel<T extends AbstractPolicyTO> extends Direct public Iterator<PolicyRuleWrapper> iterator(final long first, final long count) { final T actual = restClient.getPolicy(policy); - final List<PolicyRuleWrapper> rules = getRuleConf(actual).stream().map(input - -> new PolicyRuleWrapper(input.getName()).setName(input.getName()).setConf(input)). - collect(Collectors.toList()); + List<PolicyRuleWrapper> rules = PolicyRuleWizardBuilder.getPolicyRuleWrappers(actual); Collections.sort(rules, comparator); return rules.subList((int) first, (int) (first + count)).iterator(); @@ -240,7 +237,7 @@ public class PolicyRuleDirectoryPanel<T extends AbstractPolicyTO> extends Direct @Override public long size() { final T actual = restClient.getPolicy(policy); - return getRuleConf(actual).size(); + return PolicyRuleWizardBuilder.getPolicyRuleWrappers(actual).size(); } @Override @@ -249,61 +246,6 @@ public class PolicyRuleDirectoryPanel<T extends AbstractPolicyTO> extends Direct } } - @SuppressWarnings("unchecked") - private List<RuleConf> getRuleConf(final T policyTO) { - Object res = PropertyResolver.getValue("ruleConfs", policyTO); - if (res instanceof List) { - return (List<RuleConf>) res; - } else { - return null; - } - } - - public static class PolicyRuleWrapper implements Serializable { - - private static final long serialVersionUID = 2472755929742424558L; - - private String oldname; - - private String name; - - private RuleConf conf; - - public PolicyRuleWrapper() { - this(null); - } - - public PolicyRuleWrapper(final String name) { - this.oldname = name; - } - - public boolean isNew() { - return oldname == null; - } - - public String getOldName() { - return this.oldname; - } - - public String getName() { - return this.name; - } - - public PolicyRuleWrapper setName(final String name) { - this.name = name; - return this; - } - - public RuleConf getConf() { - return conf; - } - - public PolicyRuleWrapper setConf(final RuleConf conf) { - this.conf = conf; - return this; - } - } - @Override public void onEvent(final IEvent<?> event) { super.onEvent(event); http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java index b9a36a9..261604b 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWizardBuilder.java @@ -18,34 +18,70 @@ */ package org.apache.syncope.client.console.policies; +import com.fasterxml.jackson.databind.ObjectMapper; import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.client.console.panels.BeanPanel; +import org.apache.syncope.client.console.rest.ImplementationRestClient; import org.apache.syncope.client.console.rest.PolicyRestClient; 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.wizards.AjaxWizardBuilder; +import org.apache.syncope.common.lib.info.JavaImplInfo; import org.apache.syncope.common.lib.policy.AbstractPolicyTO; +import org.apache.syncope.common.lib.policy.AccountPolicyTO; import org.apache.syncope.common.lib.policy.ComposablePolicy; import org.apache.syncope.common.lib.policy.RuleConf; +import org.apache.syncope.common.lib.to.ImplementationTO; +import org.apache.syncope.common.lib.types.ImplementationEngine; +import org.apache.syncope.common.lib.types.ImplementationType; import org.apache.syncope.common.lib.types.PolicyType; import org.apache.wicket.PageReference; +import org.apache.wicket.core.util.lang.PropertyResolver; import org.apache.wicket.extensions.wizard.WizardModel; import org.apache.wicket.extensions.wizard.WizardStep; import org.apache.wicket.model.LoadableDetachableModel; import org.apache.wicket.model.PropertyModel; -import org.springframework.beans.BeanWrapper; -import org.springframework.beans.PropertyAccessorFactory; -public class PolicyRuleWizardBuilder - extends AjaxWizardBuilder<PolicyRuleDirectoryPanel.PolicyRuleWrapper> { +public class PolicyRuleWizardBuilder extends AjaxWizardBuilder<PolicyRuleWrapper> { private static final long serialVersionUID = 5945391813567245081L; + private static final ObjectMapper MAPPER = new ObjectMapper(); + + private static final ImplementationRestClient IMPLEMENTATION_CLIENT = new ImplementationRestClient(); + + @SuppressWarnings("unchecked") + public static List<PolicyRuleWrapper> getPolicyRuleWrappers(final AbstractPolicyTO policyTO) { + Object rules = PropertyResolver.getValue("rules", policyTO); + if (rules instanceof List) { + return ((List<String>) rules).stream().map(rule -> { + ImplementationTO implementation = IMPLEMENTATION_CLIENT.read(rule); + + PolicyRuleWrapper wrapper = null; + if (implementation.getEngine() == ImplementationEngine.JAVA) { + try { + RuleConf ruleConf = MAPPER.readValue(implementation.getBody(), RuleConf.class); + wrapper = new PolicyRuleWrapper(). + setImplementationKey(implementation.getKey()). + setName(ruleConf.getName()); + } catch (Exception e) { + LOG.error("During deserialization", e); + } + } + + return wrapper; + }).filter(wrapper -> wrapper != null).collect(Collectors.toList()); + } else { + return null; + } + } + private final PolicyRestClient restClient = new PolicyRestClient(); private final String policy; @@ -55,7 +91,7 @@ public class PolicyRuleWizardBuilder public PolicyRuleWizardBuilder( final String policy, final PolicyType type, - final PolicyRuleDirectoryPanel.PolicyRuleWrapper reportlet, + final PolicyRuleWrapper reportlet, final PageReference pageRef) { super(reportlet, pageRef); this.policy = policy; @@ -63,34 +99,45 @@ public class PolicyRuleWizardBuilder } @Override - protected Serializable onApplyInternal(final PolicyRuleDirectoryPanel.PolicyRuleWrapper modelObject) { - BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(modelObject.getConf()); - wrapper.setPropertyValue("name", modelObject.getName()); - + protected Serializable onApplyInternal(final PolicyRuleWrapper modelObject) { AbstractPolicyTO policyTO = restClient.getPolicy(policy); - final ComposablePolicy<RuleConf> composable; + ComposablePolicy composable; if (policyTO instanceof ComposablePolicy) { - composable = (ComposablePolicy<RuleConf>) policyTO; + composable = (ComposablePolicy) policyTO; } else { throw new IllegalStateException("Non composable policy"); } - if (modelObject.isNew()) { - composable.getRuleConfs().add(modelObject.getConf()); - } else { - composable.getRuleConfs().removeAll(composable.getRuleConfs().stream(). - filter(conf -> conf.getName().equals(modelObject.getOldName())).collect(Collectors.toList())); - composable.getRuleConfs().add(modelObject.getConf()); + ImplementationTO rule = new ImplementationTO(); + rule.setKey(modelObject.getName()); + rule.setEngine(ImplementationEngine.JAVA); + rule.setType(composable instanceof AccountPolicyTO + ? ImplementationType.ACCOUNT_RULE : ImplementationType.PASSWORD_RULE); + try { + rule.setBody(MAPPER.writeValueAsString(modelObject.getConf())); + + rule = IMPLEMENTATION_CLIENT.create(rule); + } catch (Exception e) { + throw new IllegalStateException("Could not create rule", e); + } + + if (!modelObject.isNew()) { + List<PolicyRuleWrapper> wrappers = getPolicyRuleWrappers(policyTO); + wrappers.removeAll(wrappers.stream(). + filter(wrapper -> wrapper.getName().equals(modelObject.getOldName())).collect(Collectors.toSet())); + composable.getRules().clear(); + composable.getRules().addAll(wrappers.stream(). + map(PolicyRuleWrapper::getImplementationKey).collect(Collectors.toSet())); } + composable.getRules().add(rule.getKey()); restClient.updatePolicy(policyTO); return modelObject; } @Override - protected WizardModel buildModelSteps( - final PolicyRuleDirectoryPanel.PolicyRuleWrapper modelObject, final WizardModel wizardModel) { + protected WizardModel buildModelSteps(final PolicyRuleWrapper modelObject, final WizardModel wizardModel) { wizardModel.add(new Profile(modelObject)); wizardModel.add(new Configuration(modelObject)); return wizardModel; @@ -100,8 +147,7 @@ public class PolicyRuleWizardBuilder private static final long serialVersionUID = -3043839139187792810L; - public Profile(final PolicyRuleDirectoryPanel.PolicyRuleWrapper rule) { - + public Profile(final PolicyRuleWrapper rule) { final AjaxTextFieldPanel name = new AjaxTextFieldPanel( "name", "rule", new PropertyModel<>(rule, "name"), false); name.addRequiredLabel(); @@ -131,14 +177,23 @@ public class PolicyRuleWizardBuilder } }); + Optional<JavaImplInfo> providers; List<String> choices; switch (type) { case ACCOUNT: - choices = new ArrayList<>(SyncopeConsoleSession.get().getPlatformInfo().getAccountRules()); + providers = SyncopeConsoleSession.get().getPlatformInfo(). + getJavaImplInfo(ImplementationType.ACCOUNT_RULE); + choices = providers.isPresent() + ? new ArrayList<>(providers.get().getClasses()) + : new ArrayList<>(); break; case PASSWORD: - choices = new ArrayList<>(SyncopeConsoleSession.get().getPlatformInfo().getPasswordRules()); + providers = SyncopeConsoleSession.get().getPlatformInfo(). + getJavaImplInfo(ImplementationType.PASSWORD_RULE); + choices = providers.isPresent() + ? new ArrayList<>(providers.get().getClasses()) + : new ArrayList<>(); break; default: @@ -159,7 +214,7 @@ public class PolicyRuleWizardBuilder private final LoadableDetachableModel<Serializable> bean; - public Configuration(final PolicyRuleDirectoryPanel.PolicyRuleWrapper rule) { + public Configuration(final PolicyRuleWrapper rule) { bean = new LoadableDetachableModel<Serializable>() { private static final long serialVersionUID = 2092144708018739371L; http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWrapper.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWrapper.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWrapper.java new file mode 100644 index 0000000..b05eabc --- /dev/null +++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicyRuleWrapper.java @@ -0,0 +1,70 @@ +/* + * 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.policies; + +import java.io.Serializable; +import org.apache.syncope.common.lib.policy.RuleConf; + +public class PolicyRuleWrapper implements Serializable { + + private static final long serialVersionUID = 2472755929742424558L; + + private String implementationKey; + + private String oldname; + + private String name; + + private RuleConf conf; + + public String getImplementationKey() { + return implementationKey; + } + + public boolean isNew() { + return oldname == null; + } + + public String getOldName() { + return this.oldname; + } + + public String getName() { + return this.name; + } + + public PolicyRuleWrapper setImplementationKey(final String implementationKey) { + this.implementationKey = implementationKey; + return this; + } + + public PolicyRuleWrapper setName(final String name) { + this.name = name; + return this; + } + + public RuleConf getConf() { + return conf; + } + + public PolicyRuleWrapper setConf(final RuleConf conf) { + this.conf = conf; + return this; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicySpecModalPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicySpecModalPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicySpecModalPanel.java index 4eaecb1..7cee8ab 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicySpecModalPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/policies/PolicySpecModalPanel.java @@ -26,6 +26,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; import org.apache.syncope.client.console.SyncopeConsoleSession; @@ -40,10 +41,12 @@ import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.Bas import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPalettePanel; import org.apache.syncope.client.console.wicket.markup.html.form.MultiPanel; +import org.apache.syncope.common.lib.info.JavaImplInfo; import org.apache.syncope.common.lib.policy.PullPolicyTO; import org.apache.syncope.common.lib.to.EntityTO; import org.apache.syncope.common.lib.types.AnyTypeKind; import org.apache.syncope.common.lib.types.ConflictResolutionAction; +import org.apache.syncope.common.lib.types.ImplementationType; import org.apache.syncope.common.lib.types.SchemaType; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; @@ -96,11 +99,10 @@ public class PolicySpecModalPanel extends AbstractModalPanel<PullPolicyTO> { @Override public void setObject(final List<CorrelationRule> object) { policyTO.getSpecification().getCorrelationRules().clear(); - for (CorrelationRule rule : rules) { + rules.forEach(rule -> { policyTO.getSpecification().getCorrelationRules().put(rule.getAny(), rule.getRule()); - } + }); } - }; add(new MultiPanel<CorrelationRule>("correlationRules", "correlationRules", model) { @@ -159,9 +161,14 @@ public class PolicySpecModalPanel extends AbstractModalPanel<PullPolicyTO> { // --------------------------------------------------------------- // Java rule palette // --------------------------------------------------------------- + Optional<JavaImplInfo> pullCorrelationRules = SyncopeConsoleSession.get().getPlatformInfo(). + getJavaImplInfo(ImplementationType.PULL_CORRELATION_RULE); + List<String> load = pullCorrelationRules.isPresent() + ? new ArrayList<>(pullCorrelationRules.get().getClasses()) + : new ArrayList<>(); + Collections.sort(load); final AjaxDropDownChoicePanel<String> javaRule = new AjaxDropDownChoicePanel<>( - "javaRule", "rule.java", new PropertyModel<String>(rule.getObject(), "rule")).setChoices( - new ArrayList<>(SyncopeConsoleSession.get().getPlatformInfo().getPullCorrelationRules())); + "javaRule", "rule.java", new PropertyModel<String>(rule.getObject(), "rule")).setChoices(load); javaRule.setOutputMarkupPlaceholderTag(true); add(javaRule.setVisible("JAVA".equals(rule.getObject().getType()))); // --------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletDirectoryPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletDirectoryPanel.java index 7a2b4ed..721ab0e 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletDirectoryPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletDirectoryPanel.java @@ -22,14 +22,10 @@ import java.io.Serializable; import java.util.ArrayList; 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 java.util.stream.Collectors; import org.apache.commons.lang3.SerializationUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.Pair; import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.client.console.commons.Constants; import org.apache.syncope.client.console.commons.DirectoryDataProvider; @@ -37,8 +33,6 @@ import org.apache.syncope.client.console.commons.SortableDataProviderComparator; import org.apache.syncope.client.console.pages.BasePage; import org.apache.syncope.client.console.panels.DirectoryPanel; import org.apache.syncope.client.console.panels.ModalPanel; -import org.apache.syncope.client.console.panels.search.SearchClause; -import org.apache.syncope.client.console.reports.ReportletDirectoryPanel.ReportletWrapper; import org.apache.syncope.client.console.rest.ReportRestClient; import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal; import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink; @@ -47,9 +41,7 @@ import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel; import org.apache.syncope.client.console.wizards.AjaxWizard; import org.apache.syncope.common.lib.types.StandardEntitlement; import org.apache.syncope.common.lib.SyncopeClientException; -import org.apache.syncope.common.lib.report.AbstractReportletConf; import org.apache.syncope.common.lib.report.ReportletConf; -import org.apache.syncope.common.lib.search.AbstractFiqlSearchConditionBuilder; import org.apache.syncope.common.lib.to.ReportTO; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; @@ -134,12 +126,11 @@ public class ReportletDirectoryPanel extends DirectoryPanel< @Override public void onClick(final AjaxRequestTarget target, final ReportletWrapper ignore) { ReportletDirectoryPanel.this.getTogglePanel().close(target); - AbstractReportletConf clone = SerializationUtils.clone(model.getObject().getConf()); - clone.setName(null); + ReportletConf clone = SerializationUtils.clone(model.getObject().getConf()); send(ReportletDirectoryPanel.this, Broadcast.EXACT, new AjaxWizard.EditItemActionEvent<>( - new ReportletWrapper().setConf(clone), + new ReportletWrapper().setConf(clone).setName(null), target)); } }, ActionLink.ActionType.CLONE, StandardEntitlement.REPORT_CREATE); @@ -163,9 +154,9 @@ public class ReportletDirectoryPanel extends DirectoryPanel< final ReportletConf reportlet = model.getObject().getConf(); try { final ReportTO actual = restClient.read(report); - actual.getReportletConfs().removeAll(actual.getReportletConfs().stream(). - filter(conf -> conf.getName().equals(reportlet.getName())).collect(Collectors.toList())); + actual.getReportlets().remove(model.getObject().getImplementationKey()); restClient.update(actual); + SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED)); customActionOnFinishCallback(target); } catch (SyncopeClientException e) { @@ -233,9 +224,7 @@ public class ReportletDirectoryPanel extends DirectoryPanel< public Iterator<ReportletWrapper> iterator(final long first, final long count) { final ReportTO actual = restClient.read(report); - final List<ReportletWrapper> reportlets = actual.getReportletConfs().stream(). - map(conf -> new ReportletWrapper(conf.getName()).setName(conf.getName()).setConf(conf)). - collect(Collectors.toList()); + List<ReportletWrapper> reportlets = ReportletWizardBuilder.getReportletWrappers(actual); Collections.sort(reportlets, comparator); return reportlets.subList((int) first, (int) (first + count)).iterator(); @@ -244,7 +233,7 @@ public class ReportletDirectoryPanel extends DirectoryPanel< @Override public long size() { final ReportTO actual = restClient.read(report); - return actual.getReportletConfs().size(); + return ReportletWizardBuilder.getReportletWrappers(actual).size(); } @Override @@ -253,58 +242,6 @@ public class ReportletDirectoryPanel extends DirectoryPanel< } } - public static class ReportletWrapper implements Serializable { - - private static final long serialVersionUID = 2472755929742424558L; - - private String oldname; - - private String name; - - private AbstractReportletConf conf; - - private final Map<String, Pair<AbstractFiqlSearchConditionBuilder, List<SearchClause>>> scondWrapper; - - public ReportletWrapper() { - this(null); - } - - public ReportletWrapper(final String name) { - this.oldname = name; - this.scondWrapper = new HashMap<>(); - } - - public boolean isNew() { - return oldname == null; - } - - public String getOldName() { - return this.oldname; - } - - public String getName() { - return this.name; - } - - public ReportletWrapper setName(final String name) { - this.name = name; - return this; - } - - public AbstractReportletConf getConf() { - return conf; - } - - public ReportletWrapper setConf(final AbstractReportletConf conf) { - this.conf = conf; - return this; - } - - public Map<String, Pair<AbstractFiqlSearchConditionBuilder, List<SearchClause>>> getSCondWrapper() { - return scondWrapper; - } - } - @Override public void onEvent(final IEvent<?> event) { super.onEvent(event); http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletWizardBuilder.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletWizardBuilder.java index cf69215..0355ce6 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletWizardBuilder.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletWizardBuilder.java @@ -18,63 +18,96 @@ */ package org.apache.syncope.client.console.reports; +import com.fasterxml.jackson.databind.ObjectMapper; import java.io.Serializable; import java.util.ArrayList; +import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.client.console.panels.BeanPanel; -import org.apache.syncope.client.console.panels.search.SearchUtils; +import org.apache.syncope.client.console.rest.ImplementationRestClient; import org.apache.syncope.client.console.rest.ReportRestClient; 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.wizards.AjaxWizardBuilder; +import org.apache.syncope.common.lib.info.JavaImplInfo; import org.apache.syncope.common.lib.report.AbstractReportletConf; +import org.apache.syncope.common.lib.report.ReportletConf; +import org.apache.syncope.common.lib.to.ImplementationTO; import org.apache.syncope.common.lib.to.ReportTO; +import org.apache.syncope.common.lib.types.ImplementationEngine; +import org.apache.syncope.common.lib.types.ImplementationType; import org.apache.wicket.PageReference; import org.apache.wicket.extensions.wizard.WizardModel; import org.apache.wicket.extensions.wizard.WizardStep; import org.apache.wicket.model.PropertyModel; -import org.springframework.beans.BeanWrapper; -import org.springframework.beans.PropertyAccessorFactory; import org.apache.wicket.model.LoadableDetachableModel; -public class ReportletWizardBuilder extends AjaxWizardBuilder<ReportletDirectoryPanel.ReportletWrapper> { +public class ReportletWizardBuilder extends AjaxWizardBuilder<ReportletWrapper> { private static final long serialVersionUID = 5945391813567245081L; + private static final ObjectMapper MAPPER = new ObjectMapper(); + + private static final ImplementationRestClient IMPLEMENTATION_CLIENT = new ImplementationRestClient(); + + public static List<ReportletWrapper> getReportletWrappers(final ReportTO reportTO) { + return reportTO.getReportlets().stream().map(reportlet -> { + ImplementationTO implementation = IMPLEMENTATION_CLIENT.read(reportlet); + + ReportletWrapper wrapper = null; + if (implementation.getEngine() == ImplementationEngine.JAVA) { + try { + ReportletConf reportletCOnf = MAPPER.readValue(implementation.getBody(), ReportletConf.class); + wrapper = new ReportletWrapper(). + setImplementationKey(implementation.getKey()). + setName(reportletCOnf.getName()); + } catch (Exception e) { + LOG.error("During deserialization", e); + } + } + + return wrapper; + }).filter(wrapper -> wrapper != null).collect(Collectors.toList()); + } + private final ReportRestClient restClient = new ReportRestClient(); private final String report; public ReportletWizardBuilder( final String report, - final ReportletDirectoryPanel.ReportletWrapper reportlet, + final ReportletWrapper reportlet, final PageReference pageRef) { super(reportlet, pageRef); this.report = report; } @Override - protected Serializable onApplyInternal(final ReportletDirectoryPanel.ReportletWrapper modelObject) { - modelObject.getConf().setName(modelObject.getName()); - - final ReportTO reportTO = restClient.read(report); - - if (modelObject.isNew()) { - reportTO.getReportletConfs().add(modelObject.getConf()); - } else { - reportTO.getReportletConfs().removeAll( - reportTO.getReportletConfs().stream(). - filter(object -> object.getName().equals(modelObject.getOldName())). - collect(Collectors.toList())); - reportTO.getReportletConfs().add(modelObject.getConf()); + protected Serializable onApplyInternal(final ReportletWrapper modelObject) { + ImplementationTO reportlet = new ImplementationTO(); + reportlet.setKey(modelObject.getName()); + reportlet.setEngine(ImplementationEngine.JAVA); + reportlet.setType(ImplementationType.REPORTLET); + try { + reportlet.setBody(MAPPER.writeValueAsString(modelObject.getConf())); + + reportlet = IMPLEMENTATION_CLIENT.create(reportlet); + } catch (Exception e) { + throw new IllegalStateException("Could not create reportlet", e); } - BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(modelObject.getConf()); - modelObject.getSCondWrapper().entrySet().forEach(entry -> { - wrapper.setPropertyValue(entry.getKey(), - SearchUtils.buildFIQL(entry.getValue().getRight(), entry.getValue().getLeft())); - }); + ReportTO reportTO = restClient.read(report); + if (!modelObject.isNew()) { + List<ReportletWrapper> wrappers = getReportletWrappers(reportTO); + wrappers.removeAll(wrappers.stream(). + filter(wrapper -> wrapper.getName().equals(modelObject.getOldName())).collect(Collectors.toSet())); + reportTO.getReportlets().clear(); + reportTO.getReportlets().addAll(wrappers.stream(). + map(ReportletWrapper::getImplementationKey).collect(Collectors.toSet())); + } + reportTO.getReportlets().add(reportlet.getKey()); restClient.update(reportTO); return modelObject; @@ -82,7 +115,7 @@ public class ReportletWizardBuilder extends AjaxWizardBuilder<ReportletDirectory @Override protected WizardModel buildModelSteps( - final ReportletDirectoryPanel.ReportletWrapper modelObject, final WizardModel wizardModel) { + final ReportletWrapper modelObject, final WizardModel wizardModel) { wizardModel.add(new Profile(modelObject)); wizardModel.add(new Configuration(modelObject)); return wizardModel; @@ -92,7 +125,7 @@ public class ReportletWizardBuilder extends AjaxWizardBuilder<ReportletDirectory private static final long serialVersionUID = -3043839139187792810L; - public Profile(final ReportletDirectoryPanel.ReportletWrapper reportlet) { + public Profile(final ReportletWrapper reportlet) { final AjaxTextFieldPanel name = new AjaxTextFieldPanel( "name", "reportlet", new PropertyModel<>(reportlet, "name"), false); @@ -124,7 +157,12 @@ public class ReportletWizardBuilder extends AjaxWizardBuilder<ReportletDirectory } }); - conf.setChoices(new ArrayList<>(SyncopeConsoleSession.get().getPlatformInfo().getReportletConfs())); + Optional<JavaImplInfo> reportlets = SyncopeConsoleSession.get().getPlatformInfo(). + getJavaImplInfo(ImplementationType.REPORTLET); + List<String> choices = reportlets.isPresent() + ? new ArrayList<>(reportlets.get().getClasses()) + : new ArrayList<>(); + conf.setChoices(choices); conf.addRequiredLabel(); add(conf); @@ -135,7 +173,7 @@ public class ReportletWizardBuilder extends AjaxWizardBuilder<ReportletDirectory private static final long serialVersionUID = -785981096328637758L; - public Configuration(final ReportletDirectoryPanel.ReportletWrapper reportlet) { + public Configuration(final ReportletWrapper reportlet) { final LoadableDetachableModel<Serializable> bean = new LoadableDetachableModel<Serializable>() { private static final long serialVersionUID = 2092144708018739371L; http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletWrapper.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletWrapper.java b/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletWrapper.java new file mode 100644 index 0000000..d6d1d77 --- /dev/null +++ b/client/console/src/main/java/org/apache/syncope/client/console/reports/ReportletWrapper.java @@ -0,0 +1,91 @@ +/* + * 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.reports; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.syncope.client.console.panels.search.SearchClause; +import org.apache.syncope.common.lib.report.ReportletConf; +import org.apache.syncope.common.lib.search.AbstractFiqlSearchConditionBuilder; + +public class ReportletWrapper implements Serializable { + + private static final long serialVersionUID = 2472755929742424558L; + + private String implementationKey; + + private String oldname; + + private String name; + + private ReportletConf conf; + + private final Map<String, Pair<AbstractFiqlSearchConditionBuilder, List<SearchClause>>> scondWrapper; + + public ReportletWrapper() { + this(null); + } + + public ReportletWrapper(final String name) { + this.oldname = name; + this.scondWrapper = new HashMap<>(); + } + + public String getImplementationKey() { + return implementationKey; + } + + public ReportletWrapper setImplementationKey(final String implementationKey) { + this.implementationKey = implementationKey; + return this; + } + + public boolean isNew() { + return oldname == null; + } + + public String getOldName() { + return this.oldname; + } + + public String getName() { + return this.name; + } + + public ReportletWrapper setName(final String name) { + this.name = name; + return this; + } + + public ReportletConf getConf() { + return conf; + } + + public ReportletWrapper setConf(final ReportletConf conf) { + this.conf = conf; + return this; + } + + public Map<String, Pair<AbstractFiqlSearchConditionBuilder, List<SearchClause>>> getSCondWrapper() { + return scondWrapper; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/client/console/src/main/java/org/apache/syncope/client/console/rest/ImplementationRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ImplementationRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ImplementationRestClient.java new file mode 100644 index 0000000..2de2a54 --- /dev/null +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ImplementationRestClient.java @@ -0,0 +1,41 @@ +/* + * 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.rest; + +import static org.apache.syncope.client.console.rest.BaseRestClient.getObject; +import static org.apache.syncope.client.console.rest.BaseRestClient.getService; + +import javax.ws.rs.core.Response; +import org.apache.syncope.common.lib.to.ImplementationTO; +import org.apache.syncope.common.rest.api.service.ImplementationService; + +public class ImplementationRestClient extends BaseRestClient { + + private static final long serialVersionUID = -4111950555473526287L; + + public ImplementationTO read(final String key) { + return getService(ImplementationService.class).read(key); + } + + public ImplementationTO create(final ImplementationTO implementation) { + ImplementationService service = getService(ImplementationService.class); + Response response = service.create(implementation); + return getObject(service, response.getLocation(), ImplementationTO.class); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskDirectoryPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskDirectoryPanel.java index 069e34b..a2c48fd 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskDirectoryPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskDirectoryPanel.java @@ -72,9 +72,6 @@ public abstract class SchedTaskDirectoryPanel<T extends SchedTaskTO> private static final long serialVersionUID = 4984337552918213290L; - private static final String GROUP_MEMBER_PROVISION_TASKJOB = - "org.apache.syncope.core.provisioning.java.job.GroupMemberProvisionTaskJobDelegate"; - protected final Class<T> reference; protected T schedTaskTO; @@ -213,11 +210,6 @@ public abstract class SchedTaskDirectoryPanel<T extends SchedTaskTO> Model.of(Pair.of( ActionLink.ActionType.EDIT, model.getObject()))))); } - - @Override - protected boolean statusCondition(final T modelObject) { - return !GROUP_MEMBER_PROVISION_TASKJOB.equals(taskTO.getJobDelegateClassName()); - } }, ActionLink.ActionType.EDIT, StandardEntitlement.TASK_UPDATE); panel.add(new ActionLink<T>() { @@ -249,11 +241,6 @@ public abstract class SchedTaskDirectoryPanel<T extends SchedTaskTO> model.getObject().getKey(), model.getObject().getName(), target); startAt.toggle(target, true); } - - @Override - protected boolean statusCondition(final T modelObject) { - return !GROUP_MEMBER_PROVISION_TASKJOB.equals(taskTO.getJobDelegateClassName()); - } }, ActionLink.ActionType.EXECUTE, StandardEntitlement.TASK_EXECUTE); addFurtherActions(panel, model); http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java index 368b419..b940cf1 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.client.console.commons.Constants; @@ -34,11 +35,13 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownCho 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.client.console.wizards.AjaxWizardBuilder; +import org.apache.syncope.common.lib.info.JavaImplInfo; import org.apache.syncope.common.lib.to.AbstractProvisioningTaskTO; import org.apache.syncope.common.lib.to.SchedTaskTO; import org.apache.syncope.common.lib.to.PullTaskTO; import org.apache.syncope.common.lib.to.PushTaskTO; import org.apache.syncope.common.lib.to.RealmTO; +import org.apache.syncope.common.lib.types.ImplementationType; import org.apache.syncope.common.lib.types.MatchingRule; import org.apache.syncope.common.lib.types.PullMode; import org.apache.syncope.common.lib.types.UnmatchingRule; @@ -116,7 +119,13 @@ public class SchedTaskWizardBuilder<T extends SchedTaskTO> extends AjaxWizardBui @Override protected List<String> load() { - return new ArrayList<>(SyncopeConsoleSession.get().getPlatformInfo().getTaskJobs()); + Optional<JavaImplInfo> taskJobDelegates = SyncopeConsoleSession.get().getPlatformInfo(). + getJavaImplInfo(ImplementationType.TASKJOB_DELEGATE); + List<String> load = taskJobDelegates.isPresent() + ? new ArrayList<>(taskJobDelegates.get().getClasses()) + : new ArrayList<>(); + Collections.sort(load); + return load; } }; @@ -127,7 +136,13 @@ public class SchedTaskWizardBuilder<T extends SchedTaskTO> extends AjaxWizardBui @Override protected List<String> load() { - return new ArrayList<>(SyncopeConsoleSession.get().getPlatformInfo().getReconciliationFilterBuilders()); + Optional<JavaImplInfo> reconFilterBuilders = SyncopeConsoleSession.get().getPlatformInfo(). + getJavaImplInfo(ImplementationType.RECON_FILTER_BUILDER); + List<String> load = reconFilterBuilders.isPresent() + ? new ArrayList<>(reconFilterBuilders.get().getClasses()) + : new ArrayList<>(); + Collections.sort(load); + return load; } }; @@ -137,7 +152,13 @@ public class SchedTaskWizardBuilder<T extends SchedTaskTO> extends AjaxWizardBui @Override protected List<String> load() { - return new ArrayList<>(SyncopeConsoleSession.get().getPlatformInfo().getPullActions()); + Optional<JavaImplInfo> pullActions = SyncopeConsoleSession.get().getPlatformInfo(). + getJavaImplInfo(ImplementationType.PULL_ACTIONS); + List<String> load = pullActions.isPresent() + ? new ArrayList<>(pullActions.get().getClasses()) + : new ArrayList<>(); + Collections.sort(load); + return load; } }; @@ -147,7 +168,13 @@ public class SchedTaskWizardBuilder<T extends SchedTaskTO> extends AjaxWizardBui @Override protected List<String> load() { - return new ArrayList<>(SyncopeConsoleSession.get().getPlatformInfo().getPushActions()); + Optional<JavaImplInfo> pushActions = SyncopeConsoleSession.get().getPlatformInfo(). + getJavaImplInfo(ImplementationType.PUSH_ACTIONS); + List<String> load = pushActions.isPresent() + ? new ArrayList<>(pushActions.get().getClasses()) + : new ArrayList<>(); + Collections.sort(load); + return load; } }; http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java index 87f184d..5478c61 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java @@ -24,8 +24,8 @@ import java.util.UUID; import org.apache.commons.lang3.StringUtils; import org.apache.syncope.client.console.commons.status.StatusBean; import org.apache.syncope.client.console.panels.TogglePanel; -import org.apache.syncope.client.console.policies.PolicyRuleDirectoryPanel.PolicyRuleWrapper; -import org.apache.syncope.client.console.reports.ReportletDirectoryPanel.ReportletWrapper; +import org.apache.syncope.client.console.policies.PolicyRuleWrapper; +import org.apache.syncope.client.console.reports.ReportletWrapper; import org.apache.syncope.client.console.wizards.any.AnyWrapper; import org.apache.syncope.client.console.wizards.any.GroupWrapper; import org.apache.syncope.client.console.wizards.any.UserWrapper; http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/client/console/src/main/java/org/apache/syncope/client/console/widgets/ItemTransformerWidget.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/widgets/ItemTransformerWidget.java b/client/console/src/main/java/org/apache/syncope/client/console/widgets/ItemTransformerWidget.java index 9aa4142..fcdfebc 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/widgets/ItemTransformerWidget.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/widgets/ItemTransformerWidget.java @@ -56,7 +56,7 @@ public class ItemTransformerWidget extends AlertWidget<String> { @Override public List<String> getObject() { - return item.getTransformerClassNames(); + return item.getTransformers(); } }; } http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ItemTransformersTogglePanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ItemTransformersTogglePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ItemTransformersTogglePanel.java index 6e37955..9b10057 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ItemTransformersTogglePanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ItemTransformersTogglePanel.java @@ -22,11 +22,14 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Optional; import org.apache.commons.lang3.StringUtils; import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.client.console.panels.TogglePanel; import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPalettePanel; +import org.apache.syncope.common.lib.info.JavaImplInfo; import org.apache.syncope.common.lib.to.ItemTO; +import org.apache.syncope.common.lib.types.ImplementationType; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink; @@ -55,13 +58,20 @@ public class ItemTransformersTogglePanel extends TogglePanel<Serializable> { // [!] this is required to disable changed with close button return item == null ? Collections.<String>emptyList() - : new ArrayList<>(item.getTransformerClassNames()); + : item.getTransformers(); } }; Form<?> form = new Form<>("form"); addInnerObject(form); + Optional<JavaImplInfo> itemTransformers = SyncopeConsoleSession.get().getPlatformInfo(). + getJavaImplInfo(ImplementationType.ITEM_TRANSFORMER); + List<String> choices = itemTransformers.isPresent() + ? new ArrayList<>(itemTransformers.get().getClasses()) + : new ArrayList<>(); + Collections.sort(choices); + form.add(new AjaxPalettePanel.Builder<String>().setAllowOrder(true).setRenderer(new IChoiceRenderer<String>() { private static final long serialVersionUID = 3464376099975468136L; @@ -89,7 +99,7 @@ public class ItemTransformersTogglePanel extends TogglePanel<Serializable> { }).build( "classes", model, - new ListModel<>(new ArrayList<>(SyncopeConsoleSession.get().getPlatformInfo().getItemTransformers()))). + new ListModel<>(choices)). hideLabel().setEnabled(true).setOutputMarkupId(true)); form.add(new AjaxSubmitLink("submit", form) { @@ -101,8 +111,8 @@ public class ItemTransformersTogglePanel extends TogglePanel<Serializable> { toggle(target, false); // [!] this is required to disable changed with close button - item.getTransformerClassNames().clear(); - item.getTransformerClassNames().addAll(model.getObject()); + item.getTransformers().clear(); + item.getTransformers().addAll(model.getObject()); target.add(container); } http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceDetailsPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceDetailsPanel.java index 52b2535..9c24f9a 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceDetailsPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceDetailsPanel.java @@ -20,7 +20,9 @@ package org.apache.syncope.client.console.wizards.resources; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel; @@ -28,7 +30,9 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownCho import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPalettePanel; import org.apache.syncope.client.console.wicket.markup.html.form.AjaxSpinnerFieldPanel; import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.common.lib.info.JavaImplInfo; import org.apache.syncope.common.lib.to.ResourceTO; +import org.apache.syncope.common.lib.types.ImplementationType; import org.apache.syncope.common.lib.types.TraceLevel; import org.apache.wicket.extensions.wizard.WizardStep; import org.apache.wicket.markup.html.WebMarkupContainer; @@ -49,7 +53,13 @@ public class ResourceDetailsPanel extends WizardStep { @Override protected List<String> load() { - return new ArrayList<>(SyncopeConsoleSession.get().getPlatformInfo().getPropagationActions()); + Optional<JavaImplInfo> propagationActions = SyncopeConsoleSession.get().getPlatformInfo(). + getJavaImplInfo(ImplementationType.PROPAGATION_ACTIONS); + List<String> load = propagationActions.isPresent() + ? new ArrayList<>(propagationActions.get().getClasses()) + : new ArrayList<>(); + Collections.sort(load); + return load; } }; http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/common/lib/src/main/java/org/apache/syncope/common/lib/info/JavaImplInfo.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/info/JavaImplInfo.java b/common/lib/src/main/java/org/apache/syncope/common/lib/info/JavaImplInfo.java new file mode 100644 index 0000000..82cd73b --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/info/JavaImplInfo.java @@ -0,0 +1,56 @@ +/* + * 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.common.lib.info; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.HashSet; +import java.util.Set; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.apache.syncope.common.lib.AbstractBaseBean; +import org.apache.syncope.common.lib.types.ImplementationType; + +@XmlRootElement(name = "javaImplInfo") +@XmlType +public class JavaImplInfo extends AbstractBaseBean { + + private static final long serialVersionUID = 4036793959111794959L; + + private ImplementationType type; + + private final Set<String> classes = new HashSet<>(); + + public ImplementationType getType() { + return type; + } + + public void setType(final ImplementationType type) { + this.type = type; + } + + @XmlElementWrapper(name = "classes") + @XmlElement(name = "class") + @JsonProperty("classes") + public Set<String> getClasses() { + return classes; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/common/lib/src/main/java/org/apache/syncope/common/lib/info/PlatformInfo.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/info/PlatformInfo.java b/common/lib/src/main/java/org/apache/syncope/common/lib/info/PlatformInfo.java index 4d7e4f9..2854259 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/info/PlatformInfo.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/info/PlatformInfo.java @@ -18,16 +18,19 @@ */ package org.apache.syncope.common.lib.info; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.ArrayList; import java.util.HashSet; import java.util.List; +import java.util.Optional; import java.util.Set; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.apache.syncope.common.lib.AbstractBaseBean; +import org.apache.syncope.common.lib.types.ImplementationType; @XmlRootElement(name = "platformInfo") @XmlType @@ -77,35 +80,7 @@ public class PlatformInfo extends AbstractBaseBean { private final Set<String> entitlements = new HashSet<>(); - private final Set<String> jwtSSOProviders = new HashSet<>(); - - private final Set<String> reportletConfs = new HashSet<>(); - - private final Set<String> accountRules = new HashSet<>(); - - private final Set<String> passwordRules = new HashSet<>(); - - private final Set<String> itemTransformers = new HashSet<>(); - - private final Set<String> taskJobs = new HashSet<>(); - - private final Set<String> reconciliationFilterBuilders = new HashSet<>(); - - private final Set<String> logicActions = new HashSet<>(); - - private final Set<String> propagationActions = new HashSet<>(); - - private final Set<String> pullActions = new HashSet<>(); - - private final Set<String> pushActions = new HashSet<>(); - - private final Set<String> pullCorrelationRules = new HashSet<>(); - - private final Set<String> pushCorrelationRules = new HashSet<>(); - - private final Set<String> validators = new HashSet<>(); - - private final Set<String> notificationRecipientsProviders = new HashSet<>(); + private final Set<JavaImplInfo> javaImplInfos = new HashSet<>(); public String getVersion() { return version; @@ -217,109 +192,16 @@ public class PlatformInfo extends AbstractBaseBean { return entitlements; } - @XmlElementWrapper(name = "jwtSSOProviders") - @XmlElement(name = "jwtSSOProvider") - @JsonProperty("jwtSSOProviders") - public Set<String> getJwtSSOProviders() { - return jwtSSOProviders; - } - - @XmlElementWrapper(name = "reportletConfs") - @XmlElement(name = "reportletConf") - @JsonProperty("reportletConfs") - public Set<String> getReportletConfs() { - return reportletConfs; - } - - @XmlElementWrapper(name = "accountRules") - @XmlElement(name = "accountRule") - @JsonProperty("accountRules") - public Set<String> getAccountRules() { - return accountRules; - } - - @XmlElementWrapper(name = "passwordRules") - @XmlElement(name = "passwordRule") - @JsonProperty("passwordRules") - public Set<String> getPasswordRules() { - return passwordRules; - } - - @XmlElementWrapper(name = "itemTransformers") - @XmlElement(name = "itemTransformer") - @JsonProperty("itemTransformers") - public Set<String> getItemTransformers() { - return itemTransformers; - } - - @XmlElementWrapper(name = "taskJobs") - @XmlElement(name = "taskJob") - @JsonProperty("taskJobs") - public Set<String> getTaskJobs() { - return taskJobs; - } - - @XmlElementWrapper(name = "reconciliationFilterBuilders") - @XmlElement(name = "reconciliationFilterBuilder") - @JsonProperty("reconciliationFilterBuilders") - public Set<String> getReconciliationFilterBuilders() { - return reconciliationFilterBuilders; - } - - @XmlElementWrapper(name = "logicActions") - @XmlElement(name = "logicAction") - @JsonProperty("logicActions") - public Set<String> getLogicActions() { - return logicActions; - } - - @XmlElementWrapper(name = "propagationActions") - @XmlElement(name = "propagationAction") - @JsonProperty("propagationActions") - public Set<String> getPropagationActions() { - return propagationActions; - } - - @XmlElementWrapper(name = "pullActions") - @XmlElement(name = "pullAction") - @JsonProperty("pullActions") - public Set<String> getPullActions() { - return pullActions; - } - - @XmlElementWrapper(name = "pushActions") - @XmlElement(name = "pushAction") - @JsonProperty("pushActions") - public Set<String> getPushActions() { - return pushActions; - } - - @XmlElementWrapper(name = "pullCorrelationRules") - @XmlElement(name = "pullCorrelationRule") - @JsonProperty("pullCorrelationRules") - public Set<String> getPullCorrelationRules() { - return pullCorrelationRules; - } - - @XmlElementWrapper(name = "pushCorrelationRules") - @XmlElement(name = "pushCorrelationRule") - @JsonProperty("pushCorrelationRules") - public Set<String> getPushCorrelationRules() { - return pushCorrelationRules; - } - - @XmlElementWrapper(name = "validators") - @XmlElement(name = "validator") - @JsonProperty("validators") - public Set<String> getValidators() { - return validators; + @JsonIgnore + public Optional<JavaImplInfo> getJavaImplInfo(final ImplementationType type) { + return javaImplInfos.stream().filter(javaImplInfo -> javaImplInfo.getType() == type).findFirst(); } - @XmlElementWrapper(name = "notificationRecipientsProviders") - @XmlElement(name = "notificationRecipientsProvider") - @JsonProperty("notificationRecipientsProviders") - public Set<String> getNotificationRecipientsProviders() { - return notificationRecipientsProviders; + @XmlElementWrapper(name = "javaImplInfos") + @XmlElement(name = "javaImplInfo") + @JsonProperty("javaImplInfos") + public Set<JavaImplInfo> getJavaImplInfos() { + return javaImplInfos; } public void setVersion(final String version) { http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AccountPolicyTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AccountPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AccountPolicyTO.java index caf2506..7811c00 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AccountPolicyTO.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AccountPolicyTO.java @@ -28,7 +28,7 @@ import javax.xml.bind.annotation.XmlType; @XmlRootElement(name = "accountPolicy") @XmlType -public class AccountPolicyTO extends AbstractPolicyTO implements ComposablePolicy<AbstractAccountRuleConf> { +public class AccountPolicyTO extends AbstractPolicyTO implements ComposablePolicy { private static final long serialVersionUID = -1557150042828800134L; @@ -36,7 +36,7 @@ public class AccountPolicyTO extends AbstractPolicyTO implements ComposablePolic private int maxAuthenticationAttempts; - private final List<AbstractAccountRuleConf> ruleConfs = new ArrayList<>(); + private final List<String> rules = new ArrayList<>(); private final List<String> passthroughResources = new ArrayList<>(); @@ -56,12 +56,12 @@ public class AccountPolicyTO extends AbstractPolicyTO implements ComposablePolic this.maxAuthenticationAttempts = maxAuthenticationAttempts; } - @XmlElementWrapper(name = "ruleConfs") - @XmlElement(name = "ruleConf") - @JsonProperty("ruleConfs") + @XmlElementWrapper(name = "rules") + @XmlElement(name = "rule") + @JsonProperty("rules") @Override - public List<AbstractAccountRuleConf> getRuleConfs() { - return ruleConfs; + public List<String> getRules() { + return rules; } @XmlElementWrapper(name = "passthroughResources") http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/common/lib/src/main/java/org/apache/syncope/common/lib/policy/ComposablePolicy.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/ComposablePolicy.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/ComposablePolicy.java index b03d538..a0835c1 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/ComposablePolicy.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/ComposablePolicy.java @@ -21,12 +21,12 @@ package org.apache.syncope.common.lib.policy; import java.io.Serializable; import java.util.List; -public interface ComposablePolicy<T extends RuleConf> extends Serializable { +public interface ComposablePolicy extends Serializable { /** * Return policy rules. * * @return policy rules. */ - List<T> getRuleConfs(); + List<String> getRules(); } http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PasswordPolicyTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PasswordPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PasswordPolicyTO.java index b9d6d3e..fd7d55c 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PasswordPolicyTO.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PasswordPolicyTO.java @@ -28,7 +28,7 @@ import javax.xml.bind.annotation.XmlType; @XmlRootElement(name = "passwordPolicy") @XmlType -public class PasswordPolicyTO extends AbstractPolicyTO implements ComposablePolicy<AbstractPasswordRuleConf> { +public class PasswordPolicyTO extends AbstractPolicyTO implements ComposablePolicy { private static final long serialVersionUID = -5606086441294799690L; @@ -36,7 +36,7 @@ public class PasswordPolicyTO extends AbstractPolicyTO implements ComposablePoli private int historyLength; - private final List<AbstractPasswordRuleConf> ruleConfs = new ArrayList<>(); + private final List<String> rules = new ArrayList<>(); public boolean isAllowNullPassword() { return allowNullPassword; @@ -54,11 +54,11 @@ public class PasswordPolicyTO extends AbstractPolicyTO implements ComposablePoli this.historyLength = historyLength; } - @XmlElementWrapper(name = "ruleConfs") - @XmlElement(name = "ruleConf") - @JsonProperty("ruleConfs") + @XmlElementWrapper(name = "rules") + @XmlElement(name = "rule") + @JsonProperty("rules") @Override - public List<AbstractPasswordRuleConf> getRuleConfs() { - return ruleConfs; + public List<String> getRules() { + return rules; } } http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/common/lib/src/main/java/org/apache/syncope/common/lib/report/ReportletConf.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/report/ReportletConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/report/ReportletConf.java index 57bcf52..0e4c1c7 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/report/ReportletConf.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/report/ReportletConf.java @@ -19,9 +19,10 @@ package org.apache.syncope.common.lib.report; import com.fasterxml.jackson.annotation.JsonTypeInfo; +import java.io.Serializable; @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class") -public interface ReportletConf { +public interface ReportletConf extends Serializable { /** * Give name of related reportlet instance. http://git-wip-us.apache.org/repos/asf/syncope/blob/d5b57922/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractProvisioningTaskTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractProvisioningTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractProvisioningTaskTO.java index cd7a5ae..14637ee 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractProvisioningTaskTO.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractProvisioningTaskTO.java @@ -19,8 +19,8 @@ package org.apache.syncope.common.lib.to; import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.HashSet; -import java.util.Set; +import java.util.ArrayList; +import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; @@ -50,7 +50,7 @@ public class AbstractProvisioningTaskTO extends SchedTaskTO { private MatchingRule matchingRule; - private final Set<String> actionsClassNames = new HashSet<>(); + private final List<String> actions = new ArrayList<>(); public String getResource() { return resource; @@ -92,11 +92,11 @@ public class AbstractProvisioningTaskTO extends SchedTaskTO { this.syncStatus = syncStatus; } - @XmlElementWrapper(name = "actionsClassNames") - @XmlElement(name = "actionsClassName") - @JsonProperty("actionsClassNames") - public Set<String> getActionsClassNames() { - return actionsClassNames; + @XmlElementWrapper(name = "actions") + @XmlElement(name = "action") + @JsonProperty("actions") + public List<String> getActions() { + return actions; } public UnmatchingRule getUnmatchingRule() {
