Skip to content

Commit

Permalink
- configurable option for selecting new or old design
Browse files Browse the repository at this point in the history
- reviving create from template
- a but of cleanup (navigate to details panel for mainObjectListPanel)
  • Loading branch information
katkav committed Sep 8, 2021
1 parent 7be7913 commit ad0e843
Show file tree
Hide file tree
Showing 27 changed files with 66 additions and 210 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.Component;
import org.apache.wicket.RestartResponseException;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
Expand Down Expand Up @@ -575,4 +576,15 @@ public IModel<String> getConfirmationMessageModel(){
}
};
}

@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, O object) {
if (WebComponentUtil.hasDetailsPage(object.getClass())) {
WebComponentUtil.dispatchToObjectDetailsPage(object.getClass(), object.getOid(), this, true);
} else {
error("Could not find proper response page");
throw new RestartResponseException(getPageBase());
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,7 @@ public abstract class AbstractPageObjectDetails<O extends ObjectType, ODM extend
protected boolean previewRequested;

public AbstractPageObjectDetails() {
if (getObjectOidParameter() == null) {
ObjectTypes objectType = ObjectTypes.getObjectTypeIfKnown(getType());
Collection<CompiledObjectCollectionView> applicableArchetypes = getCompiledGuiProfile().findAllApplicableArchetypeViews(objectType.getTypeQName());
if (!applicableArchetypes.isEmpty()) {
PageParameters params = new PageParameters();
params.add("type", objectType.getRestType());
throw new RestartResponseException(PageCreateFromTemplate.class, params);
}
}
this(null, null);
}

public AbstractPageObjectDetails(PageParameters pageParameters) {
Expand All @@ -104,6 +96,16 @@ public AbstractPageObjectDetails(PrismObject<O> object) {

private AbstractPageObjectDetails(PageParameters params, PrismObject<O> object) {
super(params);

if (params == null && object == null) {
ObjectTypes objectType = ObjectTypes.getObjectTypeIfKnown(getType());
Collection<CompiledObjectCollectionView> applicableArchetypes = getCompiledGuiProfile().findAllApplicableArchetypeViews(objectType.getTypeQName());
if (!applicableArchetypes.isEmpty()) {
PageParameters templateParams = new PageParameters();
templateParams.add("type", objectType.getRestType());
throw new RestartResponseException(PageCreateFromTemplate.class, templateParams);
}
}
objectDetailsModels = createObjectDetailsModels(object);
initLayout();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,6 @@ protected UserProfileStorage.TableId getTableId() {
return AbstractRoleMemberPanel.this.getTableId(getComplexTypeQName());
}

@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, AH object) {
detailsPerformed(object);
}

@Override
protected boolean isObjectDetailsEnabled(IModel<SelectableBean<AH>> rowModel) {
if (rowModel == null || rowModel.getObject() == null
Expand Down Expand Up @@ -1040,14 +1035,14 @@ protected ObjectQuery createAllMemberQuery(Collection<QName> relations) {
.build();
}

protected void detailsPerformed(ObjectType object) {
if (WebComponentUtil.hasDetailsPage(object.getClass())) {
WebComponentUtil.dispatchToObjectDetailsPage(object.getClass(), object.getOid(), this, true);
} else {
error("Could not find proper response page");
throw new RestartResponseException(getPageBase());
}
}
// protected void detailsPerformed(ObjectType object) {
// if (WebComponentUtil.hasDetailsPage(object.getClass())) {
// WebComponentUtil.dispatchToObjectDetailsPage(object.getClass(), object.getOid(), this, true);
// } else {
// error("Could not find proper response page");
// throw new RestartResponseException(getPageBase());
// }
// }

private Collection<SelectorOptions<GetOperationOptions>> getSearchOptions() {
return SelectorOptions.createCollection(GetOperationOptions.createDistinct());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@ protected void initLayout() {
MainObjectListPanel<CaseType> table = new MainObjectListPanel<CaseType>(ID_CHILD_CASES_PANEL,
CaseType.class, Collections.emptyList()) {

@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, CaseType caseInstance) {
PageParameters pageParameters = new PageParameters();
pageParameters.add(OnePageParameterEncoder.PARAMETER, caseInstance.getOid());
ChildCasesPanel.this.getPageBase().navigateToNext(PageCase.class, pageParameters);
}

@Override
protected List<IColumn<SelectableBean<CaseType>, String>> createDefaultColumns() {
List<IColumn<SelectableBean<CaseType>, String>> columns = new ArrayList<IColumn<SelectableBean<CaseType>, String>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
description = "PageOrgUnit.auth.orgUnit.description") })
public class PageOrg extends PageFocusDetails<OrgType, FocusDetailsModels<OrgType>> {

public PageOrg() {
super();
}

public PageOrg(PageParameters pageParameters) {
super(pageParameters);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ public class PageReport extends PageAssignmentHolderDetails<ReportType, Assignme

private Boolean runReport = false;

public PageReport() {
super();
}

public PageReport(PageParameters pageParameters) {
super(pageParameters);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,6 @@ protected List<InlineMenuItem> createInlineMenu() {
return null;
}

@Override
public void objectDetailsPerformed(AjaxRequestTarget target, TaskType task) {
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, task.getOid());
getPageBase().navigateToNext(PageTask.class, parameters);
}

@Override
protected void newObjectPerformed(AjaxRequestTarget target, AssignmentObjectRelation relation, CompiledObjectCollectionView collectionView) {
if (collectionView == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
@AuthorizationAction(actionUri = AuthorizationConstants.AUTZ_UI_ROLE_URL, label = "PageRole.auth.role.label", description = "PageRole.auth.role.description") })
public class PageRole extends PageFocusDetails<RoleType, FocusDetailsModels<RoleType>> {

public PageRole() {
super();
}

public PageRole(PageParameters pageParameters) {
super(pageParameters);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
description = "PageService.auth.role.description") })
public class PageService extends PageFocusDetails<ServiceType, FocusDetailsModels<ServiceType>> {

public PageService() {
super();
}

public PageService(PageParameters pageParameters) {
super(pageParameters);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@
})
public class PageTask extends PageAssignmentHolderDetails<TaskType, AssignmentHolderDetailsModel<TaskType>> {

public PageTask() {
super();
}

public PageTask(PageParameters pageParameters) {
super(pageParameters);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
*/
boolean loginPage() default false;

/**
* If set to true, page is available only if the experimental features are turned on.
* Also, the link in the sidebar panel (on the left) is visible for experimental pages only
* if the experimental featires are on.
*/
boolean experimental() default false;

}
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,12 @@ private void initLayout() {
add(mainForm);

MainObjectListPanel<ArchetypeType> table = new MainObjectListPanel<ArchetypeType>(ID_TABLE, ArchetypeType.class) {
@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, ArchetypeType archetype) {
PageParameters pageParameters = new PageParameters();
pageParameters.add(OnePageParameterEncoder.PARAMETER, archetype.getOid());
navigateToNext(PageArchetype.class, pageParameters);
}

@Override
protected TableId getTableId() {
return UserProfileStorage.TableId.TABLE_ARCHETYPES;
}

// @Override
// protected List<IColumn<SelectableBean<ArchetypeType>, String>> createDefaultColumns() {
// return ColumnUtils.getDefaultArchetypeColumns();
// }

@Override
protected IColumn<SelectableBean<ArchetypeType>, String> createCheckboxColumn() {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,6 @@ private void initLayout() {
MainObjectListPanel<CaseType> table = new MainObjectListPanel<CaseType>(ID_CHILD_CASES_PANEL,
CaseType.class, Collections.emptyList()) {

@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, CaseType caseInstance) {
PageParameters pageParameters = new PageParameters();
pageParameters.add(OnePageParameterEncoder.PARAMETER, caseInstance.getOid());
ChildCasesTabPanel.this.getPageBase().navigateToNext(PageCase.class, pageParameters);
}

@Override
protected List<IColumn<SelectableBean<CaseType>, String>> createDefaultColumns() {
List<IColumn<SelectableBean<CaseType>, String>> columns = new ArrayList<IColumn<SelectableBean<CaseType>, String>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ private void initLayout() {
add(mainForm);

MainObjectListPanel<ObjectCollectionType> table = new MainObjectListPanel<ObjectCollectionType>(ID_TABLE, ObjectCollectionType.class) {
@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, ObjectCollectionType collection) {
PageParameters pageParameters = new PageParameters();
pageParameters.add(OnePageParameterEncoder.PARAMETER, collection.getOid());
navigateToNext(PageObjectCollection.class, pageParameters);
}

@Override
protected UserProfileStorage.TableId getTableId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ private void initLayout() {
add(mainForm);

MainObjectListPanel<ObjectTemplateType> table = new MainObjectListPanel<ObjectTemplateType>(ID_TABLE, ObjectTemplateType.class) {
@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, ObjectTemplateType template) {
PageParameters pageParameters = new PageParameters();
pageParameters.add(OnePageParameterEncoder.PARAMETER, template.getOid());
navigateToNext(PageObjectTemplate.class, pageParameters);
}

@Override
protected UserProfileStorage.TableId getTableId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ protected void initLayout() {
add(mainForm);

MainObjectListPanel<OrgType> table = new MainObjectListPanel<OrgType>(ID_TABLE, OrgType.class, getQueryOptions()) {
@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, OrgType org) {
PageOrgs.this.orgDetailsPerformed(target, org.getOid());
}

@Override
protected UserProfileStorage.TableId getTableId() {
Expand Down Expand Up @@ -135,12 +131,6 @@ private Collection<SelectorOptions<GetOperationOptions>> getQueryOptions() {
.build();
}

private void orgDetailsPerformed(AjaxRequestTarget target, String oid) {
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, oid);
navigateToNext(PageOrg.class, parameters);
}

private IModel<String> getConfirmationMessageModel(ColumnMenuAction action, String actionName){
return WebComponentUtil.createAbstractRoleConfirmationMessage(actionName, action, getObjectListPanel(), this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,7 @@ private void initLayout() {
add(mainForm);

MainObjectListPanel<ReportType> table = new MainObjectListPanel<ReportType>(ID_TABLE, ReportType.class) {
@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, ReportType reportType) {
PageParameters pageParameters = new PageParameters();
pageParameters.add(OnePageParameterEncoder.PARAMETER, reportType.getOid());
navigateToNext(PageReport.class, pageParameters);
}


@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.PAGE_REPORTS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ protected void initLayout() {
MainObjectListPanel<ConnectorHostType> table = new MainObjectListPanel<ConnectorHostType>(ID_TABLE, ConnectorHostType.class, getQueryOptions()) {
@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, ConnectorHostType host) {
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, host.getOid());
navigateToNext(PageUser.class, parameters);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,6 @@ protected void initLayout() {
add(mainForm);

MainObjectListPanel<ResourceType> table = new MainObjectListPanel<ResourceType>(ID_TABLE, ResourceType.class, getQueryOptions()) {
@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, ResourceType resource) {
PageResources.this.resourceDetailsPerformed(target, resource.getOid());
}

@Override
protected UserProfileStorage.TableId getTableId() {
Expand All @@ -122,11 +118,6 @@ protected List<IColumn<SelectableBean<ResourceType>, String>> createDefaultColum
return PageResources.this.initResourceColumns();
}

// @Override
// protected IColumn<SelectableBean<ResourceType>, String> createCheckboxColumn() {
// return null;
// }

@Override
protected List<InlineMenuItem> createInlineMenu() {
return PageResources.this.createRowMenuItems();
Expand Down Expand Up @@ -335,14 +326,6 @@ private List<IColumn<SelectableBean<ResourceType>, String>> initResourceColumns(
return columns;
}

private void resourceDetailsPerformed(AjaxRequestTarget target, String oid) {
clearSessionStorageForResourcePage();

PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, oid);
navigateToNext(PageResource.class, parameters);
}

private List<ResourceType> isAnyResourceSelected(AjaxRequestTarget target, ResourceType single) {
return single != null
? Collections.singletonList(single)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,34 +113,16 @@ protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.PAGE_RESOURCE_TASKS_PANEL;
}

// @Override
// protected ISelectableDataProvider<TaskType, SelectableBean<TaskType>> createProvider() {
// return new SelectableListDataProvider<>(pageBase, tasks);
// }

@Override
protected ISelectableDataProvider<TaskType, SelectableBean<TaskType>> createProvider() {
return createSelectableBeanObjectDataProvider(() -> createResourceTasksQuery(), null);
}

// @Override
// protected ObjectQuery getCustomizeContentQuery() {
// return
//
// }

@Override
protected List<InlineMenuItem> createInlineMenu() {
return null;
}

@Override
public void objectDetailsPerformed(AjaxRequestTarget target, TaskType task) {
PageParameters parameters = new PageParameters();
parameters.add(OnePageParameterEncoder.PARAMETER, task.getOid());
getPageBase().navigateToNext(PageTask.class, parameters);
}

@Override
protected void newObjectPerformed(AjaxRequestTarget target, AssignmentObjectRelation relation, CompiledObjectCollectionView collectionView) {
if (collectionView == null) {
Expand Down

0 comments on commit ad0e843

Please sign in to comment.