-
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.
Merge remote-tracking branch 'origin/master' into feature/simulations
- Loading branch information
Showing
14 changed files
with
465 additions
and
25 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
94 changes: 94 additions & 0 deletions
94
...n-gui/src/main/java/com/evolveum/midpoint/gui/impl/component/AbstractObjectListPanel.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,94 @@ | ||
/* | ||
* 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.MainObjectListPanel; | ||
import com.evolveum.midpoint.gui.api.util.WebComponentUtil; | ||
import com.evolveum.midpoint.gui.impl.component.search.Search; | ||
import com.evolveum.midpoint.gui.impl.component.search.SearchConfigurationWrapper; | ||
import com.evolveum.midpoint.gui.impl.component.search.SearchFactory; | ||
import com.evolveum.midpoint.gui.impl.page.admin.ObjectDetailsModels; | ||
import com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView; | ||
import com.evolveum.midpoint.prism.PrismContext; | ||
import com.evolveum.midpoint.prism.path.ItemPath; | ||
import com.evolveum.midpoint.prism.query.ObjectQuery; | ||
import com.evolveum.midpoint.util.QNameUtil; | ||
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.ISelectableDataProvider; | ||
import com.evolveum.midpoint.web.component.util.SelectableBean; | ||
import com.evolveum.midpoint.web.session.UserProfileStorage; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.*; | ||
|
||
import java.util.Arrays; | ||
|
||
public abstract class AbstractObjectListPanel<O extends ObjectType> extends MainObjectListPanel<O> { | ||
|
||
private final ObjectDetailsModels<O> objectDetailsModel; | ||
|
||
public AbstractObjectListPanel(String id, ObjectDetailsModels<O> model, ContainerPanelConfigurationType config) { | ||
super(id, (Class<O>) ObjectType.class, null, config); | ||
objectDetailsModel = model; | ||
} | ||
|
||
public ObjectDetailsModels<O> getObjectDetailsModel() { | ||
return objectDetailsModel; | ||
} | ||
|
||
@Override | ||
protected boolean isCreateNewObjectEnabled() { | ||
return false; | ||
} | ||
|
||
@Override | ||
protected ISelectableDataProvider<SelectableBean<O>> createProvider() { | ||
return createSelectableBeanObjectDataProvider(() -> getCustomizeContentQuery(), null); | ||
} | ||
|
||
protected ObjectQuery getCustomizeContentQuery(){ | ||
return null; | ||
} | ||
|
||
@Override | ||
protected Search createSearch(Class<O> type) { | ||
return SearchFactory.createSearch(createSearchBoxConfigurationWrapper(), getPageBase()); | ||
} | ||
|
||
protected SearchConfigurationWrapper<O> createSearchBoxConfigurationWrapper() { | ||
CompiledObjectCollectionView view = getObjectCollectionView(); | ||
|
||
SearchConfigurationWrapper<O> searchWrapper; | ||
if (getPanelConfiguration() != null | ||
&& getPanelConfiguration().getListView() != null | ||
&& getPanelConfiguration().getListView().getSearchBoxConfiguration() != null) { | ||
searchWrapper = new SearchConfigurationWrapper<>(getType(), getPanelConfiguration().getListView().getSearchBoxConfiguration(), getPageBase()); | ||
} else if (view != null && view.getSearchBoxConfiguration() != null) { | ||
searchWrapper = new SearchConfigurationWrapper<>(getType(), view.getSearchBoxConfiguration(), getPageBase()); | ||
} else { | ||
searchWrapper = new SearchConfigurationWrapper<>(getType(), getPageBase()); | ||
} | ||
|
||
if (view != null | ||
&& view.getCollection() != null | ||
&& view.getCollection().getCollectionRef() != null | ||
&& QNameUtil.match(ObjectCollectionType.COMPLEX_TYPE, view.getCollection().getCollectionRef().getType())) { | ||
searchWrapper.setCollectionRefOid(view.getCollection().getCollectionRef().getOid()); | ||
} | ||
|
||
return searchWrapper; | ||
} | ||
|
||
@Override | ||
protected String getStorageKey() { | ||
String suffix = getTableId().name(); | ||
if (getPanelConfiguration() != null) { | ||
suffix = getPanelConfiguration().getIdentifier(); | ||
} | ||
return WebComponentUtil.getObjectListPageStorageKey(suffix); | ||
} | ||
} |
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
60 changes: 60 additions & 0 deletions
60
...java/com/evolveum/midpoint/gui/impl/page/admin/abstractrole/component/InducedByPanel.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,60 @@ | ||
/* | ||
* 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.abstractrole.component; | ||
|
||
import com.evolveum.midpoint.gui.impl.component.AbstractObjectListPanel; | ||
import com.evolveum.midpoint.gui.impl.component.search.SearchConfigurationWrapper; | ||
import com.evolveum.midpoint.gui.impl.page.admin.ObjectDetailsModels; | ||
import com.evolveum.midpoint.prism.PrismContext; | ||
import com.evolveum.midpoint.prism.path.ItemPath; | ||
import com.evolveum.midpoint.prism.query.ObjectQuery; | ||
import com.evolveum.midpoint.web.application.*; | ||
import com.evolveum.midpoint.web.session.UserProfileStorage; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.*; | ||
|
||
import java.util.Arrays; | ||
|
||
@PanelType(name = "inducedBy") | ||
@PanelInstance(identifier = "inducedBy", | ||
applicableForType = AbstractRoleType.class, | ||
display = @PanelDisplay(label = "InducedByPanel.label", order = 130)) | ||
public class InducedByPanel<AR extends AbstractRoleType> extends AbstractObjectListPanel<AR> { | ||
|
||
public InducedByPanel(String id, ObjectDetailsModels<AR> model, ContainerPanelConfigurationType config) { | ||
super(id, model, config); | ||
} | ||
|
||
@Override | ||
protected Class<AR> getDefaultType() { | ||
return (Class<AR>) AbstractRoleType.class; | ||
} | ||
|
||
protected ObjectQuery getCustomizeContentQuery(){ | ||
return PrismContext.get().queryFor(AbstractRoleType.class) | ||
.item(ItemPath.create(AbstractRoleType.F_INDUCEMENT, AssignmentType.F_TARGET_REF)) | ||
.ref(getObjectDetailsModel().getObjectWrapper().getOid()).build(); | ||
} | ||
|
||
protected SearchConfigurationWrapper<AR> createSearchBoxConfigurationWrapper() { | ||
SearchConfigurationWrapper<AR> searchWrapper = super.createSearchBoxConfigurationWrapper(); | ||
if (searchWrapper.getAllowedTypeList().isEmpty()) { | ||
searchWrapper.getAllowedTypeList() | ||
.addAll(Arrays.asList( | ||
AbstractRoleType.class, | ||
OrgType.class, | ||
ArchetypeType.class, | ||
RoleType.class, | ||
ServiceType.class)); | ||
} | ||
return searchWrapper; | ||
} | ||
|
||
@Override | ||
protected UserProfileStorage.TableId getTableId() { | ||
return UserProfileStorage.TableId.PANEL_INDUCT_BY; | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
...evolveum/midpoint/gui/impl/page/admin/assignmentholder/component/RoleMembershipPanel.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,63 @@ | ||
/* | ||
* 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.assignmentholder.component; | ||
|
||
import com.evolveum.midpoint.gui.api.util.WebComponentUtil; | ||
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils; | ||
import com.evolveum.midpoint.gui.impl.component.AbstractObjectListPanel; | ||
import com.evolveum.midpoint.gui.impl.page.admin.ObjectDetailsModels; | ||
import com.evolveum.midpoint.prism.Containerable; | ||
import com.evolveum.midpoint.prism.PrismContext; | ||
import com.evolveum.midpoint.prism.PrismObject; | ||
import com.evolveum.midpoint.prism.path.ItemPath; | ||
import com.evolveum.midpoint.prism.query.ObjectQuery; | ||
import com.evolveum.midpoint.schema.result.OperationResult; | ||
import com.evolveum.midpoint.task.api.Task; | ||
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.session.UserProfileStorage; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.*; | ||
|
||
@PanelType(name = "roleMemberships") | ||
public class RoleMembershipPanel<AH extends AssignmentHolderType> extends AbstractObjectListPanel<AH> { | ||
|
||
public RoleMembershipPanel(String id, ObjectDetailsModels<AH> model, ContainerPanelConfigurationType config) { | ||
super(id, model, config); | ||
} | ||
|
||
@Override | ||
protected Class<AH> getDefaultType() { | ||
return (Class<AH>) AssignmentHolderType.class; | ||
} | ||
|
||
protected ObjectQuery getCustomizeContentQuery() { | ||
|
||
if (getPageBase().isNativeRepo()) { | ||
return getPrismContext().queryFor(AbstractRoleType.class) | ||
.referencedBy(getObjectDetailsModel().getObjectType().getClass(), AssignmentHolderType.F_ROLE_MEMBERSHIP_REF) | ||
.id(getObjectDetailsModel().getObjectWrapper().getOid()) | ||
.and().not().type(ArchetypeType.class) | ||
.build(); | ||
} | ||
|
||
String[] oids = getObjectDetailsModel().getObjectType().getRoleMembershipRef().stream() | ||
.filter(r -> r.getOid() != null) | ||
.map(r -> r.getOid()) | ||
.toArray(String[]::new); | ||
|
||
return getPrismContext().queryFor(AbstractRoleType.class) | ||
.id(oids) | ||
.and().not().type(ArchetypeType.class) | ||
.build(); | ||
} | ||
|
||
@Override | ||
protected UserProfileStorage.TableId getTableId() { | ||
return UserProfileStorage.TableId.PANEL_ROLE_MEMBERSHIP; | ||
} | ||
} |
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
Oops, something went wrong.