Skip to content

Commit

Permalink
started with object collection new page/panels
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Sep 13, 2021
1 parent 4c873aa commit 3df31e8
Show file tree
Hide file tree
Showing 8 changed files with 169 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<AH extends AssignmentHolderType> extends AbstractObjectMainPanel<AH, ObjectDetailsModels<AH>> {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<ObjectCollectionType, AssignmentHolderDetailsModel<ObjectCollectionType>> {

private static final Trace LOGGER = TraceManager.getTrace(PageObjectCollection.class);

public PageObjectCollection() {
super();
}

public PageObjectCollection(PageParameters parameters) {
super(parameters);
}

public PageObjectCollection(final PrismObject<ObjectCollectionType> unitToEdit) {
super(unitToEdit);
}

@Override
protected Class<ObjectCollectionType> getType() {
return ObjectCollectionType.class;
}

@Override
protected Panel createSummaryPanel(String id, LoadableModel<ObjectCollectionType> summaryModel) {
return new ObjectCollectionSummaryPanel(id, summaryModel, this);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2021 Evolveum
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org">
<body>
<wicket:panel>
<div class="row">
<div class="col-md-12">
<div wicket:id="panel" />
</div>
</div>
</wicket:panel>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -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<ObjectCollectionType, ObjectDetailsModels<ObjectCollectionType>> {
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<ObjectCollectionType> model, ContainerPanelConfigurationType config) {
super(id, model, config);
}

@Override
protected void initLayout() {
SingleContainerPanel panel =
new SingleContainerPanel<CollectionRefSpecificationType>(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 <C extends Containerable> PrismContainerWrapperModel<ObjectCollectionType, C> createModel(IModel<PrismObjectWrapper<ObjectCollectionType>> model, ItemName itemName) {
return PrismContainerWrapperModel.fromContainerWrapper(model, itemName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ private String getDescriptionLabel() {

PrismContainerWrapper<? extends Containerable> child = getModelObject().getSelectedChild();
//TODO only for provenance?
if (!child.isRuntimeSchema()) {
if (child != null && !child.isRuntimeSchema()) {
return getString(child.getTypeName().getLocalPart() + ".displayType");
}
return "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
};

Expand Down

0 comments on commit 3df31e8

Please sign in to comment.