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-1617 #389

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import org.apache.syncope.client.ui.commons.panels.ModalPanel;
import org.apache.syncope.common.lib.SyncopeConstants;
import org.apache.syncope.common.lib.to.ConnObject;
import org.apache.syncope.common.lib.to.Provision;
import org.apache.syncope.common.lib.to.PullTaskTO;
import org.apache.syncope.common.lib.to.ResourceProvision;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.wicket.PageReference;
Expand All @@ -51,7 +51,7 @@ public ConnObjects(final ResourceTO resource, final PageReference pageRef) {
super(BaseModal.CONTENT_ID);

List<String> availableAnyTypes = resource.getProvisions().stream().
map(Provision::getAnyType).
map(ResourceProvision::getAnyType).
sorted(AnyTypeRestClient.KEY_COMPARATOR).
collect(Collectors.toList());
if (resource.getOrgUnit() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.apache.syncope.common.lib.to.AnyTypeClassTO;
import org.apache.syncope.common.lib.to.AnyTypeTO;
import org.apache.syncope.common.lib.to.PlainSchemaTO;
import org.apache.syncope.common.lib.to.Provision;
import org.apache.syncope.common.lib.to.ResourceProvision;
import org.apache.syncope.common.lib.types.SchemaType;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
Expand All @@ -45,9 +45,9 @@ public class ProvisionAuxClassesPanel extends Panel {

private static final Logger LOG = LoggerFactory.getLogger(ProvisionAuxClassesPanel.class);

private final Provision provision;
private final ResourceProvision provision;

public ProvisionAuxClassesPanel(final String id, final Provision provision) {
public ProvisionAuxClassesPanel(final String id, final ResourceProvision provision) {
super(id);
setOutputMarkupId(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.apache.syncope.client.ui.commons.DirectoryDataProvider;
import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel;
import org.apache.syncope.client.ui.commons.status.StatusBean;
import org.apache.syncope.common.lib.to.Provision;
import org.apache.syncope.common.lib.to.ResourceProvision;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand All @@ -48,7 +48,7 @@ public ResourceStatusModal(
super(pageRef, resource, null, false);

List<String> availableAnyTypes = resource.getProvisions().stream().
map(Provision::getAnyType).
map(ResourceProvision::getAnyType).
sorted(AnyTypeRestClient.KEY_COMPARATOR).
collect(Collectors.toList());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
import org.apache.syncope.client.console.wicket.markup.html.form.IndicatingOnConfirmAjaxLink;
import org.apache.syncope.client.console.wizards.resources.ConnectorWizardBuilder;
import org.apache.syncope.client.console.wizards.resources.ResourceProvision;
import org.apache.syncope.client.console.wizards.resources.ResourceProvisionPanel;
import org.apache.syncope.client.console.wizards.resources.ResourceProvisionPanelObj;
import org.apache.syncope.client.console.wizards.resources.ResourceWizardBuilder;
import org.apache.syncope.client.ui.commons.Constants;
import org.apache.syncope.client.ui.commons.pages.BaseWebPage;
import org.apache.syncope.client.ui.commons.wizards.AjaxWizard;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
import org.apache.syncope.common.lib.to.Provision;
import org.apache.syncope.common.lib.to.ResourceProvision;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.types.AuditElements;
import org.apache.syncope.common.lib.types.IdMEntitlement;
Expand Down Expand Up @@ -154,8 +154,8 @@ public void toggleWithContent(final AjaxRequestTarget target, final TopologyNode
@Override
protected String getTargetKey(final Serializable modelObject) {
String key = super.getTargetKey(modelObject);
if (modelObject instanceof ResourceProvision) {
key = ((ResourceProvision) modelObject).getKey();
if (modelObject instanceof ResourceProvisionPanelObj) {
key = ((ResourceProvisionPanelObj) modelObject).getKey();
} else if (modelObject instanceof TopologyNode) {
key = ((TopologyNode) modelObject).getKey();
}
Expand Down Expand Up @@ -608,7 +608,7 @@ public void onClick(final AjaxRequestTarget target) {
ResourceTO resource = ResourceRestClient.read(node.getKey());
resource.setKey("Copy of " + node.getKey());

for (Provision provision : resource.getProvisions()) {
for (ResourceProvision provision : resource.getProvisions()) {
if (provision.getMapping() != null) {
provision.getMapping().getLinkingItems().clear();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public abstract class ObjectTypeTogglePanel extends TogglePanel<Serializable> {

ObjectTypeTogglePanel(
final String id,
final ResourceProvision resourceProvision,
final ResourceProvisionPanelObj resourceProvision,
final LoadableDetachableModel<List<String>> anyTypes,
final PageReference pageRef) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior;
import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel;
import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.common.lib.to.Provision;
import org.apache.syncope.common.lib.to.ResourceProvision;
import org.apache.syncope.common.lib.to.ResourceTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.wicket.PageReference;
Expand All @@ -46,7 +46,7 @@
import org.apache.wicket.model.ResourceModel;
import org.apache.wicket.model.StringResourceModel;

public class ProvisionWizardBuilder extends BaseAjaxWizardBuilder<ResourceProvision> {
public class ProvisionWizardBuilder extends BaseAjaxWizardBuilder<ResourceProvisionPanelObj> {

private static final long serialVersionUID = 3739399543837732640L;

Expand All @@ -63,7 +63,7 @@ private final class ObjectType extends WizardStep {

private static final long serialVersionUID = -1657800545799468278L;

ObjectType(final ResourceProvision resourceProvision) {
ObjectType(final ResourceProvisionPanelObj resourceProvision) {
super(new ResourceModel("clazz.title", StringUtils.EMPTY),
new ResourceModel("clazz.summary", StringUtils.EMPTY), new Model<>(resourceProvision));

Expand All @@ -78,7 +78,9 @@ private final class ObjectType extends WizardStep {
container.add(clazz);

AjaxCheckBoxPanel ignoreCaseMatch = new AjaxCheckBoxPanel(
"ignoreCaseMatch", "ignoreCaseMatch", new PropertyModel<>(resourceProvision, "ignoreCaseMatch"));
"ignoreCaseMatch",
"ignoreCaseMatch",
new PropertyModel<>(resourceProvision, "ignoreCaseMatch"));
container.add(ignoreCaseMatch);
}
}
Expand All @@ -102,13 +104,16 @@ private static final class AuxClasses extends WizardStep implements ICondition {

private static final long serialVersionUID = 5315236191866427500L;

private final ResourceProvision provision;
private final ResourceProvisionPanelObj provision;

AuxClasses(final ResourceProvision resourceProvision) {
AuxClasses(final ResourceProvisionPanelObj resourceProvision) {
this.provision = resourceProvision;

setTitleModel(new ResourceModel("auxClasses.title"));
setSummaryModel(new StringResourceModel("auxClasses.summary", this, new Model<>(resourceProvision)));
setSummaryModel(new StringResourceModel(
"auxClasses.summary",
this,
new Model<>(resourceProvision)));
add(new ProvisionAuxClassesPanel("auxClasses", resourceProvision.getProvisionTO()));
}

Expand Down Expand Up @@ -138,7 +143,7 @@ private static final class ConnObjectLink extends WizardStep {

private static final long serialVersionUID = 2359955465172450478L;

ConnObjectLink(final ResourceProvision resourceProvision) {
ConnObjectLink(final ResourceProvisionPanelObj resourceProvision) {
super(new ResourceModel("link.title", StringUtils.EMPTY),
new ResourceModel("link.summary", StringUtils.EMPTY));

Expand All @@ -153,7 +158,9 @@ private static final class ConnObjectLink extends WizardStep {

final AjaxCheckBoxPanel connObjectLinkCheckbox = new AjaxCheckBoxPanel(
"connObjectLinkCheckbox",
new ResourceModel("connObjectLinkCheckbox", "connObjectLinkCheckbox").getObject(),
new ResourceModel(
"connObjectLinkCheckbox",
"connObjectLinkCheckbox").getObject(),
new Model<>(connObjectLinkEnabled),
false);
connObjectLinkCheckbox.setEnabled(true);
Expand Down Expand Up @@ -192,13 +199,15 @@ protected void onUpdate(final AjaxRequestTarget target) {
* @param pageRef Caller page reference.
*/
public ProvisionWizardBuilder(final ResourceTO resourceTO, final String adminRealm, final PageReference pageRef) {
super(new ResourceProvision(), pageRef);
super(new ResourceProvisionPanelObj(), pageRef);
this.resourceTO = resourceTO;
this.adminRealm = adminRealm;
}

@Override
protected WizardModel buildModelSteps(final ResourceProvision resourceProvision, final WizardModel wizardModel) {
protected WizardModel buildModelSteps(
final ResourceProvisionPanelObj resourceProvision,
final WizardModel wizardModel) {
wizardModel.add(new ObjectType(resourceProvision));
wizardModel.add(new AuxClasses(resourceProvision));

Expand All @@ -222,14 +231,14 @@ protected WizardModel buildModelSteps(final ResourceProvision resourceProvision,
}

@Override
protected Serializable onApplyInternal(final ResourceProvision resourceProvision) {
protected Serializable onApplyInternal(final ResourceProvisionPanelObj resourceProvision) {
if (resourceProvision.getOrgUnitTO() != null) {
this.resourceTO.setOrgUnit(resourceProvision.getOrgUnitTO());

this.resourceTO.getOrgUnit().getItems().clear();
this.resourceTO.getOrgUnit().getItems().addAll(resourceProvision.getItems());
} else if (resourceProvision.getProvisionTO() != null) {
final List<Provision> provisions;
final List<ResourceProvision> provisions;
if (resourceProvision.getKey() == null) {
provisions = this.resourceTO.getProvisions().stream().
filter(object -> !resourceProvision.getAnyType().equals(object.getAnyType())).
Expand All @@ -240,7 +249,7 @@ protected Serializable onApplyInternal(final ResourceProvision resourceProvision
collect(Collectors.toList());
}

Provision provisionTO = resourceProvision.getProvisionTO();
ResourceProvision provisionTO = resourceProvision.getProvisionTO();
provisionTO.getMapping().getItems().clear();
provisionTO.getMapping().getItems().addAll(resourceProvision.getItems());
provisions.add(provisionTO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class ResourceMappingPanel extends AbstractMappingPanel {
/**
* External resource provisioning configuration instance to be updated.
*/
private final ResourceProvision provision;
private final ResourceProvisionPanelObj provision;

private final LoadableDetachableModel<List<String>> extAttrNames;

Expand All @@ -74,7 +74,7 @@ public ResourceMappingPanel(
final String id,
final ResourceTO resourceTO,
final String adminRealm,
final ResourceProvision provision,
final ResourceProvisionPanelObj provision,
final ItemTransformersTogglePanel itemTransformers,
final JEXLTransformersTogglePanel jexlTransformers) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ public class ResourceProvisionPanel extends AbstractModalPanel<Serializable> {

private final ResourceTO resourceTO;

private final List<ResourceProvision> provisions;
private final List<ResourceProvisionPanelObj> provisions;

private final ObjectTypeTogglePanel objectTypeTogglePanel;

private final WizardMgtPanel<ResourceProvision> list;
private final WizardMgtPanel<ResourceProvisionPanelObj> list;

private final ProvisionWizardBuilder wizard;

private final AjaxLink<ResourceProvision> addAjaxLink;
private final AjaxLink<ResourceProvisionPanelObj> addAjaxLink;

protected ActionLinksTogglePanel<ResourceProvision> actionTogglePanel;
protected ActionLinksTogglePanel<ResourceProvisionPanelObj> actionTogglePanel;

public ResourceProvisionPanel(
final BaseModal<Serializable> modal,
Expand All @@ -84,14 +84,14 @@ public ResourceProvisionPanel(

wizard = new ProvisionWizardBuilder(resourceTO, adminRealm, pageRef);

ListViewPanel.Builder<ResourceProvision> builder = new ListViewPanel.Builder<>(
ResourceProvision.class, pageRef) {
ListViewPanel.Builder<ResourceProvisionPanelObj> builder = new ListViewPanel.Builder<>(
ResourceProvisionPanelObj.class, pageRef) {

private static final long serialVersionUID = 4907732721283972943L;

@Override
protected ResourceProvision getActualItem(
final ResourceProvision item, final List<ResourceProvision> list) {
protected ResourceProvisionPanelObj getActualItem(
final ResourceProvisionPanelObj item, final List<ResourceProvisionPanelObj> list) {

return Optional.ofNullable(item).flatMap(resourceProvision -> list.stream()
.filter(in -> ((resourceProvision.getKey() == null && in.getKey() == null)
Expand Down Expand Up @@ -125,16 +125,16 @@ protected void customActionOnFinishCallback(final AjaxRequestTarget target) {
}

@Override
protected ActionLinksTogglePanel<ResourceProvision> getTogglePanel() {
protected ActionLinksTogglePanel<ResourceProvisionPanelObj> getTogglePanel() {
return actionTogglePanel;
}
};

provisions = new ArrayList<>();
if (resourceTO.getOrgUnit() != null) {
provisions.add(new ResourceProvision(resourceTO.getOrgUnit()));
provisions.add(new ResourceProvisionPanelObj(resourceTO.getOrgUnit()));
}
resourceTO.getProvisions().forEach(provision -> provisions.add(new ResourceProvision(provision)));
resourceTO.getProvisions().forEach(provision -> provisions.add(new ResourceProvisionPanelObj(provision)));
// keep list ordered - SYNCOPE-1154
sortProvisions();

Expand All @@ -147,7 +147,7 @@ protected ActionLinksTogglePanel<ResourceProvision> getTogglePanel() {
private static final long serialVersionUID = -3722207913631435504L;

@Override
public void onClick(final AjaxRequestTarget target, final ResourceProvision provision) {
public void onClick(final AjaxRequestTarget target, final ResourceProvisionPanelObj provision) {
try {
send(ResourceProvisionPanel.this, Broadcast.DEPTH,
new AjaxWizard.NewItemActionEvent<>(provision, 1, target).setResourceModel(
Expand All @@ -166,7 +166,7 @@ public void onClick(final AjaxRequestTarget target, final ResourceProvision prov
private static final long serialVersionUID = -7780999687733432439L;

@Override
public void onClick(final AjaxRequestTarget target, final ResourceProvision provision) {
public void onClick(final AjaxRequestTarget target, final ResourceProvisionPanelObj provision) {
try {
ResourceRestClient.setLatestSyncToken(resourceTO.getKey(), provision.getAnyType());
SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
Expand All @@ -183,7 +183,7 @@ public void onClick(final AjaxRequestTarget target, final ResourceProvision prov
private static final long serialVersionUID = -7780999687733432439L;

@Override
public void onClick(final AjaxRequestTarget target, final ResourceProvision provision) {
public void onClick(final AjaxRequestTarget target, final ResourceProvisionPanelObj provision) {
try {
ResourceRestClient.removeSyncToken(resourceTO.getKey(), provision.getAnyType());
SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
Expand All @@ -200,7 +200,7 @@ public void onClick(final AjaxRequestTarget target, final ResourceProvision prov
private static final long serialVersionUID = -3722207913631435544L;

@Override
public void onClick(final AjaxRequestTarget target, final ResourceProvision provision) {
public void onClick(final AjaxRequestTarget target, final ResourceProvisionPanelObj provision) {
if (provision.getOrgUnitTO() != null) {
resourceTO.setOrgUnit(null);
} else if (provision.getProvisionTO() != null) {
Expand Down Expand Up @@ -234,7 +234,7 @@ public void onClick(final AjaxRequestTarget target) {

// ----------------------------------------------------------------------
// toggle panel, used to choose 'type' before starting wizard - SYNCOPE-1167
final ResourceProvision provision = new ResourceProvision();
final ResourceProvisionPanelObj provision = new ResourceProvisionPanelObj();
provision.setAnyType("");
objectTypeTogglePanel = new ObjectTypeTogglePanel("objectTypeToggle", provision, getAnyTypes(), pageRef) {

Expand Down
Loading