-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding part of resource wizard for attribute mapping
- Loading branch information
Showing
39 changed files
with
1,481 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
137 changes: 137 additions & 0 deletions
137
...m/midpoint/gui/impl/page/admin/resource/component/wizard/AbstractResourceWizardPanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
/* | ||
* Copyright (C) 2022 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
package com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard; | ||
|
||
import com.evolveum.midpoint.gui.api.component.BasePanel; | ||
import com.evolveum.midpoint.gui.api.component.wizard.WizardModel; | ||
import com.evolveum.midpoint.gui.api.component.wizard.WizardPanel; | ||
import com.evolveum.midpoint.gui.api.component.wizard.WizardStep; | ||
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper; | ||
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper; | ||
import com.evolveum.midpoint.gui.api.util.WebPrismUtil; | ||
import com.evolveum.midpoint.gui.impl.page.admin.resource.ResourceDetailsModel; | ||
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.attributeMapping.AttributeMappingsTableWizardPanel; | ||
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType.attributeMapping.BasicSettingAttributeMappingStepPanel; | ||
import com.evolveum.midpoint.prism.Containerable; | ||
import com.evolveum.midpoint.prism.PrismContainerValue; | ||
import com.evolveum.midpoint.prism.path.ItemPath; | ||
import com.evolveum.midpoint.schema.result.OperationResult; | ||
import com.evolveum.midpoint.util.exception.SchemaException; | ||
import com.evolveum.midpoint.util.logging.Trace; | ||
import com.evolveum.midpoint.util.logging.TraceManager; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceAttributeDefinitionType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectTypeDefinitionType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.SchemaHandlingType; | ||
|
||
import org.apache.wicket.Component; | ||
import org.apache.wicket.ajax.AjaxRequestTarget; | ||
import org.apache.wicket.markup.html.form.Form; | ||
import org.apache.wicket.markup.html.panel.Fragment; | ||
import org.apache.wicket.model.IModel; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* @author lskublik | ||
*/ | ||
public abstract class AbstractResourceWizardPanel<C extends Containerable> extends BasePanel { | ||
|
||
private static final Trace LOGGER = TraceManager.getTrace(AbstractResourceWizardPanel.class); | ||
|
||
private static final String ID_FRAGMENT = "fragment"; | ||
private static final String ID_CHOICE_FRAGMENT = "choiceFragment"; | ||
private static final String ID_CHOICE_PANEL = "choicePanel"; | ||
private static final String ID_WIZARD_FRAGMENT = "wizardFragment"; | ||
private static final String ID_MAIN_FORM = "mainForm"; | ||
private static final String ID_WIZARD = "wizard"; | ||
|
||
private final ResourceDetailsModel resourceModel; | ||
public AbstractResourceWizardPanel( | ||
String id, | ||
ResourceDetailsModel model) { | ||
super(id); | ||
this.resourceModel = model; | ||
} | ||
|
||
@Override | ||
protected void onInitialize() { | ||
super.onInitialize(); | ||
initLayout(); | ||
} | ||
|
||
protected abstract void initLayout(); | ||
|
||
protected Fragment createChoiceFragment(Component choicePanel) { | ||
Fragment fragment = new Fragment(ID_FRAGMENT, ID_CHOICE_FRAGMENT, AbstractResourceWizardPanel.this); | ||
fragment.setOutputMarkupId(true); | ||
choicePanel.setOutputMarkupId(true); | ||
fragment.add(choicePanel); | ||
return fragment; | ||
} | ||
|
||
protected String getIdOfChoicePanel() { | ||
return ID_CHOICE_PANEL; | ||
} | ||
|
||
protected void showChoiceFragment(AjaxRequestTarget target, Component choicePanel) { | ||
showFragment(target, createChoiceFragment(choicePanel)); | ||
} | ||
|
||
private void showFragment(AjaxRequestTarget target, Fragment fragment) { | ||
AbstractResourceWizardPanel.this.replace(fragment); | ||
target.add(fragment); | ||
} | ||
|
||
protected Fragment createWizardFragment(Component wizardPanel) { | ||
Fragment fragment = new Fragment(ID_FRAGMENT, ID_WIZARD_FRAGMENT, AbstractResourceWizardPanel.this); | ||
fragment.setOutputMarkupId(true); | ||
Form mainForm = new Form(ID_MAIN_FORM); | ||
fragment.add(mainForm); | ||
wizardPanel.setOutputMarkupId(true); | ||
mainForm.add(wizardPanel); | ||
return fragment; | ||
} | ||
|
||
protected String getIdOfWizardPanel() { | ||
return ID_WIZARD; | ||
} | ||
|
||
protected void showWizardFragment(AjaxRequestTarget target, Component wizardPanel) { | ||
showFragment(target, createWizardFragment(wizardPanel)); | ||
} | ||
|
||
protected void onExitPerformed(AjaxRequestTarget target) { | ||
} | ||
|
||
protected IModel<PrismContainerValueWrapper<C>> createModelOfNewValue(ItemPath path) { | ||
try { | ||
PrismContainerWrapper<C> container = findContainer(path); | ||
PrismContainerValue<C> newItem = container.getItem().createNewValue(); | ||
PrismContainerValueWrapper<C> newItemWrapper = WebPrismUtil.createNewValueWrapper(container, newItem, getPageBase()); | ||
container.getValues().add(newItemWrapper); | ||
return () -> newItemWrapper; | ||
|
||
} catch (SchemaException e) { | ||
LOGGER.error("Cannot find wrapper: {}", e.getMessage()); | ||
} | ||
return null; | ||
} | ||
|
||
protected PrismContainerWrapper<C> findContainer(ItemPath path) throws SchemaException { | ||
return getResourceModel().getObjectWrapper().findContainer(path); | ||
} | ||
|
||
public ResourceDetailsModel getResourceModel() { | ||
return resourceModel; | ||
} | ||
|
||
protected OperationResult onSaveResourcePerformed(AjaxRequestTarget target) { | ||
return null; | ||
} | ||
} |
File renamed without changes.
91 changes: 91 additions & 0 deletions
91
...i/impl/page/admin/resource/component/wizard/AbstractValueFormResourceWizardStepPanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* Copyright (C) 2022 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
package com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard; | ||
|
||
import com.evolveum.midpoint.gui.api.prism.wrapper.ItemVisibilityHandler; | ||
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper; | ||
import com.evolveum.midpoint.gui.impl.page.admin.resource.ResourceDetailsModel; | ||
import com.evolveum.midpoint.gui.impl.prism.panel.ItemPanelSettings; | ||
import com.evolveum.midpoint.gui.impl.prism.panel.ItemPanelSettingsBuilder; | ||
import com.evolveum.midpoint.gui.impl.prism.panel.vertical.form.VerticalFormContainerHeaderPanel; | ||
import com.evolveum.midpoint.gui.impl.prism.panel.vertical.form.VerticalFormDefaultContainerablePanel; | ||
import com.evolveum.midpoint.gui.impl.prism.panel.vertical.form.VerticalFormPrismPropertyValuePanel; | ||
import com.evolveum.midpoint.gui.impl.prism.panel.vertical.form.VerticalFormPrismReferenceValuePanel; | ||
import com.evolveum.midpoint.prism.Containerable; | ||
|
||
import org.apache.wicket.ajax.AjaxRequestTarget; | ||
import org.apache.wicket.model.IModel; | ||
|
||
/** | ||
* @author lskublik | ||
*/ | ||
public abstract class AbstractValueFormResourceWizardStepPanel<C extends Containerable> extends AbstractResourceWizardStepPanel { | ||
|
||
private static final String ID_HEADER = "header"; | ||
private static final String ID_VALUE = "value"; | ||
private final IModel<PrismContainerValueWrapper<C>> newValueModel; | ||
|
||
public AbstractValueFormResourceWizardStepPanel( | ||
ResourceDetailsModel model, | ||
IModel<PrismContainerValueWrapper<C>> newValueModel) { | ||
super(model); | ||
this.newValueModel = newValueModel; | ||
} | ||
|
||
@Override | ||
protected void onInitialize() { | ||
super.onInitialize(); | ||
initLayout(); | ||
} | ||
|
||
protected void initLayout() { | ||
VerticalFormContainerHeaderPanel header = new VerticalFormContainerHeaderPanel(ID_HEADER, getTitle()) { | ||
@Override | ||
protected String getIcon() { | ||
return AbstractValueFormResourceWizardStepPanel.this.getIcon(); | ||
} | ||
}; | ||
add(header); | ||
|
||
ItemPanelSettings settings = new ItemPanelSettingsBuilder() | ||
.visibilityHandler(getVisibilityHandler()).build(); | ||
VerticalFormDefaultContainerablePanel<C> panel | ||
= new VerticalFormDefaultContainerablePanel<C>(ID_VALUE, newValueModel, settings); | ||
add(panel); | ||
} | ||
|
||
protected ItemVisibilityHandler getVisibilityHandler() { | ||
return null; | ||
} | ||
|
||
protected String getIcon() { | ||
return "fa fa-circle"; | ||
} | ||
|
||
@Override | ||
protected void updateFeedbackPanels(AjaxRequestTarget target) { | ||
getValuePanel().visitChildren(VerticalFormPrismPropertyValuePanel.class, (component, objectIVisit) -> { | ||
((VerticalFormPrismPropertyValuePanel) component).updateFeedbackPanel(target); | ||
}); | ||
getValuePanel().visitChildren(VerticalFormPrismReferenceValuePanel.class, (component, objectIVisit) -> { | ||
((VerticalFormPrismReferenceValuePanel) component).updateFeedbackPanel(target); | ||
}); | ||
} | ||
|
||
@Override | ||
protected boolean isExitButtonVisible() { | ||
return true; | ||
} | ||
|
||
private VerticalFormDefaultContainerablePanel getValuePanel() { | ||
return (VerticalFormDefaultContainerablePanel) get(ID_VALUE); | ||
} | ||
|
||
protected IModel<PrismContainerValueWrapper<C>> getValueModel() { | ||
return newValueModel; | ||
} | ||
} |
File renamed without changes.
68 changes: 68 additions & 0 deletions
68
...idpoint/gui/impl/page/admin/resource/component/wizard/PreviewResourceDataWizardPanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright (C) 2022 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
package com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard; | ||
|
||
import com.evolveum.midpoint.gui.api.component.wizard.AbstractWizardBasicPanel; | ||
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper; | ||
import com.evolveum.midpoint.gui.api.util.WebComponentUtil; | ||
import com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanelWithDetailsPanel; | ||
import com.evolveum.midpoint.gui.impl.page.admin.AbstractPageObjectDetails; | ||
import com.evolveum.midpoint.gui.impl.page.admin.resource.ResourceDetailsModel; | ||
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.ResourceSchemaHandlingPanel; | ||
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.ResourceUncategorizedPanel; | ||
import com.evolveum.midpoint.web.component.AjaxIconButton; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ContainerPanelConfigurationType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectTypeDefinitionType; | ||
|
||
import org.apache.wicket.ajax.AjaxRequestTarget; | ||
import org.apache.wicket.behavior.AttributeAppender; | ||
import org.apache.wicket.markup.repeater.RepeatingView; | ||
import org.apache.wicket.model.IModel; | ||
import org.apache.wicket.model.Model; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author lskublik | ||
*/ | ||
public class PreviewResourceDataWizardPanel extends AbstractWizardBasicPanel { | ||
|
||
private static final String PANEL_TYPE = "resourceUncategorized"; | ||
private static final String ID_TABLE = "table"; | ||
|
||
public PreviewResourceDataWizardPanel(String id, ResourceDetailsModel model) { | ||
super(id, model); | ||
} | ||
|
||
@Override | ||
protected void onInitialize() { | ||
super.onInitialize(); | ||
initLayout(); | ||
} | ||
|
||
private void initLayout() { | ||
ResourceUncategorizedPanel table = new ResourceUncategorizedPanel(ID_TABLE, getResourceModel(), getConfiguration()); | ||
table.setOutputMarkupId(true); | ||
add(table); | ||
} | ||
|
||
ContainerPanelConfigurationType getConfiguration(){ | ||
return WebComponentUtil.getContainerConfiguration( | ||
getResourceModel().getObjectDetailsPageConfiguration().getObject(), | ||
PANEL_TYPE); | ||
} | ||
|
||
@Override | ||
protected IModel<String> getSubTextModel() { | ||
return getPageBase().createStringResource("PreviewResourceDataWizardPanel.text"); | ||
} | ||
|
||
@Override | ||
protected IModel<String> getTextModel() { | ||
return getPageBase().createStringResource("PreviewResourceDataWizardPanel.subText"); | ||
} | ||
} |
Oops, something went wrong.