Skip to content

Commit

Permalink
resource attributes panel
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Apr 27, 2021
1 parent 774b053 commit 15d417b
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 11 deletions.
@@ -0,0 +1,14 @@
<!--
~ 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.
-->

<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div wicket:id="basic" />
<div wicket:id="attributes" />
</wicket:panel>
</html>
@@ -0,0 +1,87 @@
/*
* 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.component;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper;
import com.evolveum.midpoint.gui.impl.prism.panel.ResourceAttributePanel;
import com.evolveum.midpoint.gui.impl.prism.panel.SingleContainerPanel;
import com.evolveum.midpoint.prism.path.ItemPath;
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.AbstractRoleType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ConstructionType;

import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType;

import org.apache.wicket.model.IModel;

public class AssignmentConstructionPanel extends BasePanel<PrismContainerWrapper<ConstructionType>> {

private static final String ID_BASIC = "basic";
private static final String ID_ATTRIBUTES = "attributes";

public AssignmentConstructionPanel(String id, IModel<PrismContainerWrapper<ConstructionType>> model) {
super(id, model);
}

@Override
protected void onInitialize() {
super.onInitialize();
initLayout();
}

private void initLayout() {

SingleContainerPanel<ConstructionType> baseConstructionPanel = new SingleContainerPanel<>(ID_BASIC, getModel(), ConstructionType.COMPLEX_TYPE) {

@Override
protected ItemVisibility getVisibility(ItemPath itemPath) {
if (isAssociation(itemPath)) {
return ItemVisibility.HIDDEN;
}

if (isAttributePath(itemPath)) {
return ItemVisibility.HIDDEN;
}

if (ConstructionType.F_KIND.equivalent(itemPath.lastName())) {
return ItemVisibility.HIDDEN;
}

if (ConstructionType.F_INTENT.equivalent(itemPath.lastName())) {
return ItemVisibility.HIDDEN;
}

if (ConstructionType.F_RESOURCE_REF.equivalent(itemPath.lastName())) {
return ItemVisibility.HIDDEN;
}
return ItemVisibility.AUTO;
}
};
add(baseConstructionPanel);

ResourceAttributePanel attrsPanel = new ResourceAttributePanel(ID_ATTRIBUTES, PrismContainerWrapperModel.fromContainerWrapper(getModel(), ConstructionType.F_ATTRIBUTE));
add(attrsPanel);

}

private boolean isAttributePath(ItemPath itemPath) {
ItemPath assignmentAttribute = ItemPath.create(FocusType.F_ASSIGNMENT, AssignmentType.F_CONSTRUCTION, ConstructionType.F_ATTRIBUTE);
ItemPath inducementAttribute = ItemPath.create(AbstractRoleType.F_INDUCEMENT, AssignmentType.F_CONSTRUCTION, ConstructionType.F_ATTRIBUTE);
ItemPath pathWithoutIds = itemPath.namedSegmentsOnly();
return pathWithoutIds.equivalent(assignmentAttribute) || pathWithoutIds.equivalent(inducementAttribute);
}

private boolean isAssociation(ItemPath itemPath) {
ItemPath assignmentAssociation = ItemPath.create(FocusType.F_ASSIGNMENT, AssignmentType.F_CONSTRUCTION, ConstructionType.F_ASSOCIATION);
ItemPath inducementAssociation = ItemPath.create(AbstractRoleType.F_INDUCEMENT, AssignmentType.F_CONSTRUCTION, ConstructionType.F_ASSOCIATION);
ItemPath pathWithoutIds = itemPath.namedSegmentsOnly();
return pathWithoutIds.equivalent(assignmentAssociation) || pathWithoutIds.equivalent(inducementAssociation);
}
}
Expand Up @@ -214,7 +214,14 @@ public WebMarkupContainer createPanel(String panelId) {

}
private PanelTab createConstructionTabs() {
return createTabs("AssignmentType.construction", AssignmentType.F_CONSTRUCTION, ConstructionType.COMPLEX_TYPE);
return new PanelTab(createStringResource("AssignmentType.construction")) {

@Override
public WebMarkupContainer createPanel(String panelId) {
return new AssignmentConstructionPanel(panelId, PrismContainerWrapperModel.fromContainerValueWrapper(getModel(), AssignmentType.F_CONSTRUCTION));
}
};
// return createTabs("AssignmentType.construction", AssignmentType.F_CONSTRUCTION, ConstructionType.COMPLEX_TYPE);
}

private PanelTab createActivationTab() {
Expand Down
Expand Up @@ -133,14 +133,6 @@ protected List<CompositedIconButtonDto> createNewButtonDescription() {
return null;
}

// protected boolean isNewObjectButtonEnabled(){
// return true;
// }
//
// protected boolean getNewObjectGenericButtonVisibility(){
// return true;
// }

protected void newItemPerformed(AjaxRequestTarget target, AssignmentObjectRelation relationSepc) {

}
Expand Down
@@ -0,0 +1,14 @@
<!--
~ 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.
-->

<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div wicket:id="table" />

</wicket:panel>
</html>
Expand Up @@ -70,8 +70,8 @@ protected UserProfileStorage.TableId getTableId() {
protected List<IColumn<PrismContainerValueWrapper<ResourceAttributeDefinitionType>, String>> createDefaultColumns() {
List<IColumn<PrismContainerValueWrapper<ResourceAttributeDefinitionType>, String>> columns = new ArrayList<>();

columns.add(new PrismPropertyWrapperColumn<>(getModel(), ResourceAttributeDefinitionType.F_REF, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<>(getModel(), ResourceAttributeDefinitionType.F_DISPLAY_NAME, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<>(ResourceAttributePanel.this.getModel(), ResourceAttributeDefinitionType.F_REF, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
columns.add(new PrismPropertyWrapperColumn<>(ResourceAttributePanel.this.getModel(), ResourceAttributeDefinitionType.F_DISPLAY_NAME, AbstractItemWrapperColumn.ColumnType.STRING, getPageBase()));
return columns;
}
};
Expand Down
Expand Up @@ -398,6 +398,15 @@ public WebMarkupContainer createPanel(String panelId) {
}
});

tabs.add(new PanelTab(createStringResource("PageResource.tab.schemaHandling")) {
private static final long serialVersionUID = 1L;

@Override
public WebMarkupContainer createPanel(String panelId) {
return new ResourceConnectorPanel(panelId, null, resourceModel, PageResource.this);
}
});

AjaxTabbedPanel<ITab> resourceTabs = new AjaxTabbedPanel<ITab>(ID_TAB_PANEL, tabs) {
private static final long serialVersionUID = 1L;

Expand Down
@@ -0,0 +1,22 @@
/*
* 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.web.page.admin.resources;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SchemaHandlingType;

import org.apache.wicket.model.IModel;

public class ResourceSchemaHandlingPanel extends BasePanel<PrismContainerWrapper<SchemaHandlingType>> {

public ResourceSchemaHandlingPanel(String id, IModel<PrismContainerWrapper<SchemaHandlingType>> model) {
super(id, model);
}


}

0 comments on commit 15d417b

Please sign in to comment.