-
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.
simulations, processed result objects page. prepared for all objects …
…and objects filtered by tag
- Loading branch information
Showing
7 changed files
with
251 additions
and
14 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
...ava/com/evolveum/midpoint/gui/impl/page/admin/simulation/PageSimulationResultObjects.html
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,16 @@ | ||
<!-- | ||
~ 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"> | ||
<body> | ||
<wicket:extend> | ||
<div class="row" > | ||
<div class="col-md-12" wicket:id="table"/> | ||
</div> | ||
</wicket:extend> | ||
</body> | ||
</html> |
101 changes: 101 additions & 0 deletions
101
...ava/com/evolveum/midpoint/gui/impl/page/admin/simulation/PageSimulationResultObjects.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,101 @@ | ||
/* | ||
* Copyright (c) 2010-2023 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.simulation; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
import org.apache.wicket.RestartResponseException; | ||
import org.apache.wicket.model.IModel; | ||
import org.apache.wicket.request.mapper.parameter.PageParameters; | ||
import org.apache.wicket.request.mapper.parameter.PageParametersEncoder; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import com.evolveum.midpoint.authentication.api.authorization.AuthorizationAction; | ||
import com.evolveum.midpoint.authentication.api.authorization.PageDescriptor; | ||
import com.evolveum.midpoint.authentication.api.authorization.Url; | ||
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils; | ||
import com.evolveum.midpoint.security.api.AuthorizationConstants; | ||
import com.evolveum.midpoint.web.page.admin.PageAdmin; | ||
import com.evolveum.midpoint.web.page.error.PageError404; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.SimulationResultType; | ||
|
||
/** | ||
* Created by Viliam Repan (lazyman). | ||
*/ | ||
@PageDescriptor( | ||
urls = { | ||
@Url(mountUrl = "/admin/simulations/result/${RESULT_OID}/objects"), | ||
@Url(mountUrl = "/admin/simulations/result/${RESULT_OID}/tag/${TAG_OID}") | ||
}, | ||
encoder = PageParametersEncoder.class, | ||
// todo authorizations | ||
action = { | ||
@AuthorizationAction(actionUri = AuthorizationConstants.AUTZ_UI_SIMULATIONS_ALL_URL, | ||
label = "PageSimulationResults.auth.simulationsAll.label", | ||
description = "PageSimulationResults.auth.simulationsAll.description"), | ||
@AuthorizationAction(actionUri = AuthorizationConstants.AUTZ_UI_SIMULATION_RESULT_URL, | ||
label = "PageSimulationResults.auth.simulationResult.label", | ||
description = "PageSimulationResults.auth.simulationResult.description") | ||
} | ||
) | ||
public class PageSimulationResultObjects extends PageAdmin { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
private static final String PAGE_PARAMETER_RESULT_OID = "RESULT_OID"; | ||
private static final String PAGE_PARAMETER_TAG_OID = "TAG_OID"; | ||
|
||
private static final String ID_TABLE = "table"; | ||
|
||
public PageSimulationResultObjects() { | ||
this(new PageParameters()); | ||
} | ||
|
||
public PageSimulationResultObjects(PageParameters parameters) { | ||
super(parameters); | ||
|
||
initLayout(); | ||
} | ||
|
||
private void initLayout() { | ||
ProcessedObjectsPanel table = new ProcessedObjectsPanel(ID_TABLE) { | ||
|
||
@Override | ||
protected @NotNull String getSimulationResultOid() { | ||
String oid = getPageParameterResultOid(); | ||
if (StringUtils.isEmpty(oid)) { | ||
throw new RestartResponseException(PageError404.class); | ||
} | ||
|
||
return oid; | ||
} | ||
}; | ||
add(table); | ||
} | ||
|
||
private String getPageParameterResultOid() { | ||
PageParameters params = getPageParameters(); | ||
return params.get(PAGE_PARAMETER_RESULT_OID).toString(); | ||
} | ||
|
||
@Override | ||
protected IModel<String> createPageTitleModel() { | ||
return () -> { | ||
String oid = getPageParameterResultOid(); | ||
|
||
if (StringUtils.isEmpty(oid)) { | ||
throw new RestartResponseException(PageError404.class); | ||
} | ||
|
||
String name = WebModelServiceUtils.resolveReferenceName( | ||
new ObjectReferenceType().oid(oid).type(SimulationResultType.COMPLEX_TYPE), this); | ||
|
||
return getString("PageSimulationResultObjects.title", name); | ||
}; | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
...main/java/com/evolveum/midpoint/gui/impl/page/admin/simulation/ProcessedObjectsPanel.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,69 @@ | ||
/* | ||
* Copyright (c) 2010-2023 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.simulation; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import com.evolveum.midpoint.gui.impl.component.ContainerableListPanel; | ||
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.SimulationResultProcessedObjectType; | ||
|
||
/** | ||
* Created by Viliam Repan (lazyman). | ||
*/ | ||
public class ProcessedObjectsPanel extends ContainerableListPanel<SimulationResultProcessedObjectType, SelectableBean<SimulationResultProcessedObjectType>> { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
public ProcessedObjectsPanel(String id) { | ||
super(id, SimulationResultProcessedObjectType.class); | ||
} | ||
|
||
@Override | ||
protected UserProfileStorage.TableId getTableId() { | ||
return UserProfileStorage.TableId.PAGE_SIMULATION_RESULT_PROCESSED_OBJECTS; | ||
} | ||
|
||
@Override | ||
protected SimulationResultProcessedObjectType getRowRealValue(SelectableBean<SimulationResultProcessedObjectType> bean) { | ||
return bean != null ? bean.getValue() : null; | ||
} | ||
|
||
@Override | ||
protected IColumn<SelectableBean<SimulationResultProcessedObjectType>, String> createIconColumn() { | ||
// TODO | ||
return null; | ||
} | ||
|
||
@Override | ||
protected ISelectableDataProvider<SelectableBean<SimulationResultProcessedObjectType>> createProvider() { | ||
return new ProcessedObjectsProvider(this, getSearchModel()) { | ||
|
||
@Override | ||
protected @NotNull String getSimulationResultOid() { | ||
return ProcessedObjectsPanel.this.getSimulationResultOid(); | ||
} | ||
}; | ||
} | ||
|
||
@NotNull | ||
protected String getSimulationResultOid() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<SimulationResultProcessedObjectType> getSelectedRealObjects() { | ||
return getSelectedObjects().stream().map(o -> o.getValue()).collect(Collectors.toList()); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...n/java/com/evolveum/midpoint/gui/impl/page/admin/simulation/ProcessedObjectsProvider.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,43 @@ | ||
/* | ||
* Copyright (c) 2010-2023 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.simulation; | ||
|
||
import org.apache.wicket.Component; | ||
import org.apache.wicket.model.IModel; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import com.evolveum.midpoint.gui.impl.component.search.Search; | ||
import com.evolveum.midpoint.prism.query.ObjectQuery; | ||
import com.evolveum.midpoint.web.component.data.SelectableBeanContainerDataProvider; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.SimulationResultProcessedObjectType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.SimulationResultType; | ||
|
||
/** | ||
* Created by Viliam Repan (lazyman). | ||
*/ | ||
public class ProcessedObjectsProvider extends SelectableBeanContainerDataProvider<SimulationResultProcessedObjectType> { | ||
|
||
public ProcessedObjectsProvider(Component component, @NotNull IModel<Search<SimulationResultProcessedObjectType>> search) { | ||
super(component, search, null, false); | ||
} | ||
|
||
@Override | ||
protected ObjectQuery getCustomizeContentQuery() { | ||
String oid = getSimulationResultOid(); | ||
|
||
return getPrismContext().queryFor(SimulationResultProcessedObjectType.class) | ||
.ownedBy(SimulationResultType.class, SimulationResultType.F_PROCESSED_OBJECT) | ||
.id(oid) | ||
.build(); | ||
} | ||
|
||
@NotNull | ||
protected String getSimulationResultOid() { | ||
return null; | ||
} | ||
} |
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