Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYNCOPE-1829] Introducing support for Live Sync #915

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,7 @@ under the License.

<profile>
<id>standalone</id>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
</dependencies>


<build>
<plugins>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,7 @@ under the License.

<profile>
<id>standalone</id>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
</dependencies>


<build>
<plugins>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,6 @@ under the License.
<profile>
<id>standalone</id>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
Expand Down
7 changes: 0 additions & 7 deletions archetype/src/main/resources/archetype-resources/wa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,6 @@ under the License.
<profiles>
<profile>
<id>standalone</id>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.stream.Collectors;
import org.apache.syncope.client.console.init.ClassPathScanImplementationLookup;
import org.apache.syncope.client.console.rest.ImplementationRestClient;
import org.apache.syncope.common.lib.policy.PullCorrelationRuleConf;
import org.apache.syncope.common.lib.policy.InboundCorrelationRuleConf;
import org.apache.syncope.common.lib.policy.PushCorrelationRuleConf;
import org.apache.syncope.common.lib.to.ImplementationTO;
import org.apache.syncope.common.lib.types.IdMImplementationType;
Expand All @@ -44,7 +44,7 @@ public IdMImplementationInfoProvider(

@Override
public ViewMode getViewMode(final ImplementationTO implementation) {
return IdMImplementationType.PULL_CORRELATION_RULE.equals(implementation.getType())
return IdMImplementationType.INBOUND_CORRELATION_RULE.equals(implementation.getType())
|| IdMImplementationType.PUSH_CORRELATION_RULE.equals(implementation.getType())
? ViewMode.JSON_BODY
: super.getViewMode(implementation);
Expand All @@ -55,8 +55,8 @@ public List<String> getClasses(final ImplementationTO implementation, final View
List<String> classes = new ArrayList<>();
if (viewMode == ViewMode.JSON_BODY && IdMImplementationType.values().containsKey(implementation.getType())) {
switch (implementation.getType()) {
case IdMImplementationType.PULL_CORRELATION_RULE:
classes = lookup.getClasses(PullCorrelationRuleConf.class).stream().
case IdMImplementationType.INBOUND_CORRELATION_RULE:
classes = lookup.getClasses(InboundCorrelationRuleConf.class).stream().
map(Class::getName).collect(Collectors.toList());
break;

Expand Down Expand Up @@ -88,16 +88,16 @@ public String getGroovyTemplateClassName(final String implementationType) {
templateClassName = "MyPropagationActions";
break;

case IdMImplementationType.PULL_ACTIONS:
templateClassName = "MyPullActions";
case IdMImplementationType.INBOUND_ACTIONS:
templateClassName = "MyInboundActions";
break;

case IdMImplementationType.PUSH_ACTIONS:
templateClassName = "MyPushActions";
break;

case IdMImplementationType.PULL_CORRELATION_RULE:
templateClassName = "MyPullCorrelationRule";
case IdMImplementationType.INBOUND_CORRELATION_RULE:
templateClassName = "MyInboundCorrelationRule";
break;

case IdMImplementationType.PUSH_CORRELATION_RULE:
Expand All @@ -119,8 +119,8 @@ public String getGroovyTemplateClassName(final String implementationType) {
public Class<?> getClass(final String implementationType, final String name) {
Class<?> clazz;
switch (implementationType) {
case IdMImplementationType.PULL_CORRELATION_RULE:
clazz = lookup.getClasses(PullCorrelationRuleConf.class).stream().
case IdMImplementationType.INBOUND_CORRELATION_RULE:
clazz = lookup.getClasses(InboundCorrelationRuleConf.class).stream().
filter(c -> c.getName().equals(name)).findFirst().orElse(null);
break;

Expand Down Expand Up @@ -151,14 +151,14 @@ protected List<String> load() {
}

@Override
public IModel<List<String>> getPullActions() {
public IModel<List<String>> getInboundActions() {
return new LoadableDetachableModel<>() {

private static final long serialVersionUID = 5275935387613157437L;

@Override
protected List<String> load() {
return implementationRestClient.list(IdMImplementationType.PULL_ACTIONS).stream().
return implementationRestClient.list(IdMImplementationType.INBOUND_ACTIONS).stream().
map(ImplementationTO::getKey).sorted().collect(Collectors.toList());
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

import java.util.ArrayList;
import java.util.List;
import org.apache.syncope.client.console.policies.InboundPolicyDirectoryPanel;
import org.apache.syncope.client.console.policies.PropagationPolicyDirectoryPanel;
import org.apache.syncope.client.console.policies.PullPolicyDirectoryPanel;
import org.apache.syncope.client.console.policies.PushPolicyDirectoryPanel;
import org.apache.syncope.client.console.rest.PolicyRestClient;
import org.apache.wicket.PageReference;
Expand Down Expand Up @@ -54,13 +54,13 @@ public Panel getPanel(final String panelId) {
}
});

tabs.add(new AbstractTab(new ResourceModel("policy.pull")) {
tabs.add(new AbstractTab(new ResourceModel("policy.inbound")) {

private static final long serialVersionUID = -6815067322125799251L;

@Override
public Panel getPanel(final String panelId) {
return new PullPolicyDirectoryPanel(panelId, policyRestClient, pageRef);
return new InboundPolicyDirectoryPanel(panelId, policyRestClient, pageRef);
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.apache.syncope.client.console.init;

import java.util.Optional;
import org.apache.syncope.common.lib.policy.PullCorrelationRuleConf;
import org.apache.syncope.common.lib.policy.InboundCorrelationRuleConf;
import org.apache.syncope.common.lib.policy.PushCorrelationRuleConf;
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
import org.springframework.core.type.filter.AssignableTypeFilter;
Expand All @@ -30,14 +30,14 @@ public class IdMClassPathScanImplementationContributor implements ClassPathScanI

@Override
public void extend(final ClassPathScanningCandidateComponentProvider scanner) {
scanner.addIncludeFilter(new AssignableTypeFilter(PullCorrelationRuleConf.class));
scanner.addIncludeFilter(new AssignableTypeFilter(InboundCorrelationRuleConf.class));
scanner.addIncludeFilter(new AssignableTypeFilter(PushCorrelationRuleConf.class));
}

@Override
public Optional<String> getLabel(final Class<?> clazz) {
if (PullCorrelationRuleConf.class.isAssignableFrom(clazz)) {
return Optional.of(PullCorrelationRuleConf.class.getName());
if (InboundCorrelationRuleConf.class.isAssignableFrom(clazz)) {
return Optional.of(InboundCorrelationRuleConf.class.getName());
}
if (PushCorrelationRuleConf.class.isAssignableFrom(clazz)) {
return Optional.of(PushCorrelationRuleConf.class.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.syncope.client.console.rest.PolicyRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
import org.apache.syncope.common.lib.policy.PullPolicyTO;
import org.apache.syncope.common.lib.policy.InboundPolicyTO;
import org.apache.syncope.common.lib.types.IdRepoEntitlement;
import org.apache.syncope.common.lib.types.PolicyType;
import org.apache.wicket.PageReference;
Expand All @@ -37,39 +37,41 @@
/**
* Pull policies page.
*/
public class PullPolicyDirectoryPanel extends PolicyDirectoryPanel<PullPolicyTO> {
public class InboundPolicyDirectoryPanel extends PolicyDirectoryPanel<InboundPolicyTO> {

private static final long serialVersionUID = 4984337552918213290L;

public PullPolicyDirectoryPanel(final String id, final PolicyRestClient restClient, final PageReference pageRef) {
super(id, restClient, PolicyType.PULL, pageRef);
public InboundPolicyDirectoryPanel(
final String id, final PolicyRestClient restClient, final PageReference pageRef) {

this.addNewItemPanelBuilder(
new PolicyModalPanelBuilder<>(PolicyType.PULL, new PullPolicyTO(), modal, restClient, pageRef), true);
super(id, restClient, PolicyType.INBOUND, pageRef);

this.addNewItemPanelBuilder(new PolicyModalPanelBuilder<>(
PolicyType.INBOUND, new InboundPolicyTO(), modal, restClient, pageRef), true);
MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, IdRepoEntitlement.POLICY_CREATE);

initResultTable();
}

@Override
protected void addCustomColumnFields(final List<IColumn<PullPolicyTO, String>> columns) {
protected void addCustomColumnFields(final List<IColumn<InboundPolicyTO, String>> columns) {
columns.add(new PropertyColumn<>(new StringResourceModel(
"conflictResolutionAction", this), "conflictResolutionAction", "conflictResolutionAction"));
}

@Override
protected void addCustomActions(final ActionsPanel<PullPolicyTO> panel, final IModel<PullPolicyTO> model) {
protected void addCustomActions(final ActionsPanel<InboundPolicyTO> panel, final IModel<InboundPolicyTO> model) {
panel.add(new ActionLink<>() {

private static final long serialVersionUID = -3722207913631435501L;

@Override
public void onClick(final AjaxRequestTarget target, final PullPolicyTO ignore) {
public void onClick(final AjaxRequestTarget target, final InboundPolicyTO ignore) {
target.add(policySpecModal.setContent(
new ProvisioningPolicyModalPanel(model.getObject(), policySpecModal, pageRef)));

policySpecModal.header(new StringResourceModel(
"policy.rules", PullPolicyDirectoryPanel.this, Model.of(model.getObject())));
"policy.rules", InboundPolicyDirectoryPanel.this, Model.of(model.getObject())));

MetaDataRoleAuthorizationStrategy.authorize(
policySpecModal.getForm(), ENABLE, IdRepoEntitlement.POLICY_UPDATE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
import org.apache.syncope.client.ui.commons.markup.html.form.AjaxPalettePanel;
import org.apache.syncope.client.ui.commons.pages.BaseWebPage;
import org.apache.syncope.common.lib.policy.AbstractCorrelationRuleConf;
import org.apache.syncope.common.lib.policy.DefaultPullCorrelationRuleConf;
import org.apache.syncope.common.lib.policy.DefaultInboundCorrelationRuleConf;
import org.apache.syncope.common.lib.policy.DefaultPushCorrelationRuleConf;
import org.apache.syncope.common.lib.policy.InboundPolicyTO;
import org.apache.syncope.common.lib.policy.ProvisioningPolicyTO;
import org.apache.syncope.common.lib.policy.PullPolicyTO;
import org.apache.syncope.common.lib.to.ImplementationTO;
import org.apache.syncope.common.lib.to.SchemaTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
Expand Down Expand Up @@ -102,8 +102,8 @@ public ProvisioningPolicyModalPanel(

@Override
protected Map<String, ImplementationTO> load() {
return implementationRestClient.list(policyTO instanceof PullPolicyTO
? IdMImplementationType.PULL_CORRELATION_RULE
return implementationRestClient.list(policyTO instanceof InboundPolicyTO
? IdMImplementationType.INBOUND_CORRELATION_RULE
: IdMImplementationType.PUSH_CORRELATION_RULE).stream().
collect(Collectors.toMap(ImplementationTO::getKey, Function.identity()));
}
Expand All @@ -115,8 +115,8 @@ protected Map<String, ImplementationTO> load() {

private final List<CorrelationRule> rules = policyTO.getCorrelationRules().keySet().stream().
map(anyType -> new CorrelationRule(
policyTO instanceof PullPolicyTO
? DefaultPullCorrelationRuleConf.class
policyTO instanceof InboundPolicyTO
? DefaultInboundCorrelationRuleConf.class
: DefaultPushCorrelationRuleConf.class,
anyType,
implementations.getObject().get(policyTO.getCorrelationRules().get(anyType)))).
Expand All @@ -140,8 +140,8 @@ public void setObject(final List<CorrelationRule> object) {

@Override
protected CorrelationRule newModelObject() {
return new CorrelationRule(policyTO instanceof PullPolicyTO
? DefaultPullCorrelationRuleConf.class
return new CorrelationRule(policyTO instanceof InboundPolicyTO
? DefaultInboundCorrelationRuleConf.class
: DefaultPushCorrelationRuleConf.class);
}

Expand Down Expand Up @@ -172,8 +172,8 @@ public void onSubmit(final AjaxRequestTarget target) {
}
}
});
policyRestClient.update(getItem() instanceof PullPolicyTO
? PolicyType.PULL : PolicyType.PUSH, getItem());
policyRestClient.update(getItem() instanceof InboundPolicyTO
? PolicyType.INBOUND : PolicyType.PUSH, getItem());

SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
this.modal.close(target);
Expand Down Expand Up @@ -216,8 +216,8 @@ protected class CorrelationRulePanel extends Panel {
@Override
public Boolean getObject() {
AbstractCorrelationRuleConf conf = correlationRule.getObject().getDefaultRuleConf();
return conf instanceof DefaultPullCorrelationRuleConf
? DefaultPullCorrelationRuleConf.class.cast(conf).isOrSchemas()
return conf instanceof DefaultInboundCorrelationRuleConf
? DefaultInboundCorrelationRuleConf.class.cast(conf).isOrSchemas()
: conf instanceof DefaultPushCorrelationRuleConf
? DefaultPushCorrelationRuleConf.class.cast(conf).isOrSchemas()
: false;
Expand All @@ -226,8 +226,8 @@ public Boolean getObject() {
@Override
public void setObject(final Boolean object) {
AbstractCorrelationRuleConf conf = correlationRule.getObject().getDefaultRuleConf();
if (conf instanceof DefaultPullCorrelationRuleConf) {
DefaultPullCorrelationRuleConf.class.cast(conf).setOrSchemas(object);
if (conf instanceof DefaultInboundCorrelationRuleConf) {
DefaultInboundCorrelationRuleConf.class.cast(conf).setOrSchemas(object);
} else if (conf instanceof DefaultPushCorrelationRuleConf) {
DefaultPushCorrelationRuleConf.class.cast(conf).setOrSchemas(object);
}
Expand All @@ -244,8 +244,8 @@ public void setObject(final Boolean object) {

private List<String> schemas() {
AbstractCorrelationRuleConf conf = correlationRule.getObject().getDefaultRuleConf();
return conf instanceof DefaultPullCorrelationRuleConf
? DefaultPullCorrelationRuleConf.class.cast(conf).getSchemas()
return conf instanceof DefaultInboundCorrelationRuleConf
? DefaultInboundCorrelationRuleConf.class.cast(conf).getSchemas()
: conf instanceof DefaultPushCorrelationRuleConf
? DefaultPushCorrelationRuleConf.class.cast(conf).getSchemas()
: List.of();
Expand Down
Loading
Loading