Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/forgot-user…
Browse files Browse the repository at this point in the history
…name

* origin/master: (22 commits)
  Added test suite for PreparedQuery and TypedQuery to showcase its use.
  Added convenience functinos to MidpointFunctions and ModelService
  Documented Midpoint PreparedQuery and TypedQuery, made APIs more user friendly
  rename header of lifecycle state column
  better layout for query playground
  - query playground adapted to axiom query.. - added converter tab (from xml/json/yaml to axiom) - updated samples to axiom
  mark element 'enabled' on AbstractMappingType as depracated
  MID-8409: adding option for creating of resource as 'copy from template'
  fix for reopen wizard steps panel
  Fix postgres-new-upgrade.sql
  Fix origin determination in ImportController
  search parameters for history panel (plus some cleanup)
  Add "evaluateExpression" bulk action
  Make TestUtil#CHECK_RESULTS final
  Revert change to TestUtils
  Updated database to store ActivityAffectedObjects
  support for opening links on new tab (supported for all main object lists, e.g. users, roles, resources,... and supported also for audit log)
  Resolve merge conflicts
  Prepare scripting/library execution profiles
  Fix "affected objects" schema
  ...
  • Loading branch information
katkav committed Aug 8, 2023
2 parents 1e52022 + af9fe9c commit e5ab1b7
Show file tree
Hide file tree
Showing 307 changed files with 7,070 additions and 3,256 deletions.
60 changes: 31 additions & 29 deletions config/sql/native-new/postgres-new-upgrade.sql
Original file line number Diff line number Diff line change
Expand Up @@ -325,38 +325,12 @@ $aa$);

-- Task Affected Indexing (Changes to types)
call apply_change(16, $aa$
ALTER TYPE ContainerType ADD VALUE IF NOT EXISTS 'AFFECTED_RESOURCE_OBJECTS' AFTER 'ACCESS_CERTIFICATION_WORK_ITEM';
ALTER TYPE ContainerType ADD VALUE IF NOT EXISTS 'AFFECTED_OBJECTS' AFTER 'AFFECTED_RESOURCE_OBJECTS';
ALTER TYPE ContainerType ADD VALUE IF NOT EXISTS 'AFFECTED_OBJECTS' AFTER 'ACCESS_CERTIFICATION_WORK_ITEM';
$aa$);

-- Task Affected Indexing (tables)

call apply_change(17, $aa$
CREATE TABLE m_task_affected_resource_objects (
ownerOid UUID NOT NULL REFERENCES m_object_oid(oid) ON DELETE CASCADE,
containerType ContainerType GENERATED ALWAYS AS ('AFFECTED_RESOURCE_OBJECTS') STORED
CHECK (containerType = 'AFFECTED_RESOURCE_OBJECTS'),
objectClassId INTEGER REFERENCES m_uri(id),
resourceRefTargetOid UUID,
resourceRefTargetType ObjectType,
resourceRefRelationId INTEGER REFERENCES m_uri(id),
intent TEXT,
kind ShadowKindType,
PRIMARY KEY (ownerOid, cid)
) INHERITS(m_container);

CREATE TABLE m_task_affected_objects (
ownerOid UUID NOT NULL REFERENCES m_object_oid(oid) ON DELETE CASCADE,
containerType ContainerType GENERATED ALWAYS AS ('AFFECTED_OBJECTS') STORED
CHECK (containerType = 'AFFECTED_OBJECTS'),
type ObjectType,
archetypeRefTargetOid UUID,
archetypeRefTargetType ObjectType,
archetypeRefRelationId INTEGER REFERENCES m_uri(id),
PRIMARY KEY (ownerOid, cid)
) INHERITS(m_container);
-- Task Affected Indexing (tables), empty now, replaced with change 19

$aa$);
call apply_change(17, $$ SELECT 1 $$, true);


-- Resource/super/resourceRef Indexing (tables)
Expand All @@ -365,7 +339,35 @@ ALTER TABLE m_resource
ADD COLUMN superRefTargetOid UUID,
ADD COLUMN superRefTargetType ObjectType,
ADD COLUMN superRefRelationId INTEGER REFERENCES m_uri(id);
$aa$);

