Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Mar 3, 2022
2 parents 378dcca + 51656cc commit 7376680
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 136 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,6 @@
type = "FullTextSearchConfigurationType",
expanded = true
)
//@PanelInstance(
// identifier = "profilingPanel",
// applicableForType = ProfilingConfigurationType.class,
// display = @PanelDisplay(
// label = "ProfilingConfiguration.label",
// icon = GuiStyleConstants.CLASS_CIRCLE_FULL,
// order = 10
// ),
// containerPath = "profilingConfiguration",
// type = "ProfilingConfigurationType",
// expanded = true
//)
@PanelInstance(
identifier = "adminGuiPanel",
applicableForType = AdminGuiConfigurationType.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.evolveum.midpoint.web.application.CollectionInstance;
import com.evolveum.midpoint.web.application.PanelDisplay;
import com.evolveum.midpoint.web.component.form.MidpointForm;
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem;
import com.evolveum.midpoint.web.component.util.SelectableBean;
import com.evolveum.midpoint.web.page.admin.PageAdmin;
import com.evolveum.midpoint.web.session.UserProfileStorage.TableId;
Expand All @@ -26,6 +27,9 @@
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.markup.html.form.Form;

import java.util.Arrays;
import java.util.List;

@PageDescriptor(
urls = {
@Url(mountUrl = "/admin/messageTemplates")
Expand Down Expand Up @@ -78,6 +82,11 @@ protected TableId getTableId() {
protected IColumn<SelectableBean<MessageTemplateType>, String> createCheckboxColumn() {
return null;
}

@Override
protected List<InlineMenuItem> createInlineMenu() {
return Arrays.asList(createDeleteInlineMenu());
}
};
table.setOutputMarkupId(true);
mainForm.add(table);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ public class CustomTransportContentPanel extends MultivalueContainerListPanelWit
public CustomTransportContentPanel(String id, AssignmentHolderDetailsModel model, ContainerPanelConfigurationType configurationType) {
super(id, CustomTransportConfigurationType.class, configurationType);

this.model = PrismContainerWrapperModel.fromContainerWrapper(model.getObjectWrapperModel(), ItemPath.create(
SystemConfigurationType.F_MESSAGE_TRANSPORT_CONFIGURATION,
MessageTransportConfigurationType.F_MAIL
));
this.model = new MessageTransportContainerModel<>(this, model.getObjectWrapperModel(), MessageTransportConfigurationType.F_CUSTOM_TRANSPORT);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ public class FileTransportContentPanel extends MultivalueContainerListPanelWithD
public FileTransportContentPanel(String id, AssignmentHolderDetailsModel model, ContainerPanelConfigurationType configurationType) {
super(id, FileTransportConfigurationType.class, configurationType);

this.model = PrismContainerWrapperModel.fromContainerWrapper(model.getObjectWrapperModel(), ItemPath.create(
SystemConfigurationType.F_MESSAGE_TRANSPORT_CONFIGURATION,
MessageTransportConfigurationType.F_FILE
));
this.model = new MessageTransportContainerModel<>(this, model.getObjectWrapperModel(), MessageTransportConfigurationType.F_FILE);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ public class MailTransportContentPanel extends MultivalueContainerListPanelWithD
public MailTransportContentPanel(String id, AssignmentHolderDetailsModel model, ContainerPanelConfigurationType configurationType) {
super(id, MailTransportConfigurationType.class, configurationType);

this.model = PrismContainerWrapperModel.fromContainerWrapper(model.getObjectWrapperModel(), ItemPath.create(
SystemConfigurationType.F_MESSAGE_TRANSPORT_CONFIGURATION,
MessageTransportConfigurationType.F_MAIL
));
this.model = new MessageTransportContainerModel<>(this, model.getObjectWrapperModel(), MessageTransportConfigurationType.F_MAIL);
}

@Override
Expand Down
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.systemconfiguration.component;

import javax.xml.namespace.QName;

import org.apache.wicket.model.IModel;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.api.factory.wrapper.PrismContainerWrapperFactory;
import com.evolveum.midpoint.gui.api.factory.wrapper.WrapperContext;
import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismObjectWrapper;
import com.evolveum.midpoint.prism.Containerable;
import com.evolveum.midpoint.prism.PrismContainerDefinition;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.web.model.PrismContainerWrapperModel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType;

/**
* @deprecated
*
* This helper model was created because currently there's no simple way of creating PrismContainerWrapper automatically if ItemPath
* has more than one item. PrismObjectWrapper creates containers only up to first level. In our case for SystemConfigurationType it creates
* PrismContainerWrapper for messageTransportConfiguration container but if there's no existing configuration, this container contains zero items.
*
* This should be fixed somewhere in PrismContainerWrapperModel or ItemWrapperModel, but it was not an easy fix - it's a mess
* there (between model, wrapper and real prism items). To complicate the change even further, we also don't want to create
* recursively all container wrappers for all non-existing containers at all times.
*
* Created by Viliam Repan (lazyman).
*/
@Deprecated
public class MessageTransportContainerModel<T extends Containerable> implements IModel<PrismContainerWrapper<T>> {

private BasePanel panel;

private LoadableModel<PrismObjectWrapper<SystemConfigurationType>> model;

private QName containerName;

public MessageTransportContainerModel(BasePanel panel, LoadableModel<PrismObjectWrapper<SystemConfigurationType>> model, QName containerName) {

this.panel = panel;
this.model = model;
this.containerName = containerName;
}

@Override
public PrismContainerWrapper<T> getObject() {
PrismContainerWrapper container = PrismContainerWrapperModel.fromContainerWrapper(model, ItemPath.create(
SystemConfigurationType.F_MESSAGE_TRANSPORT_CONFIGURATION, containerName)).getObject();

if (container != null) {
return container;
}

container = PrismContainerWrapperModel.fromContainerWrapper(model, ItemPath.create(
SystemConfigurationType.F_MESSAGE_TRANSPORT_CONFIGURATION)).getObject();

try {
PrismContainerValueWrapper value = (PrismContainerValueWrapper) container.getValue();

PrismContainerDefinition def = container.findContainerDefinition(ItemPath.create(containerName));
PrismContainerWrapperFactory factory = panel.getPageBase().getRegistry().findContainerWrapperFactory(def);

Task task = panel.getPageBase().createSimpleTask("Create child containers");
WrapperContext ctx = new WrapperContext(task, task.getResult());
ctx.setCreateIfEmpty(true);

PrismContainerWrapper child = (PrismContainerWrapper) factory.createWrapper(value, def, ctx);
value.addItem(child);

return child;
} catch (SchemaException ex) {
// todo handle
ex.printStackTrace();
}

return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,16 @@
import com.evolveum.midpoint.gui.impl.component.data.column.AbstractItemWrapperColumn;
import com.evolveum.midpoint.gui.impl.component.data.column.PrismPropertyWrapperColumn;
import com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.AssignmentHolderDetailsModel;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.web.application.Counter;
import com.evolveum.midpoint.web.application.PanelDisplay;
import com.evolveum.midpoint.web.application.PanelInstance;
import com.evolveum.midpoint.web.application.PanelType;
import com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn;
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem;
import com.evolveum.midpoint.web.model.PrismContainerWrapperModel;
import com.evolveum.midpoint.web.session.UserProfileStorage;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ContainerPanelConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SmsTransportConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.MessageTransportConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SmsTransportConfigurationType;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
Expand Down Expand Up @@ -58,10 +55,7 @@ public class SmsTransportContentPanel extends MultivalueContainerListPanelWithDe
public SmsTransportContentPanel(String id, AssignmentHolderDetailsModel model, ContainerPanelConfigurationType configurationType) {
super(id, SmsTransportConfigurationType.class, configurationType);

this.model = PrismContainerWrapperModel.fromContainerWrapper(model.getObjectWrapperModel(), ItemPath.create(
SystemConfigurationType.F_MESSAGE_TRANSPORT_CONFIGURATION,
MessageTransportConfigurationType.F_SMS
));
this.model = new MessageTransportContainerModel<>(this, model.getObjectWrapperModel(), MessageTransportConfigurationType.F_SMS);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
*/
package com.evolveum.midpoint.gui.impl.page.admin.systemconfiguration.page;

import java.util.Arrays;
import java.util.List;
import javax.xml.namespace.QName;

import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;

import com.evolveum.midpoint.gui.api.GuiStyleConstants;
import com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.AssignmentHolderDetailsModel;
import com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.PageAssignmentHolderDetails;
Expand All @@ -20,14 +28,6 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SystemObjectsType;

import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;

import javax.xml.namespace.QName;
import java.util.Arrays;
import java.util.List;

public abstract class PageBaseSystemConfiguration extends PageAssignmentHolderDetails<SystemConfigurationType, AssignmentHolderDetailsModel<SystemConfigurationType>> {

private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -126,100 +126,4 @@ public List<Class<? extends Containerable>> getAllDetailsTypes() {
public Class<? extends Containerable> getDetailsType() {
return getType();
}

//
// @Override
// protected PrismObject<SystemConfigurationType> loadPrismObject(PrismObject<SystemConfigurationType> objectToEdit, Task task, OperationResult result) {
// return WebModelServiceUtils.loadSystemConfigurationAsPrismObject(this, task, result);
// }
//
// @Override
// protected ItemStatus computeWrapperStatus() {
// return ItemStatus.NOT_CHANGED;
// }
//
// @Override
// public Class<SystemConfigurationType> getCompileTimeClass() {
// return SystemConfigurationType.class;
// }
//
// @Override
// public SystemConfigurationType createNewObject() {
// return new SystemConfigurationType(getPrismContext());
// }
//
// @Override
// protected ObjectSummaryPanel<SystemConfigurationType> createSummaryPanel(IModel<SystemConfigurationType> summaryModel) {
// return new SystemConfigurationSummaryPanel(ID_SUMMARY_PANEL, summaryModel, WebComponentUtil.getSummaryPanelSpecification(SystemConfigurationType.class, getCompiledGuiProfile()));
// }
//
// @Override
// protected void setSummaryPanelVisibility(ObjectSummaryPanel<SystemConfigurationType> summaryPanel) {
// summaryPanel.setVisible(true);
// }
//
// @Override
// protected AbstractObjectMainPanel<SystemConfigurationType> createMainPanel(String id) {
// return new AbstractObjectMainPanel<>(id, getObjectModel(), this) {
//
// private static final long serialVersionUID = 1L;
//
// @Override
// protected List<ITab> createTabs(PageAdminObjectDetails<SystemConfigurationType> parentPage) {
// return PageAbstractSystemConfiguration.this.createTabs();
// }
//
// @Override
// protected boolean getOptionsPanelVisibility() {
// return false;
// }
//
// @Override
// protected boolean isPreviewButtonVisible() {
// return false;
// }
//
// };
// }
//
// @Override
// protected Class<? extends Page> getRestartResponsePage() {
// return PageSystemConfigurationNew.class;
// }
//
// <C extends Containerable> ContainerOfSystemConfigurationPanel<C> createContainerPanel(String panelId, IModel<? extends PrismContainerWrapper<C>> objectModel, ItemName propertyName, QName propertyType) {
// return new ContainerOfSystemConfigurationPanel<>(panelId, createModel(objectModel, propertyName), propertyType);
// }
//
// <C extends Containerable, T extends Containerable> PrismContainerWrapperModel<C, T> createModel(IModel<? extends PrismContainerWrapper<C>> model, ItemName itemName) {
// return PrismContainerWrapperModel.fromContainerWrapper(model, itemName);
// }
//
// protected abstract List<ITab> createTabs();
//
// @Override
// public void saveOrPreviewPerformed(AjaxRequestTarget target, OperationResult result, boolean previewOnly) {
//
// ProgressPanel progressPanel = getProgressPanel();
// progressPanel.hide();
// Task task = createSimpleTask(OPERATION_SEND_TO_SUBMIT);
// super.saveOrPreviewPerformed(target, result, previewOnly, task);
//
// try {
// TimeUnit.SECONDS.sleep(1);
// while(task.isClosed()) {TimeUnit.SECONDS.sleep(1);}
// } catch ( InterruptedException ex) {
// result.recomputeStatus();
// result.recordFatalError(getString("PageSystemConfiguration.message.saveOrPreviewPerformed.fatalError"), ex);
//
// LoggingUtils.logUnexpectedException(LOGGER, "Couldn't use sleep", ex);
// }
// result.recomputeStatus();
// target.add(getFeedbackPanel());
//
// if(result.getStatus().equals(OperationResultStatus.SUCCESS)) {
// showResult(result);
// redirectBack();
// }
// }
}

0 comments on commit 7376680

Please sign in to comment.