From 3df31e8089d591ceaef80a7b1e7358ad6c1e1458 Mon Sep 17 00:00:00 2001 From: kate Date: Tue, 14 Sep 2021 00:44:17 +0200 Subject: [PATCH] started with object collection new page/panels --- .../api/DefaultGuiConfigurationCompiler.java | 1 + .../gui/api/util/WebComponentUtil.java | 2 +- .../AssignmentHolderAssignmentPanel.java | 5 +- .../PageObjectCollection.java | 70 ++++++++++++++++++ .../component/BaseCollectionPanel.html | 20 +++++ .../component/BaseCollectionPanel.java | 73 +++++++++++++++++++ .../prism/panel/ProvenanceMetadataPanel.java | 2 +- .../web/application/DescriptorLoader.java | 1 + 8 files changed, 169 insertions(+), 5 deletions(-) create mode 100644 gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/page/admin/objectcollection/PageObjectCollection.java create mode 100644 gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/page/admin/objectcollection/component/BaseCollectionPanel.html create mode 100644 gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/page/admin/objectcollection/component/BaseCollectionPanel.java diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/DefaultGuiConfigurationCompiler.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/DefaultGuiConfigurationCompiler.java index 03db406030e..feca2d8c5e2 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/DefaultGuiConfigurationCompiler.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/DefaultGuiConfigurationCompiler.java @@ -63,6 +63,7 @@ public class DefaultGuiConfigurationCompiler implements GuiProfileCompilable { "com.evolveum.midpoint.gui.impl.page.admin.org.component", "com.evolveum.midpoint.gui.impl.page.admin.cases.component", "com.evolveum.midpoint.gui.impl.page.admin.user.component", + "com.evolveum.midpoint.gui.impl.page.admin.objectcollection.component", "com.evolveum.midpoint.gui.impl.page.admin.report.component" }; diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/util/WebComponentUtil.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/util/WebComponentUtil.java index 922e7543742..b4fbf0ff21c 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/util/WebComponentUtil.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/util/WebComponentUtil.java @@ -255,7 +255,7 @@ public final class WebComponentUtil { OBJECT_DETAILS_PAGE_MAP_NEW.put(CaseType.class, com.evolveum.midpoint.gui.impl.page.admin.cases.PageCase.class); OBJECT_DETAILS_PAGE_MAP_NEW.put(ArchetypeType.class, PageArchetype.class); OBJECT_DETAILS_PAGE_MAP_NEW.put(ShadowType.class, PageAccount.class); - OBJECT_DETAILS_PAGE_MAP_NEW.put(ObjectCollectionType.class, PageObjectCollection.class); + OBJECT_DETAILS_PAGE_MAP_NEW.put(ObjectCollectionType.class, com.evolveum.midpoint.gui.impl.page.admin.objectcollection.PageObjectCollection.class); OBJECT_DETAILS_PAGE_MAP_NEW.put(ObjectTemplateType.class, PageObjectTemplate.class); } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/page/admin/assignmentholder/component/AssignmentHolderAssignmentPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/page/admin/assignmentholder/component/AssignmentHolderAssignmentPanel.java index 3f4e95ffba3..77bdab9a133 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/page/admin/assignmentholder/component/AssignmentHolderAssignmentPanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/page/admin/assignmentholder/component/AssignmentHolderAssignmentPanel.java @@ -11,19 +11,18 @@ import com.evolveum.midpoint.gui.impl.page.admin.AbstractObjectMainPanel; import com.evolveum.midpoint.gui.impl.page.admin.ObjectDetailsModels; import com.evolveum.midpoint.web.application.*; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ContainerPanelConfigurationType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.*; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.model.Model; import com.evolveum.midpoint.web.component.assignment.SwitchAssignmentTypePanel; import com.evolveum.midpoint.web.model.PrismContainerWrapperModel; -import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentHolderType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType; //@PanelType(name = "assignments", defaultContainerPath = "assignment") @PanelInstance(identifier = "assignments", applicableFor = AssignmentHolderType.class, + notApplicableFor = ObjectCollectionType.class, display = @PanelDisplay(label = "pageAdminFocus.assignments", icon = GuiStyleConstants.EVO_ASSIGNMENT_ICON, order = 30)) @Counter(provider = AssignmentCounter.class) public class AssignmentHolderAssignmentPanel extends AbstractObjectMainPanel> { diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/page/admin/objectcollection/PageObjectCollection.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/page/admin/objectcollection/PageObjectCollection.java new file mode 100644 index 00000000000..b111a275159 --- /dev/null +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/page/admin/objectcollection/PageObjectCollection.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2021 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.objectcollection; + +import com.evolveum.midpoint.gui.api.model.LoadableModel; +import com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.AssignmentHolderDetailsModel; +import com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.PageAssignmentHolderDetails; + +import com.evolveum.midpoint.xml.ns._public.common.common_3.*; + +import org.apache.wicket.markup.html.panel.Panel; +import org.apache.wicket.request.mapper.parameter.PageParameters; +import com.evolveum.midpoint.prism.PrismObject; +import com.evolveum.midpoint.security.api.AuthorizationConstants; +import com.evolveum.midpoint.util.logging.Trace; +import com.evolveum.midpoint.util.logging.TraceManager; +import com.evolveum.midpoint.web.application.AuthorizationAction; +import com.evolveum.midpoint.web.application.PageDescriptor; +import com.evolveum.midpoint.web.application.Url; +import com.evolveum.midpoint.web.page.admin.configuration.PageAdminConfiguration; +import com.evolveum.midpoint.web.page.admin.objectCollection.ObjectCollectionSummaryPanel; +import com.evolveum.midpoint.web.util.OnePageParameterEncoder; + +@PageDescriptor( + urls = { + @Url(mountUrl = "/admin/newObjectCollection") + }, + encoder = OnePageParameterEncoder.class, + action = { + @AuthorizationAction(actionUri = PageAdminConfiguration.AUTH_CONFIGURATION_ALL, + label = PageAdminConfiguration.AUTH_CONFIGURATION_ALL_LABEL, + description = PageAdminConfiguration.AUTH_CONFIGURATION_ALL_DESCRIPTION), + @AuthorizationAction(actionUri = AuthorizationConstants.AUTZ_UI_OBJECT_COLLECTIONS_ALL_URL, + label = "PageObjectCollection.auth.objectCollectionsAll.label", + description = "PageObjectCollection.auth.objectCollectionsAll.description"), + @AuthorizationAction(actionUri = AuthorizationConstants.AUTZ_UI_OBJECT_COLLECTION_URL, + label = "PageObjectCollection.auth.objectCollection.label", + description = "PageObjectCollection.auth.objectCollection.description") + }) +public class PageObjectCollection extends PageAssignmentHolderDetails> { + + private static final Trace LOGGER = TraceManager.getTrace(PageObjectCollection.class); + + public PageObjectCollection() { + super(); + } + + public PageObjectCollection(PageParameters parameters) { + super(parameters); + } + + public PageObjectCollection(final PrismObject unitToEdit) { + super(unitToEdit); + } + + @Override + protected Class getType() { + return ObjectCollectionType.class; + } + + @Override + protected Panel createSummaryPanel(String id, LoadableModel summaryModel) { + return new ObjectCollectionSummaryPanel(id, summaryModel, this); + } + +} diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/page/admin/objectcollection/component/BaseCollectionPanel.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/page/admin/objectcollection/component/BaseCollectionPanel.html new file mode 100644 index 00000000000..234b6e2f93e --- /dev/null +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/page/admin/objectcollection/component/BaseCollectionPanel.html @@ -0,0 +1,20 @@ + + + + + + +
+
+
+
+
+ + + diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/page/admin/objectcollection/component/BaseCollectionPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/page/admin/objectcollection/component/BaseCollectionPanel.java new file mode 100644 index 00000000000..ff2575cc583 --- /dev/null +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/page/admin/objectcollection/component/BaseCollectionPanel.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2021 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.objectcollection.component; + +import org.apache.wicket.model.IModel; + +import com.evolveum.midpoint.gui.api.prism.ItemStatus; +import com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper; +import com.evolveum.midpoint.gui.api.prism.wrapper.PrismObjectWrapper; +import com.evolveum.midpoint.gui.impl.page.admin.AbstractObjectMainPanel; +import com.evolveum.midpoint.gui.impl.page.admin.ObjectDetailsModels; +import com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.AssignmentHolderDetailsModel; +import com.evolveum.midpoint.gui.impl.page.admin.task.component.TaskActivityPanel; +import com.evolveum.midpoint.gui.impl.prism.panel.SingleContainerPanel; +import com.evolveum.midpoint.prism.Containerable; +import com.evolveum.midpoint.prism.path.ItemName; +import com.evolveum.midpoint.prism.path.ItemPath; +import com.evolveum.midpoint.util.logging.Trace; +import com.evolveum.midpoint.util.logging.TraceManager; +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.prism.ItemVisibility; +import com.evolveum.midpoint.web.model.PrismContainerWrapperModel; +import com.evolveum.midpoint.xml.ns._public.common.common_3.CollectionRefSpecificationType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ContainerPanelConfigurationType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectCollectionType; + +@PanelType(name = "baseCollection") +@PanelInstance(identifier = "baseCollection", + applicableFor = ObjectCollectionType.class, + status = ItemStatus.NOT_CHANGED, + display = @PanelDisplay(label = "pageObjectCollection.baseCollection.title", order = 40)) +public class BaseCollectionPanel extends AbstractObjectMainPanel> { + private static final long serialVersionUID = 1L; + + private static final Trace LOGGER = TraceManager.getTrace(BaseCollectionPanel.class); + private static final String ID_PANEL = "panel"; + + private static final String DOT_CLASS = BaseCollectionPanel.class.getName() + "."; + + public BaseCollectionPanel(String id, AssignmentHolderDetailsModel model, ContainerPanelConfigurationType config) { + super(id, model, config); + } + + @Override + protected void initLayout() { + SingleContainerPanel panel = + new SingleContainerPanel(ID_PANEL, + createModel(getObjectWrapperModel(), ObjectCollectionType.F_BASE_COLLECTION), + CollectionRefSpecificationType.COMPLEX_TYPE) { + private static final long serialVersionUID = 1L; + + @Override + protected ItemVisibility getVisibility(ItemWrapper itemWrapper) { + if (ItemPath.create(ObjectCollectionType.F_BASE_COLLECTION, CollectionRefSpecificationType.F_BASE_COLLECTION_REF) + .isSuperPathOrEquivalent(itemWrapper.getPath())) { + return ItemVisibility.HIDDEN; + } + return ItemVisibility.AUTO; + } + }; + add(panel); + } + + private PrismContainerWrapperModel createModel(IModel> model, ItemName itemName) { + return PrismContainerWrapperModel.fromContainerWrapper(model, itemName); + } +} diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/prism/panel/ProvenanceMetadataPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/prism/panel/ProvenanceMetadataPanel.java index eac35a21c1f..0a9f886ecd6 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/prism/panel/ProvenanceMetadataPanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/prism/panel/ProvenanceMetadataPanel.java @@ -231,7 +231,7 @@ private String getDescriptionLabel() { PrismContainerWrapper child = getModelObject().getSelectedChild(); //TODO only for provenance? - if (!child.isRuntimeSchema()) { + if (child != null && !child.isRuntimeSchema()) { return getString(child.getTypeName().getLocalPart() + ".displayType"); } return ""; diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/application/DescriptorLoader.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/application/DescriptorLoader.java index 06b549b4d2b..24513606287 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/application/DescriptorLoader.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/application/DescriptorLoader.java @@ -65,6 +65,7 @@ public final class DescriptorLoader implements DebugDumpable { "com.evolveum.midpoint.gui.impl.page.admin.service", "com.evolveum.midpoint.gui.impl.page.admin.task", "com.evolveum.midpoint.gui.impl.page.admin.user", + "com.evolveum.midpoint.gui.impl.page.admin.objectcollection", "com.evolveum.midpoint.gui.impl.page.admin.report" };