-- Fixed upgrade for task indexing
-- Drop tables should only affect development machines
call apply_change(19, $aa$
DROP TABLE IF EXISTS m_task_affected_resource_objects;
DROP TABLE IF EXISTS m_task_affected_objects;

CREATE TABLE m_task_affected_objects (
ownerOid UUID NOT NULL REFERENCES m_object_oid(oid) ON DELETE CASCADE,
containerType ContainerType GENERATED ALWAYS AS ('AFFECTED_OBJECTS') STORED
CHECK (containerType = 'AFFECTED_OBJECTS'),
activityId INTEGER REFERENCES m_uri(id),
type ObjectType,
archetypeRefTargetOid UUID,
archetypeRefTargetType ObjectType,
archetypeRefRelationId INTEGER REFERENCES m_uri(id),
objectClassId INTEGER REFERENCES m_uri(id),
resourceRefTargetOid UUID,
resourceRefTargetType ObjectType,
resourceRefRelationId INTEGER REFERENCES m_uri(id),
intent TEXT,
kind ShadowKindType,
PRIMARY KEY (ownerOid, cid)
) INHERITS(m_container);

$aa$)


---
-- WRITE CHANGES ABOVE ^^
-- IMPORTANT: update apply_change number at the end of postgres-new.sql
Expand Down
39 changes: 17 additions & 22 deletions config/sql/native-new/postgres-new.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; -- fuzzy string match (levenshtein
CREATE TYPE ContainerType AS ENUM (
'ACCESS_CERTIFICATION_CASE',
'ACCESS_CERTIFICATION_WORK_ITEM',
'AFFECTED_OBJECTS',
'ASSIGNMENT',
'CASE_WORK_ITEM',
'FOCUS_IDENTITY',
Expand Down Expand Up @@ -1312,28 +1313,22 @@ CREATE INDEX m_task_fullTextInfo_idx ON m_task USING gin(fullTextInfo gin_trgm_o
CREATE INDEX m_task_createTimestamp_idx ON m_task (createTimestamp);
CREATE INDEX m_task_modifyTimestamp_idx ON m_task (modifyTimestamp);

CREATE TABLE m_task_affected_resource_objects (
ownerOid UUID NOT NULL REFERENCES m_object_oid(oid) ON DELETE CASCADE,
containerType ContainerType GENERATED ALWAYS AS ('AFFECTED_RESOURCE_OBJECTS') STORED
CHECK (containerType = 'AFFECTED_RESOURCE_OBJECTS'),
objectClassId INTEGER REFERENCES m_uri(id),
resourceRefTargetOid UUID,
resourceRefTargetType ObjectType,
resourceRefRelationId INTEGER REFERENCES m_uri(id),
intent TEXT,
kind ShadowKindType,
PRIMARY KEY (ownerOid, cid)
) INHERITS(m_container);

CREATE TABLE m_task_affected_objects (
ownerOid UUID NOT NULL REFERENCES m_object_oid(oid) ON DELETE CASCADE,
containerType ContainerType GENERATED ALWAYS AS ('AFFECTED_OBJECTS') STORED
CHECK (containerType = 'AFFECTED_OBJECTS'),
type ObjectType,
archetypeRefTargetOid UUID,
archetypeRefTargetType ObjectType,
archetypeRefRelationId INTEGER REFERENCES m_uri(id),
PRIMARY KEY (ownerOid, cid)
ownerOid UUID NOT NULL REFERENCES m_object_oid(oid) ON DELETE CASCADE,
containerType ContainerType GENERATED ALWAYS AS ('AFFECTED_OBJECTS') STORED
CHECK (containerType = 'AFFECTED_OBJECTS'),
activityId INTEGER REFERENCES m_uri(id),
type ObjectType,
archetypeRefTargetOid UUID,
archetypeRefTargetType ObjectType,
archetypeRefRelationId INTEGER REFERENCES m_uri(id),
objectClassId INTEGER REFERENCES m_uri(id),
resourceRefTargetOid UUID,
resourceRefTargetType ObjectType,
resourceRefRelationId INTEGER REFERENCES m_uri(id),
intent TEXT,
kind ShadowKindType,
PRIMARY KEY (ownerOid, cid)
) INHERITS(m_container);

-- endregion
Expand Down Expand Up @@ -2115,4 +2110,4 @@ END $$;
-- This is important to avoid applying any change more than once.
-- Also update SqaleUtils.CURRENT_SCHEMA_CHANGE_NUMBER
-- repo/repo-sqale/src/main/java/com/evolveum/midpoint/repo/sqale/SqaleUtils.java
call apply_change(18, $$ SELECT 1 $$, true);
call apply_change(19, $$ SELECT 1 $$, true);
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import com.evolveum.midpoint.gui.api.util.GuiDisplayTypeUtil;

import com.evolveum.midpoint.gui.api.util.ObjectTypeListUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand Down Expand Up @@ -517,7 +518,7 @@ private List<ObjectTypes> mergeNewAssignmentTargetTypeLists(List<QName> allowedB
}

protected List<ObjectTypes> getObjectTypesList() {
return WebComponentUtil.createAssignableTypesList();
return ObjectTypeListUtil.createAssignableTypesList();
}

protected boolean isEntitlementAssignment() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
package com.evolveum.midpoint.gui.api.component;

import java.io.Serial;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
Expand All @@ -25,9 +26,11 @@
import org.jetbrains.annotations.NotNull;

import com.evolveum.midpoint.gui.api.GuiStyleConstants;
import com.evolveum.midpoint.gui.api.component.data.provider.ISelectableDataProvider;
import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.GuiDisplayTypeUtil;
import com.evolveum.midpoint.gui.api.util.LocalizationUtil;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.impl.component.AjaxCompositedIconButton;
import com.evolveum.midpoint.gui.impl.component.icon.CompositedIcon;
Expand All @@ -42,8 +45,6 @@
import com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView;
import com.evolveum.midpoint.prism.delta.ChangeType;
import com.evolveum.midpoint.prism.delta.ObjectDelta;
import com.evolveum.midpoint.schema.GetOperationOptions;
import com.evolveum.midpoint.schema.SelectorOptions;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.security.api.AuthorizationConstants;
import com.evolveum.midpoint.task.api.Task;
Expand All @@ -56,9 +57,9 @@
import com.evolveum.midpoint.web.component.AjaxIconButton;
import com.evolveum.midpoint.web.component.CompositedIconButtonDto;
import com.evolveum.midpoint.web.component.MultiFunctinalButtonDto;
import com.evolveum.midpoint.gui.api.component.data.provider.ISelectableDataProvider;
import com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn;
import com.evolveum.midpoint.web.component.data.column.ColumnMenuAction;
import com.evolveum.midpoint.web.component.data.column.ObjectNameColumn;
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem;
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction;
import com.evolveum.midpoint.web.component.util.SelectableBean;
Expand All @@ -72,16 +73,16 @@
* @author katkav
*/
public abstract class MainObjectListPanel<O extends ObjectType> extends ObjectListPanel<O> {
private static final long serialVersionUID = 1L;
@Serial private static final long serialVersionUID = 1L;

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

private static final String DOT_CLASS = MainObjectListPanel.class.getName() + ".";
private static final String OPERATION_DELETE_OBJECTS = DOT_CLASS + "deleteObjects";
private static final String OPERATION_DELETE_OBJECT = DOT_CLASS + "deleteObject";

private LoadableModel<ExecuteChangeOptionsDto> executeOptionsModel;
private final LoadableModel<ExecuteChangeOptionsDto> executeOptionsModel;

public MainObjectListPanel(String id, Class<O> type) {
super(id, type);
executeOptionsModel = new LoadableModel<>(false) {
Expand Down Expand Up @@ -130,6 +131,29 @@ protected void newObjectPerformed(AjaxRequestTarget target, AssignmentObjectRela
}
}

@Override
protected IColumn<SelectableBean<O>, String> createNameColumn(IModel<String> displayModel, GuiObjectColumnType customColumn, ExpressionType expression) {
return new ObjectNameColumn<>(displayModel == null ? createStringResource("ObjectType.name") : displayModel,
customColumn, expression, getPageBase()) {
@Serial private static final long serialVersionUID = 1L;

@Override
public void onClick(IModel<SelectableBean<O>> rowModel) {
O object = rowModel.getObject().getValue();
MainObjectListPanel.this.objectDetailsPerformed(object);
}

@Override
public boolean isClickable(IModel<SelectableBean<O>> rowModel) {
return MainObjectListPanel.this.isObjectDetailsEnabled(rowModel);
}
};
}

protected boolean isObjectDetailsEnabled(IModel<SelectableBean<O>> rowModel) {
return true;
}

protected List<ObjectReferenceType> getNewObjectReferencesList(CompiledObjectCollectionView collectionView, AssignmentObjectRelation relation) {
return ObjectCollectionViewUtil.getArchetypeReferencesList(collectionView);
}
Expand All @@ -142,8 +166,7 @@ private CompositedIcon createCompositedIcon(CompiledObjectCollectionView collect

builder.setBasicIcon(GuiDisplayTypeUtil.getIconCssClass(display), IconCssStyle.IN_ROW_STYLE)
.appendColorHtmlValue(GuiDisplayTypeUtil.getIconColor(display))
.setTitle(WebComponentUtil.getTranslatedPolyString(tooltip));
// .appendLayerIcon(WebComponentUtil.createIconType(GuiStyleConstants.CLASS_PLUS_CIRCLE, "green"), IconCssStyle.BOTTOM_RIGHT_STYLE);
.setTitle(LocalizationUtil.translatePolyString(tooltip));

return builder.build();
}
Expand All @@ -158,7 +181,6 @@ protected List<Component> createToolbarButtonsList(String buttonId) {
List<Component> buttonsList = new ArrayList<>();

buttonsList.add(createNewObjectButton(buttonId));
// buttonsList.add(createCreateNewObjectButton(buttonId));
buttonsList.add(createImportObjectButton(buttonId));
buttonsList.add(createDownloadButton(buttonId));
buttonsList.add(createCreateReportButton(buttonId));
Expand All @@ -185,7 +207,7 @@ private Component createNewObjectButton(String buttonId) {
AjaxCompositedIconButton createNewObjectButton = new AjaxCompositedIconButton(buttonId, builder.build(),
createStringResource(StringUtils.isEmpty(iconTitle) ? "MainObjectListPanel.newObject" : iconTitle)) {

private static final long serialVersionUID = 1L;
@Serial private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
Expand All @@ -204,7 +226,7 @@ public void onClick(AjaxRequestTarget target) {
}

NewObjectCreationPopup buttonsPanel = new NewObjectCreationPopup(getPageBase().getMainPopupBodyId(), new PropertyModel<>(loadButtonDescriptions(), MultiFunctinalButtonDto.F_ADDITIONAL_BUTTONS)) {
private static final long serialVersionUID = 1L;
@Serial private static final long serialVersionUID = 1L;

@Override
protected void buttonClickPerformed(AjaxRequestTarget target, AssignmentObjectRelation relationSpec, CompiledObjectCollectionView collectionViews, Class<? extends WebPage> page) {
Expand All @@ -227,7 +249,7 @@ protected boolean isCollectionViewWithoutMorePossibleNewType(CompiledObjectColle
}

protected boolean showNewObjectCreationPopup() {
return getNewObjectInfluencesList() != null && getNewObjectInfluencesList().size() > 1;
return getNewObjectInfluencesList().size() > 1;
}

protected boolean isViewForObjectCollectionType(CompiledObjectCollectionView collectionView, String oid, QName type) {
Expand Down Expand Up @@ -301,7 +323,7 @@ private AjaxIconButton createImportObjectButton(String buttonId) {
AjaxIconButton importObject = new AjaxIconButton(buttonId, new Model<>(GuiStyleConstants.CLASS_UPLOAD),
createStringResource("MainObjectListPanel.import")) {

private static final long serialVersionUID = 1L;
@Serial private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
Expand Down Expand Up @@ -335,7 +357,7 @@ private AjaxCompositedIconButton createCreateReportButton(String buttonId) {
AjaxCompositedIconButton createReport = new AjaxCompositedIconButton(buttonId, builder.build(),
getPageBase().createStringResource("MainObjectListPanel.createReport")) {

private static final long serialVersionUID = 1L;
@Serial private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
Expand All @@ -351,7 +373,7 @@ private AjaxIconButton createRefreshButton(String buttonId) {
AjaxIconButton refreshIcon = new AjaxIconButton(buttonId, new Model<>(GuiStyleConstants.CLASS_RECONCILE),
createStringResource("MainObjectListPanel.refresh")) {

private static final long serialVersionUID = 1L;
@Serial private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
Expand All @@ -369,7 +391,7 @@ private AjaxIconButton createPlayPauseButton(String buttonId) {
AjaxIconButton playPauseIcon = new AjaxIconButton(buttonId, getRefreshPausePlayButtonModel(),
getRefreshPausePlayButtonTitleModel()) {

private static final long serialVersionUID = 1L;
@Serial private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
Expand Down Expand Up @@ -413,16 +435,15 @@ protected boolean isCreateNewObjectVisible() {
CollectionUtils.isNotEmpty(getNewObjectInfluencesList());
}

@NotNull
protected List<CompiledObjectCollectionView> getNewObjectInfluencesList() {
@NotNull protected List<CompiledObjectCollectionView> getNewObjectInfluencesList() {
if (isCollectionViewPanelForCompiledView()) {
return new ArrayList<>();
}
return getAllApplicableArchetypeViews();
}

public void deleteConfirmedPerformed(AjaxRequestTarget target, IModel<SelectableBean<O>> objectToDelete) {
List<SelectableBean<O>> objects = isAnythingSelected(target, objectToDelete);
List<SelectableBean<O>> objects = isAnythingSelected(objectToDelete);

if (objects.isEmpty()) {
return;
Expand Down Expand Up @@ -465,10 +486,8 @@ public ExecuteChangeOptionsDto getExecuteOptions() {
/**
* This method check selection in table. If selectedObject != null than it
* returns only this object.
*
* @return
*/
public List<SelectableBean<O>> isAnythingSelected(AjaxRequestTarget target, IModel<SelectableBean<O>> selectedObject) {
public List<SelectableBean<O>> isAnythingSelected(IModel<SelectableBean<O>> selectedObject) {
List<SelectableBean<O>> selectedObjects;
if (selectedObject != null) {
selectedObjects = new ArrayList<>();
Expand Down Expand Up @@ -503,7 +522,7 @@ protected String getConfirmMessageKeyForSingleObject() {

public InlineMenuItem createDeleteInlineMenu() {
return new InlineMenuItem(createStringResource("MainObjectListPanel.menu.delete")) {
private static final long serialVersionUID = 1L;
@Serial private static final long serialVersionUID = 1L;

@Override
public InlineMenuItemAction initAction() {
Expand All @@ -523,8 +542,7 @@ public IModel<String> getConfirmationMessageModel() {
};
}

@Override
protected void objectDetailsPerformed(AjaxRequestTarget target, O object) {
protected void objectDetailsPerformed(O object) {
if (WebComponentUtil.hasDetailsPage(object.getClass())) {
WebComponentUtil.dispatchToObjectDetailsPage(object.getClass(), object.getOid(), this, true);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package com.evolveum.midpoint.gui.api.component;

import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.gui.api.util.ObjectTypeListUtil;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.impl.component.search.Search;
import com.evolveum.midpoint.prism.delta.ObjectDelta;
Expand All @@ -17,7 +18,7 @@
import com.evolveum.midpoint.web.component.input.DropDownChoicePanel;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.RelationSearchItemConfigurationType;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.OnChangeAjaxBehavior;
import org.apache.wicket.markup.html.WebMarkupContainer;
Expand Down Expand Up @@ -82,7 +83,7 @@ protected ObjectDelta prepareDelta(){
}

protected List<ObjectTypes> getSupportedTypesList(){
List<ObjectTypes> supportedTypes = WebComponentUtil.createAssignmentHolderTypesList();
List<ObjectTypes> supportedTypes = ObjectTypeListUtil.createAssignmentHolderTypesList();
supportedTypes.remove(ObjectTypes.USER);
supportedTypes.remove(ObjectTypes.ROLE);
supportedTypes.remove(ObjectTypes.SERVICE);
Expand Down

0 comments on commit e5ab1b7

Please sign in to comment.