Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	release-notes.adoc
  • Loading branch information
tchrapovic committed Apr 23, 2024
2 parents fd36d1b + add45ae commit a6dcc8f
Show file tree
Hide file tree
Showing 67 changed files with 1,502 additions and 216 deletions.
50 changes: 50 additions & 0 deletions config/sql/native/postgres-upgrade.sql
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,56 @@ call apply_change(31, $aa$
ALTER TYPE ShadowKindType ADD VALUE IF NOT EXISTS 'ASSOCIATED' AFTER 'GENERIC';
$aa$);


-- value metatada for assignments and inducements
call apply_change(32, $aa$
ALTER TYPE ContainerType ADD VALUE IF NOT EXISTS 'ASSIGNMENT_METADATA' AFTER 'ASSIGNMENT';
$aa$);

call apply_change(33, $aa$
CREATE TABLE m_assignment_metadata (
ownerOid UUID NOT NULL REFERENCES m_object_oid(oid) ON DELETE CASCADE,
ownerType ObjectType,
assignmentCid INTEGER NOT NULL,
containerType ContainerType GENERATED ALWAYS AS ('ASSIGNMENT_METADATA') STORED
CHECK (containerType = 'ASSIGNMENT_METADATA'),

-- Storage metadata
creatorRefTargetOid UUID,
creatorRefTargetType ObjectType,
creatorRefRelationId INTEGER REFERENCES m_uri(id),
createChannelId INTEGER REFERENCES m_uri(id),
createTimestamp TIMESTAMPTZ,
modifierRefTargetOid UUID,
modifierRefTargetType ObjectType,
modifierRefRelationId INTEGER REFERENCES m_uri(id),
modifyChannelId INTEGER REFERENCES m_uri(id),
modifyTimestamp TIMESTAMPTZ,

PRIMARY KEY (ownerOid, cid)
) INHERITS(m_container);

CREATE INDEX m_assignment_metadata_createTimestamp_idx ON m_assignment (createTimestamp);
CREATE INDEX m_assignment_metadata_modifyTimestamp_idx ON m_assignment (modifyTimestamp);

ALTER TABLE m_assignment_ref_create_approver ADD COLUMN metadataCid INTEGER;

-- Primary key should also consider metadata

ALTER TABLE "m_assignment_ref_create_approver" DROP CONSTRAINT "m_assignment_ref_create_approver_pkey";

ALTER TABLE "m_assignment_ref_create_approver" ADD CONSTRAINT "m_assignment_ref_create_approver_pkey"
UNIQUE ("owneroid", "assignmentcid", "metadatacid", "referencetype", "relationid", "targetoid");


ALTER TABLE m_assignment_ref_modify_approver ADD COLUMN metadataCid INTEGER;

ALTER TABLE "m_assignment_ref_modify_approver" DROP CONSTRAINT "m_assignment_ref_modify_approver_pkey";

ALTER TABLE "m_assignment_ref_modify_approver" ADD CONSTRAINT "m_assignment_ref_modify_approver_pkey"
UNIQUE ("owneroid", "assignmentcid", "metadatacid", "referencetype", "relationid", "targetoid");

$aa$);
---
-- WRITE CHANGES ABOVE ^^
-- IMPORTANT: update apply_change number at the end of postgres-new.sql
Expand Down
48 changes: 41 additions & 7 deletions config/sql/native/postgres.sql
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ CREATE TYPE ContainerType AS ENUM (
'ACCESS_CERTIFICATION_WORK_ITEM',
'AFFECTED_OBJECTS',
'ASSIGNMENT',
'ASSIGNMENT_METADATA',
'CASE_WORK_ITEM',
'FOCUS_IDENTITY',
'INDUCEMENT',
Expand Down Expand Up @@ -1951,6 +1952,34 @@ CREATE TABLE m_assignment (
PRIMARY KEY (ownerOid, cid)
);

-- Assignment metadata

CREATE TABLE m_assignment_metadata (
ownerOid UUID NOT NULL REFERENCES m_object_oid(oid) ON DELETE CASCADE,
ownerType ObjectType,
assignmentCid INTEGER NOT NULL,
containerType ContainerType GENERATED ALWAYS AS ('ASSIGNMENT_METADATA') STORED
CHECK (containerType = 'ASSIGNMENT_METADATA'),

-- Storage metadata
creatorRefTargetOid UUID,
creatorRefTargetType ObjectType,
creatorRefRelationId INTEGER REFERENCES m_uri(id),
createChannelId INTEGER REFERENCES m_uri(id),
createTimestamp TIMESTAMPTZ,
modifierRefTargetOid UUID,
modifierRefTargetType ObjectType,
modifierRefRelationId INTEGER REFERENCES m_uri(id),
modifyChannelId INTEGER REFERENCES m_uri(id),
modifyTimestamp TIMESTAMPTZ,

PRIMARY KEY (ownerOid, cid)
) INHERITS(m_container);

CREATE INDEX m_assignment_metadata_createTimestamp_idx ON m_assignment (createTimestamp);
CREATE INDEX m_assignment_metadata_modifyTimestamp_idx ON m_assignment (modifyTimestamp);


CREATE INDEX m_assignment_policySituation_idx
ON m_assignment USING gin(policysituations gin__int_ops);
CREATE INDEX m_assignment_subtypes_idx ON m_assignment USING gin(subtypes);
Expand All @@ -1972,17 +2001,20 @@ CREATE INDEX m_assignment_modifyTimestamp_idx ON m_assignment (modifyTimestamp);
CREATE TABLE m_assignment_ref_create_approver (
ownerOid UUID NOT NULL REFERENCES m_object_oid(oid) ON DELETE CASCADE,
assignmentCid INTEGER NOT NULL,
metadataCid INTEGER,
referenceType ReferenceType GENERATED ALWAYS AS ('ASSIGNMENT_CREATE_APPROVER') STORED
CHECK (referenceType = 'ASSIGNMENT_CREATE_APPROVER'),

PRIMARY KEY (ownerOid, assignmentCid, referenceType, relationId, targetOid)
CHECK (referenceType = 'ASSIGNMENT_CREATE_APPROVER')
)
INHERITS (m_reference);

-- indexed by first two PK columns
ALTER TABLE m_assignment_ref_create_approver ADD CONSTRAINT m_assignment_ref_create_approver_id_fk
FOREIGN KEY (ownerOid, assignmentCid) REFERENCES m_assignment (ownerOid, cid)
ON DELETE CASCADE;
-- table does not have primary key since metadataCid == null are original values in metadata containar
-- and metadataCid != null are value metadata references
ALTER TABLE "m_assignment_ref_create_approver" ADD CONSTRAINT "m_assignment_ref_create_approver_pkey"
UNIQUE ("owneroid", "assignmentcid", "metadatacid", "referencetype", "relationid", "targetoid");

CREATE INDEX m_assignment_ref_create_approver_targetOidRelationId_idx
ON m_assignment_ref_create_approver (targetOid, relationId);
Expand All @@ -1991,10 +2023,9 @@ CREATE INDEX m_assignment_ref_create_approver_targetOidRelationId_idx
CREATE TABLE m_assignment_ref_modify_approver (
ownerOid UUID NOT NULL REFERENCES m_object_oid(oid) ON DELETE CASCADE,
assignmentCid INTEGER NOT NULL,
metadataCid INTEGER,
referenceType ReferenceType GENERATED ALWAYS AS ('ASSIGNMENT_MODIFY_APPROVER') STORED
CHECK (referenceType = 'ASSIGNMENT_MODIFY_APPROVER'),

PRIMARY KEY (ownerOid, assignmentCid, referenceType, relationId, targetOid)
CHECK (referenceType = 'ASSIGNMENT_MODIFY_APPROVER')
)
INHERITS (m_reference);

Expand All @@ -2003,6 +2034,9 @@ ALTER TABLE m_assignment_ref_modify_approver ADD CONSTRAINT m_assignment_ref_mod
FOREIGN KEY (ownerOid, assignmentCid) REFERENCES m_assignment (ownerOid, cid)
ON DELETE CASCADE;

ALTER TABLE "m_assignment_ref_modify_approver" ADD CONSTRAINT "m_assignment_ref_modify_approver_pkey"
UNIQUE ("owneroid", "assignmentcid", "metadatacid", "referencetype", "relationid", "targetoid");

CREATE INDEX m_assignment_ref_modify_approver_targetOidRelationId_idx
ON m_assignment_ref_modify_approver (targetOid, relationId);
-- endregion
Expand Down Expand Up @@ -2271,4 +2305,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(31, $$ SELECT 1 $$, true);
call apply_change(33, $$ SELECT 1 $$, true);
5 changes: 3 additions & 2 deletions docs/concepts/query/midpoint-query-language/errors/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ a| The schema defines enumerated value for this attribute. In this case the allo

| Troubleshooting hints
a| * Search for allowed values in schema definition. Schemas are described in
xref:../../../../schema/schemadoc.adoc[SchemaDoc].
xref:/midpoint/reference/schema/schemadoc.adoc[SchemaDoc].
Select version according your midPoint version. +
In this case search in schema "common/common-3" for "LockoutStatusType"

Expand Down Expand Up @@ -201,5 +201,6 @@ For polystring you need to use `origIgnoreCase` matching rule.

| Troubleshooting hints
a| * For more information about matching rules in query see xref:../introduction.adoc#_matching_rules[matching rules chapter] in introduction to Midpoint Query Language.
* List of all matching rules is defined in xref:../../matching-rules.adoc[matching rules] page.
* List of all matching rules is defined in xref:/midpoint/reference/concepts/matching-rules.adoc[matching rules] page.

|====
2 changes: 1 addition & 1 deletion docs/concepts/query/midpoint-query-language/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ image:advanced-query-select.png[Select Advanced query]
You can test the queries directly in GUI. Starting in All users view. It is easy and straightforward.
As an example, to select all users with given name starting with "J" just enter `givenName startsWith "J"` to search bar and click search button.

Examples how to use the midPoint query in GUI can be found in xref:/midpoint/guides/gui-midpoint-query-examples[Advanced search - EXAMPLES].
Examples how to use the midPoint query in GUI can be found in xref:/midpoint/reference/concepts/query/midpoint-query-language/query-examples[Advanced search - EXAMPLES].


=== Using in Configuration
Expand Down
4 changes: 2 additions & 2 deletions docs/concepts/query/midpoint-query-language/introduction.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ The exact syntax of queries for values of different types is described in the fo

| dateTime
| `metadata/createTimestamp >= "2024-03-01"`
| DateTime values are enclosed in quotes (') or double quotes ("). It can be compared as dates or date and time - written in format of xref:https://en.wikipedia.org/wiki/ISO_8601[ISO-8601].
| DateTime values are enclosed in quotes (') or double quotes ("). It can be compared as dates or date and time - written in format of https://en.wikipedia.org/wiki/ISO_8601[ISO-8601].

|
| `metadata/createTimestamp >= "2024-03-01T15:30:00"`
Expand Down Expand Up @@ -403,7 +403,7 @@ All roles and organization units which are organization tree roots.

This chapter provides information and examples of queries in midPoint Query Language, mainly used in objects while configuration of midPoint itself.

Additional examples can be found in xref:/midpoint/guides/gui-midpoint-query-examples[Advanced search - EXAMPLES].
Additional examples can be found in xref:/midpoint/reference/concepts/query/midpoint-query-language/query-examples[Advanced search - EXAMPLES].

=== Searching by Archetype Name

Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a6dcc8f

Please sign in to comment.