From d7452536e7c513ebde7de980a0f96aa3346d7897 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Mon, 3 Nov 2014 14:49:18 +0100 Subject: [PATCH 001/215] updated hiberenate to 4.3.7.Final, not compilable now. --- build-system/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-system/pom.xml b/build-system/pom.xml index e2c1f1b182c..15099973cdd 100644 --- a/build-system/pom.xml +++ b/build-system/pom.xml @@ -62,7 +62,7 @@ 6.8.8 1.2 2.2.3 - 4.1.12.Final + 4.3.7.Final 1.3.171 9.1-901.jdbc4 5.1.31 From 40a38f1986cda27d23c285d45b762566d259f09a Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Sat, 29 Nov 2014 19:53:17 +0100 Subject: [PATCH 002/215] repository entities compiletime fix. --- .../sql/util/HibernateToSqlTranslator.java | 2 +- .../repo/sql/data/common/RObject.java | 33 +++++++++---------- .../data/common/container/RAssignment.java | 20 ++++++----- 3 files changed, 27 insertions(+), 28 deletions(-) diff --git a/repo/repo-sql-impl-test/src/main/java/com/evolveum/midpoint/repo/sql/util/HibernateToSqlTranslator.java b/repo/repo-sql-impl-test/src/main/java/com/evolveum/midpoint/repo/sql/util/HibernateToSqlTranslator.java index 00d8c6369ae..c2ed49fc297 100644 --- a/repo/repo-sql-impl-test/src/main/java/com/evolveum/midpoint/repo/sql/util/HibernateToSqlTranslator.java +++ b/repo/repo-sql-impl-test/src/main/java/com/evolveum/midpoint/repo/sql/util/HibernateToSqlTranslator.java @@ -94,7 +94,7 @@ public static String toSql(SessionFactory sessionFactory, String hqlQueryText) { createQueryTranslator( hqlQueryText, hqlQueryText, - Collections.EMPTY_MAP, factory + Collections.EMPTY_MAP, factory, null ); translator.compile(Collections.EMPTY_MAP, false); return translator.getSQLString(); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObject.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObject.java index accab316c7b..03adb506a48 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObject.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObject.java @@ -37,7 +37,6 @@ import com.evolveum.midpoint.schema.SelectorOptions; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; import com.evolveum.midpoint.xml.ns._public.common.common_3.TriggerType; - import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.Validate; import org.hibernate.annotations.*; @@ -46,9 +45,10 @@ import javax.persistence.*; import javax.persistence.Entity; +import javax.persistence.ForeignKey; +import javax.persistence.Index; import javax.persistence.Table; import javax.xml.datatype.XMLGregorianCalendar; - import java.io.Serializable; import java.util.Collection; import java.util.HashSet; @@ -78,11 +78,11 @@ @NamedQuery(name = "isAnySubordinateAttempt.moreLowerOids", query = "select count(*) from ROrgClosure o where o.ancestorOid=:aOid and o.descendantOid in (:dOids)"), }) @Entity -@Table(name = "m_object") -@org.hibernate.annotations.Table(appliesTo = "m_object", - indexes = {@Index(name = "iObjectNameOrig", columnNames = "name_orig"), - @Index(name = "iObjectNameNorm", columnNames = "name_norm")}) -@ForeignKey(name = "fk_object") +@Table(name = "m_object", indexes = { + @Index(name = "iObjectNameOrig", columnList = "name_orig"), + @Index(name = "iObjectNameNorm", columnList = "name_norm"), + @Index(name = "iObjectTypeClass", columnList = "objectTypeClass"), + @Index(name = "iObjectCreateTimestamp", columnList = "createTimestamp")}) @Inheritance(strategy = InheritanceType.JOINED) public abstract class RObject implements Metadata, Serializable { @@ -136,7 +136,7 @@ public RPolyString getName() { return name; } - @ForeignKey(name = "none") +// @JoinTable(foreignKey = @ForeignKey(name = "none")) @OneToMany(mappedBy = RTrigger.F_OWNER, orphanRemoval = true) @Cascade({org.hibernate.annotations.CascadeType.ALL}) public Set getTrigger() { @@ -184,7 +184,7 @@ public byte[] getFullObject() { @Where(clause = RObjectReference.REFERENCE_TYPE + "=" + RCreateApproverRef.DISCRIMINATOR) @OneToMany(mappedBy = RObjectReference.F_OWNER, orphanRemoval = true) - @ForeignKey(name = "none") +// @JoinTable(foreignKey = @ForeignKey(name = "none")) @Cascade({org.hibernate.annotations.CascadeType.ALL}) public Set getCreateApproverRef() { if (createApproverRef == null) { @@ -197,7 +197,6 @@ public String getCreateChannel() { return createChannel; } - @Index(name = "iObjectCreateTimestamp") public XMLGregorianCalendar getCreateTimestamp() { return createTimestamp; } @@ -214,7 +213,7 @@ public REmbeddedReference getModifierRef() { @Where(clause = RObjectReference.REFERENCE_TYPE + "=" + RModifyApproverRef.DISCRIMINATOR) @OneToMany(mappedBy = RObjectReference.F_OWNER, orphanRemoval = true) - @ForeignKey(name = "none") +// @JoinTable(foreignKey = @ForeignKey(name = "none")) @Cascade({org.hibernate.annotations.CascadeType.ALL}) public Set getModifyApproverRef() { if (modifyApproverRef == null) { @@ -233,7 +232,6 @@ public XMLGregorianCalendar getModifyTimestamp() { @OneToMany(mappedBy = "owner", orphanRemoval = true) @Cascade({org.hibernate.annotations.CascadeType.ALL}) -// @Cascade({PERSIST, REMOVE, REFRESH, DELETE, SAVE_UPDATE, REPLICATE, LOCK, DETACH}) public Set getLongs() { if (longs == null) { longs = new HashSet<>(); @@ -312,7 +310,6 @@ public Short getPolysCount() { return polysCount; } - @Index(name = "iObjectTypeClass") @Enumerated public RObjectType getObjectTypeClass() { return objectTypeClass; @@ -553,12 +550,12 @@ public static void copyFromJAXB(PrismContainerValue containerValue, RObject repo Set values = new HashSet(); try { List> items = containerValue.getItems(); - //TODO: is this ehought??should we try items without definitions?? + //TODO: is this ehought??should we try items without definitions?? if (items != null) { - for (Item item : items) { - values.addAll(converter.convertToRValue(item, false)); - } - } + for (Item item : items) { + values.addAll(converter.convertToRValue(item, false)); + } + } } catch (Exception ex) { throw new DtoTranslationException(ex.getMessage(), ex); } diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RAssignment.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RAssignment.java index 982a7c8a8cc..16142843eec 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RAssignment.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RAssignment.java @@ -42,6 +42,9 @@ import javax.persistence.*; import javax.persistence.Entity; +import javax.persistence.ForeignKey; +import javax.persistence.Index; +import javax.persistence.Table; import javax.xml.datatype.XMLGregorianCalendar; import java.util.HashSet; @@ -53,10 +56,9 @@ @JaxbType(type = AssignmentType.class) @Entity @IdClass(RContainerId.class) -@org.hibernate.annotations.Table(appliesTo = "m_assignment", - indexes = {@Index(name = "iAssignmentAdministrative", columnNames = "administrativeStatus"), - @Index(name = "iAssignmentEffective", columnNames = "effectiveStatus")}) -@ForeignKey(name = "fk_assignment") +@Table(name = "m_assignment", indexes = { + @Index(name = "iAssignmentAdministrative", columnList = "administrativeStatus"), + @Index(name = "iAssignmentEffective", columnList = "effectiveStatus")}) public class RAssignment implements Container, Metadata { public static final String F_OWNER = "owner"; @@ -100,9 +102,9 @@ public RAssignment(RObject owner, RAssignmentOwner assignmentOwner) { } @Id - @ForeignKey(name = "fk_assignment_owner") @MapsId("owner") @ManyToOne(fetch = FetchType.LAZY) +// @JoinTable(foreignKey = @ForeignKey(name = "fk_assignment_owner")) public RObject getOwner() { return owner; } @@ -140,12 +142,12 @@ public REmbeddedReference getTenantRef() { @com.evolveum.midpoint.repo.sql.query.definition.Any(jaxbNameLocalPart = "extension") @OneToOne(optional = true, orphanRemoval = true) - @ForeignKey(name = "none") @Cascade({org.hibernate.annotations.CascadeType.ALL}) - @JoinColumns({ + @JoinColumns(value = { @JoinColumn(name = "extOid", referencedColumnName = "owner_owner_oid"), @JoinColumn(name = "extId", referencedColumnName = "owner_id") }) +// , foreignKey = @ForeignKey(name = "none")) public RAssignmentExtension getExtension() { return extension; } @@ -162,8 +164,8 @@ public Integer getOrder() { @Where(clause = RAssignmentReference.REFERENCE_TYPE + "=" + RACreateApproverRef.DISCRIMINATOR) @OneToMany(mappedBy = RAssignmentReference.F_OWNER, orphanRemoval = true) - @ForeignKey(name = "none") @Cascade({org.hibernate.annotations.CascadeType.ALL}) +// @JoinTable(foreignKey = @ForeignKey(name = "none")) public Set getCreateApproverRef() { if (createApproverRef == null) { createApproverRef = new HashSet<>(); @@ -191,7 +193,7 @@ public REmbeddedReference getModifierRef() { @Where(clause = RAssignmentReference.REFERENCE_TYPE + "=" + RAModifyApproverRef.DISCRIMINATOR) @OneToMany(mappedBy = RAssignmentReference.F_OWNER, orphanRemoval = true) - @ForeignKey(name = "none") +// @JoinTable(foreignKey = @ForeignKey(name = "none")) @Cascade({org.hibernate.annotations.CascadeType.ALL}) public Set getModifyApproverRef() { if (modifyApproverRef == null) { From e7ddd0388807df2135fd6d538f1d878a2b2f0202 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Sat, 29 Nov 2014 19:53:59 +0100 Subject: [PATCH 003/215] statistics (to be removed later). --- repo/repo-sql-impl-test/STATS | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 repo/repo-sql-impl-test/STATS diff --git a/repo/repo-sql-impl-test/STATS b/repo/repo-sql-impl-test/STATS new file mode 100644 index 00000000000..21d8c6ef6aa --- /dev/null +++ b/repo/repo-sql-impl-test/STATS @@ -0,0 +1,3 @@ +find . -name "test.log" -exec cat {} \; | grep org.hibernate.SQL | grep -v ": $" | wc -l +master: 254277 +long(default,aspectj,extratest): 155507 \ No newline at end of file From 61833f4e9ff246386f4db928b8dc3c3fd716ec2c Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Mon, 1 Dec 2014 08:48:49 +0100 Subject: [PATCH 004/215] improving add/modify operations with entity state interceptor implementation. --- .../main/resources/ctx-repository-session.xml | 3 + .../repo/sql/SqlRepositoryServiceImpl.java | 7 ++- .../repo/sql/data/common/RAbstractRole.java | 11 ++-- .../repo/sql/data/common/RConnector.java | 9 ++- .../repo/sql/data/common/RConnectorHost.java | 8 ++- .../midpoint/repo/sql/data/common/RFocus.java | 10 ++-- .../repo/sql/data/common/RGenericObject.java | 9 ++- .../midpoint/repo/sql/data/common/RNode.java | 7 ++- .../repo/sql/data/common/RObject.java | 35 ++++++++---- .../repo/sql/data/common/RObjectTemplate.java | 8 +-- .../midpoint/repo/sql/data/common/ROrg.java | 9 ++- .../repo/sql/data/common/RReport.java | 6 +- .../repo/sql/data/common/RReportOutput.java | 6 +- .../repo/sql/data/common/RResource.java | 6 +- .../midpoint/repo/sql/data/common/RRole.java | 7 ++- .../repo/sql/data/common/RSecurityPolicy.java | 6 +- .../repo/sql/data/common/RShadow.java | 6 +- .../sql/data/common/RSystemConfiguration.java | 6 +- .../midpoint/repo/sql/data/common/RTask.java | 9 +-- .../midpoint/repo/sql/data/common/RUser.java | 7 ++- .../repo/sql/data/common/RValuePolicy.java | 7 ++- .../sql/data/common/container/Container.java | 3 +- .../data/common/container/RAssignment.java | 22 ++++++-- .../sql/data/common/container/RExclusion.java | 20 ++++++- .../sql/data/common/container/RTrigger.java | 20 ++++++- .../repo/sql/util/ContainerIdGenerator.java | 2 +- .../midpoint/repo/sql/util/EntityState.java | 11 ++++ .../repo/sql/util/EntityStateInterceptor.java | 56 +++++++++++++++++++ .../repo/sql/util/IdGeneratorResult.java | 31 ++++++++++ .../sql/util/PrismIdentifierGenerator.java | 24 +++++++- .../main/resources/ctx-repository-session.xml | 3 + 31 files changed, 289 insertions(+), 85 deletions(-) create mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/EntityState.java create mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/EntityStateInterceptor.java create mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/IdGeneratorResult.java diff --git a/repo/repo-sql-impl-test/src/main/resources/ctx-repository-session.xml b/repo/repo-sql-impl-test/src/main/resources/ctx-repository-session.xml index 8728d7faa0c..618e513de6b 100644 --- a/repo/repo-sql-impl-test/src/main/resources/ctx-repository-session.xml +++ b/repo/repo-sql-impl-test/src/main/resources/ctx-repository-session.xml @@ -81,5 +81,8 @@ com.evolveum.midpoint.repo.sql.data.audit + + + \ No newline at end of file diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SqlRepositoryServiceImpl.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SqlRepositoryServiceImpl.java index c7eea4b70e2..8dc79e87e7d 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SqlRepositoryServiceImpl.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SqlRepositoryServiceImpl.java @@ -1200,7 +1200,7 @@ private RObject createDataObjectFromJAXB(PrismObject p throws SchemaException { PrismIdentifierGenerator generator = new PrismIdentifierGenerator(); - generator.generate(prismObject); + IdGeneratorResult generatorResult = generator.generate(prismObject); T object = prismObject.asObjectable(); @@ -1208,8 +1208,9 @@ private RObject createDataObjectFromJAXB(PrismObject p Class clazz = ClassMapper.getHQLTypeClass(object.getClass()); try { rObject = clazz.newInstance(); - Method method = clazz.getMethod("copyFromJAXB", object.getClass(), clazz, PrismContext.class); - method.invoke(clazz, object, rObject, getPrismContext()); + Method method = clazz.getMethod("copyFromJAXB", object.getClass(), clazz, + PrismContext.class, IdGeneratorResult.class); + method.invoke(clazz, object, rObject, getPrismContext(), generatorResult); } catch (Exception ex) { String message = ex.getMessage(); if (StringUtils.isEmpty(message) && ex.getCause() != null) { diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RAbstractRole.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RAbstractRole.java index af036f9928e..b89d3b38a1d 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RAbstractRole.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RAbstractRole.java @@ -28,6 +28,7 @@ import com.evolveum.midpoint.repo.sql.query.definition.VirtualCollection; import com.evolveum.midpoint.repo.sql.query.definition.VirtualQueryParam; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.xml.ns._public.common.common_3.AbstractRoleType; import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType; @@ -150,20 +151,22 @@ public int hashCode() { } public static void copyFromJAXB(AbstractRoleType jaxb, RAbstractRole repo, - PrismContext prismContext) throws DtoTranslationException { - RFocus.copyFromJAXB(jaxb, repo, prismContext); + PrismContext prismContext, + IdGeneratorResult generatorResult) + throws DtoTranslationException { + RFocus.copyFromJAXB(jaxb, repo, prismContext, generatorResult); repo.setRequestable(jaxb.isRequestable()); for (AssignmentType inducement : jaxb.getInducement()) { RAssignment rInducement = new RAssignment(repo, RAssignmentOwner.ABSTRACT_ROLE); - RAssignment.copyFromJAXB(inducement, rInducement, jaxb, prismContext); + RAssignment.copyFromJAXB(inducement, rInducement, jaxb, prismContext, generatorResult); repo.getAssignments().add(rInducement); } for (ExclusionType exclusion : jaxb.getExclusion()) { RExclusion rExclusion = new RExclusion(repo); - RExclusion.copyFromJAXB(exclusion, rExclusion, jaxb, prismContext); + RExclusion.copyFromJAXB(exclusion, rExclusion, jaxb, prismContext, generatorResult); repo.getExclusion().add(rExclusion); } diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RConnector.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RConnector.java index 80025744b31..09fa097bb5a 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RConnector.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RConnector.java @@ -20,18 +20,17 @@ import com.evolveum.midpoint.repo.sql.data.common.embedded.REmbeddedReference; import com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; import com.evolveum.midpoint.util.logging.Trace; import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorType; - import org.hibernate.annotations.Cascade; import org.hibernate.annotations.ForeignKey; import javax.persistence.*; - import java.util.Collection; import java.util.Set; @@ -151,9 +150,9 @@ public int hashCode() { return result; } - public static void copyFromJAXB(ConnectorType jaxb, RConnector repo, PrismContext prismContext) throws - DtoTranslationException { - RObject.copyFromJAXB(jaxb, repo, prismContext); + public static void copyFromJAXB(ConnectorType jaxb, RConnector repo, PrismContext prismContext, + IdGeneratorResult generatorResult) throws DtoTranslationException { + RObject.copyFromJAXB(jaxb, repo, prismContext, generatorResult); repo.setName(RPolyString.copyFromJAXB(jaxb.getName())); repo.setConnectorBundle(jaxb.getConnectorBundle()); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RConnectorHost.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RConnectorHost.java index cfce18be16b..afea98f242c 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RConnectorHost.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RConnectorHost.java @@ -25,6 +25,7 @@ import javax.persistence.Table; import javax.persistence.UniqueConstraint; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import org.hibernate.annotations.ForeignKey; import org.hibernate.annotations.Index; import org.hibernate.annotations.Type; @@ -43,6 +44,7 @@ import javax.persistence.Entity; import javax.persistence.Table; import javax.persistence.UniqueConstraint; + /** * @author lazyman */ @@ -104,9 +106,9 @@ public int hashCode() { return result; } - public static void copyFromJAXB(ConnectorHostType jaxb, RConnectorHost repo, PrismContext prismContext) throws - DtoTranslationException { - RObject.copyFromJAXB(jaxb, repo, prismContext); + public static void copyFromJAXB(ConnectorHostType jaxb, RConnectorHost repo, PrismContext prismContext, + IdGeneratorResult generatorResult) throws DtoTranslationException { + RObject.copyFromJAXB(jaxb, repo, prismContext, generatorResult); repo.setName(RPolyString.copyFromJAXB(jaxb.getName())); repo.setHostname(jaxb.getHostname()); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RFocus.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RFocus.java index 2fe7c13d8aa..46f8d8d8da3 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RFocus.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RFocus.java @@ -27,6 +27,7 @@ import com.evolveum.midpoint.repo.sql.query.definition.VirtualCollection; import com.evolveum.midpoint.repo.sql.query.definition.VirtualQueryParam; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType; import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType; @@ -149,16 +150,17 @@ public int hashCode() { return result; } - public static void copyFromJAXB(FocusType jaxb, RFocus repo, PrismContext prismContext) throws - DtoTranslationException { - RObject.copyFromJAXB(jaxb, repo, prismContext); + public static void copyFromJAXB(FocusType jaxb, RFocus repo, PrismContext prismContext, + IdGeneratorResult generatorResult) + throws DtoTranslationException { + RObject.copyFromJAXB(jaxb, repo, prismContext, generatorResult); repo.getLinkRef().addAll( RUtil.safeListReferenceToSet(jaxb.getLinkRef(), prismContext, repo, RReferenceOwner.USER_ACCOUNT)); for (AssignmentType assignment : jaxb.getAssignment()) { RAssignment rAssignment = new RAssignment(repo, RAssignmentOwner.FOCUS); - RAssignment.copyFromJAXB(assignment, rAssignment, jaxb, prismContext); + RAssignment.copyFromJAXB(assignment, rAssignment, jaxb, prismContext, generatorResult); repo.getAssignments().add(rAssignment); } diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RGenericObject.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RGenericObject.java index 0d853874ff5..05ec7650806 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RGenericObject.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RGenericObject.java @@ -19,18 +19,17 @@ import com.evolveum.midpoint.prism.PrismContext; import com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; import com.evolveum.midpoint.xml.ns._public.common.common_3.GenericObjectType; - import org.hibernate.annotations.ForeignKey; import javax.persistence.Embedded; import javax.persistence.Entity; import javax.persistence.Table; import javax.persistence.UniqueConstraint; - import java.util.Collection; /** @@ -83,9 +82,9 @@ public int hashCode() { return result; } - public static void copyFromJAXB(GenericObjectType jaxb, RGenericObject repo, PrismContext prismContext) throws - DtoTranslationException { - RObject.copyFromJAXB(jaxb, repo, prismContext); + public static void copyFromJAXB(GenericObjectType jaxb, RGenericObject repo, PrismContext prismContext, + IdGeneratorResult generatorResult) throws DtoTranslationException { + RObject.copyFromJAXB(jaxb, repo, prismContext, generatorResult); repo.setName(RPolyString.copyFromJAXB(jaxb.getName())); repo.setObjectType(jaxb.getObjectType()); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RNode.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RNode.java index 5d7fd80dfca..452a77dcbfd 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RNode.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RNode.java @@ -19,6 +19,7 @@ import com.evolveum.midpoint.prism.PrismContext; import com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; @@ -82,9 +83,9 @@ public int hashCode() { return result; } - public static void copyFromJAXB(NodeType jaxb, RNode repo, PrismContext prismContext) throws - DtoTranslationException { - RObject.copyFromJAXB(jaxb, repo, prismContext); + public static void copyFromJAXB(NodeType jaxb, RNode repo, PrismContext prismContext, + IdGeneratorResult generatorResult) throws DtoTranslationException { + RObject.copyFromJAXB(jaxb, repo, prismContext, generatorResult); repo.setName(RPolyString.copyFromJAXB(jaxb.getName())); repo.setNodeIdentifier(jaxb.getNodeIdentifier()); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObject.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObject.java index 03adb506a48..aa4d1f09657 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObject.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObject.java @@ -30,9 +30,7 @@ import com.evolveum.midpoint.repo.sql.data.common.type.RObjectExtensionType; import com.evolveum.midpoint.repo.sql.data.common.type.RParentOrgRef; import com.evolveum.midpoint.repo.sql.data.factory.MetadataFactory; -import com.evolveum.midpoint.repo.sql.util.ClassMapper; -import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; -import com.evolveum.midpoint.repo.sql.util.RUtil; +import com.evolveum.midpoint.repo.sql.util.*; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; @@ -84,10 +82,12 @@ @Index(name = "iObjectTypeClass", columnList = "objectTypeClass"), @Index(name = "iObjectCreateTimestamp", columnList = "createTimestamp")}) @Inheritance(strategy = InheritanceType.JOINED) -public abstract class RObject implements Metadata, Serializable { +public abstract class RObject implements Metadata, EntityState, Serializable { public static final String F_OBJECT_TYPE_CLASS = "objectTypeClass"; + private Boolean trans; + private String oid; private int version; //full XML @@ -124,8 +124,8 @@ public abstract class RObject implements Metadata polys; @Id - @GeneratedValue(generator = "ContainerOidGenerator") - @GenericGenerator(name = "ContainerOidGenerator", strategy = "com.evolveum.midpoint.repo.sql.util.ObjectOidGenerator") + @GeneratedValue(generator = "ObjectOidGenerator") + @GenericGenerator(name = "ObjectOidGenerator", strategy = "com.evolveum.midpoint.repo.sql.util.ObjectOidGenerator") @Column(name = "oid", nullable = false, updatable = false, length = RUtil.COLUMN_LENGTH_OID) public String getOid() { return oid; @@ -136,7 +136,7 @@ public RPolyString getName() { return name; } -// @JoinTable(foreignKey = @ForeignKey(name = "none")) + // @JoinTable(foreignKey = @ForeignKey(name = "none")) @OneToMany(mappedBy = RTrigger.F_OWNER, orphanRemoval = true) @Cascade({org.hibernate.annotations.CascadeType.ALL}) public Set getTrigger() { @@ -315,6 +315,16 @@ public RObjectType getObjectTypeClass() { return objectTypeClass; } + @Transient + public Boolean isTransient() { + return trans; + } + + @Override + public void setTransient(Boolean trans) { + this.trans = trans; + } + public void setObjectTypeClass(RObjectType objectTypeClass) { this.objectTypeClass = objectTypeClass; } @@ -502,14 +512,17 @@ protected static void copyToJAXB(RObject repo, ObjectT } } - public static void copyFromJAXB(ObjectType jaxb, RObject repo, PrismContext prismContext) + public static void copyFromJAXB(ObjectType jaxb, RObject repo, PrismContext prismContext, + IdGeneratorResult generatorResult) throws DtoTranslationException { Validate.notNull(jaxb, "JAXB object must not be null."); Validate.notNull(repo, "Repo object must not be null."); + repo.setTransient(generatorResult.isGeneratedOid()); + repo.setOid(jaxb.getOid()); + repo.setObjectTypeClass(RObjectType.getType(ClassMapper.getHQLTypeClass(jaxb.getClass()))); repo.setName(RPolyString.copyFromJAXB(jaxb.getName())); - repo.setOid(jaxb.getOid()); String strVersion = jaxb.getVersion(); int version = StringUtils.isNotEmpty(strVersion) && strVersion.matches("[0-9]*") ? Integer.parseInt(jaxb @@ -520,8 +533,8 @@ public static void copyFromJAXB(ObjectType jaxb, RObject< repo, RReferenceOwner.OBJECT_PARENT_ORG)); for (TriggerType trigger : jaxb.getTrigger()) { - RTrigger rTrigger = new RTrigger(repo); - RTrigger.copyFromJAXB(trigger, rTrigger, jaxb, prismContext); + RTrigger rTrigger = new RTrigger(null); + RTrigger.copyFromJAXB(trigger, rTrigger, jaxb, prismContext, generatorResult); repo.getTrigger().add(rTrigger); } diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObjectTemplate.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObjectTemplate.java index e4eb95f2139..3dfdd655cbe 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObjectTemplate.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObjectTemplate.java @@ -23,6 +23,7 @@ import com.evolveum.midpoint.repo.sql.data.common.other.RReferenceOwner; import com.evolveum.midpoint.repo.sql.data.common.type.RIncludeRef; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; @@ -110,10 +111,9 @@ public int hashCode() { return result; } - public static void copyFromJAXB(ObjectTemplateType jaxb, RObjectTemplate repo, PrismContext prismContext) throws - DtoTranslationException { - - RObject.copyFromJAXB(jaxb, repo, prismContext); + public static void copyFromJAXB(ObjectTemplateType jaxb, RObjectTemplate repo, PrismContext prismContext, + IdGeneratorResult generatorResult) throws DtoTranslationException { + RObject.copyFromJAXB(jaxb, repo, prismContext, generatorResult); repo.setType(RUtil.getRepoEnumValue(jaxb.asPrismObject().getElementName(), RObjectTemplateType.class)); repo.setName(RPolyString.copyFromJAXB(jaxb.getName())); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/ROrg.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/ROrg.java index 392bf8ca3ef..ea8bab772f8 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/ROrg.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/ROrg.java @@ -19,17 +19,16 @@ import com.evolveum.midpoint.prism.PrismContext; import com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; import com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType; - import org.hibernate.annotations.Cascade; import org.hibernate.annotations.ForeignKey; import org.hibernate.annotations.Index; import javax.persistence.*; - import java.util.Collection; import java.util.Set; @@ -156,9 +155,9 @@ public int hashCode() { return result; } - public static void copyFromJAXB(OrgType jaxb, ROrg repo, PrismContext prismContext) throws - DtoTranslationException { - RAbstractRole.copyFromJAXB(jaxb, repo, prismContext); + public static void copyFromJAXB(OrgType jaxb, ROrg repo, PrismContext prismContext, + IdGeneratorResult generatorResult) throws DtoTranslationException { + RAbstractRole.copyFromJAXB(jaxb, repo, prismContext, generatorResult); repo.setName(RPolyString.copyFromJAXB(jaxb.getName())); repo.setCostCenter(jaxb.getCostCenter()); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RReport.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RReport.java index b0469d5c2f0..012329fc2bd 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RReport.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RReport.java @@ -5,6 +5,7 @@ import com.evolveum.midpoint.repo.sql.data.common.enums.RExportType; import com.evolveum.midpoint.repo.sql.data.common.enums.ROrientationType; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; @@ -107,10 +108,11 @@ public int hashCode() { return result; } - public static void copyFromJAXB(ReportType jaxb, RReport repo, PrismContext prismContext) + public static void copyFromJAXB(ReportType jaxb, RReport repo, PrismContext prismContext, + IdGeneratorResult generatorResult) throws DtoTranslationException { - RObject.copyFromJAXB(jaxb, repo, prismContext); + RObject.copyFromJAXB(jaxb, repo, prismContext, generatorResult); repo.setName(RPolyString.copyFromJAXB(jaxb.getName())); repo.setOrientation(RUtil.getRepoEnumValue(jaxb.getOrientation(), ROrientationType.class)); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RReportOutput.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RReportOutput.java index abdbdad6815..7cf087a67ce 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RReportOutput.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RReportOutput.java @@ -5,6 +5,7 @@ import com.evolveum.midpoint.repo.sql.data.common.embedded.REmbeddedReference; import com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; @@ -67,9 +68,10 @@ public int hashCode() { return result; } - public static void copyFromJAXB(ReportOutputType jaxb, RReportOutput repo, PrismContext prismContext) throws + public static void copyFromJAXB(ReportOutputType jaxb, RReportOutput repo, PrismContext prismContext, + IdGeneratorResult generatorResult) throws DtoTranslationException { - RObject.copyFromJAXB(jaxb, repo, prismContext); + RObject.copyFromJAXB(jaxb, repo, prismContext, generatorResult); repo.setName(RPolyString.copyFromJAXB(jaxb.getName())); repo.setReportRef(RUtil.jaxbRefToEmbeddedRepoRef(jaxb.getReportRef(), prismContext)); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RResource.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RResource.java index 5b7dee7031c..78337938a7b 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RResource.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RResource.java @@ -28,6 +28,7 @@ import com.evolveum.midpoint.repo.sql.data.common.other.RReferenceOwner; import com.evolveum.midpoint.repo.sql.data.common.type.RResourceApproverRef; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; @@ -142,9 +143,10 @@ public int hashCode() { return result; } - public static void copyFromJAXB(ResourceType jaxb, RResource repo, PrismContext prismContext) + public static void copyFromJAXB(ResourceType jaxb, RResource repo, PrismContext prismContext, + IdGeneratorResult generatorResult) throws DtoTranslationException { - RObject.copyFromJAXB(jaxb, repo, prismContext); + RObject.copyFromJAXB(jaxb, repo, prismContext, generatorResult); repo.setName(RPolyString.copyFromJAXB(jaxb.getName())); repo.setConnectorRef(RUtil.jaxbRefToEmbeddedRepoRef(jaxb.getConnectorRef(), prismContext)); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RRole.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RRole.java index 3f43391cc72..d5379fbce45 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RRole.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RRole.java @@ -19,6 +19,7 @@ import com.evolveum.midpoint.prism.PrismContext; import com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; @@ -88,9 +89,9 @@ public int hashCode() { return result; } - public static void copyFromJAXB(RoleType jaxb, RRole repo, PrismContext prismContext) - throws DtoTranslationException { - RAbstractRole.copyFromJAXB(jaxb, repo, prismContext); + public static void copyFromJAXB(RoleType jaxb, RRole repo, PrismContext prismContext, + IdGeneratorResult generatorResult) throws DtoTranslationException { + RAbstractRole.copyFromJAXB(jaxb, repo, prismContext, generatorResult); repo.setRoleType(jaxb.getRoleType()); repo.setName(RPolyString.copyFromJAXB(jaxb.getName())); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSecurityPolicy.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSecurityPolicy.java index 2d50f7ddc9e..ae90bc04732 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSecurityPolicy.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSecurityPolicy.java @@ -3,6 +3,7 @@ import com.evolveum.midpoint.prism.PrismContext; import com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; @@ -53,10 +54,11 @@ public int hashCode() { return result; } - public static void copyFromJAXB(SecurityPolicyType jaxb, RSecurityPolicy repo, PrismContext prismContext) + public static void copyFromJAXB(SecurityPolicyType jaxb, RSecurityPolicy repo, PrismContext prismContext, + IdGeneratorResult generatorResult) throws DtoTranslationException { - RObject.copyFromJAXB(jaxb, repo, prismContext); + RObject.copyFromJAXB(jaxb, repo, prismContext, generatorResult); repo.setName(RPolyString.copyFromJAXB(jaxb.getName())); } diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RShadow.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RShadow.java index fff55e23711..6ad2bde8676 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RShadow.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RShadow.java @@ -28,6 +28,7 @@ import com.evolveum.midpoint.repo.sql.data.common.enums.RSynchronizationSituation; import com.evolveum.midpoint.repo.sql.data.common.type.RObjectExtensionType; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; @@ -231,8 +232,9 @@ public int hashCode() { } public static void copyFromJAXB(ShadowType jaxb, RShadow repo, - PrismContext prismContext) throws DtoTranslationException { - RObject.copyFromJAXB(jaxb, repo, prismContext); + PrismContext prismContext, IdGeneratorResult generatorResult) + throws DtoTranslationException { + RObject.copyFromJAXB(jaxb, repo, prismContext, generatorResult); repo.setName(RPolyString.copyFromJAXB(jaxb.getName())); repo.setObjectClass(RUtil.qnameToString(jaxb.getObjectClass())); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSystemConfiguration.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSystemConfiguration.java index 74000650d3a..072491addba 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSystemConfiguration.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSystemConfiguration.java @@ -19,6 +19,7 @@ import com.evolveum.midpoint.prism.PrismContext; import com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; @@ -74,8 +75,9 @@ public int hashCode() { } public static void copyFromJAXB(SystemConfigurationType jaxb, RSystemConfiguration repo, - PrismContext prismContext) throws DtoTranslationException { - RObject.copyFromJAXB(jaxb, repo, prismContext); + PrismContext prismContext, IdGeneratorResult generatorResult) + throws DtoTranslationException { + RObject.copyFromJAXB(jaxb, repo, prismContext, generatorResult); repo.setName(RPolyString.copyFromJAXB(jaxb.getName())); } diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RTask.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RTask.java index 3ed34341d35..7e1c454b752 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RTask.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RTask.java @@ -22,6 +22,7 @@ import com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString; import com.evolveum.midpoint.repo.sql.data.common.enums.*; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; @@ -305,10 +306,10 @@ public int hashCode() { return result1; } - public static void copyFromJAXB(TaskType jaxb, RTask repo, PrismContext prismContext) throws - DtoTranslationException { - RObject.copyFromJAXB(jaxb, repo, prismContext); - + public static void copyFromJAXB(TaskType jaxb, RTask repo, PrismContext prismContext, + IdGeneratorResult generatorResult) throws DtoTranslationException { + RObject.copyFromJAXB(jaxb, repo, prismContext, generatorResult); + PrismObjectDefinition taskDefinition = jaxb.asPrismObject().getDefinition(); repo.setName(RPolyString.copyFromJAXB(jaxb.getName())); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RUser.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RUser.java index 8c59b25fbce..7af2e00dcf5 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RUser.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RUser.java @@ -22,6 +22,7 @@ import com.evolveum.midpoint.repo.sql.data.common.enums.ROperationResultStatus; import com.evolveum.midpoint.repo.sql.query.definition.JaxbName; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; @@ -363,9 +364,9 @@ public int hashCode() { return result; } - public static void copyFromJAXB(UserType jaxb, RUser repo, PrismContext prismContext) throws - DtoTranslationException { - RFocus.copyFromJAXB(jaxb, repo, prismContext); + public static void copyFromJAXB(UserType jaxb, RUser repo, PrismContext prismContext, + IdGeneratorResult generatorResult) throws DtoTranslationException { + RFocus.copyFromJAXB(jaxb, repo, prismContext, generatorResult); repo.setName(RPolyString.copyFromJAXB(jaxb.getName())); repo.setFullName(RPolyString.copyFromJAXB(jaxb.getFullName())); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RValuePolicy.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RValuePolicy.java index ac47c719a4a..56eb0b87f47 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RValuePolicy.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RValuePolicy.java @@ -19,6 +19,7 @@ import com.evolveum.midpoint.prism.PrismContext; import com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; @@ -72,9 +73,9 @@ public int hashCode() { return result; } - public static void copyFromJAXB(ValuePolicyType jaxb, RValuePolicy repo, PrismContext prismContext) throws - DtoTranslationException { - RObject.copyFromJAXB(jaxb, repo, prismContext); + public static void copyFromJAXB(ValuePolicyType jaxb, RValuePolicy repo, PrismContext prismContext, + IdGeneratorResult generatorResult) throws DtoTranslationException { + RObject.copyFromJAXB(jaxb, repo, prismContext, generatorResult); repo.setName(RPolyString.copyFromJAXB(jaxb.getName())); } diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/Container.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/Container.java index 07f2fb5652a..a7f2a166665 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/Container.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/Container.java @@ -17,13 +17,14 @@ package com.evolveum.midpoint.repo.sql.data.common.container; import com.evolveum.midpoint.repo.sql.data.common.RObject; +import com.evolveum.midpoint.repo.sql.util.EntityState; import java.io.Serializable; /** * @author lazyman */ -public interface Container extends Serializable { +public interface Container extends EntityState, Serializable { RObject getOwner(); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RAssignment.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RAssignment.java index 16142843eec..a8d8e530a43 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RAssignment.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RAssignment.java @@ -16,7 +16,6 @@ package com.evolveum.midpoint.repo.sql.data.common.container; -import com.evolveum.midpoint.prism.ItemDefinition; import com.evolveum.midpoint.prism.PrismContext; import com.evolveum.midpoint.repo.sql.data.common.Metadata; import com.evolveum.midpoint.repo.sql.data.common.RObject; @@ -31,6 +30,7 @@ import com.evolveum.midpoint.repo.sql.data.factory.MetadataFactory; import com.evolveum.midpoint.repo.sql.query.definition.JaxbType; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.util.logging.Trace; import com.evolveum.midpoint.util.logging.TraceManager; @@ -42,7 +42,6 @@ import javax.persistence.*; import javax.persistence.Entity; -import javax.persistence.ForeignKey; import javax.persistence.Index; import javax.persistence.Table; import javax.xml.datatype.XMLGregorianCalendar; @@ -70,6 +69,8 @@ public class RAssignment implements Container, Metadata { private static final Trace LOGGER = TraceManager.getTrace(RAssignment.class); + private Boolean trans; + private RObject owner; private String ownerOid; private Short id; @@ -210,6 +211,17 @@ public XMLGregorianCalendar getModifyTimestamp() { return modifyTimestamp; } + @Transient + @Override + public Boolean isTransient() { + return trans; + } + + @Override + public void setTransient(Boolean trans) { + this.trans = trans; + } + public void setOwner(RObject owner) { this.owner = owner; } @@ -315,11 +327,13 @@ public int hashCode() { return result; } - public static void copyFromJAXB(AssignmentType jaxb, RAssignment repo, ObjectType parent, PrismContext prismContext) - throws DtoTranslationException { + public static void copyFromJAXB(AssignmentType jaxb, RAssignment repo, ObjectType parent, PrismContext prismContext, + IdGeneratorResult generatorResult) throws DtoTranslationException { Validate.notNull(repo, "Repo object must not be null."); Validate.notNull(jaxb, "JAXB object must not be null."); + repo.setTransient(generatorResult.isTransient(jaxb.asPrismContainerValue())); + repo.setOwnerOid(parent.getOid()); repo.setId(RUtil.toShort(jaxb.getId())); repo.setOrder(jaxb.getOrder()); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RExclusion.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RExclusion.java index ff9d1f7b4e8..02f7321c84b 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RExclusion.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RExclusion.java @@ -23,6 +23,7 @@ import com.evolveum.midpoint.repo.sql.data.common.id.RContainerId; import com.evolveum.midpoint.repo.sql.query.definition.JaxbType; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.xml.ns._public.common.common_3.ExclusionType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; @@ -43,6 +44,9 @@ public class RExclusion implements Container { public static final String F_OWNER = "owner"; + + private Boolean trans; + //owner private RObject owner; private String ownerOid; @@ -94,6 +98,17 @@ public REmbeddedReference getTargetRef() { return targetRef; } + @Transient + @Override + public Boolean isTransient() { + return trans; + } + + @Override + public void setTransient(Boolean trans) { + this.trans = trans; + } + public void setOwner(RObject owner) { this.owner = owner; } @@ -150,11 +165,12 @@ public static void copyToJAXB(RExclusion repo, ExclusionType jaxb, PrismContext } } - public static void copyFromJAXB(ExclusionType jaxb, RExclusion repo, ObjectType parent, PrismContext prismContext) - throws DtoTranslationException { + public static void copyFromJAXB(ExclusionType jaxb, RExclusion repo, ObjectType parent, PrismContext prismContext, + IdGeneratorResult generatorResult) throws DtoTranslationException { Validate.notNull(repo, "Repo object must not be null."); Validate.notNull(jaxb, "JAXB object must not be null."); + repo.setTransient(generatorResult.isTransient(jaxb.asPrismContainerValue())); repo.setOwnerOid(parent.getOid()); repo.setId(RUtil.toShort(jaxb.getId())); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RTrigger.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RTrigger.java index 523a83b2189..65204f2df3d 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RTrigger.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RTrigger.java @@ -5,6 +5,7 @@ import com.evolveum.midpoint.repo.sql.data.common.id.RContainerId; import com.evolveum.midpoint.repo.sql.query.definition.JaxbType; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; import com.evolveum.midpoint.xml.ns._public.common.common_3.TriggerType; @@ -20,6 +21,7 @@ @JaxbType(type = TriggerType.class) @Entity @IdClass(RContainerId.class) +//@Table(indexes = {@Index(name = "iTriggerTimestamp", columnList = RTrigger.C_TIMESTAMP)}) @ForeignKey(name = "fk_trigger") @org.hibernate.annotations.Table(appliesTo = "m_trigger", indexes = {@Index(name = "iTriggerTimestamp", columnNames = RTrigger.C_TIMESTAMP)}) @@ -28,6 +30,8 @@ public class RTrigger implements Container { public static final String F_OWNER = "owner"; public static final String C_TIMESTAMP = "timestampValue"; + private Boolean trans; + //identificator private RObject owner; private String ownerOid; @@ -44,7 +48,6 @@ public RTrigger(RObject owner) { setOwner(owner); } - @Id @ForeignKey(name = "fk_trigger_owner") @MapsId("owner") @@ -78,6 +81,17 @@ public XMLGregorianCalendar getTimestamp() { return timestamp; } + @Transient + @Override + public Boolean isTransient() { + return trans; + } + + @Override + public void setTransient(Boolean trans) { + this.trans = trans; + } + public void setOwner(RObject owner) { this.owner = owner; } @@ -133,10 +147,12 @@ public static void copyToJAXB(RTrigger repo, TriggerType jaxb, PrismContext pris } public static void copyFromJAXB(TriggerType jaxb, RTrigger repo, ObjectType parent, - PrismContext prismContext) throws DtoTranslationException { + PrismContext prismContext, IdGeneratorResult generatorResult) + throws DtoTranslationException { Validate.notNull(repo, "Repo object must not be null."); Validate.notNull(jaxb, "JAXB object must not be null."); + repo.setTransient(generatorResult.isTransient(jaxb.asPrismContainerValue())); repo.setOwnerOid(parent.getOid()); repo.setId(RUtil.toShort(jaxb.getId())); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/ContainerIdGenerator.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/ContainerIdGenerator.java index 4c9345476d1..d01b13a1354 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/ContainerIdGenerator.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/ContainerIdGenerator.java @@ -36,7 +36,7 @@ public class ContainerIdGenerator implements IdentifierGenerator { public Serializable generate(SessionImplementor session, Object object) throws HibernateException { if (!(object instanceof Container)) { throw new HibernateException("Couldn't create id for '" - + object.getClass().getSimpleName() + "' not instance of RContainer."); + + object.getClass().getSimpleName() + "' not instance of '" + Container.class.getName() + "'."); } return generate((Container) object); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/EntityState.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/EntityState.java new file mode 100644 index 00000000000..4fd58910f81 --- /dev/null +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/EntityState.java @@ -0,0 +1,11 @@ +package com.evolveum.midpoint.repo.sql.util; + +/** + * @author lazyman + */ +public interface EntityState { + + Boolean isTransient(); + + void setTransient(Boolean trans); +} diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/EntityStateInterceptor.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/EntityStateInterceptor.java new file mode 100644 index 00000000000..4825b13fe02 --- /dev/null +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/EntityStateInterceptor.java @@ -0,0 +1,56 @@ +package com.evolveum.midpoint.repo.sql.util; + +import com.evolveum.midpoint.repo.sql.data.common.RObject; +import com.evolveum.midpoint.repo.sql.data.common.RObjectReference; +import com.evolveum.midpoint.repo.sql.data.common.RUserPhoto; +import com.evolveum.midpoint.repo.sql.data.common.any.RAExtValue; +import com.evolveum.midpoint.repo.sql.data.common.any.RAssignmentExtension; +import com.evolveum.midpoint.repo.sql.data.common.any.ROExtValue; +import com.evolveum.midpoint.repo.sql.data.common.container.Container; +import com.evolveum.midpoint.repo.sql.data.common.container.RAssignmentReference; +import org.hibernate.EmptyInterceptor; + +/** + * @author lazyman + */ +public class EntityStateInterceptor extends EmptyInterceptor { + + @Override + public Boolean isTransient(Object entity) { + if (entity instanceof EntityState) { + return ((EntityState) entity).isTransient(); + } + + if (entity instanceof RObjectReference) { + RObjectReference ref = (RObjectReference) entity; + return isTransient(ref.getOwner()); + } else if (entity instanceof RAssignmentReference) { + RAssignmentReference ref = (RAssignmentReference) entity; + return isTransient(ref.getOwner()); + } else if (entity instanceof RAssignmentExtension) { + RAssignmentExtension ext = (RAssignmentExtension) entity; + return isTransient(ext.getOwner()); + } else if (entity instanceof RAExtValue) { + RAExtValue val = (RAExtValue) entity; + RAssignmentExtension ext = val.getAnyContainer(); + return ext != null ? isTransient(ext.getOwner()) : null; + } else if (entity instanceof ROExtValue) { + ROExtValue val = (ROExtValue) entity; + return isTransient(val.getOwner()); + } else if (entity instanceof RUserPhoto) { + RUserPhoto photo = (RUserPhoto) entity; + return isTransient(photo.getOwner()); + } + + return null; + } + + private Boolean isTransient(EntityState object) { + Boolean trans = object != null ? object.isTransient() : null; + if (Boolean.TRUE.equals(trans)) { + return true; + } + + return null; + } +} diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/IdGeneratorResult.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/IdGeneratorResult.java new file mode 100644 index 00000000000..b2125e65995 --- /dev/null +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/IdGeneratorResult.java @@ -0,0 +1,31 @@ +package com.evolveum.midpoint.repo.sql.util; + +import com.evolveum.midpoint.prism.PrismContainerValue; + +import java.util.HashSet; +import java.util.Set; + +/** + * @author lazyman + */ +public class IdGeneratorResult { + + private Set values = new HashSet<>(); + private boolean generatedOid; + + public Set getValues() { + return values; + } + + public boolean isGeneratedOid() { + return generatedOid; + } + + public void setGeneratedOid(boolean generatedOid) { + this.generatedOid = generatedOid; + } + + public boolean isTransient(PrismContainerValue value) { + return generatedOid || values.contains(value); + } +} diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/PrismIdentifierGenerator.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/PrismIdentifierGenerator.java index 91cac494f9b..5f343953365 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/PrismIdentifierGenerator.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/PrismIdentifierGenerator.java @@ -16,16 +16,28 @@ */ public class PrismIdentifierGenerator { - public void generate(PrismObject object) { + /** + * Method inserts id for prism container values, which didn't have ids, + * also returns all container values which has generated id + * + * @param object + * @return + */ + public IdGeneratorResult generate(PrismObject object) { + IdGeneratorResult result = new IdGeneratorResult(); if (StringUtils.isEmpty(object.getOid())) { String oid = UUID.randomUUID().toString(); object.setOid(oid); + + result.setGeneratedOid(true); } - generateIdForObject(object); + generateIdForObject(object, result, result.isGeneratedOid()); + + return result; } - private void generateIdForObject(PrismObject object) { + private void generateIdForObject(PrismObject object, IdGeneratorResult result, boolean generatedOid) { if (object == null) { return; } @@ -52,6 +64,10 @@ private void generateIdForObject(PrismObject object) { for (PrismContainerValue val : (List) c.getValues()) { if (val.getId() != null) { + if (generatedOid) { + result.getValues().add(val); + } + continue; } @@ -61,6 +77,8 @@ private void generateIdForObject(PrismObject object) { val.setId(nextId); usedIds.add(nextId); + + result.getValues().add(val); } } } diff --git a/repo/repo-sql-impl/src/main/resources/ctx-repository-session.xml b/repo/repo-sql-impl/src/main/resources/ctx-repository-session.xml index 8916a7f1fd0..0919aaf7865 100644 --- a/repo/repo-sql-impl/src/main/resources/ctx-repository-session.xml +++ b/repo/repo-sql-impl/src/main/resources/ctx-repository-session.xml @@ -79,5 +79,8 @@ com.evolveum.midpoint.repo.sql.data.audit + + + \ No newline at end of file From 578f3e0f7b622ce0e8dce0c2b25af986dc4c68e6 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Mon, 1 Dec 2014 11:51:42 +0100 Subject: [PATCH 005/215] audit operation improved, no select queries needed. --- .../repo/sql/data/audit/RAuditEventRecord.java | 1 + .../sql/data/audit/RObjectDeltaOperation.java | 16 +++++++++++++++- .../repo/sql/util/EntityStateInterceptor.java | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/audit/RAuditEventRecord.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/audit/RAuditEventRecord.java index 9442e6de722..d4daa0b25f3 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/audit/RAuditEventRecord.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/audit/RAuditEventRecord.java @@ -391,6 +391,7 @@ public static RAuditEventRecord toRepo(AuditEventRecord record, PrismContext pri continue; } RObjectDeltaOperation rDelta = RObjectDeltaOperation.toRepo(repo, delta, prismContext); + rDelta.setTransient(true); rDelta.setRecord(repo); repo.getDeltas().add(rDelta); } diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/audit/RObjectDeltaOperation.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/audit/RObjectDeltaOperation.java index 11d4b34123f..3b53e8df63d 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/audit/RObjectDeltaOperation.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/audit/RObjectDeltaOperation.java @@ -23,6 +23,7 @@ import com.evolveum.midpoint.repo.sql.data.common.enums.RChangeType; import com.evolveum.midpoint.repo.sql.data.common.enums.ROperationResultStatus; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.EntityState; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.schema.DeltaConvertor; import com.evolveum.midpoint.schema.ObjectDeltaOperation; @@ -42,11 +43,13 @@ @Entity @IdClass(RObjectDeltaOperationId.class) @Table(name = RObjectDeltaOperation.TABLE_NAME) -public class RObjectDeltaOperation implements OperationResultFull { +public class RObjectDeltaOperation implements OperationResultFull, EntityState { public static final String TABLE_NAME = "m_audit_delta"; public static final String COLUMN_RECORD_ID = "record_id"; + private Boolean trans; + private RAuditEventRecord record; private Long recordId; @@ -121,6 +124,17 @@ public ROperationResultStatus getStatus() { return status; } + @Transient + @Override + public Boolean isTransient() { + return trans; + } + + @Override + public void setTransient(Boolean trans) { + this.trans = trans; + } + public void setRecord(RAuditEventRecord record) { this.record = record; } diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/EntityStateInterceptor.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/EntityStateInterceptor.java index 4825b13fe02..c8ef671824a 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/EntityStateInterceptor.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/EntityStateInterceptor.java @@ -1,5 +1,6 @@ package com.evolveum.midpoint.repo.sql.util; +import com.evolveum.midpoint.repo.sql.data.audit.RObjectDeltaOperation; import com.evolveum.midpoint.repo.sql.data.common.RObject; import com.evolveum.midpoint.repo.sql.data.common.RObjectReference; import com.evolveum.midpoint.repo.sql.data.common.RUserPhoto; From 2122fb87e6777497e77915a32a106f3b42914768 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Thu, 4 Dec 2014 09:17:14 +0100 Subject: [PATCH 006/215] one more fix to entity state interceptor. --- .../repo/sql/SqlRepositoryServiceImpl.java | 13 +++++++++---- .../repo/sql/util/EntityStateInterceptor.java | 5 +---- .../sql/util/PrismIdentifierGenerator.java | 19 ++++++++++++------- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SqlRepositoryServiceImpl.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SqlRepositoryServiceImpl.java index 8dc79e87e7d..25e731ac081 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SqlRepositoryServiceImpl.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SqlRepositoryServiceImpl.java @@ -464,7 +464,11 @@ private String addObjectAttempt(PrismObject object, Re } LOGGER.trace("Translating JAXB to data type."); - RObject rObject = createDataObjectFromJAXB(object, true); + PrismIdentifierGenerator.Operation operation = options.isOverwrite() ? + PrismIdentifierGenerator.Operation.ADD_WITH_OVERWRITE : + PrismIdentifierGenerator.Operation.ADD; + + RObject rObject = createDataObjectFromJAXB(object, operation); session = beginTransaction(); @@ -1042,7 +1046,7 @@ private void modifyObjectAttempt(Class type, String oi } // merge and update user LOGGER.trace("Translating JAXB to data type."); - RObject rObject = createDataObjectFromJAXB(prismObject, false); + RObject rObject = createDataObjectFromJAXB(prismObject, PrismIdentifierGenerator.Operation.MODIFY); rObject.setVersion(rObject.getVersion() + 1); updateFullObject(rObject, prismObject); @@ -1196,11 +1200,12 @@ private void validateObjectType(PrismObject prismObjec } } - private RObject createDataObjectFromJAXB(PrismObject prismObject, boolean add) + private RObject createDataObjectFromJAXB(PrismObject prismObject, + PrismIdentifierGenerator.Operation operation) throws SchemaException { PrismIdentifierGenerator generator = new PrismIdentifierGenerator(); - IdGeneratorResult generatorResult = generator.generate(prismObject); + IdGeneratorResult generatorResult = generator.generate(prismObject, operation); T object = prismObject.asObjectable(); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/EntityStateInterceptor.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/EntityStateInterceptor.java index c8ef671824a..f0869df164d 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/EntityStateInterceptor.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/EntityStateInterceptor.java @@ -1,13 +1,10 @@ package com.evolveum.midpoint.repo.sql.util; -import com.evolveum.midpoint.repo.sql.data.audit.RObjectDeltaOperation; -import com.evolveum.midpoint.repo.sql.data.common.RObject; import com.evolveum.midpoint.repo.sql.data.common.RObjectReference; import com.evolveum.midpoint.repo.sql.data.common.RUserPhoto; import com.evolveum.midpoint.repo.sql.data.common.any.RAExtValue; import com.evolveum.midpoint.repo.sql.data.common.any.RAssignmentExtension; import com.evolveum.midpoint.repo.sql.data.common.any.ROExtValue; -import com.evolveum.midpoint.repo.sql.data.common.container.Container; import com.evolveum.midpoint.repo.sql.data.common.container.RAssignmentReference; import org.hibernate.EmptyInterceptor; @@ -19,7 +16,7 @@ public class EntityStateInterceptor extends EmptyInterceptor { @Override public Boolean isTransient(Object entity) { if (entity instanceof EntityState) { - return ((EntityState) entity).isTransient(); + return isTransient((EntityState) entity); } if (entity instanceof RObjectReference) { diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/PrismIdentifierGenerator.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/PrismIdentifierGenerator.java index 5f343953365..318caa7fbf4 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/PrismIdentifierGenerator.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/PrismIdentifierGenerator.java @@ -6,7 +6,6 @@ import com.evolveum.midpoint.xml.ns._public.common.common_3.AbstractRoleType; import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; - import org.apache.cxf.common.util.StringUtils; import java.util.*; @@ -16,6 +15,8 @@ */ public class PrismIdentifierGenerator { + public static enum Operation {ADD, ADD_WITH_OVERWRITE, MODIFY} + /** * Method inserts id for prism container values, which didn't have ids, * also returns all container values which has generated id @@ -23,8 +24,11 @@ public class PrismIdentifierGenerator { * @param object * @return */ - public IdGeneratorResult generate(PrismObject object) { + public IdGeneratorResult generate(PrismObject object, Operation operation) { IdGeneratorResult result = new IdGeneratorResult(); + boolean adding = Operation.ADD.equals(operation); + result.setGeneratedOid(adding); + if (StringUtils.isEmpty(object.getOid())) { String oid = UUID.randomUUID().toString(); object.setOid(oid); @@ -32,12 +36,12 @@ public IdGeneratorResult generate(PrismObject object) { result.setGeneratedOid(true); } - generateIdForObject(object, result, result.isGeneratedOid()); + generateIdForObject(object, result, operation); return result; } - private void generateIdForObject(PrismObject object, IdGeneratorResult result, boolean generatedOid) { + private void generateIdForObject(PrismObject object, IdGeneratorResult result, Operation operation) { if (object == null) { return; } @@ -64,10 +68,9 @@ private void generateIdForObject(PrismObject object, IdGeneratorResult result, b for (PrismContainerValue val : (List) c.getValues()) { if (val.getId() != null) { - if (generatedOid) { + if (Operation.ADD.equals(operation)) { result.getValues().add(val); } - continue; } @@ -78,7 +81,9 @@ private void generateIdForObject(PrismObject object, IdGeneratorResult result, b val.setId(nextId); usedIds.add(nextId); - result.getValues().add(val); + if (!Operation.ADD_WITH_OVERWRITE.equals(operation)) { + result.getValues().add(val); + } } } } From 8c776b2eba81f2161a2106f1198b1637eaaab1fd Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Mon, 8 Dec 2014 09:56:34 +0100 Subject: [PATCH 007/215] one more fix to entity state interceptor. --- .../midpoint/repo/sql/util/EntityStateInterceptor.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/EntityStateInterceptor.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/EntityStateInterceptor.java index f0869df164d..df7bbc54c29 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/EntityStateInterceptor.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/EntityStateInterceptor.java @@ -44,7 +44,14 @@ public Boolean isTransient(Object entity) { } private Boolean isTransient(EntityState object) { + return isTransient(object, false); + } + + private Boolean isTransient(EntityState object, boolean isObjectMyParent) { Boolean trans = object != null ? object.isTransient() : null; + if (!isObjectMyParent) { + return trans; + } if (Boolean.TRUE.equals(trans)) { return true; } From b9784cbad0848165a8c89f2f360c0c0ec6cc5625 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Sun, 14 Dec 2014 19:08:30 +0100 Subject: [PATCH 008/215] fix in id generator. --- .../midpoint/repo/sql/util/PrismIdentifierGenerator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/PrismIdentifierGenerator.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/PrismIdentifierGenerator.java index 318caa7fbf4..53d19f48ace 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/PrismIdentifierGenerator.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/PrismIdentifierGenerator.java @@ -81,7 +81,8 @@ private void generateIdForObject(PrismObject object, IdGeneratorResult result, O val.setId(nextId); usedIds.add(nextId); - if (!Operation.ADD_WITH_OVERWRITE.equals(operation)) { + if (!Operation.ADD_WITH_OVERWRITE.equals(operation) + && !Operation.MODIFY.equals(operation)) { result.getValues().add(val); } } From 952e1e525268f1726fe57a658287ce033693db3e Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Mon, 15 Dec 2014 11:49:15 +0100 Subject: [PATCH 009/215] prepared modify handlers, implementation still missing. --- repo/repo-sql-impl-test/STATS | 5 +- .../repo/sql/MetadataModifyHandler.java | 43 +++++++++++++ .../midpoint/repo/sql/ModifyHandler.java | 45 +++++++++++++ .../repo/sql/SqlRepositoryServiceImpl.java | 6 +- .../repo/sql/SyncSituationModifyHandler.java | 64 +++++++++++++++++++ 5 files changed, 158 insertions(+), 5 deletions(-) create mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/MetadataModifyHandler.java create mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/ModifyHandler.java create mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SyncSituationModifyHandler.java diff --git a/repo/repo-sql-impl-test/STATS b/repo/repo-sql-impl-test/STATS index 21d8c6ef6aa..2e3a3acf2e0 100644 --- a/repo/repo-sql-impl-test/STATS +++ b/repo/repo-sql-impl-test/STATS @@ -1,3 +1,4 @@ find . -name "test.log" -exec cat {} \; | grep org.hibernate.SQL | grep -v ": $" | wc -l -master: 254277 -long(default,aspectj,extratest): 155507 \ No newline at end of file +long(default,aspectj,extratest) - TestLdapUniversity (4k entries): +646563 => + diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/MetadataModifyHandler.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/MetadataModifyHandler.java new file mode 100644 index 00000000000..a16bba706ca --- /dev/null +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/MetadataModifyHandler.java @@ -0,0 +1,43 @@ +package com.evolveum.midpoint.repo.sql; + +/** + * @author lazyman + */ + +import com.evolveum.midpoint.prism.delta.ItemDelta; +import com.evolveum.midpoint.schema.result.OperationResult; +import com.evolveum.midpoint.util.exception.ObjectNotFoundException; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; + +import java.util.Collection; + +/** + * @author lazyman + * + *

+ * iteration + * REPLACE: 0 + * iterationToken + * REPLACE: + * metadata/modifyChannel + * REPLACE: http://midpoint.evolveum.com/xml/ns/public/provisioning/channels-3#import + * metadata/modifyTimestamp + * REPLACE: 2014-12-14T21:18:28.932+01:00 + * metadata/modifierRef + * REPLACE: oid=00000000-0000-0000-0000-00000000000 + */ +public class MetadataModifyHandler implements ModifyHandler { + + @Override + public boolean canHandle(Class type, String oid, + Collection modifications) { + return false; + } + + @Override + public void modifyObject(Class type, String oid, + Collection modifications, + OperationResult result) throws ObjectNotFoundException { + + } +} diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/ModifyHandler.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/ModifyHandler.java new file mode 100644 index 00000000000..5244803e85a --- /dev/null +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/ModifyHandler.java @@ -0,0 +1,45 @@ +package com.evolveum.midpoint.repo.sql; + +import com.evolveum.midpoint.prism.delta.ItemDelta; +import com.evolveum.midpoint.schema.result.OperationResult; +import com.evolveum.midpoint.util.exception.ObjectNotFoundException; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; + +import java.util.Collection; + +/** + * @author lazyman + *

+ * This interface provides abstraction for different modify operation handlers and + * can be used for optimization. For example some simple modification operations can be done + * without merging full entity state, which should save a few select queries during merge + * (in case of complex objects it could be 10-20 select queries). + *

+ * Instances of his interface should be stateless. + */ +public interface ModifyHandler { + + /** + * + * @param type + * @param oid + * @param modifications + * @param + * @return + */ + boolean canHandle(Class type, String oid, + Collection modifications); + + /** + * + * @param type + * @param oid + * @param modifications + * @param result + * @param + * @throws ObjectNotFoundException + */ + void modifyObject(Class type, String oid, + Collection modifications, + OperationResult result) throws ObjectNotFoundException; +} diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SqlRepositoryServiceImpl.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SqlRepositoryServiceImpl.java index 25e731ac081..f3789ac746a 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SqlRepositoryServiceImpl.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SqlRepositoryServiceImpl.java @@ -707,7 +707,7 @@ public int countObjects(Class type, ObjectQuery query, OperationResult subResult = result.createMinorSubresult(COUNT_OBJECTS); subResult.addParam("type", type.getName()); subResult.addParam("query", query); - + if (query != null) { ObjectFilter filter = query.getFilter(); filter = ObjectQueryUtil.simplify(filter); @@ -775,7 +775,7 @@ public SearchResultList> searchObjects(Cla subResult.addParam("type", type.getName()); subResult.addParam("query", query); // subResult.addParam("paging", paging); - + if (query != null) { ObjectFilter filter = query.getFilter(); filter = ObjectQueryUtil.simplify(filter); @@ -1445,7 +1445,7 @@ public SearchResultMetadata searchObjectsIterative(Class< OperationResult subResult = result.createSubresult(SEARCH_OBJECTS_ITERATIVE); subResult.addParam("type", type.getName()); subResult.addParam("query", query); - + if (query != null) { ObjectFilter filter = query.getFilter(); filter = ObjectQueryUtil.simplify(filter); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SyncSituationModifyHandler.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SyncSituationModifyHandler.java new file mode 100644 index 00000000000..0ecf68a98aa --- /dev/null +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SyncSituationModifyHandler.java @@ -0,0 +1,64 @@ +package com.evolveum.midpoint.repo.sql; + +import com.evolveum.midpoint.prism.delta.ItemDelta; +import com.evolveum.midpoint.prism.delta.PropertyDelta; +import com.evolveum.midpoint.schema.result.OperationResult; +import com.evolveum.midpoint.util.exception.ObjectNotFoundException; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; + +import java.util.Collection; + +/** + * @author lazyman + *

+ * synchronizationSituationDescription + * ADD: SyncDesc(LINKED,2014-12-14T20:24:22.659+01:00,http://midpoint.evolveum.com/xml/ns/public/provisioning/channels-3#reconciliation,full) + * synchronizationTimestamp + * REPLACE: 2014-12-14T20:24:22.659+01:00 + * fullSynchronizationTimestamp + * REPLACE: 2014-12-14T20:24:22.659+01:00 + * or + * synchronizationSituationDescription + * ADD: SyncDesc(LINKED,2014-12-14T21:18:29.043+01:00,full) + * synchronizationTimestamp + * REPLACE: 2014-12-14T21:18:29.043+01:00 + * fullSynchronizationTimestamp + * REPLACE: 2014-12-14T21:18:29.043+01:00 + * synchronizationSituation + * REPLACE: LINKED + */ +public class SyncSituationModifyHandler implements ModifyHandler { + + @Override + public boolean canHandle(Class type, String oid, + Collection modifications) { + if (!ShadowType.class.isAssignableFrom(type)) { + return false; + } + + if (modifications.size() == 3 || modifications.size() == 4) { + return false; + } + + PropertyDelta syncSituationDesc = PropertyDelta.findPropertyDelta(modifications, + ShadowType.F_SYNCHRONIZATION_SITUATION_DESCRIPTION); + PropertyDelta syncTimestamp = PropertyDelta.findPropertyDelta(modifications, + ShadowType.F_SYNCHRONIZATION_TIMESTAMP); + PropertyDelta fullSyncTimestamp = PropertyDelta.findPropertyDelta(modifications, + ShadowType.F_FULL_SYNCHRONIZATION_TIMESTAMP); + + if (syncSituationDesc == null || syncTimestamp == null || fullSyncTimestamp == null) { + return false; + } + + return true; + } + + @Override + public void modifyObject(Class type, String oid, + Collection modifications, + OperationResult result) throws ObjectNotFoundException { + + } +} From 45b1821ae464fee21bcbd2c3a9320f120119bb77 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Fri, 2 Jan 2015 12:32:38 +0100 Subject: [PATCH 010/215] added perf. logging messages. --- .../repo/sql/SqlRepositoryServiceImpl.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SqlRepositoryServiceImpl.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SqlRepositoryServiceImpl.java index f06670ce480..9e04eafc86a 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SqlRepositoryServiceImpl.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SqlRepositoryServiceImpl.java @@ -76,6 +76,8 @@ public class SqlRepositoryServiceImpl extends SqlBaseService implements RepositoryService { private static final Trace LOGGER = TraceManager.getTrace(SqlRepositoryServiceImpl.class); + private static final Trace LOGGER_SQL = TraceManager.getTrace("org.hibernate.SQL"); + private static final int MAX_CONSTRAINT_NAME_LENGTH = 40; private static final String IMPLEMENTATION_SHORT_NAME = "SQL"; private static final String IMPLEMENTATION_DESCRIPTION = "Implementation that stores data in generic relational" + @@ -226,6 +228,7 @@ private PrismObject getObjectAttempt(Class type, St Collection> options, OperationResult result) throws ObjectNotFoundException, SchemaException { + LOGGER_SQL.debug("> get object {}, oid={}", type.getSimpleName(), oid); PrismObject objectType = null; Session session = null; @@ -285,6 +288,7 @@ public PrismObject searchShadowOwner(String shadowOid, private PrismObject searchShadowOwnerAttempt(String shadowOid, Collection> options, OperationResult result) throws ObjectNotFoundException { + LOGGER_SQL.debug("> search shadow owner for oid={}", shadowOid); PrismObject owner = null; Session session = null; try { @@ -357,6 +361,7 @@ public PrismObject listAccountShadowOwner(String accountOid, Operation private PrismObject listAccountShadowOwnerAttempt(String accountOid, OperationResult result) throws ObjectNotFoundException { + LOGGER_SQL.debug("> list account shadow owner oid={}", accountOid); PrismObject userType = null; Session session = null; try { @@ -451,6 +456,8 @@ public String addObject(PrismObject object, RepoAddOpt private String addObjectAttempt(PrismObject object, RepoAddOptions options, OperationResult result) throws ObjectAlreadyExistsException, SchemaException { + LOGGER_SQL.debug("> add object {}, oid={}, overwrite={}", + new Object[]{object.getCompileTimeClass().getSimpleName(), object.getOid(), options.isOverwrite()}); String oid = null; Session session = null; OrgClosureManager.Context closureContext = null; @@ -664,6 +671,7 @@ private List createAddParentRefDelta(Pris private void deleteObjectAttempt(Class type, String oid, OperationResult result) throws ObjectNotFoundException { + LOGGER_SQL.debug("> delete object {}, oid={}", new Object[]{type.getSimpleName(), oid}); Session session = null; OrgClosureManager.Context closureContext = null; try { @@ -732,6 +740,8 @@ public int countObjects(Class type, ObjectQuery query, } private int countObjectsAttempt(Class type, ObjectQuery query, OperationResult result) { + LOGGER_SQL.debug("> count objects {}", new Object[]{type.getSimpleName()}); + int count = 0; Session session = null; @@ -831,6 +841,7 @@ private void logSearchInputParameters(Class type, Obje private SearchResultList> searchObjectsAttempt(Class type, ObjectQuery query, Collection> options, OperationResult result) throws SchemaException { + LOGGER_SQL.debug("> search objects {}", new Object[]{type.getSimpleName()}); List> list = new ArrayList<>(); Session session = null; try { @@ -1019,6 +1030,8 @@ private void modifyObjectAttempt(Class type, String oi OperationResult result) throws ObjectNotFoundException, SchemaException, ObjectAlreadyExistsException, SerializationRelatedException { LOGGER.debug("Modifying object '{}' with oid '{}'.", new Object[]{type.getSimpleName(), oid}); + LOGGER_SQL.debug("> modify object {}, oid={}, modifications={}", + new Object[]{type.getSimpleName(), oid, modifications}); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Modifications:\n{}", new Object[]{DebugUtil.debugDump(modifications)}); } @@ -1167,6 +1180,8 @@ private List> listResourceObjectShadowsAtt String resourceOid, Class resourceObjectShadowType, OperationResult result) throws ObjectNotFoundException, SchemaException { + LOGGER_SQL.debug("> list resource object shadows {}, for resource oid={}", + new Object[]{resourceObjectShadowType.getSimpleName(), resourceOid}); List> list = new ArrayList<>(); Session session = null; try { @@ -1414,6 +1429,8 @@ public String getVersion(Class type, String oid, Opera private String getVersionAttempt(Class type, String oid, OperationResult result) throws ObjectNotFoundException, SchemaException { + LOGGER_SQL.debug("> get version {}, oid={}", new Object[]{type.getSimpleName(), oid}); + String version = null; Session session = null; try { From 78fc5ee3ef81ff7063c94aa91da13ac4783fdc55 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Fri, 2 Jan 2015 12:33:08 +0100 Subject: [PATCH 011/215] modify handlers, work in progress --- .../MetadataHandler.java} | 4 ++-- .../midpoint/repo/sql/{ => handler}/ModifyHandler.java | 2 +- .../SyncSituationHandler.java} | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) rename repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/{MetadataModifyHandler.java => handler/MetadataHandler.java} (92%) rename repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/{ => handler}/ModifyHandler.java (96%) rename repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/{SyncSituationModifyHandler.java => handler/SyncSituationHandler.java} (95%) diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/MetadataModifyHandler.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/MetadataHandler.java similarity index 92% rename from repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/MetadataModifyHandler.java rename to repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/MetadataHandler.java index a16bba706ca..642e0657665 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/MetadataModifyHandler.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/MetadataHandler.java @@ -1,4 +1,4 @@ -package com.evolveum.midpoint.repo.sql; +package com.evolveum.midpoint.repo.sql.handler; /** * @author lazyman @@ -26,7 +26,7 @@ * metadata/modifierRef * REPLACE: oid=00000000-0000-0000-0000-00000000000 */ -public class MetadataModifyHandler implements ModifyHandler { +public class MetadataHandler implements ModifyHandler { @Override public boolean canHandle(Class type, String oid, diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/ModifyHandler.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/ModifyHandler.java similarity index 96% rename from repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/ModifyHandler.java rename to repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/ModifyHandler.java index 5244803e85a..5b7ccbb333a 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/ModifyHandler.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/ModifyHandler.java @@ -1,4 +1,4 @@ -package com.evolveum.midpoint.repo.sql; +package com.evolveum.midpoint.repo.sql.handler; import com.evolveum.midpoint.prism.delta.ItemDelta; import com.evolveum.midpoint.schema.result.OperationResult; diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SyncSituationModifyHandler.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/SyncSituationHandler.java similarity index 95% rename from repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SyncSituationModifyHandler.java rename to repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/SyncSituationHandler.java index 0ecf68a98aa..95732753825 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SyncSituationModifyHandler.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/SyncSituationHandler.java @@ -1,4 +1,4 @@ -package com.evolveum.midpoint.repo.sql; +package com.evolveum.midpoint.repo.sql.handler; import com.evolveum.midpoint.prism.delta.ItemDelta; import com.evolveum.midpoint.prism.delta.PropertyDelta; @@ -28,7 +28,7 @@ * synchronizationSituation * REPLACE: LINKED */ -public class SyncSituationModifyHandler implements ModifyHandler { +public class SyncSituationHandler implements ModifyHandler { @Override public boolean canHandle(Class type, String oid, From 20b1d7e38ff090b7036444356a01e586a6bb1897 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Fri, 2 Jan 2015 12:44:03 +0100 Subject: [PATCH 012/215] modify handlers, prepared classes. --- .../repo/sql/SqlRepositoryServiceImpl.java | 100 +++++++++--------- .../sql/handler/DefaultModifyHandler.java | 27 +++++ .../repo/sql/handler/ShadowHandler.java | 32 ++++++ .../sql/handler/ShadowLinkRefHandler.java | 35 ++++++ .../repo/sql/handler/TaskProgressHandler.java | 55 ++++++++++ 5 files changed, 200 insertions(+), 49 deletions(-) create mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/DefaultModifyHandler.java create mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/ShadowHandler.java create mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/ShadowLinkRefHandler.java create mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/TaskProgressHandler.java diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SqlRepositoryServiceImpl.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SqlRepositoryServiceImpl.java index 9e04eafc86a..6a67a27c016 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SqlRepositoryServiceImpl.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/SqlRepositoryServiceImpl.java @@ -75,8 +75,10 @@ @Repository public class SqlRepositoryServiceImpl extends SqlBaseService implements RepositoryService { + public static final String PERFORMANCE_LOG_NAME = SqlRepositoryServiceImpl.class.getName() + ".performance"; + private static final Trace LOGGER = TraceManager.getTrace(SqlRepositoryServiceImpl.class); - private static final Trace LOGGER_SQL = TraceManager.getTrace("org.hibernate.SQL"); + private static final Trace LOGGER_PERFORMANCE = TraceManager.getTrace(PERFORMANCE_LOG_NAME); private static final int MAX_CONSTRAINT_NAME_LENGTH = 40; private static final String IMPLEMENTATION_SHORT_NAME = "SQL"; @@ -228,7 +230,7 @@ private PrismObject getObjectAttempt(Class type, St Collection> options, OperationResult result) throws ObjectNotFoundException, SchemaException { - LOGGER_SQL.debug("> get object {}, oid={}", type.getSimpleName(), oid); + LOGGER_PERFORMANCE.debug("> get object {}, oid={}", type.getSimpleName(), oid); PrismObject objectType = null; Session session = null; @@ -239,7 +241,7 @@ private PrismObject getObjectAttempt(Class type, St session.getTransaction().commit(); } catch (ObjectNotFoundException ex) { - GetOperationOptions rootOptions = SelectorOptions.findRootOptions(options); + GetOperationOptions rootOptions = SelectorOptions.findRootOptions(options); rollbackTransaction(session, ex, result, !GetOperationOptions.isAllowNotFound(rootOptions)); throw ex; } catch (SchemaException ex) { @@ -288,7 +290,7 @@ public PrismObject searchShadowOwner(String shadowOid, private PrismObject searchShadowOwnerAttempt(String shadowOid, Collection> options, OperationResult result) throws ObjectNotFoundException { - LOGGER_SQL.debug("> search shadow owner for oid={}", shadowOid); + LOGGER_PERFORMANCE.debug("> search shadow owner for oid={}", shadowOid); PrismObject owner = null; Session session = null; try { @@ -323,7 +325,7 @@ private PrismObject searchShadowOwnerAttempt(String sha session.getTransaction().commit(); } catch (ObjectNotFoundException ex) { - GetOperationOptions rootOptions = SelectorOptions.findRootOptions(options); + GetOperationOptions rootOptions = SelectorOptions.findRootOptions(options); rollbackTransaction(session, ex, result, !GetOperationOptions.isAllowNotFound(rootOptions)); throw ex; } catch (SchemaException | RuntimeException ex) { @@ -361,7 +363,7 @@ public PrismObject listAccountShadowOwner(String accountOid, Operation private PrismObject listAccountShadowOwnerAttempt(String accountOid, OperationResult result) throws ObjectNotFoundException { - LOGGER_SQL.debug("> list account shadow owner oid={}", accountOid); + LOGGER_PERFORMANCE.debug("> list account shadow owner oid={}", accountOid); PrismObject userType = null; Session session = null; try { @@ -456,12 +458,12 @@ public String addObject(PrismObject object, RepoAddOpt private String addObjectAttempt(PrismObject object, RepoAddOptions options, OperationResult result) throws ObjectAlreadyExistsException, SchemaException { - LOGGER_SQL.debug("> add object {}, oid={}, overwrite={}", + LOGGER_PERFORMANCE.debug("> add object {}, oid={}, overwrite={}", new Object[]{object.getCompileTimeClass().getSimpleName(), object.getOid(), options.isOverwrite()}); String oid = null; Session session = null; OrgClosureManager.Context closureContext = null; - // it is needed to keep the original oid for example for import options. if we do not keep it + // it is needed to keep the original oid for example for import options. if we do not keep it // and it was null it can bring some error because the oid is set when the object contains orgRef // or it is org. and by the import we do not know it so it will be trying to delete non-existing object String originalOid = object.getOid(); @@ -671,7 +673,7 @@ private List createAddParentRefDelta(Pris private void deleteObjectAttempt(Class type, String oid, OperationResult result) throws ObjectNotFoundException { - LOGGER_SQL.debug("> delete object {}, oid={}", new Object[]{type.getSimpleName(), oid}); + LOGGER_PERFORMANCE.debug("> delete object {}, oid={}", new Object[]{type.getSimpleName(), oid}); Session session = null; OrgClosureManager.Context closureContext = null; try { @@ -717,14 +719,14 @@ public int countObjects(Class type, ObjectQuery query, subResult.addParam("query", query); if (query != null) { - ObjectFilter filter = query.getFilter(); - filter = ObjectQueryUtil.simplify(filter); - if (filter instanceof NoneFilter) { - subResult.recordSuccess(); - return 0; - } - query = query.cloneEmpty(); - query.setFilter(filter); + ObjectFilter filter = query.getFilter(); + filter = ObjectQueryUtil.simplify(filter); + if (filter instanceof NoneFilter) { + subResult.recordSuccess(); + return 0; + } + query = query.cloneEmpty(); + query.setFilter(filter); } final String operation = "counting"; @@ -740,7 +742,7 @@ public int countObjects(Class type, ObjectQuery query, } private int countObjectsAttempt(Class type, ObjectQuery query, OperationResult result) { - LOGGER_SQL.debug("> count objects {}", new Object[]{type.getSimpleName()}); + LOGGER_PERFORMANCE.debug("> count objects {}", new Object[]{type.getSimpleName()}); int count = 0; @@ -774,8 +776,8 @@ private int countObjectsAttempt(Class type, ObjectQuer @Override public SearchResultList> searchObjects(Class type, ObjectQuery query, - Collection> options, - OperationResult result) throws SchemaException { + Collection> options, + OperationResult result) throws SchemaException { Validate.notNull(type, "Object type must not be null."); Validate.notNull(result, "Operation result must not be null."); @@ -787,14 +789,14 @@ public SearchResultList> searchObjects(Cla // subResult.addParam("paging", paging); if (query != null) { - ObjectFilter filter = query.getFilter(); - filter = ObjectQueryUtil.simplify(filter); - if (filter instanceof NoneFilter) { - subResult.recordSuccess(); - return new SearchResultList(new ArrayList>(0)); - } - query = query.cloneEmpty(); - query.setFilter(filter); + ObjectFilter filter = query.getFilter(); + filter = ObjectQueryUtil.simplify(filter); + if (filter instanceof NoneFilter) { + subResult.recordSuccess(); + return new SearchResultList(new ArrayList>(0)); + } + query = query.cloneEmpty(); + query.setFilter(filter); } SqlPerformanceMonitor pm = getPerformanceMonitor(); @@ -839,9 +841,9 @@ private void logSearchInputParameters(Class type, Obje } private SearchResultList> searchObjectsAttempt(Class type, ObjectQuery query, - Collection> options, - OperationResult result) throws SchemaException { - LOGGER_SQL.debug("> search objects {}", new Object[]{type.getSimpleName()}); + Collection> options, + OperationResult result) throws SchemaException { + LOGGER_PERFORMANCE.debug("> search objects {}", new Object[]{type.getSimpleName()}); List> list = new ArrayList<>(); Session session = null; try { @@ -1030,7 +1032,7 @@ private void modifyObjectAttempt(Class type, String oi OperationResult result) throws ObjectNotFoundException, SchemaException, ObjectAlreadyExistsException, SerializationRelatedException { LOGGER.debug("Modifying object '{}' with oid '{}'.", new Object[]{type.getSimpleName(), oid}); - LOGGER_SQL.debug("> modify object {}, oid={}, modifications={}", + LOGGER_PERFORMANCE.debug("> modify object {}, oid={}, modifications={}", new Object[]{type.getSimpleName(), oid, modifications}); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Modifications:\n{}", new Object[]{DebugUtil.debugDump(modifications)}); @@ -1115,8 +1117,8 @@ private void handleConstraintViolationException(Session session, ConstraintViola SQLException sqlException = findSqlException(ex); if (sqlException != null) { SQLException nextException = sqlException.getNextException(); - LOGGER.debug("ConstraintViolationException = {}; SQL exception = {}; embedded SQL exception = {}", new Object[] {ex, sqlException, nextException}); - String[] ok = new String[] { + LOGGER.debug("ConstraintViolationException = {}; SQL exception = {}; embedded SQL exception = {}", new Object[]{ex, sqlException, nextException}); + String[] ok = new String[]{ "duplicate key value violates unique constraint \"m_org_closure_pkey\"", "duplicate key value violates unique constraint \"m_reference_pkey\"" }; @@ -1180,7 +1182,7 @@ private List> listResourceObjectShadowsAtt String resourceOid, Class resourceObjectShadowType, OperationResult result) throws ObjectNotFoundException, SchemaException { - LOGGER_SQL.debug("> list resource object shadows {}, for resource oid={}", + LOGGER_PERFORMANCE.debug("> list resource object shadows {}, for resource oid={}", new Object[]{resourceObjectShadowType.getSimpleName(), resourceOid}); List> list = new ArrayList<>(); Session session = null; @@ -1429,7 +1431,7 @@ public String getVersion(Class type, String oid, Opera private String getVersionAttempt(Class type, String oid, OperationResult result) throws ObjectNotFoundException, SchemaException { - LOGGER_SQL.debug("> get version {}, oid={}", new Object[]{type.getSimpleName(), oid}); + LOGGER_PERFORMANCE.debug("> get version {}, oid={}", new Object[]{type.getSimpleName(), oid}); String version = null; Session session = null; @@ -1460,9 +1462,9 @@ private String getVersionAttempt(Class type, String oi */ @Override public SearchResultMetadata searchObjectsIterative(Class type, ObjectQuery query, - ResultHandler handler, - Collection> options, - OperationResult result) throws SchemaException { + ResultHandler handler, + Collection> options, + OperationResult result) throws SchemaException { Validate.notNull(type, "Object type must not be null."); Validate.notNull(handler, "Result handler must not be null."); Validate.notNull(result, "Operation result must not be null."); @@ -1474,14 +1476,14 @@ public SearchResultMetadata searchObjectsIterative(Class< subResult.addParam("query", query); if (query != null) { - ObjectFilter filter = query.getFilter(); - filter = ObjectQueryUtil.simplify(filter); - if (filter instanceof NoneFilter) { - subResult.recordSuccess(); - return null; - } - query = query.cloneEmpty(); - query.setFilter(filter); + ObjectFilter filter = query.getFilter(); + filter = ObjectQueryUtil.simplify(filter); + if (filter instanceof NoneFilter) { + subResult.recordSuccess(); + return null; + } + query = query.cloneEmpty(); + query.setFilter(filter); } if (getConfiguration().isIterativeSearchByPaging()) { @@ -1596,8 +1598,8 @@ private void searchObjectsIterativeByPaging(Class type } @Override - public boolean isAnySubordinate(String upperOrgOid, Collection lowerObjectOids) throws SchemaException { - Validate.notNull(upperOrgOid, "upperOrgOid must not be null."); + public boolean isAnySubordinate(String upperOrgOid, Collection lowerObjectOids) throws SchemaException { + Validate.notNull(upperOrgOid, "upperOrgOid must not be null."); Validate.notNull(lowerObjectOids, "lowerObjectOids must not be null."); if (LOGGER.isTraceEnabled()) diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/DefaultModifyHandler.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/DefaultModifyHandler.java new file mode 100644 index 00000000000..0eb32bfd408 --- /dev/null +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/DefaultModifyHandler.java @@ -0,0 +1,27 @@ +package com.evolveum.midpoint.repo.sql.handler; + +import com.evolveum.midpoint.prism.delta.ItemDelta; +import com.evolveum.midpoint.schema.result.OperationResult; +import com.evolveum.midpoint.util.exception.ObjectNotFoundException; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; + +import java.util.Collection; + +/** + * @author lazyman + */ +public class DefaultModifyHandler implements ModifyHandler { + + @Override + public boolean canHandle(Class type, String oid, + Collection modifications) { + return true; + } + + @Override + public void modifyObject(Class type, String oid, + Collection modifications, + OperationResult result) throws ObjectNotFoundException { + + } +} diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/ShadowHandler.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/ShadowHandler.java new file mode 100644 index 00000000000..9de8d0ad0c4 --- /dev/null +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/ShadowHandler.java @@ -0,0 +1,32 @@ +package com.evolveum.midpoint.repo.sql.handler; + +/** + * > modify object ShadowType, oid=9c555c19-55bc-4b55-b3d4-b7fa5a103a37, modifications=[PropertyDelta( / {.../common/common-3}synchronizationSituationDescription, ADD), PropertyDelta( / {.../common/common-3}synchronizationTimestamp, REPLACE), PropertyDelta( / {.../common/common-3}fullSynchronizationTimestamp, REPLACE)] + * select this_.oid as oid1_18_0_, this_1_.createChannel as createCh2_18_0_, this_1_.createTimestamp as createTi3_18_0_, this_1_.creatorRef_relation as creatorR4_18_0_, this_1_.creatorRef_targetOid as creatorR5_18_0_, this_1_.creatorRef_type as creatorR6_18_0_, this_1_.datesCount as datesCou7_18_0_, this_1_.fullObject as fullObje8_18_0_, this_1_.longsCount as longsCou9_18_0_, this_1_.modifierRef_relation as modifie10_18_0_, this_1_.modifierRef_targetOid as modifie11_18_0_, this_1_.modifierRef_type as modifie12_18_0_, this_1_.modifyChannel as modifyC13_18_0_, this_1_.modifyTimestamp as modifyT14_18_0_, this_1_.name_norm as name_no15_18_0_, this_1_.name_orig as name_or16_18_0_, this_1_.objectTypeClass as objectT17_18_0_, this_1_.polysCount as polysCo18_18_0_, this_1_.referencesCount as referen19_18_0_, this_1_.stringsCount as strings20_18_0_, this_1_.tenantRef_relation as tenantR21_18_0_, this_1_.tenantRef_targetOid as tenantR22_18_0_, this_1_.tenantRef_type as tenantR23_18_0_, this_1_.version as version24_18_0_, this_.attemptNumber as attemptN1_34_0_, this_.dead as dead2_34_0_, this_.exist as exist3_34_0_, this_.failedOperationType as failedOp4_34_0_, this_.fullSynchronizationTimestamp as fullSync5_34_0_, this_.intent as intent6_34_0_, this_.kind as kind7_34_0_, this_.name_norm as name_nor8_34_0_, this_.name_orig as name_ori9_34_0_, this_.objectClass as objectC10_34_0_, this_.resourceRef_relation as resourc11_34_0_, this_.resourceRef_targetOid as resourc12_34_0_, this_.resourceRef_type as resourc13_34_0_, this_.status as status14_34_0_, this_.synchronizationSituation as synchro15_34_0_, this_.synchronizationTimestamp as synchro16_34_0_ from m_shadow this_ inner join m_object this_1_ on this_.oid=this_1_.oid where this_.oid=? + * select parentorgr0_.owner_oid as owner_oi2_18_0_, parentorgr0_.owner_oid as owner_oi2_28_0_, parentorgr0_.relation as relation3_28_0_, parentorgr0_.targetOid as targetOi4_28_0_, parentorgr0_.owner_oid as owner_oi2_28_1_, parentorgr0_.relation as relation3_28_1_, parentorgr0_.targetOid as targetOi4_28_1_, parentorgr0_.containerType as containe5_28_1_, parentorgr0_.reference_type as referenc1_28_1_ from m_reference parentorgr0_ where ( parentorgr0_.reference_type=0) and parentorgr0_.owner_oid=? + * select roextstrin0_.eName as col_0_0_, roextstrin0_.eType as col_1_0_, roextstrin0_.valueType as col_2_0_ from m_object_ext_string roextstrin0_ where roextstrin0_.owner_oid=? and roextstrin0_.ownerType=? + * select roextstrin0_.eName as eName1_23_0_, roextstrin0_.owner_oid as owner_oi2_23_0_, roextstrin0_.ownerType as ownerTyp3_23_0_, roextstrin0_.stringValue as stringVa4_23_0_, roextstrin0_.dynamicDef as dynamicD5_23_0_, roextstrin0_.eType as eType6_23_0_, roextstrin0_.valueType as valueTyp7_23_0_ from m_object_ext_string roextstrin0_ where roextstrin0_.eName=? and roextstrin0_.owner_oid=? and roextstrin0_.ownerType=? and roextstrin0_.stringValue=? + * select roextstrin0_.eName as eName1_23_0_, roextstrin0_.owner_oid as owner_oi2_23_0_, roextstrin0_.ownerType as ownerTyp3_23_0_, roextstrin0_.stringValue as stringVa4_23_0_, roextstrin0_.dynamicDef as dynamicD5_23_0_, roextstrin0_.eType as eType6_23_0_, roextstrin0_.valueType as valueTyp7_23_0_ from m_object_ext_string roextstrin0_ where roextstrin0_.eName=? and roextstrin0_.owner_oid=? and roextstrin0_.ownerType=? and roextstrin0_.stringValue=? + * select createappr0_.owner_oid as owner_oi2_18_0_, createappr0_.owner_oid as owner_oi2_28_0_, createappr0_.relation as relation3_28_0_, createappr0_.targetOid as targetOi4_28_0_, createappr0_.owner_oid as owner_oi2_28_1_, createappr0_.relation as relation3_28_1_, createappr0_.targetOid as targetOi4_28_1_, createappr0_.containerType as containe5_28_1_, createappr0_.reference_type as referenc1_28_1_ from m_reference createappr0_ where ( createappr0_.reference_type=5) and createappr0_.owner_oid=? + * select dates0_.owner_oid as owner_oi2_18_0_, dates0_.eName as eName1_19_0_, dates0_.owner_oid as owner_oi2_19_0_, dates0_.ownerType as ownerTyp3_19_0_, dates0_.dateValue as dateValu4_19_0_, dates0_.eName as eName1_19_1_, dates0_.owner_oid as owner_oi2_19_1_, dates0_.ownerType as ownerTyp3_19_1_, dates0_.dateValue as dateValu4_19_1_, dates0_.dynamicDef as dynamicD5_19_1_, dates0_.eType as eType6_19_1_, dates0_.valueType as valueTyp7_19_1_ from m_object_ext_date dates0_ where dates0_.owner_oid=? + * select longs0_.owner_oid as owner_oi2_18_0_, longs0_.eName as eName1_20_0_, longs0_.owner_oid as owner_oi2_20_0_, longs0_.ownerType as ownerTyp3_20_0_, longs0_.longValue as longValu4_20_0_, longs0_.eName as eName1_20_1_, longs0_.owner_oid as owner_oi2_20_1_, longs0_.ownerType as ownerTyp3_20_1_, longs0_.longValue as longValu4_20_1_, longs0_.dynamicDef as dynamicD5_20_1_, longs0_.eType as eType6_20_1_, longs0_.valueType as valueTyp7_20_1_ from m_object_ext_long longs0_ where longs0_.owner_oid=? + * select modifyappr0_.owner_oid as owner_oi2_18_0_, modifyappr0_.owner_oid as owner_oi2_28_0_, modifyappr0_.relation as relation3_28_0_, modifyappr0_.targetOid as targetOi4_28_0_, modifyappr0_.owner_oid as owner_oi2_28_1_, modifyappr0_.relation as relation3_28_1_, modifyappr0_.targetOid as targetOi4_28_1_, modifyappr0_.containerType as containe5_28_1_, modifyappr0_.reference_type as referenc1_28_1_ from m_reference modifyappr0_ where ( modifyappr0_.reference_type=6) and modifyappr0_.owner_oid=? + * select polys0_.owner_oid as owner_oi2_18_0_, polys0_.eName as eName1_21_0_, polys0_.owner_oid as owner_oi2_21_0_, polys0_.ownerType as ownerTyp3_21_0_, polys0_.orig as orig4_21_0_, polys0_.eName as eName1_21_1_, polys0_.owner_oid as owner_oi2_21_1_, polys0_.ownerType as ownerTyp3_21_1_, polys0_.orig as orig4_21_1_, polys0_.dynamicDef as dynamicD5_21_1_, polys0_.norm as norm6_21_1_, polys0_.eType as eType7_21_1_, polys0_.valueType as valueTyp8_21_1_ from m_object_ext_poly polys0_ where polys0_.owner_oid=? + * select references0_.owner_oid as owner_oi2_18_0_, references0_.eName as eName1_22_0_, references0_.owner_oid as owner_oi2_22_0_, references0_.ownerType as ownerTyp3_22_0_, references0_.targetoid as targetoi4_22_0_, references0_.eName as eName1_22_1_, references0_.owner_oid as owner_oi2_22_1_, references0_.ownerType as ownerTyp3_22_1_, references0_.targetoid as targetoi4_22_1_, references0_.dynamicDef as dynamicD5_22_1_, references0_.relation as relation6_22_1_, references0_.targetType as targetTy7_22_1_, references0_.eType as eType8_22_1_, references0_.valueType as valueTyp9_22_1_ from m_object_ext_reference references0_ where references0_.owner_oid=? + * select strings0_.owner_oid as owner_oi2_18_0_, strings0_.eName as eName1_23_0_, strings0_.owner_oid as owner_oi2_23_0_, strings0_.ownerType as ownerTyp3_23_0_, strings0_.stringValue as stringVa4_23_0_, strings0_.eName as eName1_23_1_, strings0_.owner_oid as owner_oi2_23_1_, strings0_.ownerType as ownerTyp3_23_1_, strings0_.stringValue as stringVa4_23_1_, strings0_.dynamicDef as dynamicD5_23_1_, strings0_.eType as eType6_23_1_, strings0_.valueType as valueTyp7_23_1_ from m_object_ext_string strings0_ where strings0_.owner_oid=? + * select trigger0_.owner_oid as owner_oi2_18_0_, trigger0_.id as id1_38_0_, trigger0_.owner_oid as owner_oi2_38_0_, trigger0_.id as id1_38_1_, trigger0_.owner_oid as owner_oi2_38_1_, trigger0_.handlerUri as handlerU3_38_1_, trigger0_.timestampValue as timestam4_38_1_ from m_trigger trigger0_ where trigger0_.owner_oid=? + * update m_object set createChannel=?, createTimestamp=?, creatorRef_relation=?, creatorRef_targetOid=?, creatorRef_type=?, datesCount=?, fullObject=?, longsCount=?, modifierRef_relation=?, modifierRef_targetOid=?, modifierRef_type=?, modifyChannel=?, modifyTimestamp=?, name_norm=?, name_orig=?, objectTypeClass=?, polysCount=?, referencesCount=?, stringsCount=?, tenantRef_relation=?, tenantRef_targetOid=?, tenantRef_type=?, version=? where oid=? + * update m_shadow set attemptNumber=?, dead=?, exist=?, failedOperationType=?, fullSynchronizationTimestamp=?, intent=?, kind=?, name_norm=?, name_orig=?, objectClass=?, resourceRef_relation=?, resourceRef_targetOid=?, resourceRef_type=?, status=?, synchronizationSituation=?, synchronizationTimestamp=? where oid=? + *

+ * CAN BE IMPROVED TO: + *

+ * select full object + * update m_object set createChannel=?, createTimestamp=?, creatorRef_relation=?, creatorRef_targetOid=?, creatorRef_type=?, datesCount=?, fullObject=?, longsCount=?, modifierRef_relation=?, modifierRef_targetOid=?, modifierRef_type=?, modifyChannel=?, modifyTimestamp=?, name_norm=?, name_orig=?, objectTypeClass=?, polysCount=?, referencesCount=?, stringsCount=?, tenantRef_relation=?, tenantRef_targetOid=?, tenantRef_type=?, version=? where oid=? + * update m_shadow set attemptNumber=?, dead=?, exist=?, failedOperationType=?, fullSynchronizationTimestamp=?, intent=?, kind=?, name_norm=?, name_orig=?, objectClass=?, resourceRef_relation=?, resourceRef_targetOid=?, resourceRef_type=?, status=?, synchronizationSituation=?, synchronizationTimestamp=? where oid=? + *

+ * 15 => 3 + * + * @author lazyman + */ +public class ShadowHandler { +} diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/ShadowLinkRefHandler.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/ShadowLinkRefHandler.java new file mode 100644 index 00000000000..15e554462a5 --- /dev/null +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/ShadowLinkRefHandler.java @@ -0,0 +1,35 @@ +package com.evolveum.midpoint.repo.sql.handler; + +/** + * > modify object UserType, oid=92686866-0689-4bfb-9175-143c66ca8cd5, modifications=[ReferenceDelta( / {.../common/common-3}linkRef, ADD)] + * select this_.oid as oid1_18_0_, this_2_.createChannel as createCh2_18_0_, this_2_.createTimestamp as createTi3_18_0_, this_2_.creatorRef_relation as creatorR4_18_0_, this_2_.creatorRef_targetOid as creatorR5_18_0_, this_2_.creatorRef_type as creatorR6_18_0_, this_2_.datesCount as datesCou7_18_0_, this_2_.fullObject as fullObje8_18_0_, this_2_.longsCount as longsCou9_18_0_, this_2_.modifierRef_relation as modifie10_18_0_, this_2_.modifierRef_targetOid as modifie11_18_0_, this_2_.modifierRef_type as modifie12_18_0_, this_2_.modifyChannel as modifyC13_18_0_, this_2_.modifyTimestamp as modifyT14_18_0_, this_2_.name_norm as name_no15_18_0_, this_2_.name_orig as name_or16_18_0_, this_2_.objectTypeClass as objectT17_18_0_, this_2_.polysCount as polysCo18_18_0_, this_2_.referencesCount as referen19_18_0_, this_2_.stringsCount as strings20_18_0_, this_2_.tenantRef_relation as tenantR21_18_0_, this_2_.tenantRef_targetOid as tenantR22_18_0_, this_2_.tenantRef_type as tenantR23_18_0_, this_2_.version as version24_18_0_, this_1_.administrativeStatus as administ1_15_0_, this_1_.archiveTimestamp as archiveT2_15_0_, this_1_.disableReason as disableR3_15_0_, this_1_.disableTimestamp as disableT4_15_0_, this_1_.effectiveStatus as effectiv5_15_0_, this_1_.enableTimestamp as enableTi6_15_0_, this_1_.validFrom as validFro7_15_0_, this_1_.validTo as validTo8_15_0_, this_1_.validityChangeTimestamp as validity9_15_0_, this_1_.validityStatus as validit10_15_0_, this_.additionalName_norm as addition1_39_0_, this_.additionalName_orig as addition2_39_0_, this_.costCenter as costCent3_39_0_, this_.emailAddress as emailAdd4_39_0_, this_.employeeNumber as employee5_39_0_, this_.familyName_norm as familyNa6_39_0_, this_.familyName_orig as familyNa7_39_0_, this_.fullName_norm as fullName8_39_0_, this_.fullName_orig as fullName9_39_0_, this_.givenName_norm as givenNa10_39_0_, this_.givenName_orig as givenNa11_39_0_, this_.hasPhoto as hasPhot12_39_0_, this_.honorificPrefix_norm as honorif13_39_0_, this_.honorificPrefix_orig as honorif14_39_0_, this_.honorificSuffix_norm as honorif15_39_0_, this_.honorificSuffix_orig as honorif16_39_0_, this_.locale as locale17_39_0_, this_.locality_norm as localit18_39_0_, this_.locality_orig as localit19_39_0_, this_.name_norm as name_no20_39_0_, this_.name_orig as name_or21_39_0_, this_.nickName_norm as nickNam22_39_0_, this_.nickName_orig as nickNam23_39_0_, this_.preferredLanguage as preferr24_39_0_, this_.status as status25_39_0_, this_.telephoneNumber as telepho26_39_0_, this_.timezone as timezon27_39_0_, this_.title_norm as title_n28_39_0_, this_.title_orig as title_o29_39_0_ from m_user this_ inner join m_focus this_1_ on this_.oid=this_1_.oid inner join m_object this_2_ on this_.oid=this_2_.oid where this_.oid=? + * select parentorgr0_.owner_oid as owner_oi2_18_0_, parentorgr0_.owner_oid as owner_oi2_28_0_, parentorgr0_.relation as relation3_28_0_, parentorgr0_.targetOid as targetOi4_28_0_, parentorgr0_.owner_oid as owner_oi2_28_1_, parentorgr0_.relation as relation3_28_1_, parentorgr0_.targetOid as targetOi4_28_1_, parentorgr0_.containerType as containe5_28_1_, parentorgr0_.reference_type as referenc1_28_1_ from m_reference parentorgr0_ where ( parentorgr0_.reference_type=0) and parentorgr0_.owner_oid=? + * select roextstrin0_.eName as eName1_23_0_, roextstrin0_.owner_oid as owner_oi2_23_0_, roextstrin0_.ownerType as ownerTyp3_23_0_, roextstrin0_.stringValue as stringVa4_23_0_, roextstrin0_.dynamicDef as dynamicD5_23_0_, roextstrin0_.eType as eType6_23_0_, roextstrin0_.valueType as valueTyp7_23_0_ from m_object_ext_string roextstrin0_ where roextstrin0_.eName=? and roextstrin0_.owner_oid=? and roextstrin0_.ownerType=? and roextstrin0_.stringValue=? + * select rlinkref0_.owner_oid as owner_oi2_28_0_, rlinkref0_.relation as relation3_28_0_, rlinkref0_.targetOid as targetOi4_28_0_, rlinkref0_.containerType as containe5_28_0_ from m_reference rlinkref0_ where rlinkref0_.owner_oid=? and rlinkref0_.relation=? and rlinkref0_.targetOid=? and rlinkref0_.reference_type=1 + * select createappr0_.owner_oid as owner_oi2_18_0_, createappr0_.owner_oid as owner_oi2_28_0_, createappr0_.relation as relation3_28_0_, createappr0_.targetOid as targetOi4_28_0_, createappr0_.owner_oid as owner_oi2_28_1_, createappr0_.relation as relation3_28_1_, createappr0_.targetOid as targetOi4_28_1_, createappr0_.containerType as containe5_28_1_, createappr0_.reference_type as referenc1_28_1_ from m_reference createappr0_ where ( createappr0_.reference_type=5) and createappr0_.owner_oid=? + * select dates0_.owner_oid as owner_oi2_18_0_, dates0_.eName as eName1_19_0_, dates0_.owner_oid as owner_oi2_19_0_, dates0_.ownerType as ownerTyp3_19_0_, dates0_.dateValue as dateValu4_19_0_, dates0_.eName as eName1_19_1_, dates0_.owner_oid as owner_oi2_19_1_, dates0_.ownerType as ownerTyp3_19_1_, dates0_.dateValue as dateValu4_19_1_, dates0_.dynamicDef as dynamicD5_19_1_, dates0_.eType as eType6_19_1_, dates0_.valueType as valueTyp7_19_1_ from m_object_ext_date dates0_ where dates0_.owner_oid=? + * select longs0_.owner_oid as owner_oi2_18_0_, longs0_.eName as eName1_20_0_, longs0_.owner_oid as owner_oi2_20_0_, longs0_.ownerType as ownerTyp3_20_0_, longs0_.longValue as longValu4_20_0_, longs0_.eName as eName1_20_1_, longs0_.owner_oid as owner_oi2_20_1_, longs0_.ownerType as ownerTyp3_20_1_, longs0_.longValue as longValu4_20_1_, longs0_.dynamicDef as dynamicD5_20_1_, longs0_.eType as eType6_20_1_, longs0_.valueType as valueTyp7_20_1_ from m_object_ext_long longs0_ where longs0_.owner_oid=? + * select modifyappr0_.owner_oid as owner_oi2_18_0_, modifyappr0_.owner_oid as owner_oi2_28_0_, modifyappr0_.relation as relation3_28_0_, modifyappr0_.targetOid as targetOi4_28_0_, modifyappr0_.owner_oid as owner_oi2_28_1_, modifyappr0_.relation as relation3_28_1_, modifyappr0_.targetOid as targetOi4_28_1_, modifyappr0_.containerType as containe5_28_1_, modifyappr0_.reference_type as referenc1_28_1_ from m_reference modifyappr0_ where ( modifyappr0_.reference_type=6) and modifyappr0_.owner_oid=? + * select polys0_.owner_oid as owner_oi2_18_0_, polys0_.eName as eName1_21_0_, polys0_.owner_oid as owner_oi2_21_0_, polys0_.ownerType as ownerTyp3_21_0_, polys0_.orig as orig4_21_0_, polys0_.eName as eName1_21_1_, polys0_.owner_oid as owner_oi2_21_1_, polys0_.ownerType as ownerTyp3_21_1_, polys0_.orig as orig4_21_1_, polys0_.dynamicDef as dynamicD5_21_1_, polys0_.norm as norm6_21_1_, polys0_.eType as eType7_21_1_, polys0_.valueType as valueTyp8_21_1_ from m_object_ext_poly polys0_ where polys0_.owner_oid=? + * select references0_.owner_oid as owner_oi2_18_0_, references0_.eName as eName1_22_0_, references0_.owner_oid as owner_oi2_22_0_, references0_.ownerType as ownerTyp3_22_0_, references0_.targetoid as targetoi4_22_0_, references0_.eName as eName1_22_1_, references0_.owner_oid as owner_oi2_22_1_, references0_.ownerType as ownerTyp3_22_1_, references0_.targetoid as targetoi4_22_1_, references0_.dynamicDef as dynamicD5_22_1_, references0_.relation as relation6_22_1_, references0_.targetType as targetTy7_22_1_, references0_.eType as eType8_22_1_, references0_.valueType as valueTyp9_22_1_ from m_object_ext_reference references0_ where references0_.owner_oid=? + * select strings0_.owner_oid as owner_oi2_18_0_, strings0_.eName as eName1_23_0_, strings0_.owner_oid as owner_oi2_23_0_, strings0_.ownerType as ownerTyp3_23_0_, strings0_.stringValue as stringVa4_23_0_, strings0_.eName as eName1_23_1_, strings0_.owner_oid as owner_oi2_23_1_, strings0_.ownerType as ownerTyp3_23_1_, strings0_.stringValue as stringVa4_23_1_, strings0_.dynamicDef as dynamicD5_23_1_, strings0_.eType as eType6_23_1_, strings0_.valueType as valueTyp7_23_1_ from m_object_ext_string strings0_ where strings0_.owner_oid=? + * select trigger0_.owner_oid as owner_oi2_18_0_, trigger0_.id as id1_38_0_, trigger0_.owner_oid as owner_oi2_38_0_, trigger0_.id as id1_38_1_, trigger0_.owner_oid as owner_oi2_38_1_, trigger0_.handlerUri as handlerU3_38_1_, trigger0_.timestampValue as timestam4_38_1_ from m_trigger trigger0_ where trigger0_.owner_oid=? + * select assignment0_.owner_oid as owner_oi2_18_0_, assignment0_.id as id1_1_0_, assignment0_.owner_oid as owner_oi2_1_0_, assignment0_.id as id1_1_1_, assignment0_.owner_oid as owner_oi2_1_1_, assignment0_.administrativeStatus as administ3_1_1_, assignment0_.archiveTimestamp as archiveT4_1_1_, assignment0_.disableReason as disableR5_1_1_, assignment0_.disableTimestamp as disableT6_1_1_, assignment0_.effectiveStatus as effectiv7_1_1_, assignment0_.enableTimestamp as enableTi8_1_1_, assignment0_.validFrom as validFro9_1_1_, assignment0_.validTo as validTo10_1_1_, assignment0_.validityChangeTimestamp as validit11_1_1_, assignment0_.validityStatus as validit12_1_1_, assignment0_.assignmentOwner as assignm13_1_1_, assignment0_.createChannel as createC14_1_1_, assignment0_.createTimestamp as createT15_1_1_, assignment0_.creatorRef_relation as creator16_1_1_, assignment0_.creatorRef_targetOid as creator17_1_1_, assignment0_.creatorRef_type as creator18_1_1_, assignment0_.extId as extId31_1_1_, assignment0_.extOid as extOid32_1_1_, assignment0_.modifierRef_relation as modifie19_1_1_, assignment0_.modifierRef_targetOid as modifie20_1_1_, assignment0_.modifierRef_type as modifie21_1_1_, assignment0_.modifyChannel as modifyC22_1_1_, assignment0_.modifyTimestamp as modifyT23_1_1_, assignment0_.orderValue as orderVa24_1_1_, assignment0_.targetRef_relation as targetR25_1_1_, assignment0_.targetRef_targetOid as targetR26_1_1_, assignment0_.targetRef_type as targetR27_1_1_, assignment0_.tenantRef_relation as tenantR28_1_1_, assignment0_.tenantRef_targetOid as tenantR29_1_1_, assignment0_.tenantRef_type as tenantR30_1_1_, rassignmen1_.owner_id as owner_id1_7_2_, rassignmen1_.owner_owner_oid as owner_ow2_7_2_, rassignmen1_.datesCount as datesCou3_7_2_, rassignmen1_.longsCount as longsCou4_7_2_, rassignmen1_.polysCount as polysCou5_7_2_, rassignmen1_.referencesCount as referenc6_7_2_, rassignmen1_.stringsCount as stringsC7_7_2_ from m_assignment assignment0_ left outer join m_assignment_extension rassignmen1_ on assignment0_.extId=rassignmen1_.owner_id and assignment0_.extOid=rassignmen1_.owner_owner_oid where assignment0_.owner_oid=? + * select linkref0_.owner_oid as owner_oi2_18_0_, linkref0_.owner_oid as owner_oi2_28_0_, linkref0_.relation as relation3_28_0_, linkref0_.targetOid as targetOi4_28_0_, linkref0_.owner_oid as owner_oi2_28_1_, linkref0_.relation as relation3_28_1_, linkref0_.targetOid as targetOi4_28_1_, linkref0_.containerType as containe5_28_1_, linkref0_.reference_type as referenc1_28_1_ from m_reference linkref0_ where ( linkref0_.reference_type=1) and linkref0_.owner_oid=? + * select jpegphoto0_.owner_oid as owner_oi1_18_0_, jpegphoto0_.owner_oid as owner_oi1_43_0_, jpegphoto0_.owner_oid as owner_oi1_43_1_, jpegphoto0_.photo as photo2_43_1_ from m_user_photo jpegphoto0_ where jpegphoto0_.owner_oid=? + * insert into m_reference (containerType, reference_type, owner_oid, relation, targetOid) values (?, 1, ?, ?, ?) + * update m_object set createChannel=?, createTimestamp=?, creatorRef_relation=?, creatorRef_targetOid=?, creatorRef_type=?, datesCount=?, fullObject=?, longsCount=?, modifierRef_relation=?, modifierRef_targetOid=?, modifierRef_type=?, modifyChannel=?, modifyTimestamp=?, name_norm=?, name_orig=?, objectTypeClass=?, polysCount=?, referencesCount=?, stringsCount=?, tenantRef_relation=?, tenantRef_targetOid=?, tenantRef_type=?, version=? where oid=? + * delete from m_user_employee_type where user_oid=? + * delete from m_user_organization where user_oid=? + * delete from m_user_organizational_unit where user_oid=? + *

+ * CAN BE IMPROVED: + *

+ * select full object xml... + * insert into m_reference (containerType, reference_type, owner_oid, relation, targetOid) values (?, 1, ?, ?, ?) + * update m_object set createChannel=?, createTimestamp=?, creatorRef_relation=?, creatorRef_targetOid=?, creatorRef_type=?, datesCount=?, fullObject=?, longsCount=?, modifierRef_relation=?, modifierRef_targetOid=?, modifierRef_type=?, modifyChannel=?, modifyTimestamp=?, name_norm=?, name_orig=?, objectTypeClass=?, polysCount=?, referencesCount=?, stringsCount=?, tenantRef_relation=?, tenantRef_targetOid=?, tenantRef_type=?, version=? where oid=? + * + * @author lazyman + */ +public class ShadowLinkRefHandler { +} diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/TaskProgressHandler.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/TaskProgressHandler.java new file mode 100644 index 00000000000..c970a5b3340 --- /dev/null +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/handler/TaskProgressHandler.java @@ -0,0 +1,55 @@ +package com.evolveum.midpoint.repo.sql.handler; + +import com.evolveum.midpoint.prism.delta.ItemDelta; +import com.evolveum.midpoint.prism.delta.PropertyDelta; +import com.evolveum.midpoint.schema.result.OperationResult; +import com.evolveum.midpoint.util.exception.ObjectNotFoundException; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType; + +import java.util.Collection; + +/** + * > modify object TaskType, oid=f7fdd34d-562f-4355-a2ed-c7e111b9bae1, modifications=[PropertyDelta( / {.../common/common-3}progress, REPLACE)] + * select this_.oid as oid1_18_0_, this_1_.createChannel as createCh2_18_0_, this_1_.createTimestamp as createTi3_18_0_, this_1_.creatorRef_relation as creatorR4_18_0_, this_1_.creatorRef_targetOid as creatorR5_18_0_, this_1_.creatorRef_type as creatorR6_18_0_, this_1_.datesCount as datesCou7_18_0_, this_1_.fullObject as fullObje8_18_0_, this_1_.longsCount as longsCou9_18_0_, this_1_.modifierRef_relation as modifie10_18_0_, this_1_.modifierRef_targetOid as modifie11_18_0_, this_1_.modifierRef_type as modifie12_18_0_, this_1_.modifyChannel as modifyC13_18_0_, this_1_.modifyTimestamp as modifyT14_18_0_, this_1_.name_norm as name_no15_18_0_, this_1_.name_orig as name_or16_18_0_, this_1_.objectTypeClass as objectT17_18_0_, this_1_.polysCount as polysCo18_18_0_, this_1_.referencesCount as referen19_18_0_, this_1_.stringsCount as strings20_18_0_, this_1_.tenantRef_relation as tenantR21_18_0_, this_1_.tenantRef_targetOid as tenantR22_18_0_, this_1_.tenantRef_type as tenantR23_18_0_, this_1_.version as version24_18_0_, this_.binding as binding1_36_0_, this_.canRunOnNode as canRunOn2_36_0_, this_.category as category3_36_0_, this_.completionTimestamp as completi4_36_0_, this_.executionStatus as executio5_36_0_, this_.handlerUri as handlerU6_36_0_, this_.lastRunFinishTimestamp as lastRunF7_36_0_, this_.lastRunStartTimestamp as lastRunS8_36_0_, this_.name_norm as name_nor9_36_0_, this_.name_orig as name_or10_36_0_, this_.node as node11_36_0_, this_.objectRef_relation as objectR12_36_0_, this_.objectRef_targetOid as objectR13_36_0_, this_.objectRef_type as objectR14_36_0_, this_.ownerRef_relation as ownerRe15_36_0_, this_.ownerRef_targetOid as ownerRe16_36_0_, this_.ownerRef_type as ownerRe17_36_0_, this_.parent as parent18_36_0_, this_.recurrence as recurre19_36_0_, this_.status as status20_36_0_, this_.taskIdentifier as taskIde21_36_0_, this_.threadStopAction as threadS22_36_0_, this_.waitingReason as waiting23_36_0_ from m_task this_ inner join m_object this_1_ on this_.oid=this_1_.oid where this_.oid=? + * select parentorgr0_.owner_oid as owner_oi2_18_0_, parentorgr0_.owner_oid as owner_oi2_28_0_, parentorgr0_.relation as relation3_28_0_, parentorgr0_.targetOid as targetOi4_28_0_, parentorgr0_.owner_oid as owner_oi2_28_1_, parentorgr0_.relation as relation3_28_1_, parentorgr0_.targetOid as targetOi4_28_1_, parentorgr0_.containerType as containe5_28_1_, parentorgr0_.reference_type as referenc1_28_1_ from m_reference parentorgr0_ where ( parentorgr0_.reference_type=0) and parentorgr0_.owner_oid=? + * select createappr0_.owner_oid as owner_oi2_18_0_, createappr0_.owner_oid as owner_oi2_28_0_, createappr0_.relation as relation3_28_0_, createappr0_.targetOid as targetOi4_28_0_, createappr0_.owner_oid as owner_oi2_28_1_, createappr0_.relation as relation3_28_1_, createappr0_.targetOid as targetOi4_28_1_, createappr0_.containerType as containe5_28_1_, createappr0_.reference_type as referenc1_28_1_ from m_reference createappr0_ where ( createappr0_.reference_type=5) and createappr0_.owner_oid=? + * select dates0_.owner_oid as owner_oi2_18_0_, dates0_.eName as eName1_19_0_, dates0_.owner_oid as owner_oi2_19_0_, dates0_.ownerType as ownerTyp3_19_0_, dates0_.dateValue as dateValu4_19_0_, dates0_.eName as eName1_19_1_, dates0_.owner_oid as owner_oi2_19_1_, dates0_.ownerType as ownerTyp3_19_1_, dates0_.dateValue as dateValu4_19_1_, dates0_.dynamicDef as dynamicD5_19_1_, dates0_.eType as eType6_19_1_, dates0_.valueType as valueTyp7_19_1_ from m_object_ext_date dates0_ where dates0_.owner_oid=? + * select longs0_.owner_oid as owner_oi2_18_0_, longs0_.eName as eName1_20_0_, longs0_.owner_oid as owner_oi2_20_0_, longs0_.ownerType as ownerTyp3_20_0_, longs0_.longValue as longValu4_20_0_, longs0_.eName as eName1_20_1_, longs0_.owner_oid as owner_oi2_20_1_, longs0_.ownerType as ownerTyp3_20_1_, longs0_.longValue as longValu4_20_1_, longs0_.dynamicDef as dynamicD5_20_1_, longs0_.eType as eType6_20_1_, longs0_.valueType as valueTyp7_20_1_ from m_object_ext_long longs0_ where longs0_.owner_oid=? + * select modifyappr0_.owner_oid as owner_oi2_18_0_, modifyappr0_.owner_oid as owner_oi2_28_0_, modifyappr0_.relation as relation3_28_0_, modifyappr0_.targetOid as targetOi4_28_0_, modifyappr0_.owner_oid as owner_oi2_28_1_, modifyappr0_.relation as relation3_28_1_, modifyappr0_.targetOid as targetOi4_28_1_, modifyappr0_.containerType as containe5_28_1_, modifyappr0_.reference_type as referenc1_28_1_ from m_reference modifyappr0_ where ( modifyappr0_.reference_type=6) and modifyappr0_.owner_oid=? + * select polys0_.owner_oid as owner_oi2_18_0_, polys0_.eName as eName1_21_0_, polys0_.owner_oid as owner_oi2_21_0_, polys0_.ownerType as ownerTyp3_21_0_, polys0_.orig as orig4_21_0_, polys0_.eName as eName1_21_1_, polys0_.owner_oid as owner_oi2_21_1_, polys0_.ownerType as ownerTyp3_21_1_, polys0_.orig as orig4_21_1_, polys0_.dynamicDef as dynamicD5_21_1_, polys0_.norm as norm6_21_1_, polys0_.eType as eType7_21_1_, polys0_.valueType as valueTyp8_21_1_ from m_object_ext_poly polys0_ where polys0_.owner_oid=? + * select references0_.owner_oid as owner_oi2_18_0_, references0_.eName as eName1_22_0_, references0_.owner_oid as owner_oi2_22_0_, references0_.ownerType as ownerTyp3_22_0_, references0_.targetoid as targetoi4_22_0_, references0_.eName as eName1_22_1_, references0_.owner_oid as owner_oi2_22_1_, references0_.ownerType as ownerTyp3_22_1_, references0_.targetoid as targetoi4_22_1_, references0_.dynamicDef as dynamicD5_22_1_, references0_.relation as relation6_22_1_, references0_.targetType as targetTy7_22_1_, references0_.eType as eType8_22_1_, references0_.valueType as valueTyp9_22_1_ from m_object_ext_reference references0_ where references0_.owner_oid=? + * select strings0_.owner_oid as owner_oi2_18_0_, strings0_.eName as eName1_23_0_, strings0_.owner_oid as owner_oi2_23_0_, strings0_.ownerType as ownerTyp3_23_0_, strings0_.stringValue as stringVa4_23_0_, strings0_.eName as eName1_23_1_, strings0_.owner_oid as owner_oi2_23_1_, strings0_.ownerType as ownerTyp3_23_1_, strings0_.stringValue as stringVa4_23_1_, strings0_.dynamicDef as dynamicD5_23_1_, strings0_.eType as eType6_23_1_, strings0_.valueType as valueTyp7_23_1_ from m_object_ext_string strings0_ where strings0_.owner_oid=? + * select trigger0_.owner_oid as owner_oi2_18_0_, trigger0_.id as id1_38_0_, trigger0_.owner_oid as owner_oi2_38_0_, trigger0_.id as id1_38_1_, trigger0_.owner_oid as owner_oi2_38_1_, trigger0_.handlerUri as handlerU3_38_1_, trigger0_.timestampValue as timestam4_38_1_ from m_trigger trigger0_ where trigger0_.owner_oid=? + * update m_object set createChannel=?, createTimestamp=?, creatorRef_relation=?, creatorRef_targetOid=?, creatorRef_type=?, datesCount=?, fullObject=?, longsCount=?, modifierRef_relation=?, modifierRef_targetOid=?, modifierRef_type=?, modifyChannel=?, modifyTimestamp=?, name_norm=?, name_orig=?, objectTypeClass=?, polysCount=?, referencesCount=?, stringsCount=?, tenantRef_relation=?, tenantRef_targetOid=?, tenantRef_type=?, version=? where oid=? + * delete from m_task_dependent where task_oid=? + *

+ * CAN BE IMPROVED: + *

+ * select full object xml + * update m_object set createChannel=?, createTimestamp=?, creatorRef_relation=?, creatorRef_targetOid=?, creatorRef_type=?, datesCount=?, fullObject=?, longsCount=?, modifierRef_relation=?, modifierRef_targetOid=?, modifierRef_type=?, modifyChannel=?, modifyTimestamp=?, name_norm=?, name_orig=?, objectTypeClass=?, polysCount=?, referencesCount=?, stringsCount=?, tenantRef_relation=?, tenantRef_targetOid=?, tenantRef_type=?, version=? where oid=? + *

+ * 12 => 2 + * + * @author lazyman + */ +public class TaskProgressHandler implements ModifyHandler { + + @Override + public boolean canHandle(Class type, String oid, + Collection modifications) { + if (!TaskType.class.equals(type) || modifications.size() != 1) { + return false; + } + + PropertyDelta delta = PropertyDelta.findPropertyDelta(modifications, TaskType.F_PROGRESS); + return delta != null && delta.isReplace(); + } + + @Override + public void modifyObject(Class type, String oid, + Collection modifications, + OperationResult result) throws ObjectNotFoundException { + + } +} From 5d2a567c7ec7ae191fd5781bc073304a667b32fa Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Sun, 11 Jan 2015 22:13:51 +0100 Subject: [PATCH 013/215] fixing build (hopefully) --- build-system/pom.xml | 2 +- .../sample-configurations/mysql.properties | 2 +- .../repo/sql/util/DataSourceTestBeanPostprocessor.java | 9 +++++++-- .../midpoint/repo/sql/data/common/RConnectorHost.java | 2 +- .../midpoint/repo/sql/data/common/RGenericObject.java | 2 +- .../evolveum/midpoint/repo/sql/data/common/RNode.java | 2 +- .../evolveum/midpoint/repo/sql/data/common/RObject.java | 2 +- .../midpoint/repo/sql/data/common/RObjectTemplate.java | 2 +- .../com/evolveum/midpoint/repo/sql/data/common/ROrg.java | 2 +- .../evolveum/midpoint/repo/sql/data/common/RReport.java | 2 +- .../midpoint/repo/sql/data/common/RResource.java | 2 +- .../evolveum/midpoint/repo/sql/data/common/RRole.java | 2 +- .../midpoint/repo/sql/data/common/RSecurityPolicy.java | 2 +- .../repo/sql/data/common/RSystemConfiguration.java | 2 +- .../evolveum/midpoint/repo/sql/data/common/RUser.java | 2 +- .../midpoint/repo/sql/data/common/RValuePolicy.java | 2 +- .../repo/sql/data/common/container/RAssignment.java | 9 ++++++--- 17 files changed, 28 insertions(+), 20 deletions(-) diff --git a/build-system/pom.xml b/build-system/pom.xml index 181566cbd25..39cb9d2c8ff 100644 --- a/build-system/pom.xml +++ b/build-system/pom.xml @@ -62,7 +62,7 @@ 6.8.8 1.2 2.2.3 - 4.3.7.Final + 4.3.8.Final 1.3.171 9.3-1102-jdbc41 5.1.31 diff --git a/repo/repo-sql-impl-test/sample-configurations/mysql.properties b/repo/repo-sql-impl-test/sample-configurations/mysql.properties index 32b9502b9dd..53dcf061cf1 100644 --- a/repo/repo-sql-impl-test/sample-configurations/mysql.properties +++ b/repo/repo-sql-impl-test/sample-configurations/mysql.properties @@ -16,7 +16,7 @@ embedded=false driverClassName=com.mysql.jdbc.Driver -hibernateHbm2ddl=update +hibernateHbm2ddl=validate hibernateDialect=com.evolveum.midpoint.repo.sql.util.MidPointMySQLDialect jdbcUsername=midpoint jdbcPassword=qwe123 diff --git a/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/util/DataSourceTestBeanPostprocessor.java b/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/util/DataSourceTestBeanPostprocessor.java index d216f8579e2..e12eac5e949 100644 --- a/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/util/DataSourceTestBeanPostprocessor.java +++ b/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/util/DataSourceTestBeanPostprocessor.java @@ -46,11 +46,16 @@ public Object postProcessAfterInitialization(Object bean, String beanName) throw return bean; } + TestSqlRepositoryFactory factory = context.getBean("testSqlRepositoryFactory", TestSqlRepositoryFactory.class); + SqlRepositoryConfiguration config = factory.getSqlConfiguration(); + + if (!config.isUsingH2()) { + return bean; + } + System.out.println("Changing hibernate.hbm2ddl.auto to update"); LOGGER.info("Changing hibernate.hbm2ddl.auto to update"); - TestSqlRepositoryFactory factory = context.getBean("testSqlRepositoryFactory", TestSqlRepositoryFactory.class); - SqlRepositoryConfiguration config = factory.getSqlConfiguration(); config.setHibernateHbm2ddl("update"); return bean; diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RConnectorHost.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RConnectorHost.java index afea98f242c..ea691436794 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RConnectorHost.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RConnectorHost.java @@ -50,7 +50,7 @@ */ @Entity @ForeignKey(name = "fk_connector_host") -@Table(uniqueConstraints = @UniqueConstraint(columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) public class RConnectorHost extends RObject { private RPolyString name; diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RGenericObject.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RGenericObject.java index 05ec7650806..a1f6a3d91f3 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RGenericObject.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RGenericObject.java @@ -37,7 +37,7 @@ */ @Entity @ForeignKey(name = "fk_generic_object") -@Table(uniqueConstraints = @UniqueConstraint(columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) public class RGenericObject extends RObject { private RPolyString name; diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RNode.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RNode.java index 452a77dcbfd..1b405d062d9 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RNode.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RNode.java @@ -37,7 +37,7 @@ */ @Entity @ForeignKey(name = "fk_node") -@Table(uniqueConstraints = @UniqueConstraint(columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) public class RNode extends RObject { private RPolyString name; diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObject.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObject.java index aa4d1f09657..64868c46596 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObject.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObject.java @@ -184,7 +184,7 @@ public byte[] getFullObject() { @Where(clause = RObjectReference.REFERENCE_TYPE + "=" + RCreateApproverRef.DISCRIMINATOR) @OneToMany(mappedBy = RObjectReference.F_OWNER, orphanRemoval = true) -// @JoinTable(foreignKey = @ForeignKey(name = "none")) +// @JoinTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT)) @Cascade({org.hibernate.annotations.CascadeType.ALL}) public Set getCreateApproverRef() { if (createApproverRef == null) { diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObjectTemplate.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObjectTemplate.java index 3dfdd655cbe..4754c5218d1 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObjectTemplate.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObjectTemplate.java @@ -45,7 +45,7 @@ */ @Entity @ForeignKey(name = "fk_object_template") -@Table(uniqueConstraints = @UniqueConstraint(columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) public class RObjectTemplate extends RObject { private RPolyString name; diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/ROrg.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/ROrg.java index ea8bab772f8..0d305f9da5d 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/ROrg.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/ROrg.java @@ -37,7 +37,7 @@ */ @Entity @ForeignKey(name = "fk_org") -@Table(uniqueConstraints = @UniqueConstraint(columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) public class ROrg extends RAbstractRole { private RPolyString name; diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RReport.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RReport.java index 012329fc2bd..592b192541a 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RReport.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RReport.java @@ -19,7 +19,7 @@ import java.util.Collection; @Entity -@Table(uniqueConstraints = @UniqueConstraint(columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) @ForeignKey(name = "fk_report") public class RReport extends RObject { diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RResource.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RResource.java index 78337938a7b..6846782b6e1 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RResource.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RResource.java @@ -52,7 +52,7 @@ */ @Entity @ForeignKey(name = "fk_resource") -@Table(uniqueConstraints = @UniqueConstraint(columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) public class RResource extends RObject { private static final Trace LOGGER = TraceManager.getTrace(RResource.class); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RRole.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RRole.java index d5379fbce45..41414ef4ddb 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RRole.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RRole.java @@ -39,7 +39,7 @@ */ @Entity @ForeignKey(name = "fk_role") -@Table(uniqueConstraints = @UniqueConstraint(columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) public class RRole extends RAbstractRole { private RPolyString name; diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSecurityPolicy.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSecurityPolicy.java index ae90bc04732..03aea4ba61d 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSecurityPolicy.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSecurityPolicy.java @@ -19,7 +19,7 @@ import java.util.Collection; @Entity -@Table(uniqueConstraints = @UniqueConstraint(columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) @ForeignKey(name = "fk_security_policy") public class RSecurityPolicy extends RObject { diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSystemConfiguration.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSystemConfiguration.java index 072491addba..07999e16502 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSystemConfiguration.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSystemConfiguration.java @@ -40,7 +40,7 @@ */ @Entity @ForeignKey(name = "fk_system_configuration") -@Table(uniqueConstraints = @UniqueConstraint(columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) public class RSystemConfiguration extends RObject { private RPolyString name; diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RUser.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RUser.java index 7af2e00dcf5..54ed5227639 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RUser.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RUser.java @@ -43,7 +43,7 @@ * @author lazyman */ @Entity -@Table(uniqueConstraints = @UniqueConstraint(columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name="uc_name_norm", columnNames = {"name_norm"})) @org.hibernate.annotations.Table(appliesTo = "m_user", indexes = {@Index(name = "iFullName", columnNames = "fullName_orig"), @Index(name = "iFamilyName", columnNames = "familyName_orig"), diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RValuePolicy.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RValuePolicy.java index 56eb0b87f47..af577903e7e 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RValuePolicy.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RValuePolicy.java @@ -39,7 +39,7 @@ */ @Entity @ForeignKey(name = "fk_value_policy") -@Table(uniqueConstraints = @UniqueConstraint(columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) public class RValuePolicy extends RObject { private RPolyString name; diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RAssignment.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RAssignment.java index a8d8e530a43..73ae9fd5648 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RAssignment.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RAssignment.java @@ -42,6 +42,7 @@ import javax.persistence.*; import javax.persistence.Entity; +import javax.persistence.ForeignKey; import javax.persistence.Index; import javax.persistence.Table; import javax.xml.datatype.XMLGregorianCalendar; @@ -103,6 +104,7 @@ public RAssignment(RObject owner, RAssignmentOwner assignmentOwner) { } @Id + @org.hibernate.annotations.ForeignKey(name = "fk_assignment_owner") @MapsId("owner") @ManyToOne(fetch = FetchType.LAZY) // @JoinTable(foreignKey = @ForeignKey(name = "fk_assignment_owner")) @@ -141,14 +143,14 @@ public REmbeddedReference getTenantRef() { return tenantRef; } + @org.hibernate.annotations.ForeignKey(name = "none") @com.evolveum.midpoint.repo.sql.query.definition.Any(jaxbNameLocalPart = "extension") @OneToOne(optional = true, orphanRemoval = true) @Cascade({org.hibernate.annotations.CascadeType.ALL}) @JoinColumns(value = { @JoinColumn(name = "extOid", referencedColumnName = "owner_owner_oid"), @JoinColumn(name = "extId", referencedColumnName = "owner_id") - }) -// , foreignKey = @ForeignKey(name = "none")) + }, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT)) public RAssignmentExtension getExtension() { return extension; } @@ -165,8 +167,9 @@ public Integer getOrder() { @Where(clause = RAssignmentReference.REFERENCE_TYPE + "=" + RACreateApproverRef.DISCRIMINATOR) @OneToMany(mappedBy = RAssignmentReference.F_OWNER, orphanRemoval = true) + @org.hibernate.annotations.ForeignKey(name = "none") @Cascade({org.hibernate.annotations.CascadeType.ALL}) -// @JoinTable(foreignKey = @ForeignKey(name = "none")) + //@JoinTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT)) public Set getCreateApproverRef() { if (createApproverRef == null) { createApproverRef = new HashSet<>(); From 1dee4cbd8c91b3d3bafedb6d563955cd620f54a9 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Mon, 12 Jan 2015 08:26:44 +0100 Subject: [PATCH 014/215] fixing master (h2) --- .../evolveum/midpoint/repo/sql/data/common/RConnectorHost.java | 2 +- .../evolveum/midpoint/repo/sql/data/common/RGenericObject.java | 2 +- .../java/com/evolveum/midpoint/repo/sql/data/common/RNode.java | 2 +- .../evolveum/midpoint/repo/sql/data/common/RObjectTemplate.java | 2 +- .../java/com/evolveum/midpoint/repo/sql/data/common/ROrg.java | 2 +- .../com/evolveum/midpoint/repo/sql/data/common/RReport.java | 2 +- .../com/evolveum/midpoint/repo/sql/data/common/RResource.java | 2 +- .../java/com/evolveum/midpoint/repo/sql/data/common/RRole.java | 2 +- .../evolveum/midpoint/repo/sql/data/common/RSecurityPolicy.java | 2 +- .../midpoint/repo/sql/data/common/RSystemConfiguration.java | 2 +- .../java/com/evolveum/midpoint/repo/sql/data/common/RUser.java | 2 +- .../evolveum/midpoint/repo/sql/data/common/RValuePolicy.java | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RConnectorHost.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RConnectorHost.java index ea691436794..a83dadab201 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RConnectorHost.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RConnectorHost.java @@ -50,7 +50,7 @@ */ @Entity @ForeignKey(name = "fk_connector_host") -@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_connector_host_name", columnNames = {"name_norm"})) public class RConnectorHost extends RObject { private RPolyString name; diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RGenericObject.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RGenericObject.java index a1f6a3d91f3..a3bc2868ab2 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RGenericObject.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RGenericObject.java @@ -37,7 +37,7 @@ */ @Entity @ForeignKey(name = "fk_generic_object") -@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_generic_object_name", columnNames = {"name_norm"})) public class RGenericObject extends RObject { private RPolyString name; diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RNode.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RNode.java index 1b405d062d9..4d72e8941e1 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RNode.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RNode.java @@ -37,7 +37,7 @@ */ @Entity @ForeignKey(name = "fk_node") -@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_node_name", columnNames = {"name_norm"})) public class RNode extends RObject { private RPolyString name; diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObjectTemplate.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObjectTemplate.java index 4754c5218d1..73bdbb399ac 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObjectTemplate.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObjectTemplate.java @@ -45,7 +45,7 @@ */ @Entity @ForeignKey(name = "fk_object_template") -@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_object_template_name", columnNames = {"name_norm"})) public class RObjectTemplate extends RObject { private RPolyString name; diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/ROrg.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/ROrg.java index 0d305f9da5d..da5230d5bc0 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/ROrg.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/ROrg.java @@ -37,7 +37,7 @@ */ @Entity @ForeignKey(name = "fk_org") -@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_org_name", columnNames = {"name_norm"})) public class ROrg extends RAbstractRole { private RPolyString name; diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RReport.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RReport.java index 592b192541a..2466aeb2849 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RReport.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RReport.java @@ -19,7 +19,7 @@ import java.util.Collection; @Entity -@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_report_name", columnNames = {"name_norm"})) @ForeignKey(name = "fk_report") public class RReport extends RObject { diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RResource.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RResource.java index 6846782b6e1..dd100b28ba7 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RResource.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RResource.java @@ -52,7 +52,7 @@ */ @Entity @ForeignKey(name = "fk_resource") -@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_resource_name", columnNames = {"name_norm"})) public class RResource extends RObject { private static final Trace LOGGER = TraceManager.getTrace(RResource.class); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RRole.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RRole.java index 41414ef4ddb..c2b4ece89d2 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RRole.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RRole.java @@ -39,7 +39,7 @@ */ @Entity @ForeignKey(name = "fk_role") -@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_role_name", columnNames = {"name_norm"})) public class RRole extends RAbstractRole { private RPolyString name; diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSecurityPolicy.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSecurityPolicy.java index 03aea4ba61d..eca0824b487 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSecurityPolicy.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSecurityPolicy.java @@ -19,7 +19,7 @@ import java.util.Collection; @Entity -@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_security_policy_name", columnNames = {"name_norm"})) @ForeignKey(name = "fk_security_policy") public class RSecurityPolicy extends RObject { diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSystemConfiguration.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSystemConfiguration.java index 07999e16502..d1df8381040 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSystemConfiguration.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RSystemConfiguration.java @@ -40,7 +40,7 @@ */ @Entity @ForeignKey(name = "fk_system_configuration") -@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_system_configuration_name", columnNames = {"name_norm"})) public class RSystemConfiguration extends RObject { private RPolyString name; diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RUser.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RUser.java index 54ed5227639..8b65b0e2761 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RUser.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RUser.java @@ -43,7 +43,7 @@ * @author lazyman */ @Entity -@Table(uniqueConstraints = @UniqueConstraint(name="uc_name_norm", columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name="uc_user_name", columnNames = {"name_norm"})) @org.hibernate.annotations.Table(appliesTo = "m_user", indexes = {@Index(name = "iFullName", columnNames = "fullName_orig"), @Index(name = "iFamilyName", columnNames = "familyName_orig"), diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RValuePolicy.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RValuePolicy.java index af577903e7e..bf4eca4d447 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RValuePolicy.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RValuePolicy.java @@ -39,7 +39,7 @@ */ @Entity @ForeignKey(name = "fk_value_policy") -@Table(uniqueConstraints = @UniqueConstraint(name = "uc_name_norm", columnNames = {"name_norm"})) +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_value_policy_name", columnNames = {"name_norm"})) public class RValuePolicy extends RObject { private RPolyString name; From 9589ac573bb61b5ebf80fd6a35b1de365e9cc7b7 Mon Sep 17 00:00:00 2001 From: Ivan Noris Date: Mon, 12 Jan 2015 10:50:38 +0100 Subject: [PATCH 015/215] Fixed samples to fix MID-2139 --- samples/resources/opendj/opendj-localhost-medium.xml | 6 ++++++ .../opendj/opendj-localhost-resource-sync-advanced.xml | 6 ++++++ ...j-localhost-resource-sync-no-extension-advanced-test.xml | 6 ++++++ ...opendj-localhost-resource-sync-no-extension-advanced.xml | 6 ++++++ samples/resources/openldap/openldap-localhost-medium.xml | 6 ++++++ 5 files changed, 30 insertions(+) diff --git a/samples/resources/opendj/opendj-localhost-medium.xml b/samples/resources/opendj/opendj-localhost-medium.xml index 81bdfe5c411..5d42ca57a22 100644 --- a/samples/resources/opendj/opendj-localhost-medium.xml +++ b/samples/resources/opendj/opendj-localhost-medium.xml @@ -345,6 +345,12 @@ It also contains inbound mappings and definition to enable synchronization. Source may have description $user/name + + + + diff --git a/samples/resources/opendj/opendj-localhost-resource-sync-advanced.xml b/samples/resources/opendj/opendj-localhost-resource-sync-advanced.xml index 3b908486ec4..98fd3d7c295 100644 --- a/samples/resources/opendj/opendj-localhost-resource-sync-advanced.xml +++ b/samples/resources/opendj/opendj-localhost-resource-sync-advanced.xml @@ -368,6 +368,12 @@ object. Source may have description $user/name + + + + diff --git a/samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced-test.xml b/samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced-test.xml index 379c641d4b5..0a7544b2e64 100644 --- a/samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced-test.xml +++ b/samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced-test.xml @@ -368,6 +368,12 @@ object. Source may have description $user/name + + + + diff --git a/samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced.xml b/samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced.xml index f3225ee4ff7..f358296b2ad 100644 --- a/samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced.xml +++ b/samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced.xml @@ -368,6 +368,12 @@ object. Source may have description $user/name + + + + diff --git a/samples/resources/openldap/openldap-localhost-medium.xml b/samples/resources/openldap/openldap-localhost-medium.xml index 797c7eee401..162eb11b819 100644 --- a/samples/resources/openldap/openldap-localhost-medium.xml +++ b/samples/resources/openldap/openldap-localhost-medium.xml @@ -222,6 +222,12 @@ It also contains inbound mappings and definition to enable synchronization. Source may have description $user/name + + + + From ab2a8698c7d95d2ed18765a37898707de1866469 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Mon, 12 Jan 2015 11:18:59 +0100 Subject: [PATCH 016/215] Fixing MID-1640. --- .../com/evolveum/midpoint/provisioning/impl/ShadowCache.java | 3 ++- .../evolveum/midpoint/provisioning/test/impl/TestDummy.java | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCache.java b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCache.java index 40cbf6f181a..1cc05afa62c 100644 --- a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCache.java +++ b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCache.java @@ -887,7 +887,7 @@ ObjectQuery createAttributeQuery(ObjectQuery query) throws SchemaException { } private SearchResultMetadata searchObjectsIterativeRepository( - RefinedObjectClassDefinition objectClassDef, + final RefinedObjectClassDefinition objectClassDef, final ResourceType resourceType, ObjectQuery query, Collection> options, final ShadowHandler shadowHandler, OperationResult parentResult) throws SchemaException { @@ -898,6 +898,7 @@ public boolean handle(PrismObject object, OperationResult parentResult) { try { applyAttributesDefinition(object, resourceType); + resouceObjectConverter.setProtectedFlag(resourceType, objectClassDef, object); // fixing MID-1640; hoping that the protected object filter uses only identifiers (that are stored in repo) boolean cont = shadowHandler.handle(object.asObjectable()); parentResult.recordSuccess(); return cont; diff --git a/provisioning/provisioning-impl/src/test/java/com/evolveum/midpoint/provisioning/test/impl/TestDummy.java b/provisioning/provisioning-impl/src/test/java/com/evolveum/midpoint/provisioning/test/impl/TestDummy.java index c83fe1a761e..42afd775e78 100644 --- a/provisioning/provisioning-impl/src/test/java/com/evolveum/midpoint/provisioning/test/impl/TestDummy.java +++ b/provisioning/provisioning-impl/src/test/java/com/evolveum/midpoint/provisioning/test/impl/TestDummy.java @@ -1321,8 +1321,7 @@ public boolean handle(PrismObject object, OperationResult parentResu assertEquals(4, foundObjects.size()); checkConsistency(foundObjects); - // MID-1640 -// assertProtected(foundObjects, 1); + assertProtected(foundObjects, 1); // MID-1640 assertSteadyResource(); } From 2648cc968ed6b7ddf3163f931fe29927765ab862 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Tue, 13 Jan 2015 12:20:19 +0100 Subject: [PATCH 017/215] Fixing handling of assignment activation. Also some minor delta fixes. Posible fix for MID-2105. --- .../assignment/AssignmentTablePanel.java | 2 +- .../web/page/admin/users/PageUser.java | 2 +- .../midpoint/prism/PrismContainerValue.java | 2 +- .../evolveum/midpoint/prism/PrismValue.java | 2 +- .../midpoint/prism/delta/ContainerDelta.java | 16 +- .../midpoint/prism/delta/ItemDelta.java | 18 +- .../midpoint/prism/delta/ObjectDelta.java | 21 +- .../midpoint/test/util/MidPointAsserts.java | 6 + .../model/impl/lens/AssignmentPath.java | 1 + .../lens/projector/AssignmentProcessor.java | 70 ++- .../model/impl/lens/projector/Projector.java | 2 +- ...bstractConfiguredModelIntegrationTest.java | 8 + ...stractInitializedModelIntegrationTest.java | 1 + .../midpoint/model/intest/TestActivation.java | 24 +- .../midpoint/model/intest/TestIntent.java | 12 +- .../midpoint/model/intest/TestIteration.java | 10 +- .../model/intest/TestModelCrudService.java | 12 +- .../intest/TestModelServiceContract.java | 40 +- .../model/intest/TestMultiResource.java | 18 +- .../midpoint/model/intest/TestOrgStruct.java | 2 +- .../model/intest/TestOrgStructMeta.java | 8 +- .../midpoint/model/intest/TestPassword.java | 2 +- .../midpoint/model/intest/TestRbac.java | 62 +-- .../model/intest/TestStrangeCases.java | 2 +- .../negative/TestModelWebServiceNegative.java | 4 +- .../sync/TestValidityRecomputeTask.java | 504 +++++++++++++++++- .../src/test/resources/common/role-judge.xml | 10 +- .../src/test/resources/common/role-sailor.xml | 35 ++ .../test/resources/sync/role-red-judge.xml | 20 +- .../test/resources/sync/role-red-sailor.xml | 36 ++ .../test/AbstractModelIntegrationTest.java | 41 +- 31 files changed, 820 insertions(+), 173 deletions(-) create mode 100644 model/model-intest/src/test/resources/common/role-sailor.xml create mode 100644 model/model-intest/src/test/resources/sync/role-red-sailor.xml diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentTablePanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentTablePanel.java index 0321404194e..3428f2ad91f 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentTablePanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentTablePanel.java @@ -482,7 +482,7 @@ public ContainerDelta handleAssignmentDeltas(ObjectDelta userDelta, PrismCont } if (!assDelta.isEmpty()) { - userDelta.addModification(assDelta); + assDelta = userDelta.addModification(assDelta); } // todo remove this block [lazyman] after model is updated - it has to diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUser.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUser.java index 24453b84eb5..6b7d13f14be 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUser.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUser.java @@ -1252,7 +1252,7 @@ private ContainerDelta handleAssignmentDeltas(ObjectDelta userDelta, P } if (!assDelta.isEmpty()) { - userDelta.addModification(assDelta); + assDelta = userDelta.addModification(assDelta); } // todo remove this block [lazyman] after model is updated - it has to diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismContainerValue.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismContainerValue.java index 1eab6c8ba9c..3fde43b5bdf 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismContainerValue.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismContainerValue.java @@ -41,9 +41,9 @@ import com.evolveum.midpoint.util.QNameUtil; import com.evolveum.midpoint.util.exception.SchemaException; import com.evolveum.midpoint.util.exception.SystemException; - import com.evolveum.midpoint.util.logging.Trace; import com.evolveum.midpoint.util.logging.TraceManager; + import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.Validate; diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismValue.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismValue.java index 5b9994c6d5f..888be064c0c 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismValue.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismValue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2014 Evolveum + * Copyright (c) 2010-2015 Evolveum * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/delta/ContainerDelta.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/delta/ContainerDelta.java index 263bf62bc94..c2f71ef4235 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/delta/ContainerDelta.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/delta/ContainerDelta.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Evolveum + * Copyright (c) 2010-2015 Evolveum * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -201,8 +201,20 @@ public void expand(PrismObject object) throws SchemaEx } } } - + @Override + protected boolean isValueEquivalent(PrismContainerValue a, PrismContainerValue b) { + if (!super.isValueEquivalent(a, b)) { + return false; + } + if (a.getId() == null || b.getId() == null) { + return true; + } else { + return a.getId().equals(b.getId()); + } + } + + @Override public void checkConsistence(boolean requireDefinition, boolean prohibitRaw, ConsistencyCheckScope scope) { super.checkConsistence(requireDefinition, prohibitRaw, scope); checkDuplicateId(valuesToAdd); diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/delta/ItemDelta.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/delta/ItemDelta.java index 8dbd211d633..6bbee477953 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/delta/ItemDelta.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/delta/ItemDelta.java @@ -381,7 +381,7 @@ public void addValueToDelete(V newValue) { if (valuesToDelete == null) { valuesToDelete = newValueCollection(); } - if (PrismValue.containsRealValue(valuesToDelete,newValue)) { + if (containsEquivalentValue(valuesToDelete,newValue)) { return; } valuesToDelete.add(newValue); @@ -389,6 +389,22 @@ public void addValueToDelete(V newValue) { newValue.recompute(); } + protected boolean containsEquivalentValue(Collection collection, V value) { + if (collection == null) { + return false; + } + for (V colVal: collection) { + if (isValueEquivalent(colVal, value)) { + return true; + } + } + return false; + } + + protected boolean isValueEquivalent(V a, V b) { + return a.equalsRealValue(b); + } + public void mergeValuesToDelete(Collection newValues) { for (V val : newValues) { mergeValueToDelete(val); diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/delta/ObjectDelta.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/delta/ObjectDelta.java index 78157963ea0..e0f14e617af 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/delta/ObjectDelta.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/delta/ObjectDelta.java @@ -193,16 +193,24 @@ public Collection getModifications() { return modifications; } - public void addModification(ItemDelta itemDelta) { + /** + * Adds modification (itemDelta) and returns the modification that was added. + * NOTE: the modification that was added may be different from the modification that was + * passed into this method! E.g. in case if two modifications must be merged to keep the delta + * consistent. Therefore always use the returned modification after this method is invoked. + */ + public D addModification(D itemDelta) { if (getChangeType() != ChangeType.MODIFY) { throw new IllegalStateException("Cannot add modifications to "+getChangeType()+" delta"); } ItemPath itemPath = itemDelta.getPath(); - ItemDelta existingModification = findModification(itemPath, itemDelta.getClass()); + D existingModification = (D) findModification(itemPath, itemDelta.getClass()); if (existingModification != null) { existingModification.merge(itemDelta); + return existingModification; } else { ((Collection)modifications).add(itemDelta); + return itemDelta; } } @@ -679,8 +687,7 @@ private Collection> createEmptyModifications() { public PropertyDelta createPropertyModification(QName name, PrismPropertyDefinition propertyDefinition) { PropertyDelta propertyDelta = new PropertyDelta(name, propertyDefinition, prismContext); - addModification(propertyDelta); - return propertyDelta; + return addModification(propertyDelta); } public PropertyDelta createPropertyModification(ItemPath path) { @@ -698,8 +705,7 @@ public PropertyDelta createPropertyModification(ItemPath path, PrismPrope public ReferenceDelta createReferenceModification(QName name, PrismReferenceDefinition referenceDefinition) { ReferenceDelta referenceDelta = new ReferenceDelta(name, referenceDefinition, prismContext); - addModification(referenceDelta); - return referenceDelta; + return addModification(referenceDelta); } public ContainerDelta createContainerModification(ItemPath path) { @@ -710,8 +716,7 @@ public ContainerDelta createContainerModification(I public ContainerDelta createContainerModification(ItemPath path, PrismContainerDefinition containerDefinition) { ContainerDelta containerDelta = new ContainerDelta(path, containerDefinition, prismContext); - addModification(containerDelta); - return containerDelta; + return addModification(containerDelta); } /** diff --git a/infra/test-util/src/main/java/com/evolveum/midpoint/test/util/MidPointAsserts.java b/infra/test-util/src/main/java/com/evolveum/midpoint/test/util/MidPointAsserts.java index 69c69b07e17..61174226f81 100644 --- a/infra/test-util/src/main/java/com/evolveum/midpoint/test/util/MidPointAsserts.java +++ b/infra/test-util/src/main/java/com/evolveum/midpoint/test/util/MidPointAsserts.java @@ -112,6 +112,12 @@ public static void assertAssignments(PrismObject user, assertEquals("Unexepected number of assignments of type "+expectedType+" in "+user+": "+userType.getAssignment(), expectedNumber, actualAssignments); } + public static void assertNoAssignments(PrismObject user) { + F userType = user.asObjectable(); + List assignments = userType.getAssignment(); + assertTrue(user + " does have assignments "+assignments+" while not expecting it", assignments.isEmpty()); + } + public static void assertAssignedRole(PrismObject user, String roleOid) { assertAssigned(user, roleOid, RoleType.COMPLEX_TYPE); } diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/AssignmentPath.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/AssignmentPath.java index ebf4a0f7e2d..904cbed6707 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/AssignmentPath.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/AssignmentPath.java @@ -132,6 +132,7 @@ public String debugDump(int indent) { } else { sb.append(" (").append(segments.size()).append(")"); if (DebugUtil.isDetailedDebugDump()) { + sb.append("\n"); DebugUtil.debugDump(sb, segments, indent + 1, false); } else { for (AssignmentPathSegment segment: segments) { diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/AssignmentProcessor.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/AssignmentProcessor.java index 9fbbf3f1bc8..26443065ea5 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/AssignmentProcessor.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/AssignmentProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2014 Evolveum + * Copyright (c) 2010-2015 Evolveum * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -198,6 +198,22 @@ private void processAssignmentsProjectionsWithFocus(LensCo LOGGER.trace("Assignment delta:\n{}", assignmentDelta.debugDump()); Collection> changedAssignments = assignmentDelta.getValues(AssignmentType.class); + // Changes assignments may be "light", i.e. they may contain just the identifier. Make sure that we always have + // the full assignment data. + Iterator> iterator = changedAssignments.iterator(); + while (iterator.hasNext()) { + PrismContainerValue changedAssignment = iterator.next(); + if (changedAssignment.getItems().isEmpty()) { + if (changedAssignment.getId() != null) { + for (PrismContainerValue assignmentCurrent: assignmentsCurrent) { + if (changedAssignment.getId().equals(assignmentCurrent.getId())) { + iterator.remove(); + changedAssignments.add(assignmentCurrent.clone()); + } + } + } + } + } // Initializing assignment evaluator. This will be used later to process all the assignments including the nested // assignments (roles). @@ -473,7 +489,7 @@ private void processAssignmentsProjectionsWithFocus(LensCo if (LOGGER.isTraceEnabled()) { // Dump the maps - LOGGER.trace("Projection maps:\n{}", constructionMapTriple.debugDump()); + LOGGER.trace("constructionMapTriple:\n{}", constructionMapTriple.debugDump()); } @@ -511,8 +527,26 @@ private void processAssignmentsProjectionsWithFocus(LensCo String desc = rat.toHumanReadableString(); + // SITUATION: The projection is ASSIGNED + if (constructionMapTriple.getPlusMap().containsKey(rat)) { + + ConstructionPack constructionPack = constructionMapTriple.getPlusMap().get(rat); + if (constructionPack.hasValidAssignment()) { + LensProjectionContext projectionContext = LensUtil.getOrCreateProjectionContext(context, rat); + projectionContext.setAssigned(true); + projectionContext.setLegalOld(false); + AssignmentPolicyEnforcementType assignmentPolicyEnforcement = projectionContext.getAssignmentPolicyEnforcementType(); + if (assignmentPolicyEnforcement != AssignmentPolicyEnforcementType.NONE) { + LOGGER.trace("Projection {} legal: assigned (valid)", desc); + projectionContext.setLegal(true); + } + } else { + // Just ignore it, do not even create projection context + LOGGER.trace("Projection {} ignoring: assigned (invalid)", desc); + } + // SITUATION: The projection should exist (if valid), there is NO CHANGE in assignments - if (constructionMapTriple.getZeroMap().containsKey(rat)) { + } else if (constructionMapTriple.getZeroMap().containsKey(rat)) { LensProjectionContext projectionContext = context.findProjectionContext(rat); if (projectionContext == null) { @@ -617,25 +651,6 @@ private void processAssignmentsProjectionsWithFocus(LensCo } else { throw new IllegalStateException("Whoops!?!"); } - - - // SITUATION: The projection is ASSIGNED - } else if (constructionMapTriple.getPlusMap().containsKey(rat)) { - - ConstructionPack constructionPack = constructionMapTriple.getPlusMap().get(rat); - if (constructionPack.hasValidAssignment()) { - LensProjectionContext projectionContext = LensUtil.getOrCreateProjectionContext(context, rat); - projectionContext.setAssigned(true); - projectionContext.setLegalOld(false); - AssignmentPolicyEnforcementType assignmentPolicyEnforcement = projectionContext.getAssignmentPolicyEnforcementType(); - if (assignmentPolicyEnforcement != AssignmentPolicyEnforcementType.NONE) { - LOGGER.trace("Projection {} legal: assigned (valid)", desc); - projectionContext.setLegal(true); - } - } else { - // Just ignore it, do not even create projection context - LOGGER.trace("Projection {} ignoring: assigned (invalid)", desc); - } // SITUATION: The projection is UNASSIGNED } else if (constructionMapTriple.getMinusMap().containsKey(rat)) { @@ -667,9 +682,9 @@ private void processAssignmentsProjectionsWithFocus(LensCo PrismValueDeltaSetTriple> accountDeltaSetTriple = new PrismValueDeltaSetTriple>( - getConstructions(constructionMapTriple.getZeroMap().get(rat)), - getConstructions(constructionMapTriple.getPlusMap().get(rat)), - getConstructions(constructionMapTriple.getMinusMap().get(rat))); + getConstructions(constructionMapTriple.getZeroMap().get(rat), true), + getConstructions(constructionMapTriple.getPlusMap().get(rat), true), + getConstructions(constructionMapTriple.getMinusMap().get(rat), false)); LensProjectionContext accountContext = context.findProjectionContext(rat); if (accountContext != null) { // This can be null in a exotic case if we delete already deleted account @@ -949,10 +964,13 @@ private ShadowKindType determineKind(AssignmentType assignmentType) { throw new IllegalArgumentException("Construction not defined in the assigment."); } - private Collection> getConstructions(ConstructionPack accountConstructionPack) { + private Collection> getConstructions(ConstructionPack accountConstructionPack, boolean validOnly) { if (accountConstructionPack == null) { return null; } + if (validOnly && !accountConstructionPack.hasValidAssignment()) { + return null; + } return accountConstructionPack.getConstructions(); } diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/Projector.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/Projector.java index e1151b66a54..cd0e8d5b323 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/Projector.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/Projector.java @@ -181,7 +181,7 @@ public void project(LensContext context, String activi projectionContext.recompute(); } } - LensUtil.traceContext(LOGGER, activityDescription, "projection activation of all resources", false, context, false); + LensUtil.traceContext(LOGGER, activityDescription, "projection activation of all resources", true, context, true); dependencyProcessor.sortProjectionsToWaves(context); maxWaves = dependencyProcessor.computeMaxWaves(context); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractConfiguredModelIntegrationTest.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractConfiguredModelIntegrationTest.java index 2b29e24c76d..1067568483d 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractConfiguredModelIntegrationTest.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractConfiguredModelIntegrationTest.java @@ -98,6 +98,7 @@ public class AbstractConfiguredModelIntegrationTest extends AbstractModelIntegra protected static final File RESOURCE_DUMMY_DEPRECATED_FILE = new File(COMMON_DIR, "resource-dummy-deprecated.xml"); protected static final String RESOURCE_DUMMY_OID = "10000000-0000-0000-0000-000000000004"; protected static final String RESOURCE_DUMMY_NAMESPACE = "http://midpoint.evolveum.com/xml/ns/public/resource/instance/10000000-0000-0000-0000-000000000004"; + protected static final String RESOURCE_DUMMY_DRINK = "rum"; // RED resource has STRONG mappings protected static final String RESOURCE_DUMMY_RED_FILENAME = COMMON_DIR + "/resource-dummy-red.xml"; @@ -174,9 +175,15 @@ public class AbstractConfiguredModelIntegrationTest extends AbstractModelIntegra // Excludes role "pirate" protected static final File ROLE_JUDGE_FILE = new File(COMMON_DIR, "role-judge.xml"); protected static final String ROLE_JUDGE_OID = "12345111-1111-2222-1111-121212111111"; + protected static final String ROLE_JUDGE_TITLE = "Honorable Justice"; + protected static final String ROLE_JUDGE_DRINK = "tea"; protected static final File ROLE_EMPTY_FILE = new File(COMMON_DIR, "role-empty.xml"); protected static final String ROLE_EMPTY_OID = "12345111-1111-2222-1111-121212111112"; + + protected static final File ROLE_SAILOR_FILE = new File(COMMON_DIR, "role-sailor.xml"); + protected static final String ROLE_SAILOR_OID = "12345111-1111-2222-1111-121212111113"; + protected static final String ROLE_SAILOR_DRINK = "grog"; protected static final File USER_JACK_FILE = new File(COMMON_DIR, "user-jack.xml"); protected static final String USER_JACK_OID = "c0c010c0-d34d-b33f-f00d-111111111111"; @@ -186,6 +193,7 @@ public class AbstractConfiguredModelIntegrationTest extends AbstractModelIntegra protected static final File USER_BARBOSSA_FILE = new File(COMMON_DIR, "user-barbossa.xml"); protected static final String USER_BARBOSSA_OID = "c0c010c0-d34d-b33f-f00d-111111111112"; protected static final String USER_BARBOSSA_USERNAME = "barbossa"; + protected static final String USER_BARBOSSA_FULL_NAME = "Hector Barbossa"; protected static final File USER_GUYBRUSH_FILE = new File (COMMON_DIR, "user-guybrush.xml"); protected static final String USER_GUYBRUSH_OID = "c0c010c0-d34d-b33f-f00d-111111111116"; diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractInitializedModelIntegrationTest.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractInitializedModelIntegrationTest.java index 8edb802d338..95fb5d0b346 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractInitializedModelIntegrationTest.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractInitializedModelIntegrationTest.java @@ -258,6 +258,7 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti repoAddObjectFromFile(ROLE_CAPTAIN_FILENAME, RoleType.class, initResult); repoAddObjectFromFile(ROLE_JUDGE_FILE, RoleType.class, initResult); repoAddObjectFromFile(ROLE_EMPTY_FILE, RoleType.class, initResult); + repoAddObjectFromFile(ROLE_SAILOR_FILE, RoleType.class, initResult); // Orgstruct if (doAddOrgstruct()) { diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestActivation.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestActivation.java index 5e071af7e6a..fd26bce598f 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestActivation.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestActivation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Evolveum + * Copyright (c) 2010-2015 Evolveum * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,6 +42,7 @@ import com.evolveum.icf.dummy.resource.DummyAccount; import com.evolveum.icf.dummy.resource.DummyResource; import com.evolveum.midpoint.model.intest.sync.AbstractSynchronizationStoryTest; +import com.evolveum.midpoint.model.intest.sync.TestValidityRecomputeTask; import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.prism.delta.ChangeType; import com.evolveum.midpoint.prism.delta.ObjectDelta; @@ -73,7 +74,8 @@ /** * @author semancik - * + * + * @see TestValidityRecomputeTask */ @ContextConfiguration(locations = {"classpath:ctx-model-intest-test-main.xml"}) @DirtiesContext(classMode = ClassMode.AFTER_CLASS) @@ -242,7 +244,7 @@ public void test100ModifyUserJackAssignAccount() throws Exception { assertEnableTimestampShadow(accountModel, start, end); // Check account in dummy resource - assertDummyAccount("jack", "Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Jack Sparrow", true); assertDummyEnabled("jack"); @@ -855,7 +857,7 @@ private void checkAdminStatusFor15x(PrismObject user, boolean userStatus, boolea assertAdministrativeStatus(user, userStatus ? ActivationStatusType.ENABLED : ActivationStatusType.DISABLED); // Check account in dummy resource - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, "Jack Sparrow", accountStatus); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, "Jack Sparrow", accountStatus); assertDummyAccount(RESOURCE_DUMMY_YELLOW_NAME, ACCOUNT_JACK_DUMMY_USERNAME, "Jack Sparrow", accountStatusYellow); } @@ -1112,7 +1114,7 @@ public void test205ModifyUserLargoAssignAccount() throws Exception { assertDummyAccountShadowModel(accountModel, accountOid, USER_LARGO_USERNAME, "Largo LaGrande"); // Check account in dummy resource - assertDummyAccount(USER_LARGO_USERNAME, "Largo LaGrande", true); + assertDefaultDummyAccount(USER_LARGO_USERNAME, "Largo LaGrande", true); } @Test @@ -1150,7 +1152,7 @@ public void test210ModifyLargoValidTo10MinsAgo() throws Exception { assertDummyAccountShadowModel(accountModel, accountOid, USER_LARGO_USERNAME, "Largo LaGrande"); // Check account in dummy resource - assertDummyAccount(USER_LARGO_USERNAME, "Largo LaGrande", false); + assertDefaultDummyAccount(USER_LARGO_USERNAME, "Largo LaGrande", false); } @Test @@ -1189,7 +1191,7 @@ public void test211ModifyLargoValidToManana() throws Exception { assertDummyAccountShadowModel(accountModel, accountOid, USER_LARGO_USERNAME, "Largo LaGrande"); // Check account in dummy resource - assertDummyAccount(USER_LARGO_USERNAME, "Largo LaGrande", true); + assertDefaultDummyAccount(USER_LARGO_USERNAME, "Largo LaGrande", true); } /** @@ -1232,7 +1234,7 @@ public void test212SeeLargoTomorrow() throws Exception { assertDummyAccountShadowModel(accountModel, accountOid, USER_LARGO_USERNAME, "Largo LaGrande"); // Check account in dummy resource - assertDummyAccount(USER_LARGO_USERNAME, "Largo LaGrande", true); + assertDefaultDummyAccount(USER_LARGO_USERNAME, "Largo LaGrande", true); } /** @@ -1275,7 +1277,7 @@ public void test213HastaLaMananaLargo() throws Exception { assertDummyAccountShadowModel(accountModel, accountOid, USER_LARGO_USERNAME, "Largo LaGrande"); // Check account in dummy resource - assertDummyAccount(USER_LARGO_USERNAME, "Largo LaGrande", false); + assertDefaultDummyAccount(USER_LARGO_USERNAME, "Largo LaGrande", false); } @Test @@ -1312,7 +1314,7 @@ public void test215ModifyLargoRemoveValidTo() throws Exception { assertDummyAccountShadowModel(accountModel, accountOid, USER_LARGO_USERNAME, "Largo LaGrande"); // Check account in dummy resource - assertDummyAccount(USER_LARGO_USERNAME, "Largo LaGrande", true); + assertDefaultDummyAccount(USER_LARGO_USERNAME, "Largo LaGrande", true); } @Test @@ -1349,7 +1351,7 @@ public void test217ModifyLargoRemoveValidFrom() throws Exception { assertDummyAccountShadowModel(accountModel, accountOid, USER_LARGO_USERNAME, "Largo LaGrande"); // Check account in dummy resource - assertDummyAccount(USER_LARGO_USERNAME, "Largo LaGrande", false); + assertDefaultDummyAccount(USER_LARGO_USERNAME, "Largo LaGrande", false); } /** diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIntent.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIntent.java index b553221ecff..b1460d2c3f6 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIntent.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIntent.java @@ -128,7 +128,7 @@ public void test131ModifyUserJackAssignAccountDefault() throws Exception { assertEnableTimestampShadow(accountModel, startTime, endTime); // Check account in dummy resource - assertDummyAccount("jack", "Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Jack Sparrow", true); // Check audit display("Audit", dummyAuditService); @@ -188,7 +188,7 @@ public void test132ModifyUserJackAssignAccountTest() throws Exception { assertDummyAccountShadowModel(accountModel, accountOidDefault, ACCOUNT_JACK_DUMMY_USERNAME, "Jack Sparrow"); // Check account in dummy resource: intent=default - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, "Jack Sparrow", true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, "Jack Sparrow", true); // Check shadow: intent=test PrismObject accountShadowTest = repositoryService.getObject(ShadowType.class, accountOidTest, null, result); @@ -201,7 +201,7 @@ public void test132ModifyUserJackAssignAccountTest() throws Exception { assertEnableTimestampShadow(accountModelTest, startTime, endTime); // Check account in dummy resource: intent=test - assertDummyAccount("T"+ACCOUNT_JACK_DUMMY_USERNAME, "Jack Sparrow (test)", true); + assertDefaultDummyAccount("T"+ACCOUNT_JACK_DUMMY_USERNAME, "Jack Sparrow (test)", true); assertGroupMember(GROUP_DUMMY_TESTERS_NAME, "T"+ACCOUNT_JACK_DUMMY_USERNAME); // Check audit @@ -254,7 +254,7 @@ public void test135ModifyUserJackFullName() throws Exception { assertDummyAccountShadowModel(accountModel, accountOidDefault, ACCOUNT_JACK_DUMMY_USERNAME, "cpt. Jack Sparrow"); // Check account in dummy resource: intent=default - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, "cpt. Jack Sparrow", true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, "cpt. Jack Sparrow", true); // Check shadow: intent=test PrismObject accountShadowTest = repositoryService.getObject(ShadowType.class, accountOidTest, null, result); @@ -265,7 +265,7 @@ public void test135ModifyUserJackFullName() throws Exception { assertDummyAccountShadowModel(accountModelTest, accountOidTest, "T"+ACCOUNT_JACK_DUMMY_USERNAME, "cpt. Jack Sparrow (test)"); // Check account in dummy resource: intent=test - assertDummyAccount("T"+ACCOUNT_JACK_DUMMY_USERNAME, "cpt. Jack Sparrow (test)", true); + assertDefaultDummyAccount("T"+ACCOUNT_JACK_DUMMY_USERNAME, "cpt. Jack Sparrow (test)", true); // Check audit display("Audit", dummyAuditService); @@ -324,7 +324,7 @@ public void test147ModifyUserJackUnAssignAccountDefault() throws Exception { assertDummyAccountShadowModel(accountModelTest, accountOidTest, "T"+ACCOUNT_JACK_DUMMY_USERNAME, "cpt. Jack Sparrow (test)"); // Check account in dummy resource: intent=test - assertDummyAccount("T"+ACCOUNT_JACK_DUMMY_USERNAME, "cpt. Jack Sparrow (test)", true); + assertDefaultDummyAccount("T"+ACCOUNT_JACK_DUMMY_USERNAME, "cpt. Jack Sparrow (test)", true); assertNoDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIteration.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIteration.java index ed058d826cc..1973a743cd4 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIteration.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIteration.java @@ -271,7 +271,7 @@ public void test100JackAssignAccountDummyConflicting() throws Exception { assertDummyAccountShadowModel(accountModel, accountOid, ACCOUNT_JACK_DUMMY_USERNAME, "Jack Sparrow"); // Check account in dummy resource - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, "Jack Sparrow", true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, "Jack Sparrow", true); // Check audit display("Audit", dummyAuditService); @@ -333,7 +333,7 @@ public void test200JackAssignAccountDummyPinkConflicting() throws Exception { assertAccountShadowModel(accountPinkModel, accountPinkOid, "jack1", resourceDummyPinkType); // Check account in dummy resource - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, "Jack Sparrow", true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, "Jack Sparrow", true); // The original conflicting account should still remain assertDummyAccount(RESOURCE_DUMMY_PINK_NAME, ACCOUNT_JACK_DUMMY_USERNAME, "Jack Pinky", true); // The new account @@ -1092,7 +1092,7 @@ public void test300JackAssignAccountDummyVioletConflicting() throws Exception { assertAccountShadowModel(accountVioletModel, accountVioletOid, "jack.1", resourceDummyVioletType); // Check account in dummy resource - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, "Jack Sparrow", true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, "Jack Sparrow", true); // The original conflicting account should still remain assertDummyAccount(RESOURCE_DUMMY_VIOLET_NAME, ACCOUNT_JACK_DUMMY_USERNAME, "Jack Violet", true); // The new account @@ -1305,7 +1305,7 @@ public void test500JackAssignAccountDummyMagenta() throws Exception { assertIteration(accountMagentaShadow, 0, ""); // Check account in dummy resource - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, "Jack Sparrow", true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, "Jack Sparrow", true); // The original conflicting account should still remain assertDummyAccount(RESOURCE_DUMMY_VIOLET_NAME, ACCOUNT_JACK_DUMMY_USERNAME, "Jack Violet", true); assertDummyAccount(RESOURCE_DUMMY_VIOLET_NAME, "jack.1", "Jack Sparrow", true); @@ -1646,7 +1646,7 @@ public void test600JackRename() throws Exception { assertIteration(accountMagentaShadow, 0, ""); - assertDummyAccount(USER_JACK_RENAMED_NAME, "Jack Sparrow", true); + assertDefaultDummyAccount(USER_JACK_RENAMED_NAME, "Jack Sparrow", true); assertDummyAccount(RESOURCE_DUMMY_PINK_NAME, USER_JACK_RENAMED_NAME, "Jack Sparrow", true); // The original conflicting account should still remain assertDummyAccount(RESOURCE_DUMMY_VIOLET_NAME, ACCOUNT_JACK_DUMMY_USERNAME, "Jack Violet", true); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestModelCrudService.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestModelCrudService.java index 8a81f4c7876..e6d2b4a2c42 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestModelCrudService.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestModelCrudService.java @@ -154,7 +154,7 @@ public void test100ModifyUserAddAccount() throws Exception { assertDummyAccountShadowModel(accountModel, accountOid, "jack", "Jack Sparrow"); // Check account in dummy resource - assertDummyAccount("jack", "Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Jack Sparrow", true); } @Test @@ -231,7 +231,7 @@ public void test120AddAccount() throws SchemaException, ObjectNotFoundException, assertDummyAccountShadowModel(accountModel, accountOid, "jack", "Jack Sparrow"); // Check account in dummy resource - assertDummyAccount("jack", "Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Jack Sparrow", true); } @Test @@ -267,7 +267,7 @@ public void test121ModifyUserAddAccountRef() throws SchemaException, ObjectNotFo assertDummyAccountShadowModel(accountModel, accountOid, "jack", "Jack Sparrow"); // Check account in dummy resource - assertDummyAccount("jack", "Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Jack Sparrow", true); } @@ -309,7 +309,7 @@ public void test128ModifyUserDeleteAccountRef() throws SchemaException, ObjectNo assertDummyAccountShadowModel(accountModel, accountOid, "jack", "Jack Sparrow"); // Check account in dummy resource (if it is unchanged) - assertDummyAccount("jack", "Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Jack Sparrow", true); } @Test @@ -371,7 +371,7 @@ public void test150AddUserBlackbeardWithAccount() throws Exception { assertDummyAccountShadowModel(accountModel, accountOid, "blackbeard", "Edward Teach"); // Check account in dummy resource - assertDummyAccount("blackbeard", "Edward Teach", true); + assertDefaultDummyAccount("blackbeard", "Edward Teach", true); } @@ -407,7 +407,7 @@ public void test210AddUserMorganWithAssignment() throws Exception { assertDummyAccountShadowModel(accountModel, accountOid, "morgan", "Sir Henry Morgan"); // Check account in dummy resource - assertDummyAccount("morgan", "Sir Henry Morgan", true); + assertDefaultDummyAccount("morgan", "Sir Henry Morgan", true); } } diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestModelServiceContract.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestModelServiceContract.java index 2590026d128..b023826043c 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestModelServiceContract.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestModelServiceContract.java @@ -288,7 +288,7 @@ public void test100ModifyUserAddAccount() throws Exception { assertDummyAccountShadowModel(accountModel, accountOid, "jack", "Jack Sparrow"); // Check account in dummy resource - assertDummyAccount("jack", "Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Jack Sparrow", true); assertDummyScriptsAdd(userJack, accountModel, resourceDummyType); @@ -767,7 +767,7 @@ public void test120AddAccount() throws Exception { assertEnableTimestampShadow(accountModel, startTime, endTime); // Check account in dummy resource - assertDummyAccount("jack", "Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Jack Sparrow", true); // The user is not associated with the account assertDummyScriptsAdd(null, accountModel, resourceDummyType); @@ -835,7 +835,7 @@ public void test121ModifyUserAddAccountRef() throws Exception { assertDummyAccountShadowModel(accountModel, accountOid, "jack", "Jack Sparrow"); // Check account in dummy resource - assertDummyAccount("jack", "Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Jack Sparrow", true); // Check audit display("Audit", dummyAuditService); @@ -903,7 +903,7 @@ public void test128ModifyUserDeleteAccountRef() throws Exception { assertDummyAccountShadowModel(accountModel, accountOid, "jack", "Jack Sparrow"); // Check account in dummy resource (if it is unchanged) - assertDummyAccount("jack", "Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Jack Sparrow", true); // Check audit display("Audit", dummyAuditService); @@ -1075,7 +1075,7 @@ public void test131ModifyUserJackAssignAccount() throws Exception { assertEnableTimestampShadow(accountModel, startTime, endTime); // Check account in dummy resource - assertDummyAccount("jack", "Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Jack Sparrow", true); assertDummyScriptsAdd(userJack, accountModel, resourceDummyType); @@ -1156,7 +1156,7 @@ public void test132ModifyAccountJackDummy() throws Exception { "Queen Anne's Revenge"); // Check account in dummy resource - assertDummyAccount(USER_JACK_USERNAME, "Cpt. Jack Sparrow", true); + assertDefaultDummyAccount(USER_JACK_USERNAME, "Cpt. Jack Sparrow", true); assertDummyAccountAttribute(null, USER_JACK_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_SHIP_NAME, "Queen Anne's Revenge"); @@ -1300,7 +1300,7 @@ public void test141ModifyUserJackAssignAccountPositiveEnforcement() throws Excep assertEnableTimestampShadow(accountModel, startTime, endTime); // Check account in dummy resource - assertDummyAccount("jack", "Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Jack Sparrow", true); assertDummyScriptsAdd(userJack, accountModel, resourceDummyType); @@ -1385,7 +1385,7 @@ public void test148ModifyUserJackUnassignAccountPositiveEnforcement() throws Exc assertDummyAccountShadowModel(accountModel, accountOid, "jack", "Jack Sparrow"); // Check account in dummy resource - assertDummyAccount("jack", "Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Jack Sparrow", true); assertNoProvisioningScripts(); @@ -1539,7 +1539,7 @@ public void test151ModifyUserJackAssignAccountRelativeEnforcement() throws Excep assertEnableTimestampShadow(accountModel, startTime, endTime); // Check account in dummy resource - assertDummyAccount("jack", "Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Jack Sparrow", true); assertDummyScriptsAdd(userJack, accountModel, resourceDummyType); @@ -1750,7 +1750,7 @@ public void test163ModifyUserJackAddAccountNoneEnforcement() throws Exception { assertEnableTimestampShadow(accountModel, startTime, endTime); // Check account in dummy resource - assertDummyAccount("jack", "Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Jack Sparrow", true); assertDummyScriptsAdd(userJack, accountModel, resourceDummyType); @@ -1817,7 +1817,7 @@ public void test164ModifyUserJackUnassignAccountNoneEnforcement() throws Excepti assertDummyAccountShadowModel(accountModel, accountOid, "jack", "Jack Sparrow"); // Check account in dummy resource - assertDummyAccount("jack", "Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Jack Sparrow", true); assertDummyScriptsNone(); @@ -2024,7 +2024,7 @@ public void test182ModifyUserAddAndAssignAccountPositiveEnforcement() throws Exc assertEnableTimestampShadow(accountModel, startTime, endTime); // Check account in dummy resource - assertDummyAccount("jack", "Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Jack Sparrow", true); result.computeStatus(); TestUtil.assertSuccess("executeChanges result", result); @@ -2153,7 +2153,7 @@ public void test190ModifyUserJackAssignAccountAndModify() throws Exception { assertEnableTimestampShadow(accountModel, startTime, endTime); // Check account in dummy resource - assertDummyAccount(USER_JACK_USERNAME, "Cpt. Jack Sparrow", true); + assertDefaultDummyAccount(USER_JACK_USERNAME, "Cpt. Jack Sparrow", true); DummyAccount dummyAccount = getDummyAccount(null, USER_JACK_USERNAME); assertDummyAccountAttribute(null, USER_JACK_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_WEAPON_NAME, "smell"); assertNull("Unexpected loot", dummyAccount.getAttributeValue("loot", Integer.class)); @@ -2276,7 +2276,7 @@ public void test191ModifyUserJackModifyAssignment() throws Exception { assertDummyAccountShadowModel(accountModel, accountOid, USER_JACK_USERNAME, "Cpt. Jack Sparrow"); // Check account in dummy resource - assertDummyAccount(USER_JACK_USERNAME, "Cpt. Jack Sparrow", true); + assertDefaultDummyAccount(USER_JACK_USERNAME, "Cpt. Jack Sparrow", true); DummyAccount dummyAccount = getDummyAccount(null, USER_JACK_USERNAME); display(dummyAccount.debugDump()); assertDummyAccountAttribute(null, USER_JACK_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, "q"); @@ -2332,7 +2332,7 @@ public void test195ModifyUserJack() throws Exception { assertDummyAccountShadowModel(accountModel, accountOid, "jack", "Magnificent Captain Jack Sparrow"); // Check account in dummy resource - assertDummyAccount("jack", "Magnificent Captain Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Magnificent Captain Jack Sparrow", true); assertDummyScriptsModify(userJack); @@ -2395,7 +2395,7 @@ public void test196ModifyUserJackLocationEmpty() throws Exception { IntegrationTestTools.assertNoAttribute(accountModel, dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME)); // Check account in dummy resource - assertDummyAccount("jack", "Magnificent Captain Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Magnificent Captain Jack Sparrow", true); assertDummyScriptsModify(userJack); @@ -2494,7 +2494,7 @@ public void test198ModifyUserJackRaw() throws Exception { assertDummyAccountShadowModel(accountModel, accountOid, "jack", "Magnificent Captain Jack Sparrow"); // Check account in dummy resource - the original fullName should not be changed - assertDummyAccount("jack", "Magnificent Captain Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Magnificent Captain Jack Sparrow", true); assertNoProvisioningScripts(); @@ -2619,7 +2619,7 @@ public void test200AddUserBlackbeardWithAccount() throws Exception { assertEnableTimestampShadow(accountModel, startTime, endTime); // Check account in dummy resource - assertDummyAccount("blackbeard", "Edward Teach", true); + assertDefaultDummyAccount("blackbeard", "Edward Teach", true); DummyAccount dummyAccount = getDummyAccount(null, "blackbeard"); assertEquals("Wrong loot", (Integer)10000, dummyAccount.getAttributeValue("loot", Integer.class)); @@ -2698,7 +2698,7 @@ public void test210AddUserMorganWithAssignment() throws Exception { assertEnableTimestampShadow(accountModel, startTime, endTime); // Check account in dummy resource - assertDummyAccount("morgan", "Sir Henry Morgan", true); + assertDefaultDummyAccount("morgan", "Sir Henry Morgan", true); assertDummyScriptsAdd(userMorgan, accountModel, resourceDummyType); @@ -2763,7 +2763,7 @@ public void test212RenameUserMorgan() throws Exception { assertDummyAccountShadowModel(accountModel, accountOid, "sirhenry", "Sir Henry Morgan"); // Check account in dummy resource - assertDummyAccount("sirhenry", "Sir Henry Morgan", true); + assertDefaultDummyAccount("sirhenry", "Sir Henry Morgan", true); assertDummyScriptsModify(userMorgan); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestMultiResource.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestMultiResource.java index c2159f55f11..68f71a9eef7 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestMultiResource.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestMultiResource.java @@ -487,7 +487,7 @@ public void jackAssignRoleDummies(final String TEST_NAME) throws Exception { assertAssignedRole(USER_JACK_OID, ROLE_DUMMIES_OID, task, result); assertLinks(userJack, 4); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "The Great Voodoo Master"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_SHIP_NAME, "The Lost Souls"); @@ -546,7 +546,7 @@ public void jackRename(final String TEST_NAME, String toName, String toFullName, assertAssignedRole(USER_JACK_OID, ROLE_DUMMIES_OID, task, result); assertLinks(userJack, 4); - assertDummyAccount(toName, toFullName, true); + assertDefaultDummyAccount(toName, toFullName, true); assertDefaultDummyAccountAttribute(toName, "title", "The Great Voodoo Master"); assertDefaultDummyAccountAttribute(toName, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_SHIP_NAME, "The Lost Souls"); @@ -696,7 +696,7 @@ public void test300AddAndAssignRelative() throws Exception { display("User after default dummy account add", userJack); assertUserJack(userJack); assertAccount(userJack, RESOURCE_DUMMY_OID); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); // WHEN TestUtil.displayWhen(TEST_NAME); @@ -723,7 +723,7 @@ public void test300AddAndAssignRelative() throws Exception { PrismObject accountModel = modelService.getObject(ShadowType.class, accountOid, null, task, result); assertAccountShadowModel(accountModel, accountOid, ACCOUNT_JACK_DUMMY_USERNAME, resourceDummyBlueType); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDummyAccount(RESOURCE_DUMMY_BLUE_NAME, ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); } @@ -761,7 +761,7 @@ public void test310AddedAccountAndUnassignRelative() throws Exception { PrismObject accountModel = modelService.getObject(ShadowType.class, accountOid, null, task, result); assertDummyAccountShadowModel(accountModel, accountOid, ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertNoDummyAccount(RESOURCE_DUMMY_BLUE_NAME, ACCOUNT_JACK_DUMMY_USERNAME); } @@ -904,7 +904,7 @@ public void test360AddAccountDummy() throws Exception { result.computeStatus(); TestUtil.assertSuccess(result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); } @@ -968,7 +968,7 @@ public void test370DeleteAccountDummy() throws Exception { PrismObject user = getUser(USER_JACK_OID); assertAccount(user, RESOURCE_DUMMY_OID); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); } @@ -1005,7 +1005,7 @@ public void test372UnlinkAccountDummy() throws Exception { PrismObject user = getUser(USER_JACK_OID); assertAccount(user, RESOURCE_DUMMY_OID); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); } @@ -1032,7 +1032,7 @@ public void test374DeleteAccountYellow() throws Exception { assertAccount(user, RESOURCE_DUMMY_OID); assertNoDummyAccount(RESOURCE_DUMMY_YELLOW_NAME, ACCOUNT_JACK_DUMMY_USERNAME); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); } diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java index e3c9b217bed..a7dfca4bf9f 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java @@ -121,7 +121,7 @@ public void test101JackAssignScummBar() throws Exception { display("User jack after", userJack); assertUserOrg(userJack, ORG_SCUMM_BAR_OID); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, "Jack Sparrow", true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, "Jack Sparrow", true); // Postcondition assertMonkeyIslandOrgSanity(); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStructMeta.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStructMeta.java index 021e90c2908..d8407dbebb0 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStructMeta.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStructMeta.java @@ -177,7 +177,7 @@ public void test400JackAssignScummBar() throws Exception { display("User after", user); assertUserOrg(user, ORG_SCUMM_BAR_OID); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, USER_JACK_FULL_NAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, USER_JACK_FULL_NAME, true); // Postcondition assertMonkeyIslandOrgSanity(); @@ -202,7 +202,7 @@ public void test402JackAssignOrganized() throws Exception { assertUserOrg(user, ORG_SCUMM_BAR_OID); assertAssignedRole(user, ROLE_ORGANIZED_OID); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, USER_JACK_FULL_NAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, USER_JACK_FULL_NAME, true); assertDummyAccountAttribute(null, ACCOUNT_JACK_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, "Proud member of F0006"); @@ -228,7 +228,7 @@ public void test404JackUnAssignOrganized() throws Exception { display("User after", user); assertUserOrg(user, ORG_SCUMM_BAR_OID); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, USER_JACK_FULL_NAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, USER_JACK_FULL_NAME, true); assertDummyAccountAttribute(null, ACCOUNT_JACK_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME); @@ -290,7 +290,7 @@ public void test410JackAssignScummBarOrganized() throws Exception { assertUserOrg(user, ORG_SCUMM_BAR_OID); assertAssignedRole(user, ROLE_ORGANIZED_OID); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, USER_JACK_FULL_NAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, USER_JACK_FULL_NAME, true); assertDummyAccountAttribute(null, ACCOUNT_JACK_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, "Proud member of F0006"); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestPassword.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestPassword.java index 42ac5403782..a483287809a 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestPassword.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestPassword.java @@ -184,7 +184,7 @@ public void test100ModifyUserJackAssignAccount() throws Exception { assertDummyAccountShadowModel(accountModel, accountOid, "jack", "Jack Sparrow"); // Check account in dummy resource - assertDummyAccount("jack", "Jack Sparrow", true); + assertDefaultDummyAccount("jack", "Jack Sparrow", true); assertDummyPassword("jack", USER_PASSWORD_1_CLEAR); } diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestRbac.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestRbac.java index 2dbc2fad62f..306d2fabbf5 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestRbac.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestRbac.java @@ -186,7 +186,7 @@ public void test101JackAssignRolePirate() throws Exception { display("User jack after", userAfter); assertAssignedRole(USER_JACK_OID, ROLE_PIRATE_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Pirate"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "location", "Caribbean"); // Outbound mapping for weapon is weak, therefore the mapping in role should override it @@ -221,7 +221,7 @@ public void test102JackModifyUserLocality() throws Exception { TestUtil.assertSuccess(result); assertAssignedRole(USER_JACK_OID, ROLE_PIRATE_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Pirate"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "location", "Tortuga"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "weapon", "cutlass"); @@ -279,7 +279,7 @@ public void test120JackAssignRolePirateWhileAlreadyHasAccount() throws Exception assumeAssignmentPolicy(AssignmentPolicyEnforcementType.FULL); // Precondition (simplified) - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "weapon", "rum"); // gossip is a tolerant attribute. Make sure there there is something to tolerate @@ -301,7 +301,7 @@ public void test120JackAssignRolePirateWhileAlreadyHasAccount() throws Exception assertAssignments(userJack, 1); assertLinks(userJack, 1); assertAssignedRole(userJack, ROLE_PIRATE_OID); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Pirate"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "location", "Tortuga"); // The account already has a value for 'weapon', it should be unchanged. @@ -323,7 +323,7 @@ public void test121JackAssignAccountImplicitIntent() throws Exception { OperationResult result = task.getResult(); // Precondition (simplified) - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); // WHEN assignAccount(USER_JACK_OID, RESOURCE_DUMMY_OID, null, task, result); @@ -337,7 +337,7 @@ public void test121JackAssignAccountImplicitIntent() throws Exception { assertAssignments(userJack, 2); assertLinks(userJack, 1); assertAssignedRole(userJack, ROLE_PIRATE_OID); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Pirate"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "location", "Tortuga"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, @@ -355,7 +355,7 @@ public void test122JackAssignAccountExplicitIntent() throws Exception { OperationResult result = task.getResult(); // Precondition (simplified) - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); // WHEN assignAccount(USER_JACK_OID, RESOURCE_DUMMY_OID, SchemaConstants.INTENT_DEFAULT, task, result); @@ -369,7 +369,7 @@ public void test122JackAssignAccountExplicitIntent() throws Exception { assertAssignments(userJack, 3); assertLinks(userJack, 1); assertAssignedRole(userJack, ROLE_PIRATE_OID); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Pirate"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "location", "Tortuga"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, @@ -397,7 +397,7 @@ public void test127UnAssignAccountImplicitIntent() throws Exception { assertAssignments(userJack, 2); assertLinks(userJack, 1); assertAssignedRole(userJack, ROLE_PIRATE_OID); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Pirate"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "location", "Tortuga"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, @@ -424,7 +424,7 @@ public void test128UnAssignAccountExplicitIntent() throws Exception { assertAssignments(userJack, 1); assertLinks(userJack, 1); assertAssignedRole(userJack, ROLE_PIRATE_OID); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Pirate"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "location", "Tortuga"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, @@ -475,7 +475,7 @@ public void test130JackAssignRolePirateWithSeaInAssignment() throws Exception { TestUtil.assertSuccess(result); assertAssignedRole(USER_JACK_OID, ROLE_PIRATE_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Pirate"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "location", "Tortuga"); // Outbound mapping for weapon is weak, therefore the mapping in role should override it @@ -533,7 +533,7 @@ public void test134JackAssignRoleAdriaticPirate() throws Exception { TestUtil.assertSuccess(result); assertAssignedRole(USER_JACK_OID, ROLE_ADRIATIC_PIRATE_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Pirate"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "location", "Tortuga"); // Outbound mapping for weapon is weak, therefore the mapping in role should override it @@ -592,7 +592,7 @@ public void test137JackAssignRoleAdriaticPirateWithSeaInAssignment() throws Exce TestUtil.assertSuccess(result); assertAssignedRole(USER_JACK_OID, ROLE_ADRIATIC_PIRATE_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Pirate"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "location", "Tortuga"); // Outbound mapping for weapon is weak, therefore the mapping in role should override it @@ -647,7 +647,7 @@ public void test144JackAssignRoleBlackSeaPirate() throws Exception { TestUtil.assertSuccess(result); assertAssignedRole(USER_JACK_OID, ROLE_BLACK_SEA_PIRATE_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Pirate"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "location", "Tortuga"); // Outbound mapping for weapon is weak, therefore the mapping in role should override it @@ -702,7 +702,7 @@ public void test147JackAssignRoleBlackSeaPirateWithSeaInAssignment() throws Exce TestUtil.assertSuccess(result); assertAssignedRole(USER_JACK_OID, ROLE_BLACK_SEA_PIRATE_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Pirate"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "location", "Tortuga"); // Outbound mapping for weapon is weak, therefore the mapping in role should override it @@ -757,7 +757,7 @@ public void test154JackAssignRoleIndianOceanPirate() throws Exception { TestUtil.assertSuccess(result); assertAssignedRole(USER_JACK_OID, ROLE_INDIAN_OCEAN_PIRATE_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Pirate"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "location", "Tortuga"); // Outbound mapping for weapon is weak, therefore the mapping in role should override it @@ -812,7 +812,7 @@ public void test501JackAssignRolePirate() throws Exception { TestUtil.assertSuccess(result); assertAssignedRole(USER_JACK_OID, ROLE_PIRATE_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Pirate"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "location", "Tortuga"); // Outbound mapping for weapon is weak, therefore the mapping in role should override it @@ -843,7 +843,7 @@ public void test502JackModifyUserLocality() throws Exception { // THEN assertAssignedRole(USER_JACK_OID, ROLE_PIRATE_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Pirate"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "location", "Isla de Muerta"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "weapon", "cutlass"); @@ -870,7 +870,7 @@ public void test510UnAssignRolePirate() throws Exception { display("User after", userJack); assertAssignedNoRole(userJack); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "location", "Isla de Muerta"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, EXISTING_GOSSIP); } @@ -921,7 +921,7 @@ public void test520JackAssignRolePirate() throws Exception { // THEN assertAssignedRole(USER_JACK_OID, ROLE_PIRATE_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Pirate"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "location", "Isla de Muerta"); // Outbound mapping for weapon is weak, therefore the mapping in role should override it @@ -976,7 +976,7 @@ public void test530JackAssignRoleCleric() throws Exception { // THEN assertAssignedRole(USER_JACK_OID, ROLE_CLERIC_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Holy man"); } @@ -1008,7 +1008,7 @@ public void test532JackModifyAssignmentRoleCleric() throws Exception { TestUtil.assertSuccess(result); assertAssignedRole(USER_JACK_OID, ROLE_CLERIC_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Holy soul"); } @@ -1117,7 +1117,7 @@ public void test542JackModifyEmployeeTypeWannabe() throws Exception { TestUtil.assertSuccess(result); assertAssignedRole(USER_JACK_OID, ROLE_WANNABE_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Wannabe Cpt. Where's the rum?"); } @@ -1169,7 +1169,7 @@ public void test544JackSetHonorificSuffixWannabe() throws Exception { TestUtil.assertSuccess(result); assertAssignedRole(USER_JACK_OID, ROLE_WANNABE_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_QUOTE_NAME, "Arr!", "Whatever. -- jack"); } @@ -1197,7 +1197,7 @@ public void test545JackRestoreHonorificPrefixWannabe() throws Exception { TestUtil.assertSuccess(result); assertAssignedRole(USER_JACK_OID, ROLE_WANNABE_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Wannabe captain Where's the rum?"); } @@ -1247,7 +1247,7 @@ public void test600JackAssignRoleJudge() throws Exception { TestUtil.assertSuccess(result); assertAssignedRole(USER_JACK_OID, ROLE_JUDGE_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Honorable Justice"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "weapon", "mouth", "pistol"); // assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, @@ -1282,7 +1282,7 @@ public void test602JackAssignRolePirate() throws Exception { TestUtil.assertFailure(result); assertAssignedRole(USER_JACK_OID, ROLE_JUDGE_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Honorable Justice"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "weapon", "mouth", "pistol"); } @@ -1312,7 +1312,7 @@ public void test605JackUnAssignRoleJudgeAssignRolePirate() throws Exception { display("User jack after", userAfter); assertAssignedRole(USER_JACK_OID, ROLE_PIRATE_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Pirate"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "location", "Isla de Muerta"); // Even though Jack is a pirate now the mapping from the role is not applied. @@ -1366,7 +1366,7 @@ public void test700JackAssignRoleJudge() throws Exception { TestUtil.assertSuccess(result); assertAssignedRole(USER_JACK_OID, ROLE_JUDGE_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Honorable Justice"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "weapon", "mouth", "pistol"); } @@ -1423,7 +1423,7 @@ public void test702JackModifyJudgeAddInducementHonorabilityRecompute() throws Ex assertAssignedRole(USER_JACK_OID, ROLE_JUDGE_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Honorable"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "weapon", "mouth", "pistol"); @@ -1539,7 +1539,7 @@ public void test712JackModifyEmptyRoleAddInducementPirateRecompute() throws Exce assertAssignedRole(USER_JACK_OID, ROLE_EMPTY_OID, task, result); - assertDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "title", "Bloody Pirate"); assertDefaultDummyAccountAttribute(ACCOUNT_JACK_DUMMY_USERNAME, "weapon", "cutlass"); } diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestStrangeCases.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestStrangeCases.java index 50657c27449..fcf370ebaae 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestStrangeCases.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestStrangeCases.java @@ -191,7 +191,7 @@ public void test100ModifyUserGuybrushAddAccountDummyRedNoAttributesConflict() th assertDummyAccountShadowModel(accountModel, accountOid, ACCOUNT_GUYBRUSH_DUMMY_USERNAME, "Guybrush Threepwood"); // Check account in dummy resource - assertDummyAccount(ACCOUNT_GUYBRUSH_DUMMY_USERNAME, "Guybrush Threepwood", true); + assertDefaultDummyAccount(ACCOUNT_GUYBRUSH_DUMMY_USERNAME, "Guybrush Threepwood", true); result.computeStatus(); display("executeChanges result", result); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/negative/TestModelWebServiceNegative.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/negative/TestModelWebServiceNegative.java index a1023d87d7c..28d53838970 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/negative/TestModelWebServiceNegative.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/negative/TestModelWebServiceNegative.java @@ -123,7 +123,7 @@ public void test100ModifyAccountExplicitType() throws Exception { // THEN // Check account in dummy resource - assertDummyAccount(ACCOUNT_GUYBRUSH_DUMMY_USERNAME, ACCOUNT_GUYBRUSH_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_GUYBRUSH_DUMMY_USERNAME, ACCOUNT_GUYBRUSH_DUMMY_FULLNAME, true); assertDummyAccountAttribute(null, ACCOUNT_GUYBRUSH_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, "foo"); } @@ -151,7 +151,7 @@ public void test110ModifyAccountImplicitType() throws Exception { // THEN // Check account in dummy resource - assertDummyAccount(ACCOUNT_GUYBRUSH_DUMMY_USERNAME, ACCOUNT_GUYBRUSH_DUMMY_FULLNAME, true); + assertDefaultDummyAccount(ACCOUNT_GUYBRUSH_DUMMY_USERNAME, ACCOUNT_GUYBRUSH_DUMMY_FULLNAME, true); assertDummyAccountAttribute(null, ACCOUNT_GUYBRUSH_DUMMY_USERNAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, "bar"); } diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestValidityRecomputeTask.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestValidityRecomputeTask.java index 24bcd9ea31b..634c7564f48 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestValidityRecomputeTask.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestValidityRecomputeTask.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2014 Evolveum + * Copyright (c) 2013-2015 Evolveum * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,12 +31,14 @@ import org.springframework.test.context.ContextConfiguration; import org.testng.annotations.Test; +import com.evolveum.icf.dummy.resource.DummyAccount; import com.evolveum.midpoint.model.api.PolicyViolationException; import com.evolveum.midpoint.model.impl.trigger.RecomputeTriggerHandler; import com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest; import com.evolveum.midpoint.model.intest.TestActivation; import com.evolveum.midpoint.model.intest.TestMapping; import com.evolveum.midpoint.model.intest.TestTriggerTask; +import com.evolveum.midpoint.prism.PrismContainerValue; import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.prism.delta.ObjectDelta; import com.evolveum.midpoint.prism.path.IdItemPathSegment; @@ -46,10 +48,12 @@ import com.evolveum.midpoint.prism.xml.XmlTypeConverter; import com.evolveum.midpoint.schema.constants.SchemaConstants; import com.evolveum.midpoint.schema.result.OperationResult; +import com.evolveum.midpoint.schema.util.MiscSchemaUtil; import com.evolveum.midpoint.security.api.MidPointPrincipal; import com.evolveum.midpoint.security.api.SecurityEnforcer; import com.evolveum.midpoint.security.api.UserProfileService; import com.evolveum.midpoint.task.api.Task; +import com.evolveum.midpoint.test.DummyResourceContoller; import com.evolveum.midpoint.test.IntegrationTestTools; import com.evolveum.midpoint.test.util.TestUtil; import com.evolveum.midpoint.util.DebugUtil; @@ -75,6 +79,8 @@ /** * @author Radovan Semancik + * + * @see TestActivation * */ @ContextConfiguration(locations = {"classpath:ctx-model-intest-test-main.xml"}) @@ -86,6 +92,9 @@ public class TestValidityRecomputeTask extends AbstractInitializedModelIntegrati protected static final File ROLE_RED_JUDGE_FILE = new File(TEST_DIR, "role-red-judge.xml"); protected static final String ROLE_RED_JUDGE_OID = "12345111-1111-2222-1111-121212111222"; + protected static final File ROLE_RED_SAILOR_FILE = new File(TEST_DIR, "role-red-sailor.xml"); + protected static final String ROLE_RED_SAILOR_OID = "12345111-1111-2222-1111-121212111223"; + private static final XMLGregorianCalendar LONG_LONG_TIME_AGO = XmlTypeConverter.createXMLGregorianCalendar(1111, 1, 1, 12, 00, 00); private XMLGregorianCalendar drakeValidFrom; @@ -96,6 +105,7 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti super.initSystem(initTask, initResult); repoAddObjectFromFile(ROLE_RED_JUDGE_FILE, RoleType.class, initResult); + repoAddObjectFromFile(ROLE_RED_SAILOR_FILE, RoleType.class, initResult); DebugUtil.setDetailedDebugDump(true); } @@ -309,13 +319,8 @@ public void test120JackDisableAssignmentJudge() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - modifyObjectReplaceProperty(UserType.class, USER_JACK_OID, - new ItemPath( - new NameItemPathSegment(UserType.F_ASSIGNMENT), - new IdItemPathSegment(judgeAssignment.getId()), - new NameItemPathSegment(AssignmentType.F_ACTIVATION), - new NameItemPathSegment(ActivationType.F_ADMINISTRATIVE_STATUS)), - task, result, ActivationStatusType.DISABLED); + modifyAssignmentAdministrativeStatus(USER_JACK_OID, judgeAssignment.getId(), + ActivationStatusType.DISABLED, task, result); // THEN TestUtil.displayThen(TEST_NAME); @@ -342,13 +347,8 @@ public void test122JackReplaceNullAdministrativeStatusAssignmentJudge() throws E // WHEN TestUtil.displayWhen(TEST_NAME); - modifyObjectReplaceProperty(UserType.class, USER_JACK_OID, - new ItemPath( - new NameItemPathSegment(UserType.F_ASSIGNMENT), - new IdItemPathSegment(judgeAssignment.getId()), - new NameItemPathSegment(AssignmentType.F_ACTIVATION), - new NameItemPathSegment(ActivationType.F_ADMINISTRATIVE_STATUS)), - task, result); + modifyAssignmentAdministrativeStatus(USER_JACK_OID, judgeAssignment.getId(), + null, task, result); // THEN TestUtil.displayThen(TEST_NAME); @@ -372,13 +372,8 @@ public void test123JackDisableAssignmentJudge() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - modifyObjectReplaceProperty(UserType.class, USER_JACK_OID, - new ItemPath( - new NameItemPathSegment(UserType.F_ASSIGNMENT), - new IdItemPathSegment(judgeAssignment.getId()), - new NameItemPathSegment(AssignmentType.F_ACTIVATION), - new NameItemPathSegment(ActivationType.F_ADMINISTRATIVE_STATUS)), - task, result, ActivationStatusType.DISABLED); + modifyAssignmentAdministrativeStatus(USER_JACK_OID, judgeAssignment.getId(), + ActivationStatusType.DISABLED, task, result); // THEN TestUtil.displayThen(TEST_NAME); @@ -402,13 +397,8 @@ public void test124JackEnableAssignmentJudge() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - modifyObjectReplaceProperty(UserType.class, USER_JACK_OID, - new ItemPath( - new NameItemPathSegment(UserType.F_ASSIGNMENT), - new IdItemPathSegment(judgeAssignment.getId()), - new NameItemPathSegment(AssignmentType.F_ACTIVATION), - new NameItemPathSegment(ActivationType.F_ADMINISTRATIVE_STATUS)), - task, result, ActivationStatusType.ENABLED); + modifyAssignmentAdministrativeStatus(USER_JACK_OID, judgeAssignment.getId(), + ActivationStatusType.ENABLED, task, result); // THEN TestUtil.displayThen(TEST_NAME); @@ -585,6 +575,443 @@ private AssignmentType getJudgeAssignment(String userOid) throws ObjectNotFoundE assertEquals("Wrong num ass", 1, assignments.size()); return assignments.iterator().next(); } + + /** + * The test13x works with two roles for the same resource, enabling/disabling them. + */ + @Test + public void test130BarbossaAssignJudgeEnabled() throws Exception { + final String TEST_NAME = "test130BarbossaAssignJudgeEnabled"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = createTask(TestValidityRecomputeTask.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + // preconditions + assertNoAssignments(USER_BARBOSSA_OID); + assertNoDummyAccount(null, USER_BARBOSSA_USERNAME); + + ActivationType activationType = new ActivationType(); + activationType.setAdministrativeStatus(ActivationStatusType.ENABLED); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + assignRole(USER_BARBOSSA_OID, ROLE_JUDGE_OID, activationType, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(null, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(null, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + assertDummyAccountAttribute(null, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, + ROLE_JUDGE_TITLE); + assertDummyAccountAttribute(null, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME, + RESOURCE_DUMMY_DRINK, ROLE_JUDGE_DRINK); + + PrismObject user = getUser(USER_BARBOSSA_OID); + display("User after", user); + assertLinks(user, 1); + + MidPointPrincipal principal = userProfileService.getPrincipal(user); + assertAuthorized(principal, AUTZ_PUNISH_URL); + } + + @Test + public void test131BarbossaAssignSailorEnabled() throws Exception { + final String TEST_NAME = "test131BarbossaAssignSailorEnabled"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = createTask(TestValidityRecomputeTask.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + ActivationType activationType = new ActivationType(); + activationType.setAdministrativeStatus(ActivationStatusType.ENABLED); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + assignRole(USER_BARBOSSA_OID, ROLE_SAILOR_OID, activationType, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(null, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(null, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + assertDummyAccountAttribute(null, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, + ROLE_JUDGE_TITLE); + assertDummyAccountAttribute(null, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME, + RESOURCE_DUMMY_DRINK, ROLE_JUDGE_DRINK, ROLE_SAILOR_DRINK); + + PrismObject user = getUser(USER_BARBOSSA_OID); + display("User after", user); + assertLinks(user, 1); + + MidPointPrincipal principal = userProfileService.getPrincipal(user); + assertAuthorized(principal, AUTZ_PUNISH_URL); + } + + @Test + public void test132BarbossaDisableAssignmentJudge() throws Exception { + final String TEST_NAME = "test132BarbossaDisableAssignmentJudge"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = createTask(TestValidityRecomputeTask.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + AssignmentType assignment = getUserAssignment(USER_BARBOSSA_OID, ROLE_JUDGE_OID); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + modifyAssignmentAdministrativeStatus(USER_BARBOSSA_OID, assignment.getId(), + ActivationStatusType.DISABLED, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(null, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(null, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + assertNoDummyAccountAttribute(null, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME); + assertDummyAccountAttribute(null, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME, + RESOURCE_DUMMY_DRINK, ROLE_SAILOR_DRINK); + + PrismObject user = getUser(USER_BARBOSSA_OID); + display("User after", user); + assertLinks(user, 1); + + MidPointPrincipal principal = userProfileService.getPrincipal(user); + assertNotAuthorized(principal, AUTZ_PUNISH_URL); + } + + @Test + public void test133BarbossaDisableAssignmentSailor() throws Exception { + final String TEST_NAME = "test133BarbossaDisableAssignmentSailor"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = createTask(TestValidityRecomputeTask.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + AssignmentType assignment = getUserAssignment(USER_BARBOSSA_OID, ROLE_SAILOR_OID); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + modifyAssignmentAdministrativeStatus(USER_BARBOSSA_OID, assignment.getId(), + ActivationStatusType.DISABLED, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertNoDummyAccount(null, USER_BARBOSSA_USERNAME); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertNoDummyAccount(null, USER_BARBOSSA_USERNAME); + + PrismObject user = getUser(USER_BARBOSSA_OID); + display("User after", user); + assertLinks(user, 0); + + MidPointPrincipal principal = userProfileService.getPrincipal(user); + assertNotAuthorized(principal, AUTZ_PUNISH_URL); + } + + @Test + public void test134BarbossaEnableAssignmentJudge() throws Exception { + final String TEST_NAME = "test134BarbossaEnableAssignmentJudge"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = createTask(TestValidityRecomputeTask.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + AssignmentType assignment = getUserAssignment(USER_BARBOSSA_OID, ROLE_JUDGE_OID); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + modifyAssignmentAdministrativeStatus(USER_BARBOSSA_OID, assignment.getId(), + ActivationStatusType.ENABLED, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(null, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + assertDummyAccount(null, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + assertDummyAccountAttribute(null, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, + ROLE_JUDGE_TITLE); + assertDummyAccountAttribute(null, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME, + RESOURCE_DUMMY_DRINK, ROLE_JUDGE_DRINK); + + PrismObject user = getUser(USER_BARBOSSA_OID); + display("User after", user); + assertLinks(user, 1); + + MidPointPrincipal principal = userProfileService.getPrincipal(user); + assertAuthorized(principal, AUTZ_PUNISH_URL); + } + + @Test + public void test135BarbossaEnableAssignmentSailor() throws Exception { + final String TEST_NAME = "test135BarbossaEnableAssignmentSailor"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = createTask(TestValidityRecomputeTask.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + AssignmentType assignment = getUserAssignment(USER_BARBOSSA_OID, ROLE_SAILOR_OID); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + modifyAssignmentAdministrativeStatus(USER_BARBOSSA_OID, assignment.getId(), + ActivationStatusType.ENABLED, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(null, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + assertDummyAccount(null, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + assertDummyAccountAttribute(null, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, + ROLE_JUDGE_TITLE); + assertDummyAccountAttribute(null, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME, + RESOURCE_DUMMY_DRINK, ROLE_JUDGE_DRINK, ROLE_SAILOR_DRINK); + + PrismObject user = getUser(USER_BARBOSSA_OID); + display("User after", user); + assertLinks(user, 1); + + MidPointPrincipal principal = userProfileService.getPrincipal(user); + assertAuthorized(principal, AUTZ_PUNISH_URL); + } + + @Test + public void test136BarbossaDisableBothAssignments() throws Exception { + final String TEST_NAME = "test136BarbossaDisableBothAssignments"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = createTask(TestValidityRecomputeTask.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + AssignmentType judgeAssignment = getUserAssignment(USER_BARBOSSA_OID, ROLE_JUDGE_OID); + AssignmentType sailorAssignment = getUserAssignment(USER_BARBOSSA_OID, ROLE_SAILOR_OID); + + ObjectDelta objectDelta = + ObjectDelta.createModificationReplaceProperty(UserType.class, + USER_BARBOSSA_OID, + new ItemPath( + new NameItemPathSegment(UserType.F_ASSIGNMENT), + new IdItemPathSegment(judgeAssignment.getId()), + new NameItemPathSegment(AssignmentType.F_ACTIVATION), + new NameItemPathSegment(ActivationType.F_ADMINISTRATIVE_STATUS)), + prismContext, ActivationStatusType.DISABLED); + objectDelta.addModificationReplaceProperty(new ItemPath( + new NameItemPathSegment(UserType.F_ASSIGNMENT), + new IdItemPathSegment(sailorAssignment.getId()), + new NameItemPathSegment(AssignmentType.F_ACTIVATION), + new NameItemPathSegment(ActivationType.F_ADMINISTRATIVE_STATUS)), + ActivationStatusType.DISABLED); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + modelService.executeChanges(MiscSchemaUtil.createCollection(objectDelta), null, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertNoDummyAccount(null, USER_BARBOSSA_USERNAME); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertNoDummyAccount(null, USER_BARBOSSA_USERNAME); + + PrismObject user = getUser(USER_BARBOSSA_OID); + display("User after", user); + assertLinks(user, 0); + + MidPointPrincipal principal = userProfileService.getPrincipal(user); + assertNotAuthorized(principal, AUTZ_PUNISH_URL); + } + + @Test + public void test137BarbossaEnableBothAssignments() throws Exception { + final String TEST_NAME = "test137BarbossaEnableBothAssignments"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = createTask(TestValidityRecomputeTask.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + AssignmentType judgeAssignment = getUserAssignment(USER_BARBOSSA_OID, ROLE_JUDGE_OID); + AssignmentType sailorAssignment = getUserAssignment(USER_BARBOSSA_OID, ROLE_SAILOR_OID); + + ObjectDelta objectDelta = + ObjectDelta.createModificationReplaceProperty(UserType.class, + USER_BARBOSSA_OID, + new ItemPath( + new NameItemPathSegment(UserType.F_ASSIGNMENT), + new IdItemPathSegment(judgeAssignment.getId()), + new NameItemPathSegment(AssignmentType.F_ACTIVATION), + new NameItemPathSegment(ActivationType.F_ADMINISTRATIVE_STATUS)), + prismContext, ActivationStatusType.ENABLED); + objectDelta.addModificationReplaceProperty(new ItemPath( + new NameItemPathSegment(UserType.F_ASSIGNMENT), + new IdItemPathSegment(sailorAssignment.getId()), + new NameItemPathSegment(AssignmentType.F_ACTIVATION), + new NameItemPathSegment(ActivationType.F_ADMINISTRATIVE_STATUS)), + ActivationStatusType.ENABLED); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + modelService.executeChanges(MiscSchemaUtil.createCollection(objectDelta), null, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(null, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(null, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + assertDummyAccountAttribute(null, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, + ROLE_JUDGE_TITLE); + assertDummyAccountAttribute(null, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME, + RESOURCE_DUMMY_DRINK, ROLE_JUDGE_DRINK, ROLE_SAILOR_DRINK); + + PrismObject user = getUser(USER_BARBOSSA_OID); + display("User after", user); + assertLinks(user, 1); + + MidPointPrincipal principal = userProfileService.getPrincipal(user); + assertAuthorized(principal, AUTZ_PUNISH_URL); + } + + /** + * Unassign disabled assignments. + */ + @Test + public void test139BarbossaDisableBothAssignmentsUnassign() throws Exception { + final String TEST_NAME = "test139BarbossaDisableBothAssignmentsUnassign"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = createTask(TestValidityRecomputeTask.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + AssignmentType judgeAssignment = getUserAssignment(USER_BARBOSSA_OID, ROLE_JUDGE_OID); + AssignmentType judgeAssignmentLight = new AssignmentType(); + judgeAssignmentLight.setId(judgeAssignment.getId()); + AssignmentType sailorAssignment = getUserAssignment(USER_BARBOSSA_OID, ROLE_SAILOR_OID); + AssignmentType sailorAssignmentLight = new AssignmentType(); + sailorAssignmentLight.setId(sailorAssignment.getId()); + + ObjectDelta objectDelta = + ObjectDelta.createModificationReplaceProperty(UserType.class, + USER_BARBOSSA_OID, + new ItemPath( + new NameItemPathSegment(UserType.F_ASSIGNMENT), + new IdItemPathSegment(judgeAssignment.getId()), + new NameItemPathSegment(AssignmentType.F_ACTIVATION), + new NameItemPathSegment(ActivationType.F_ADMINISTRATIVE_STATUS)), + prismContext, ActivationStatusType.DISABLED); + objectDelta.addModificationReplaceProperty(new ItemPath( + new NameItemPathSegment(UserType.F_ASSIGNMENT), + new IdItemPathSegment(sailorAssignment.getId()), + new NameItemPathSegment(AssignmentType.F_ACTIVATION), + new NameItemPathSegment(ActivationType.F_ADMINISTRATIVE_STATUS)), + ActivationStatusType.DISABLED); + + modelService.executeChanges(MiscSchemaUtil.createCollection(objectDelta), null, task, result); + + assertNoDummyAccount(null, USER_BARBOSSA_USERNAME); + waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + assertNoDummyAccount(null, USER_BARBOSSA_USERNAME); + PrismObject user = getUser(USER_BARBOSSA_OID); + display("User after", user); + assertLinks(user, 0); + MidPointPrincipal principal = userProfileService.getPrincipal(user); + assertNotAuthorized(principal, AUTZ_PUNISH_URL); + + objectDelta = + ObjectDelta.createModificationDeleteContainer(UserType.class, + USER_BARBOSSA_OID, + new ItemPath(new NameItemPathSegment(UserType.F_ASSIGNMENT)), + prismContext, judgeAssignmentLight); + objectDelta.addModificationDeleteContainer( + new ItemPath(new NameItemPathSegment(UserType.F_ASSIGNMENT)), + sailorAssignmentLight); + + display("Unassign delta", objectDelta); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + modelService.executeChanges(MiscSchemaUtil.createCollection(objectDelta), null, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertNoDummyAccount(null, USER_BARBOSSA_USERNAME); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertNoDummyAccount(null, USER_BARBOSSA_USERNAME); + + user = getUser(USER_BARBOSSA_OID); + display("User after", user); + assertLinks(user, 0); + + assertNoAssignments(user); + + principal = userProfileService.getPrincipal(user); + assertNotAuthorized(principal, AUTZ_PUNISH_URL); + } @Test public void test190HermanGoesInvalid() throws Exception { @@ -1086,5 +1513,24 @@ private void assertRoleJudgeInValid(final String TEST_NAME, Task task, Operation assertLinks(user, 0); } + private void modifyAssignmentAdministrativeStatus(String userOid, long assignmentId, ActivationStatusType status, Task task, OperationResult result) throws ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException, ObjectAlreadyExistsException, PolicyViolationException, SecurityViolationException { + if (status == null) { + modifyObjectReplaceProperty(UserType.class, userOid, + new ItemPath( + new NameItemPathSegment(UserType.F_ASSIGNMENT), + new IdItemPathSegment(assignmentId), + new NameItemPathSegment(AssignmentType.F_ACTIVATION), + new NameItemPathSegment(ActivationType.F_ADMINISTRATIVE_STATUS)), + task, result); + } else { + modifyObjectReplaceProperty(UserType.class, userOid, + new ItemPath( + new NameItemPathSegment(UserType.F_ASSIGNMENT), + new IdItemPathSegment(assignmentId), + new NameItemPathSegment(AssignmentType.F_ACTIVATION), + new NameItemPathSegment(ActivationType.F_ADMINISTRATIVE_STATUS)), + task, result, status); + } + } } diff --git a/model/model-intest/src/test/resources/common/role-judge.xml b/model/model-intest/src/test/resources/common/role-judge.xml index 0bbbf6a1885..957a76501d9 100644 --- a/model/model-intest/src/test/resources/common/role-judge.xml +++ b/model/model-intest/src/test/resources/common/role-judge.xml @@ -1,5 +1,5 @@ + + Sailor + + + + account + + ri:drink + + + grog + + + + + + diff --git a/model/model-intest/src/test/resources/sync/role-red-judge.xml b/model/model-intest/src/test/resources/sync/role-red-judge.xml index 4a4ddad4b87..0122fe7c661 100644 --- a/model/model-intest/src/test/resources/sync/role-red-judge.xml +++ b/model/model-intest/src/test/resources/sync/role-red-judge.xml @@ -1,5 +1,5 @@ account + + ri:title + + + Honorable Justice + + + + + ri:drink + + + tea + + + diff --git a/model/model-intest/src/test/resources/sync/role-red-sailor.xml b/model/model-intest/src/test/resources/sync/role-red-sailor.xml new file mode 100644 index 00000000000..18b6a61778d --- /dev/null +++ b/model/model-intest/src/test/resources/sync/role-red-sailor.xml @@ -0,0 +1,36 @@ + + + Red Sailor + + + + + account + + ri:drink + + + grog + + + + + + diff --git a/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java b/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java index aef11fca176..e9bfb76f1b9 100644 --- a/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java +++ b/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java @@ -1177,6 +1177,32 @@ protected void assertNoShadow(String shadowOid) throws SchemaException { } } + protected AssignmentType getUserAssignment(String userOid, String roleOid) throws ObjectNotFoundException, SchemaException, SecurityViolationException, CommunicationException, ConfigurationException { + PrismObject user = getUser(userOid); + List assignments = user.asObjectable().getAssignment(); + for (AssignmentType assignment: assignments) { + ObjectReferenceType targetRef = assignment.getTargetRef(); + if (targetRef != null && roleOid.equals(targetRef.getOid())) { + return assignment; + } + } + return null; + } + + protected void assertNoAssignments(PrismObject user) { + MidPointAsserts.assertNoAssignments(user); + } + + protected void assertNoAssignments(String userOid, OperationResult result) throws ObjectNotFoundException, SchemaException { + PrismObject user = repositoryService.getObject(UserType.class, userOid, null, result); + assertNoAssignments(user); + } + + protected void assertNoAssignments(String userOid) throws ObjectNotFoundException, SchemaException { + OperationResult result = new OperationResult(AbstractModelIntegrationTest.class.getName() + ".assertNoShadow"); + assertNoAssignments(userOid, result); + } + protected void assertAssignedRole(String userOid, String roleOid, Task task, OperationResult result) throws ObjectNotFoundException, SchemaException { PrismObject user = repositoryService.getObject(UserType.class, userOid, null, result); assertAssignedRole(user, roleOid); @@ -2141,7 +2167,7 @@ protected DummyAccount getDummyAccountById(String dummyInstanceName, String id) } } - protected void assertDummyAccount(String username, String fullname, boolean active) { + protected void assertDefaultDummyAccount(String username, String fullname, boolean active) { assertDummyAccount(null, username, fullname, active); } @@ -2203,7 +2229,18 @@ protected void assertDummyAccountAttribute(String dummyInstanceName, String user } } } - + + protected void assertNoDummyAccountAttribute(String dummyInstanceName, String username, String attributeName) { + DummyAccount account = getDummyAccount(dummyInstanceName, username); + assertNotNull("No dummy account for username "+username, account); + Set values = account.getAttributeValues(attributeName, Object.class); + if (values == null || values.isEmpty()) { + return; + } + AssertJUnit.fail("Expected no value in attribute "+attributeName+" of dummy account "+username+ + ". Values found: "+values); + } + protected void assertDummyAccountAttributeGenerated(String dummyInstanceName, String username) { DummyAccount account = getDummyAccount(dummyInstanceName, username); assertNotNull("No dummy account for username "+username, account); From 68dced46d3de0b4390249ad0441ff10af54b2fbb Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Tue, 13 Jan 2015 14:45:32 +0100 Subject: [PATCH 018/215] MID-2113 fix. --- .../component/assignment/ACAttributeDto.java | 11 +- .../assignment/AssignmentEditorDto.java | 100 +++++++++++++++++- .../web/page/admin/roles/PageRole.java | 1 - 3 files changed, 99 insertions(+), 13 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/ACAttributeDto.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/ACAttributeDto.java index fab83e6a61f..f9a4cad850c 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/ACAttributeDto.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/ACAttributeDto.java @@ -18,8 +18,6 @@ import com.evolveum.midpoint.common.StaticExpressionUtil; import com.evolveum.midpoint.prism.*; -import com.evolveum.midpoint.schema.constants.SchemaConstants; -import com.evolveum.midpoint.util.DOMUtil; import com.evolveum.midpoint.util.exception.SchemaException; import com.evolveum.midpoint.xml.ns._public.common.common_3.ExpressionType; import com.evolveum.midpoint.xml.ns._public.common.common_3.MappingType; @@ -29,13 +27,11 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.Validate; -import org.w3c.dom.Element; import javax.xml.bind.JAXBElement; import java.io.Serializable; import java.util.ArrayList; -import java.util.Collection; import java.util.List; /** @@ -74,7 +70,7 @@ public List getValues() { } private List createValues(PrismContext context) throws SchemaException { - List values = new ArrayList(); + List values = new ArrayList<>(); MappingType outbound = construction.getOutbound(); if (outbound == null || outbound.getExpression() == null) { return values; @@ -98,11 +94,6 @@ private List getExpressionValues(List> elements, Pris if (elements == null || elements.isEmpty()) { return null; } - JAXBElement fistElement = elements.iterator().next(); - Element firstDomElement = (Element) fistElement.getValue(); - if (!DOMUtil.isElementName(firstDomElement, SchemaConstants.C_VALUE)) { - return null; - } Item item = StaticExpressionUtil.parseValueElements(elements, definition, "gui", context); return item.getValues(); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorDto.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorDto.java index 10e898d51ce..45ba17669e2 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorDto.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorDto.java @@ -16,10 +16,15 @@ package com.evolveum.midpoint.web.component.assignment; -import com.evolveum.midpoint.prism.PrismContainerValue; -import com.evolveum.midpoint.prism.PrismObject; +import com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition; +import com.evolveum.midpoint.common.refinery.RefinedResourceSchema; +import com.evolveum.midpoint.prism.*; import com.evolveum.midpoint.schema.result.OperationResult; +import com.evolveum.midpoint.task.api.Task; import com.evolveum.midpoint.util.exception.SchemaException; +import com.evolveum.midpoint.util.logging.LoggingUtils; +import com.evolveum.midpoint.util.logging.Trace; +import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.web.component.util.SelectableBean; import com.evolveum.midpoint.web.page.PageBase; import com.evolveum.midpoint.web.page.admin.dto.ObjectViewDto; @@ -33,6 +38,7 @@ import org.apache.commons.lang.Validate; import java.util.ArrayList; +import java.util.Collection; import java.util.List; /** @@ -40,8 +46,12 @@ */ public class AssignmentEditorDto extends SelectableBean implements Comparable { + private static final Trace LOGGER = TraceManager.getTrace(AssignmentEditorDto.class); + private static final String DOT_CLASS = AssignmentEditorDto.class.getName() + "."; private static final String OPERATION_LOAD_ORG_TENANT = DOT_CLASS + "loadTenantOrg"; + private static final String OPERATION_LOAD_RESOURCE = DOT_CLASS + "loadResource"; + private static final String OPERATION_LOAD_ATTRIBUTES = DOT_CLASS + "loadAttributes"; public static final String F_TYPE = "type"; public static final String F_NAME = "name"; @@ -90,6 +100,92 @@ public AssignmentEditorDto(ObjectType targetObject, AssignmentEditorDtoType type this.name = getNameForTargetObject(targetObject); this.altName = getAlternativeName(assignment); + + this.attributes = prepareAssignmentAttributes(assignment, pageBase); + } + + private List prepareAssignmentAttributes(AssignmentType assignment, PageBase pageBase){ + List acAtrList = new ArrayList<>(); + + if(assignment == null || assignment.getConstruction() == null || assignment.getConstruction().getAttribute() == null + || assignment.getConstruction() == null){ + return acAtrList; + } + + OperationResult result = new OperationResult(OPERATION_LOAD_ATTRIBUTES); + ConstructionType construction = assignment.getConstruction(); + + PrismObject resource = construction.getResource() != null + ? construction.getResource().asPrismObject() : null; + if (resource == null) { + resource = getReference(construction.getResourceRef(), result, pageBase); + } + + try { + PrismContext prismContext = pageBase.getPrismContext(); + RefinedResourceSchema refinedSchema = RefinedResourceSchema.getRefinedSchema(resource, + LayerType.PRESENTATION, prismContext); + RefinedObjectClassDefinition objectClassDefinition = refinedSchema.getRefinedDefinition(ShadowKindType.ACCOUNT, construction.getIntent()); + + if(objectClassDefinition == null){ + return attributes; + } + + PrismContainerDefinition definition = objectClassDefinition.toResourceAttributeContainerDefinition(); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Refined definition for {}\n{}", construction, definition.debugDump()); + } + + Collection definitions = definition.getDefinitions(); + for(ResourceAttributeDefinitionType attribute: assignment.getConstruction().getAttribute()){ + + for(ItemDefinition attrDef: definitions){ + if (attrDef instanceof PrismPropertyDefinition) { + PrismPropertyDefinition propertyDef = (PrismPropertyDefinition) attrDef; + + if (propertyDef.isOperational() || propertyDef.isIgnored()) { + continue; + } + + if(attribute.getRef().equals(propertyDef.getName())){ + acAtrList.add(ACAttributeDto.createACAttributeDto(propertyDef, attribute, prismContext)); + break; + } + } + } + } + + result.recordSuccess(); + } catch (Exception ex) { + LoggingUtils.logException(LOGGER, "Exception occurred during assignment attribute loading", ex); + result.recordFatalError("Exception occurred during assignment attribute loading.", ex); + } finally { + result.recomputeStatus(); + } + + return acAtrList; + } + + private PrismObject getReference(ObjectReferenceType ref, OperationResult result, PageBase pageBase) { + OperationResult subResult = result.createSubresult(OPERATION_LOAD_RESOURCE); + subResult.addParam("targetRef", ref.getOid()); + PrismObject target = null; + try { + Task task = pageBase.createSimpleTask(OPERATION_LOAD_RESOURCE); + Class type = ObjectType.class; + if (ref.getType() != null){ + type = pageBase.getPrismContext().getSchemaRegistry().determineCompileTimeClass(ref.getType()); + } + target = pageBase.getModelService().getObject(type, ref.getOid(), null, task, + subResult); + subResult.recordSuccess(); + } catch (Exception ex) { + LoggingUtils.logException(LOGGER, "Couldn't get account construction resource ref", ex); + subResult.recordFatalError("Couldn't get account construction resource ref.", ex); + } + + return target; } private ObjectViewDto loadTenantReference(ObjectType object, AssignmentType assignment, PageBase page){ diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/roles/PageRole.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/roles/PageRole.java index 58e8a8f3ede..0c73ea5a4de 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/roles/PageRole.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/roles/PageRole.java @@ -17,7 +17,6 @@ import com.evolveum.midpoint.model.api.ModelExecuteOptions; import com.evolveum.midpoint.prism.PrismObject; -import com.evolveum.midpoint.model.api.ModelService; import com.evolveum.midpoint.prism.*; import com.evolveum.midpoint.prism.delta.ItemDelta; import com.evolveum.midpoint.prism.delta.ObjectDelta; From 7057f3e33da1d4a05fc45c0e273c4463b6de1e14 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Tue, 13 Jan 2015 17:31:36 +0100 Subject: [PATCH 019/215] Tests and fix for MID-2105 --- .../lens/projector/AssignmentProcessor.java | 41 +- .../sync/TestValidityRecomputeTask.java | 458 +++++++++++++++++- .../test/resources/sync/role-big-judge.xml | 27 ++ .../test/resources/sync/role-red-judge.xml | 11 +- 4 files changed, 515 insertions(+), 22 deletions(-) create mode 100644 model/model-intest/src/test/resources/sync/role-big-judge.xml diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/AssignmentProcessor.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/AssignmentProcessor.java index 26443065ea5..2ee9b063a79 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/AssignmentProcessor.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/AssignmentProcessor.java @@ -545,8 +545,8 @@ private void processAssignmentsProjectionsWithFocus(LensCo LOGGER.trace("Projection {} ignoring: assigned (invalid)", desc); } - // SITUATION: The projection should exist (if valid), there is NO CHANGE in assignments - } else if (constructionMapTriple.getZeroMap().containsKey(rat)) { + // SITUATION: The projection should exist (is valid), there is NO CHANGE in assignments + } else if (constructionMapTriple.getZeroMap().containsKey(rat) && constructionMapTriple.getZeroMap().get(rat).hasValidAssignment()) { LensProjectionContext projectionContext = context.findProjectionContext(rat); if (projectionContext == null) { @@ -558,19 +558,10 @@ private void processAssignmentsProjectionsWithFocus(LensCo // Pretend that the assignment was just added. That should do. projectionContext = LensUtil.getOrCreateProjectionContext(context, rat); } - ConstructionPack constructionPack = constructionMapTriple.getZeroMap().get(rat); - if (constructionPack.hasValidAssignment()) { - LOGGER.trace("Projection {} legal: unchanged (valid)", desc); - projectionContext.setLegal(true); - projectionContext.setLegalOld(true); - projectionContext.setAssigned(true); - } else { - LOGGER.trace("Projection {} illegal: unchanged (invalid)", desc); - projectionContext.setLegal(false); - projectionContext.setLegalOld(false); - projectionContext.setAssigned(false); - } - + LOGGER.trace("Projection {} legal: unchanged (valid)", desc); + projectionContext.setLegal(true); + projectionContext.setLegalOld(true); + projectionContext.setAssigned(true); // SITUATION: The projection is both ASSIGNED and UNASSIGNED } else if (constructionMapTriple.getPlusMap().containsKey(rat) && constructionMapTriple.getMinusMap().containsKey(rat)) { @@ -647,7 +638,7 @@ private void processAssignmentsProjectionsWithFocus(LensCo LOGGER.trace("Projection {} nothing: both assigned and unassigned (valid->invalid) but not there", desc); // We have to delete something that is not there. Nothing to do. } - + } else { throw new IllegalStateException("Whoops!?!"); } @@ -676,6 +667,24 @@ private void processAssignmentsProjectionsWithFocus(LensCo // We have to delete something that is not there. Nothing to do. } + // SITUATION: The projection should exist (invalid), there is NO CHANGE in assignments + } else if (constructionMapTriple.getZeroMap().containsKey(rat) && !constructionMapTriple.getZeroMap().get(rat).hasValidAssignment()) { + + LensProjectionContext projectionContext = context.findProjectionContext(rat); + if (projectionContext == null) { + if (processOnlyExistingProjCxts){ + continue; + } + // The projection should exist before the change but it does not + // This happens during reconciliation if there is an inconsistency. + // Pretend that the assignment was just added. That should do. + projectionContext = LensUtil.getOrCreateProjectionContext(context, rat); + } + LOGGER.trace("Projection {} illegal: unchanged (invalid)", desc); + projectionContext.setLegal(false); + projectionContext.setLegalOld(false); + projectionContext.setAssigned(false); + } else { throw new IllegalStateException("Projection " + desc + " went looney"); } diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestValidityRecomputeTask.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestValidityRecomputeTask.java index 634c7564f48..b0ce699b673 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestValidityRecomputeTask.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestValidityRecomputeTask.java @@ -95,6 +95,9 @@ public class TestValidityRecomputeTask extends AbstractInitializedModelIntegrati protected static final File ROLE_RED_SAILOR_FILE = new File(TEST_DIR, "role-red-sailor.xml"); protected static final String ROLE_RED_SAILOR_OID = "12345111-1111-2222-1111-121212111223"; + protected static final File ROLE_BIG_JUDGE_FILE = new File(TEST_DIR, "role-big-judge.xml"); + protected static final String ROLE_BIG_JUDGE_OID = "12345111-1111-2222-1111-121212111224"; + private static final XMLGregorianCalendar LONG_LONG_TIME_AGO = XmlTypeConverter.createXMLGregorianCalendar(1111, 1, 1, 12, 00, 00); private XMLGregorianCalendar drakeValidFrom; @@ -106,6 +109,7 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti repoAddObjectFromFile(ROLE_RED_JUDGE_FILE, RoleType.class, initResult); repoAddObjectFromFile(ROLE_RED_SAILOR_FILE, RoleType.class, initResult); + repoAddObjectFromFile(ROLE_BIG_JUDGE_FILE, RoleType.class, initResult); DebugUtil.setDetailedDebugDump(true); } @@ -235,7 +239,7 @@ private void testJackAssignRoleJudgeValid(final String TEST_NAME, ActivationType // WHEN TestUtil.displayWhen(TEST_NAME); - assignRole(USER_JACK_OID, ROLE_RED_JUDGE_OID, activationType, task, result); + assignRole(USER_JACK_OID, ROLE_BIG_JUDGE_OID, activationType, task, result); // THEN TestUtil.displayThen(TEST_NAME); @@ -267,7 +271,7 @@ private void testJackAssignRoleJudgeInvalid(final String TEST_NAME, ActivationTy // WHEN TestUtil.displayWhen(TEST_NAME); - assignRole(USER_JACK_OID, ROLE_RED_JUDGE_OID, activationType, task, result); + assignRole(USER_JACK_OID, ROLE_BIG_JUDGE_OID, activationType, task, result); // THEN TestUtil.displayThen(TEST_NAME); @@ -312,7 +316,7 @@ public void test120JackDisableAssignmentJudge() throws Exception { ActivationType activationType = new ActivationType(); activationType.setAdministrativeStatus(ActivationStatusType.ENABLED); - assignRole(USER_JACK_OID, ROLE_RED_JUDGE_OID, activationType, task, result); + assignRole(USER_JACK_OID, ROLE_BIG_JUDGE_OID, activationType, task, result); assertDummyAccount(null, USER_JACK_USERNAME); assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_JACK_USERNAME); AssignmentType judgeAssignment = getJudgeAssignment(USER_JACK_OID); @@ -1012,6 +1016,454 @@ public void test139BarbossaDisableBothAssignmentsUnassign() throws Exception { principal = userProfileService.getPrincipal(user); assertNotAuthorized(principal, AUTZ_PUNISH_URL); } + + /** + * The 14x tests are similar than test13x tests, they work with two roles for the same resource, enabling/disabling them. + * The 14x work with the red dummy resource that does disable instead of account delete. + */ + @Test + public void test140BarbossaAssignRedJudgeEnabled() throws Exception { + final String TEST_NAME = "test140BarbossaAssignRedJudgeEnabled"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = createTask(TestValidityRecomputeTask.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + // preconditions + PrismObject user = getUser(USER_BARBOSSA_OID); + display("User before", user); + assertLinks(user, 0); + assertNoAssignments(user); + assertNoDummyAccount(null, USER_BARBOSSA_USERNAME); // just to be on the safe side + assertNoDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME); + + ActivationType activationType = new ActivationType(); + activationType.setAdministrativeStatus(ActivationStatusType.ENABLED); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + assignRole(USER_BARBOSSA_OID, ROLE_RED_JUDGE_OID, activationType, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + assertDummyAccountAttribute(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, + ROLE_JUDGE_TITLE); + assertDummyAccountAttribute(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME, + ROLE_JUDGE_DRINK); + + user = getUser(USER_BARBOSSA_OID); + display("User after", user); + assertLinks(user, 1); + + MidPointPrincipal principal = userProfileService.getPrincipal(user); + assertAuthorized(principal, AUTZ_PUNISH_URL); + } + + @Test + public void test141BarbossaAssignRedSailorEnabled() throws Exception { + final String TEST_NAME = "test141BarbossaAssignRedSailorEnabled"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = createTask(TestValidityRecomputeTask.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + ActivationType activationType = new ActivationType(); + activationType.setAdministrativeStatus(ActivationStatusType.ENABLED); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + assignRole(USER_BARBOSSA_OID, ROLE_RED_SAILOR_OID, activationType, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + assertDummyAccountAttribute(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, + ROLE_JUDGE_TITLE); + assertDummyAccountAttribute(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME, + ROLE_JUDGE_DRINK, ROLE_SAILOR_DRINK); + + PrismObject user = getUser(USER_BARBOSSA_OID); + display("User after", user); + assertLinks(user, 1); + + MidPointPrincipal principal = userProfileService.getPrincipal(user); + assertAuthorized(principal, AUTZ_PUNISH_URL); + } + + @Test + public void test142BarbossaDisableAssignmentRedJudge() throws Exception { + final String TEST_NAME = "test142BarbossaDisableAssignmentRedJudge"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = createTask(TestValidityRecomputeTask.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + AssignmentType assignment = getUserAssignment(USER_BARBOSSA_OID, ROLE_RED_JUDGE_OID); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + modifyAssignmentAdministrativeStatus(USER_BARBOSSA_OID, assignment.getId(), + ActivationStatusType.DISABLED, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + assertNoDummyAccountAttribute(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME); + assertDummyAccountAttribute(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME, + ROLE_SAILOR_DRINK); + + PrismObject user = getUser(USER_BARBOSSA_OID); + display("User after", user); + assertLinks(user, 1); + + MidPointPrincipal principal = userProfileService.getPrincipal(user); + assertNotAuthorized(principal, AUTZ_PUNISH_URL); + } + + @Test + public void test143BarbossaDisableAssignmentRedSailor() throws Exception { + final String TEST_NAME = "test143BarbossaDisableAssignmentRedSailor"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = createTask(TestValidityRecomputeTask.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + AssignmentType assignment = getUserAssignment(USER_BARBOSSA_OID, ROLE_RED_SAILOR_OID); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + modifyAssignmentAdministrativeStatus(USER_BARBOSSA_OID, assignment.getId(), + ActivationStatusType.DISABLED, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, false); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, false); + // TODO: check attributes + + PrismObject user = getUser(USER_BARBOSSA_OID); + display("User after", user); + assertLinks(user, 1); + + MidPointPrincipal principal = userProfileService.getPrincipal(user); + assertNotAuthorized(principal, AUTZ_PUNISH_URL); + } + + @Test + public void test144BarbossaEnableAssignmentRedJudge() throws Exception { + final String TEST_NAME = "test144BarbossaEnableAssignmentRedJudge"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = createTask(TestValidityRecomputeTask.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + AssignmentType assignment = getUserAssignment(USER_BARBOSSA_OID, ROLE_RED_JUDGE_OID); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + modifyAssignmentAdministrativeStatus(USER_BARBOSSA_OID, assignment.getId(), + ActivationStatusType.ENABLED, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + assertDummyAccountAttribute(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, + ROLE_JUDGE_TITLE); + assertDummyAccountAttribute(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME, + ROLE_JUDGE_DRINK); + + PrismObject user = getUser(USER_BARBOSSA_OID); + display("User after", user); + assertLinks(user, 1); + + MidPointPrincipal principal = userProfileService.getPrincipal(user); + assertAuthorized(principal, AUTZ_PUNISH_URL); + } + + @Test + public void test145BarbossaEnableAssignmentRedSailor() throws Exception { + final String TEST_NAME = "test145BarbossaEnableAssignmentRedSailor"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = createTask(TestValidityRecomputeTask.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + AssignmentType assignment = getUserAssignment(USER_BARBOSSA_OID, ROLE_RED_SAILOR_OID); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + modifyAssignmentAdministrativeStatus(USER_BARBOSSA_OID, assignment.getId(), + ActivationStatusType.ENABLED, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + assertDummyAccountAttribute(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, + ROLE_JUDGE_TITLE); + assertDummyAccountAttribute(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME, + ROLE_JUDGE_DRINK, ROLE_SAILOR_DRINK); + + PrismObject user = getUser(USER_BARBOSSA_OID); + display("User after", user); + assertLinks(user, 1); + + MidPointPrincipal principal = userProfileService.getPrincipal(user); + assertAuthorized(principal, AUTZ_PUNISH_URL); + } + + @Test + public void test146BarbossaDisableBothRedAssignments() throws Exception { + final String TEST_NAME = "test146BarbossaDisableBothRedAssignments"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = createTask(TestValidityRecomputeTask.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + AssignmentType judgeAssignment = getUserAssignment(USER_BARBOSSA_OID, ROLE_RED_JUDGE_OID); + AssignmentType sailorAssignment = getUserAssignment(USER_BARBOSSA_OID, ROLE_RED_SAILOR_OID); + + ObjectDelta objectDelta = + ObjectDelta.createModificationReplaceProperty(UserType.class, + USER_BARBOSSA_OID, + new ItemPath( + new NameItemPathSegment(UserType.F_ASSIGNMENT), + new IdItemPathSegment(judgeAssignment.getId()), + new NameItemPathSegment(AssignmentType.F_ACTIVATION), + new NameItemPathSegment(ActivationType.F_ADMINISTRATIVE_STATUS)), + prismContext, ActivationStatusType.DISABLED); + objectDelta.addModificationReplaceProperty(new ItemPath( + new NameItemPathSegment(UserType.F_ASSIGNMENT), + new IdItemPathSegment(sailorAssignment.getId()), + new NameItemPathSegment(AssignmentType.F_ACTIVATION), + new NameItemPathSegment(ActivationType.F_ADMINISTRATIVE_STATUS)), + ActivationStatusType.DISABLED); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + modelService.executeChanges(MiscSchemaUtil.createCollection(objectDelta), null, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, false); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, false); + // TODO: attributes + + PrismObject user = getUser(USER_BARBOSSA_OID); + display("User after", user); + assertLinks(user, 1); + + MidPointPrincipal principal = userProfileService.getPrincipal(user); + assertNotAuthorized(principal, AUTZ_PUNISH_URL); + } + + @Test + public void test147BarbossaEnableBothRedAssignments() throws Exception { + final String TEST_NAME = "test147BarbossaEnableBothRedAssignments"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = createTask(TestValidityRecomputeTask.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + AssignmentType judgeAssignment = getUserAssignment(USER_BARBOSSA_OID, ROLE_RED_JUDGE_OID); + AssignmentType sailorAssignment = getUserAssignment(USER_BARBOSSA_OID, ROLE_RED_SAILOR_OID); + + ObjectDelta objectDelta = + ObjectDelta.createModificationReplaceProperty(UserType.class, + USER_BARBOSSA_OID, + new ItemPath( + new NameItemPathSegment(UserType.F_ASSIGNMENT), + new IdItemPathSegment(judgeAssignment.getId()), + new NameItemPathSegment(AssignmentType.F_ACTIVATION), + new NameItemPathSegment(ActivationType.F_ADMINISTRATIVE_STATUS)), + prismContext, ActivationStatusType.ENABLED); + objectDelta.addModificationReplaceProperty(new ItemPath( + new NameItemPathSegment(UserType.F_ASSIGNMENT), + new IdItemPathSegment(sailorAssignment.getId()), + new NameItemPathSegment(AssignmentType.F_ACTIVATION), + new NameItemPathSegment(ActivationType.F_ADMINISTRATIVE_STATUS)), + ActivationStatusType.ENABLED); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + modelService.executeChanges(MiscSchemaUtil.createCollection(objectDelta), null, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, true); + assertDummyAccountAttribute(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, + ROLE_JUDGE_TITLE); + assertDummyAccountAttribute(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME, + ROLE_JUDGE_DRINK, ROLE_SAILOR_DRINK); + + PrismObject user = getUser(USER_BARBOSSA_OID); + display("User after", user); + assertLinks(user, 1); + + MidPointPrincipal principal = userProfileService.getPrincipal(user); + assertAuthorized(principal, AUTZ_PUNISH_URL); + } + + /** + * Unassign disabled assignments. + */ + @Test + public void test149BarbossaDisableBothRedAssignmentsUnassign() throws Exception { + final String TEST_NAME = "test149BarbossaDisableBothRedAssignmentsUnassign"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = createTask(TestValidityRecomputeTask.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + AssignmentType judgeAssignment = getUserAssignment(USER_BARBOSSA_OID, ROLE_RED_JUDGE_OID); + AssignmentType judgeAssignmentLight = new AssignmentType(); + judgeAssignmentLight.setId(judgeAssignment.getId()); + AssignmentType sailorAssignment = getUserAssignment(USER_BARBOSSA_OID, ROLE_RED_SAILOR_OID); + AssignmentType sailorAssignmentLight = new AssignmentType(); + sailorAssignmentLight.setId(sailorAssignment.getId()); + + ObjectDelta objectDelta = + ObjectDelta.createModificationReplaceProperty(UserType.class, + USER_BARBOSSA_OID, + new ItemPath( + new NameItemPathSegment(UserType.F_ASSIGNMENT), + new IdItemPathSegment(judgeAssignment.getId()), + new NameItemPathSegment(AssignmentType.F_ACTIVATION), + new NameItemPathSegment(ActivationType.F_ADMINISTRATIVE_STATUS)), + prismContext, ActivationStatusType.DISABLED); + objectDelta.addModificationReplaceProperty(new ItemPath( + new NameItemPathSegment(UserType.F_ASSIGNMENT), + new IdItemPathSegment(sailorAssignment.getId()), + new NameItemPathSegment(AssignmentType.F_ACTIVATION), + new NameItemPathSegment(ActivationType.F_ADMINISTRATIVE_STATUS)), + ActivationStatusType.DISABLED); + + modelService.executeChanges(MiscSchemaUtil.createCollection(objectDelta), null, task, result); + + assertNoDummyAccount(null, USER_BARBOSSA_USERNAME); + waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + assertNoDummyAccount(null, USER_BARBOSSA_USERNAME); + PrismObject user = getUser(USER_BARBOSSA_OID); + display("User after", user); + assertLinks(user, 1); + MidPointPrincipal principal = userProfileService.getPrincipal(user); + assertNotAuthorized(principal, AUTZ_PUNISH_URL); + + objectDelta = + ObjectDelta.createModificationDeleteContainer(UserType.class, + USER_BARBOSSA_OID, + new ItemPath(new NameItemPathSegment(UserType.F_ASSIGNMENT)), + prismContext, judgeAssignmentLight); + objectDelta.addModificationDeleteContainer( + new ItemPath(new NameItemPathSegment(UserType.F_ASSIGNMENT)), + sailorAssignmentLight); + + display("Unassign delta", objectDelta); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + modelService.executeChanges(MiscSchemaUtil.createCollection(objectDelta), null, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, false); + assertNoDummyAccount(null, USER_BARBOSSA_USERNAME); // to be on the safe side + + // WHEN + TestUtil.displayWhen(TEST_NAME); + waitForTaskNextRun(TASK_VALIDITY_SCANNER_OID, true); + + // THEN + TestUtil.displayThen(TEST_NAME); + assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, false); + // TODO: check attributes + assertNoDummyAccount(null, USER_BARBOSSA_USERNAME); // to be on the safe side + + user = getUser(USER_BARBOSSA_OID); + display("User after", user); + assertLinks(user, 1); + + assertNoAssignments(user); + + principal = userProfileService.getPrincipal(user); + assertNotAuthorized(principal, AUTZ_PUNISH_URL); + } + @Test public void test190HermanGoesInvalid() throws Exception { diff --git a/model/model-intest/src/test/resources/sync/role-big-judge.xml b/model/model-intest/src/test/resources/sync/role-big-judge.xml new file mode 100644 index 00000000000..bc1d6963b99 --- /dev/null +++ b/model/model-intest/src/test/resources/sync/role-big-judge.xml @@ -0,0 +1,27 @@ + + + Big Judge + + + + + + + diff --git a/model/model-intest/src/test/resources/sync/role-red-judge.xml b/model/model-intest/src/test/resources/sync/role-red-judge.xml index 0122fe7c661..1434ba60a8f 100644 --- a/model/model-intest/src/test/resources/sync/role-red-judge.xml +++ b/model/model-intest/src/test/resources/sync/role-red-judge.xml @@ -18,9 +18,6 @@ xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"> Red Judge - - - @@ -44,4 +41,12 @@ + + http://midpoint.evolveum.com/xml/ns/test/authorization#punish + + + A judge cannot be a pirate at the same time. At least not openly. + + enforce + From ff25d447b9922c56e0f8d6e0bfd5ff0c43e90cbe Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Tue, 13 Jan 2015 17:55:23 +0100 Subject: [PATCH 020/215] Improved tests. --- .../intest/sync/TestValidityRecomputeTask.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestValidityRecomputeTask.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestValidityRecomputeTask.java index b0ce699b673..049226e4ac1 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestValidityRecomputeTask.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestValidityRecomputeTask.java @@ -1181,7 +1181,10 @@ public void test143BarbossaDisableAssignmentRedSailor() throws Exception { // THEN TestUtil.displayThen(TEST_NAME); assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, false); - // TODO: check attributes + assertNoDummyAccountAttribute(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME); + assertNoDummyAccountAttribute(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME); PrismObject user = getUser(USER_BARBOSSA_OID); display("User after", user); @@ -1310,7 +1313,10 @@ public void test146BarbossaDisableBothRedAssignments() throws Exception { // THEN TestUtil.displayThen(TEST_NAME); assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, false); - // TODO: attributes + assertNoDummyAccountAttribute(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME); + assertNoDummyAccountAttribute(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME); PrismObject user = getUser(USER_BARBOSSA_OID); display("User after", user); @@ -1451,7 +1457,10 @@ public void test149BarbossaDisableBothRedAssignmentsUnassign() throws Exception // THEN TestUtil.displayThen(TEST_NAME); assertDummyAccount(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME, false); - // TODO: check attributes + assertNoDummyAccountAttribute(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME); + assertNoDummyAccountAttribute(RESOURCE_DUMMY_RED_NAME, USER_BARBOSSA_USERNAME, + DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME); assertNoDummyAccount(null, USER_BARBOSSA_USERNAME); // to be on the safe side user = getUser(USER_BARBOSSA_OID); From 169d607f8da4c4178ff9063f2a010dbc878b51ae Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Tue, 13 Jan 2015 17:58:02 +0100 Subject: [PATCH 021/215] Implemented MID-1571 (reevaluation of search filters). --- .../admin/configuration/PageDebugView.html | 4 + .../admin/configuration/PageDebugView.java | 11 ++ .../configuration/PageDebugView.properties | 1 + .../xml/ns/public/common/common-3.xsd | 7 ++ .../model/api/ModelExecuteOptions.java | 44 +++++++- .../midpoint/model/impl/ModelCrudService.java | 2 +- .../impl/controller/ModelController.java | 55 ++++++++-- .../model/impl/importer/ObjectImporter.java | 4 +- .../midpoint/model/impl/util/Utils.java | 102 ++++++++++++++---- 9 files changed, 191 insertions(+), 39 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.html index 013d7ac1509..8bb3875f891 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.html @@ -40,6 +40,10 @@ + diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.java index 73e3b87e127..7e1c36f04d0 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.java @@ -80,6 +80,7 @@ public class PageDebugView extends PageAdminConfiguration { private AceEditor editor; private final IModel encrypt = new Model(true); private final IModel saveAsRaw = new Model<>(true); + private final IModel reevaluateSearchFilters = new Model<>(false); private final IModel validateSchema = new Model(false); public PageDebugView() { @@ -180,6 +181,13 @@ protected void onUpdate(AjaxRequestTarget target) { } }); + mainForm.add(new AjaxCheckBox("reevaluateSearchFilters", reevaluateSearchFilters) { + + @Override + protected void onUpdate(AjaxRequestTarget target) { + } + }); + mainForm.add(new AjaxCheckBox("validateSchema", validateSchema) { @Override @@ -292,6 +300,9 @@ public void savePerformed(AjaxRequestTarget target) { if (saveAsRaw.getObject()) { options.setRaw(true); } + if (reevaluateSearchFilters.getObject()) { + options.setReevaluateSearchFilters(true); + } if(!encrypt.getObject()) { options.setNoCrypt(true); } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.properties b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.properties index f653a3fed29..0dc3a01c9d1 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.properties +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageDebugView.properties @@ -22,5 +22,6 @@ pageDebugView.edit=Edit pageDebugView.encrypt=Protected by encryption pageDebugView.validateSchema=Validate schema pageDebugView.saveAsRaw=Save in raw mode +pageDebugView.reevaluateSearchFilters=Reevaluate search filters pageDebugView.message.cantSaveEmpty=Can't save empty xml. pageDebugView.message.oidNotDefined=Object oid is not defined. diff --git a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd index ee796db8e6b..b89a083aa6a 100644 --- a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd +++ b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd @@ -8675,6 +8675,13 @@ + + + + Causes reevaluation of search filters. + + + diff --git a/model/model-api/src/main/java/com/evolveum/midpoint/model/api/ModelExecuteOptions.java b/model/model-api/src/main/java/com/evolveum/midpoint/model/api/ModelExecuteOptions.java index a01d334b7cb..9c3f4d530a1 100644 --- a/model/model-api/src/main/java/com/evolveum/midpoint/model/api/ModelExecuteOptions.java +++ b/model/model-api/src/main/java/com/evolveum/midpoint/model/api/ModelExecuteOptions.java @@ -64,6 +64,11 @@ public class ModelExecuteOptions implements Serializable, Cloneable { Boolean overwrite; Boolean isImport; + + /** + * Causes reevaluation of search filters (producing partial errors on failure). + */ + Boolean reevaluateSearchFilters; /** * Option to limit propagation only for the source resource @@ -234,7 +239,6 @@ public static ModelExecuteOptions createIsLimitPropagation() { ModelExecuteOptions opts = new ModelExecuteOptions(); opts.setLimitPropagation(true); return opts; - } public void setLimitPropagation(Boolean limitPropagation) { @@ -257,7 +261,31 @@ public static ModelExecuteOptions createExecuteImmediatelyAfterApproval(){ return opts; } - public ModelExecuteOptionsType toModelExecutionOptionsType() { + public Boolean getReevaluateSearchFilters() { + return reevaluateSearchFilters; + } + + public void setReevaluateSearchFilters(Boolean reevaluateSearchFilters) { + this.reevaluateSearchFilters = reevaluateSearchFilters; + } + + public static boolean isReevaluateSearchFilters(ModelExecuteOptions options){ + if (options == null){ + return false; + } + if (options.reevaluateSearchFilters == null){ + return false; + } + return options.reevaluateSearchFilters; + } + + public static ModelExecuteOptions createReevaluateSearchFilters(){ + ModelExecuteOptions opts = new ModelExecuteOptions(); + opts.setReevaluateSearchFilters(true); + return opts; + } + + public ModelExecuteOptionsType toModelExecutionOptionsType() { ModelExecuteOptionsType retval = new ModelExecuteOptionsType(); retval.setForce(force); retval.setRaw(raw); @@ -267,6 +295,7 @@ public ModelExecuteOptionsType toModelExecutionOptionsType() { retval.setOverwrite(overwrite); retval.setIsImport(isImport); retval.setLimitPropagation(limitPropagation); + retval.setReevaluateSearchFilters(reevaluateSearchFilters); return retval; } @@ -283,6 +312,7 @@ public static ModelExecuteOptions fromModelExecutionOptionsType(ModelExecuteOpti retval.setOverwrite(type.isOverwrite()); retval.setIsImport(type.isIsImport()); retval.setLimitPropagation(type.isLimitPropagation()); + retval.setReevaluateSearchFilters(type.isReevaluateSearchFilters()); return retval; } @@ -312,11 +342,14 @@ public static ModelExecuteOptions fromRestOptions(List options){ retVal.setReconcile(true); } if (ModelExecuteOptionsType.F_IS_IMPORT.getLocalPart().equals(option)){ - retVal.setIsImport(true);; + retVal.setIsImport(true); } if (ModelExecuteOptionsType.F_LIMIT_PROPAGATION.getLocalPart().equals(option)){ - retVal.setIsImport(true);; + retVal.setIsImport(true); } + if (ModelExecuteOptionsType.F_REEVALUATE_SEARCH_FILTERS.getLocalPart().equals(option)){ + retVal.setReevaluateSearchFilters(true); + } } return retVal; @@ -328,7 +361,8 @@ public String toString(){ + ",reconcile=" + reconcile + ",executeImmediatelyAfterApproval=" + executeImmediatelyAfterApproval + ",overwrite=" + overwrite - + "limitPropagation="+limitPropagation+"]"; + + "limitPropagation="+limitPropagation + + "reevaluateSearchFilters="+reevaluateSearchFilters+"]"; } public ModelExecuteOptions clone() { diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/ModelCrudService.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/ModelCrudService.java index d15d1c2f352..e4a94a73c7d 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/ModelCrudService.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/ModelCrudService.java @@ -266,7 +266,7 @@ public String addObject(PrismObject object, ModelExecu // Task task = taskManager.createTaskInstance(); // in the future, this // task instance will come from GUI - Utils.resolveReferences(object, repository, false, prismContext, result); + Utils.resolveReferences(object, repository, false, false, prismContext, result); RepositoryCache.enter(); diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java index 4d40a7b9872..a71b7728313 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java @@ -437,11 +437,20 @@ public Collection> executeChanges(fin OperationResult result = parentResult.createSubresult(EXECUTE_CHANGES); result.addParam(OperationResult.PARAM_OPTIONS, options); - - if (ModelExecuteOptions.isIsImport(options)){ - for (ObjectDelta delta : deltas){ - if (delta.isAdd()){ - Utils.resolveReferences(delta.getObjectToAdd(), cacheRepositoryService, false, prismContext, result); + + // Search filters treatment: if reevaluation is requested, we have to deal with three cases: + // 1) for ADD operation: filters contained in object-to-be-added -> these are treated here + // 2) for MODIFY operation: filters contained in existing object (not touched by deltas) -> these are treated after the modify operation + // 3) for MODIFY operation: filters contained in deltas -> these have to be treated here, because if OID is missing from such a delta, the change would be rejected by the repository + if (ModelExecuteOptions.isReevaluateSearchFilters(options)) { + for (ObjectDelta delta : deltas) { + Utils.resolveReferences(delta, cacheRepositoryService, false, true, prismContext, result); + } + } else if (ModelExecuteOptions.isIsImport(options)) { + // if plain import is requested, we simply evaluate filters in ADD operation (and we do not force reevaluation if OID is already set) + for (ObjectDelta delta : deltas) { + if (delta.isAdd()) { + Utils.resolveReferences(delta.getObjectToAdd(), cacheRepositoryService, false, false, prismContext, result); } } } @@ -506,6 +515,9 @@ public void run() { securityEnforcer.authorize(ModelAuthorizationAction.MODIFY.getUrl(), null, existingObject, delta, null, null, result1); cacheRepositoryService.modifyObject(delta.getObjectTypeClass(), delta.getOid(), delta.getModifications(), result1); + if (ModelExecuteOptions.isReevaluateSearchFilters(options)) { // treat filters that already exist in the object (case #2 above) + reevaluateSearchFilters(delta.getObjectTypeClass(), delta.getOid(), result1); + } } else { throw new IllegalArgumentException("Wrong delta type "+delta.getChangeType()+" in "+delta); } @@ -521,10 +533,17 @@ public void run() { auditRecord.setEventStage(AuditEventStage.EXECUTION); auditService.audit(auditRecord, task); - } else { - + } else { + LensContext context = contextFactory.createContext(deltas, options, task, result); - context.setProgressListeners(statusListeners); + + if (ModelExecuteOptions.isReevaluateSearchFilters(options)) { + String m = "ReevaluateSearchFilters option is not fully supported for non-raw operations yet. Filters already present in the object will not be touched."; + LOGGER.warn("{} Context = {}", m, context.debugDump()); + result.createSubresult(CLASS_NAME_WITH_DOT+"reevaluateSearchFilters").recordWarning(m); + } + + context.setProgressListeners(statusListeners); // Note: Request authorization happens inside clockwork clockwork.run(context, task, result); @@ -579,7 +598,25 @@ public void run() { } return retval; } - + + private void reevaluateSearchFilters(Class objectTypeClass, String oid, OperationResult parentResult) throws SchemaException, ObjectNotFoundException, ObjectAlreadyExistsException { + OperationResult result = parentResult.createSubresult(CLASS_NAME_WITH_DOT+"reevaluateSearchFilters"); + try { + PrismObject storedObject = cacheRepositoryService.getObject(objectTypeClass, oid, null, result); + PrismObject updatedObject = storedObject.clone(); + Utils.resolveReferences(updatedObject, cacheRepositoryService, false, true, prismContext, result); + ObjectDelta delta = storedObject.diff(updatedObject); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("reevaluateSearchFilters found delta: {}", delta.debugDump()); + } + cacheRepositoryService.modifyObject(objectTypeClass, oid, delta.getModifications(), result); + result.recordSuccess(); + } catch (SchemaException|ObjectNotFoundException|ObjectAlreadyExistsException|RuntimeException e) { + result.recordFatalError("Couldn't reevaluate search filters: "+e.getMessage(), e); + throw e; + } + } + @Override public void recompute(Class type, String oid, Task task, OperationResult parentResult) throws SchemaException, PolicyViolationException, ExpressionEvaluationException, ObjectNotFoundException, ObjectAlreadyExistsException, CommunicationException, ConfigurationException, SecurityViolationException { diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/importer/ObjectImporter.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/importer/ObjectImporter.java index 5ca62824966..78192af269f 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/importer/ObjectImporter.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/importer/ObjectImporter.java @@ -146,8 +146,8 @@ public EventResult postMarshall(PrismObject prismObjec object = migrator.migrate(object); Utils.resolveReferences(object, repository, - (options == null || options.isReferentialIntegrity() == null) ? false : options.isReferentialIntegrity(), - prismContext, objectResult); + (options == null || options.isReferentialIntegrity() == null) ? false : options.isReferentialIntegrity(), + false, prismContext, objectResult); objectResult.computeStatus(); if (!objectResult.isAcceptable()) { diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/util/Utils.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/util/Utils.java index 448d521b4a8..da546394150 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/util/Utils.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/util/Utils.java @@ -16,6 +16,7 @@ package com.evolveum.midpoint.model.impl.util; +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; @@ -40,10 +41,12 @@ import com.evolveum.midpoint.prism.PrismReference; import com.evolveum.midpoint.prism.PrismReferenceDefinition; import com.evolveum.midpoint.prism.PrismReferenceValue; +import com.evolveum.midpoint.prism.PrismValue; import com.evolveum.midpoint.prism.Visitable; import com.evolveum.midpoint.prism.Visitor; import com.evolveum.midpoint.prism.crypto.EncryptionException; import com.evolveum.midpoint.prism.crypto.Protector; +import com.evolveum.midpoint.prism.delta.ItemDelta; import com.evolveum.midpoint.prism.delta.ObjectDelta; import com.evolveum.midpoint.prism.parser.QueryConvertor; import com.evolveum.midpoint.prism.query.ObjectFilter; @@ -135,9 +138,20 @@ public static void searchIterative(RepositoryService repo myPaging.setOffset(myPaging.getOffset() + blockSize); } } - - public static void resolveReferences(final PrismObject object, final RepositoryService repository, - final boolean enforceReferentialIntegrity, final PrismContext prismContext, final OperationResult result) { + + /** + * Resolves references contained in given PrismObject. + * + * @param object + * @param repository + * @param enforceReferentialIntegrity If true, missing reference causes fatal error when processing (if false, only warning is issued). + * @param forceFilterReevaluation If true, references are reevaluated even if OID is present. (Given that filter is present as well, of course.) + * @param prismContext + * @param result + */ + public static void resolveReferences(final PrismObject object, final RepositoryService repository, + final boolean enforceReferentialIntegrity, final boolean forceFilterReevaluation, + final PrismContext prismContext, final OperationResult result) { Visitor visitor = new Visitor() { @Override @@ -145,17 +159,69 @@ public void visit(Visitable visitable) { if (!(visitable instanceof PrismReferenceValue)) { return; } - resolveRef((PrismReferenceValue)visitable, repository, enforceReferentialIntegrity, prismContext, object.toString(), result); + resolveRef((PrismReferenceValue)visitable, repository, enforceReferentialIntegrity, forceFilterReevaluation, prismContext, object.toString(), result); } }; object.accept(visitor); } - - private static void resolveRef(PrismReferenceValue refVal, RepositoryService repository, - boolean enforceReferentialIntegrity, PrismContext prismContext, String contextDesc, OperationResult parentResult) { - PrismReference reference = (PrismReference) refVal.getParent(); - QName refName = reference.getElementName(); + /** + * Resolves references contained in ADD and REPLACE value sets for item modifications in a given ObjectDelta. + * (specially treats collisions with values to be deleted) + */ + + public static void resolveReferences(final ObjectDelta objectDelta, final RepositoryService repository, + final boolean enforceReferentialIntegrity, final boolean forceFilterReevaluation, + final PrismContext prismContext, final OperationResult result) { + + Visitor visitor = new Visitor() { + @Override + public void visit(Visitable visitable) { + if (!(visitable instanceof PrismReferenceValue)) { + return; + } + resolveRef((PrismReferenceValue)visitable, repository, enforceReferentialIntegrity, forceFilterReevaluation, prismContext, objectDelta.toString(), result); + } + }; + // We could use objectDelta.accept(visitor), but we want to visit only values to add and replace + // (NOT values to delete! - otherwise very strange effects could result) + + // Another problem is that it is possible that one of valuesToAdd became (after resolving) + // a value that is meant do be deleted. The result would be deletion of that value; definitely + // not what we would want or expect. So we have to check whether a value that was not among + // values to be deleted accidentally becomes one of values to be deleted. + if (objectDelta.isAdd()) { + objectDelta.getObjectToAdd().accept(visitor); + } else if (objectDelta.isModify()) { + for (ItemDelta delta : objectDelta.getModifications()) { + applyVisitorToValues(delta.getValuesToAdd(), delta, visitor); + applyVisitorToValues(delta.getValuesToReplace(), delta, visitor); + } + } + } + + // see description in caller + private static void applyVisitorToValues(Collection values, ItemDelta delta, Visitor visitor) { + Collection valuesToDelete = delta.getValuesToDelete(); + if (valuesToDelete == null) { + valuesToDelete = new ArrayList<>(0); // just to simplify the code below + } + if (values != null) { + for (PrismValue pval : values) { + boolean isToBeDeleted = valuesToDelete.contains(pval); + pval.accept(visitor); + if (!isToBeDeleted && valuesToDelete.contains(pval)) { + // value becomes 'to be deleted' -> we remove it from toBeDeleted list + delta.removeValueToDelete(pval); + } + } + } + } + + private static void resolveRef(PrismReferenceValue refVal, RepositoryService repository, + boolean enforceReferentialIntegrity, boolean forceFilterReevaluation, + PrismContext prismContext, String contextDesc, OperationResult parentResult) { + QName refName = refVal.getParent().getElementName(); OperationResult result = parentResult.createSubresult(OPERATION_RESOLVE_REFERENCE); result.addContext(OperationResult.CONTEXT_ITEM, refName); @@ -179,9 +245,9 @@ private static void resolveRef(PrismReferenceValue refVal, RepositoryService rep } } SearchFilterType filter = refVal.getFilter(); - - if (!StringUtils.isBlank(refVal.getOid())) { - // We have OID + + if (!StringUtils.isBlank(refVal.getOid()) && (!forceFilterReevaluation || filter == null)) { + // We have OID (and "force filter reevaluation" is not requested or not possible) if (filter != null) { // We have both filter and OID. We will choose OID, but let's at // least log a warning @@ -229,7 +295,7 @@ private static void resolveRef(PrismReferenceValue refVal, RepositoryService rep } // No OID and we have filter. Let's check the filter a bit - ObjectFilter objFilter = null; + ObjectFilter objFilter; try{ PrismObjectDefinition objDef = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(type); objFilter = QueryConvertor.parseFilter(filter, objDef); @@ -239,16 +305,8 @@ private static void resolveRef(PrismReferenceValue refVal, RepositoryService rep } LOGGER.trace("Resolving using filter {}", objFilter.debugDump()); -// NodeList childNodes = filter.getChildNodes(); -// if (childNodes.getLength() == 0) { - if (objFilter == null){ - result.recordFatalError("OID not specified and filter is empty for property " + refName); - return; - } // // Let's do resolving -// QueryType queryType = new QueryType(); -// queryType.setFilter(filter); - List> objects = null; + List> objects; QName objectType = refVal.getTargetType(); if (objectType == null) { result.recordFatalError("Missing definition of type of reference " + refName); From 4f2435546557845320a75de0108fab9963f52197 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Wed, 14 Jan 2015 11:58:13 +0100 Subject: [PATCH 022/215] Fixed counting of failed login attempts. Preliminary implementation of unlocking (MID-1038). --- .../MidPointApplication_sk_SK.utf8.properties | 2 +- .../web/page/admin/users/PageUsers.java | 53 +++++++++++++++++++ .../web/page/admin/users/PageUsers.properties | 1 + .../MidPointAuthenticationProvider.java | 2 +- 4 files changed, 56 insertions(+), 2 deletions(-) diff --git a/gui/admin-gui-sk-SK/src/main/resources/com/evolveum/midpoint/web/security/MidPointApplication_sk_SK.utf8.properties b/gui/admin-gui-sk-SK/src/main/resources/com/evolveum/midpoint/web/security/MidPointApplication_sk_SK.utf8.properties index 9cfa3ea62b1..d297e522dbb 100644 --- a/gui/admin-gui-sk-SK/src/main/resources/com/evolveum/midpoint/web/security/MidPointApplication_sk_SK.utf8.properties +++ b/gui/admin-gui-sk-SK/src/main/resources/com/evolveum/midpoint/web/security/MidPointApplication_sk_SK.utf8.properties @@ -430,7 +430,7 @@ web.security.provider.access.denied=Access denied. You don't have permission to web.security.provider.denied=Permission denied. web.security.provider.disabled=Používateľ je zablokovaný. web.security.provider.invalid=Nesprávne meno a/alebo heslo. -web.security.provider.locked=Používateľ je zablokovaný, prosím počkajte {0,number,integer} minút. +web.security.provider.locked=Používateľ je zablokovaný, prosím počkajte. web.security.provider.password.bad=Používateľ nemá definované heslo. web.security.provider.password.encoding=Nepodarilo sa autentifikovat používateľa, dôvod\: nepodarilo sa dekódovať heslo. web.security.provider.unavailable=Momentálne nie je možné spracovať Vašu požiadavku. Skúste prosím neskôr. diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUsers.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUsers.java index 46cdd030884..b8a9263906b 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUsers.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUsers.java @@ -22,6 +22,7 @@ import com.evolveum.midpoint.prism.delta.ChangeType; import com.evolveum.midpoint.prism.delta.ObjectDelta; import com.evolveum.midpoint.prism.match.PolyStringNormMatchingRule; +import com.evolveum.midpoint.prism.path.ItemPath; import com.evolveum.midpoint.prism.polystring.PolyStringNormalizer; import com.evolveum.midpoint.prism.query.*; import com.evolveum.midpoint.schema.GetOperationOptions; @@ -97,6 +98,8 @@ public class PageUsers extends PageAdminUsers { private static final String OPERATION_ENABLE_USER = DOT_CLASS + "enableUser"; private static final String OPERATION_RECONCILE_USERS = DOT_CLASS + "reconcileUsers"; private static final String OPERATION_RECONCILE_USER = DOT_CLASS + "reconcileUser"; + private static final String OPERATION_UNLOCK_USERS = DOT_CLASS + "unlockUsers"; + private static final String OPERATION_UNLOCK_USER = DOT_CLASS + "unlockUser"; private static final String DIALOG_CONFIRM_DELETE = "confirmDeletePopup"; private static final String ID_EXECUTE_OPTIONS = "executeOptions"; @@ -273,6 +276,15 @@ public void onSubmit(AjaxRequestTarget target, Form form) { } })); + headerMenuItems.add(new InlineMenuItem(createStringResource("pageUsers.menu.unlock"), true, + new HeaderMenuAction(this) { + + @Override + public void onSubmit(AjaxRequestTarget target, Form form) { + unlockPerformed(target, null); + } + })); + headerMenuItems.add(new InlineMenuItem()); headerMenuItems.add(new InlineMenuItem(createStringResource("pageUsers.menu.delete"), true, @@ -368,6 +380,16 @@ public void onClick(AjaxRequestTarget target) { } })); + dto.getMenuItems().add(new InlineMenuItem(createStringResource("pageUsers.menu.unlock"), + new ColumnMenuAction() { + + @Override + public void onClick(AjaxRequestTarget target) { + UserListItemDto rowDto = getRowModel().getObject(); + unlockPerformed(target, rowDto); + } + })); + dto.getMenuItems().add(new InlineMenuItem()); dto.getMenuItems().add(new InlineMenuItem(createStringResource("pageUsers.menu.delete"), @@ -573,6 +595,37 @@ public static String toShortString(UserListItemDto object) { return builder.toString(); } + private void unlockPerformed(AjaxRequestTarget target, UserListItemDto selectedUser) { + List users = isAnythingSelected(target, selectedUser); + if (users.isEmpty()) { + return; + } + OperationResult result = new OperationResult(OPERATION_UNLOCK_USERS); + for (UserListItemDto user : users) { + String userShortString = toShortString(user); + OperationResult opResult = result.createSubresult(getString(OPERATION_UNLOCK_USER, userShortString)); + try { + Task task = createSimpleTask(OPERATION_UNLOCK_USER + userShortString); + // TODO skip the operation if the user has no password credentials specified (otherwise this would create almost-empty password container) + ObjectDelta delta = ObjectDelta.createModificationReplaceProperty(UserType.class, user.getOid(), + new ItemPath(UserType.F_CREDENTIALS, CredentialsType.F_PASSWORD, PasswordType.F_FAILED_LOGINS), getPrismContext(), 0); + Collection> deltas = WebMiscUtil.createDeltaCollection(delta); + getModelService().executeChanges(deltas, null, task, opResult); + opResult.computeStatusIfUnknown(); + } catch (Exception ex) { + opResult.recomputeStatus(); + opResult.recordFatalError("Couldn't unlock user " + userShortString + ".", ex); + LoggingUtils.logException(LOGGER, "Couldn't unlock user " + userShortString + ".", ex); + } + } + + result.recomputeStatus(); + + showResult(result); + target.add(getFeedbackPanel()); + target.add(getTable()); + } + private void reconcilePerformed(AjaxRequestTarget target, UserListItemDto selectedUser) { List users = isAnythingSelected(target, selectedUser); if (users.isEmpty()) { diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUsers.properties b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUsers.properties index fe5cf31ef53..5c8ee845627 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUsers.properties +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUsers.properties @@ -21,6 +21,7 @@ SearchType.GIVEN_NAME=Given name SearchType.FAMILY_NAME=Family name SearchType.FULL_NAME=Full name pageUsers.message.queryError=Error occurred during translation search query to filter. +pageUsers.menu.unlock=Unlock pageUsers.menu.reconcile=Reconcile pageUsers.menu.delete=Delete pageUsers.menu.disable=Disable diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/security/MidPointAuthenticationProvider.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/security/MidPointAuthenticationProvider.java index f065b20771b..578e8a72950 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/security/MidPointAuthenticationProvider.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/security/MidPointAuthenticationProvider.java @@ -217,7 +217,7 @@ private Authentication authenticateUserPassword(MidPointPrincipal principal, Str return token; } else { // Bad password - passwordType.setFailedLogins(failedLogins++); + passwordType.setFailedLogins(++failedLogins); XMLGregorianCalendar systemTime = MiscUtil.asXMLGregorianCalendar(new Date(System .currentTimeMillis())); LoginEventType event = new LoginEventType(); From f425a66914d63635cc8e5033a97fbd637acbcb03 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Thu, 15 Jan 2015 12:01:57 +0100 Subject: [PATCH 023/215] fix for MID-2112. --- .../web/component/prism/PrismValuePanel.java | 19 ++++++------------- .../midpoint/web/page/PageTemplate.java | 1 - .../main/webapp/less/midpoint/midpoint.less | 3 ++- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/PrismValuePanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/PrismValuePanel.java index 14872fcd688..6a12241bd8f 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/PrismValuePanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/PrismValuePanel.java @@ -434,31 +434,24 @@ private String createAssociationTooltipText(PrismProperty property){ if(property.getParent() != null && property.getParent().getParent() != null){ PrismObject shadowPrism = (PrismObject)property.getParent().getParent(); - ShadowType shadow = shadowPrism.asObjectable(); Collection> attributes = ShadowUtil.getAttributes(shadowPrism); if (attributes == null || attributes.isEmpty()){ return sb.toString(); } - + + //TODO - this is a dirty fix for situation, when attribute value is too long and it is a string without white chars, + //thus it will not break in tooltip. break-all is also not good, since it can brake in the middle of words. What we + //are doing here is replacing every, with ,​, ​ (the same with @) is a zero-width space, so the attribute value + //will break after comma. This dirty fix will be removed when association editor is completed. for (ResourceAttribute attr : attributes){ for (Object realValue : attr.getRealValues()){ sb.append(getAttributeName(attr)); sb.append(":"); - sb.append(realValue); + sb.append(((String)realValue).replace(",", ",​").replace("@", "@​")); sb.append("
"); } } -// if(shadow.getAttributes() != null){ -// ShadowAttributesType attributes = shadow.getAttributes(); -// AnyArrayList attrs = (AnyArrayList)attributes.getAny(); -// -// for(Object o: attrs){ -// ElementNSImpl element = (ElementNSImpl)o; -// sb.append(element.getLocalName() + ": "); -// sb.append(((TextImpl)element.getFirstChild()).getData() + "
"); -// } -// } } return sb.toString(); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/PageTemplate.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/PageTemplate.java index ae25a7e065d..bb5b60045a9 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/PageTemplate.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/PageTemplate.java @@ -406,7 +406,6 @@ public void renderHead(Component component, IHeaderResponse response) { @Override protected void respond(AjaxRequestTarget target) { modal.close(target); - } }); diff --git a/gui/admin-gui/src/main/webapp/less/midpoint/midpoint.less b/gui/admin-gui/src/main/webapp/less/midpoint/midpoint.less index af7e5e4adaf..fdae9424f43 100755 --- a/gui/admin-gui/src/main/webapp/less/midpoint/midpoint.less +++ b/gui/admin-gui/src/main/webapp/less/midpoint/midpoint.less @@ -214,5 +214,6 @@ div.multivalue-form { } .tooltip-inner { - max-width: 350px; + max-width: 400px; + word-break: break-word; } \ No newline at end of file From 365064a6abf5b178160d9298c99e0e70cc71a2e2 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Thu, 15 Jan 2015 15:27:23 +0100 Subject: [PATCH 024/215] fix for MID-1780. --- .../admin/users/component/OrgUnitBrowser.java | 38 ++++++++++++------- .../admin/users/component/TreeTablePanel.java | 23 ++--------- 2 files changed, 29 insertions(+), 32 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/OrgUnitBrowser.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/OrgUnitBrowser.java index 9c83322d3f9..6ea5637f8c2 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/OrgUnitBrowser.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/OrgUnitBrowser.java @@ -247,7 +247,7 @@ private ObjectQuery createQueryFromSelected() { } OperationResult result = new OperationResult(OPERATION_LOAD_PARENT_ORG_REFS); - List oids = new ArrayList(); + List oids = new ArrayList<>(); try { for (OrgTableDto dto : selected) { PrismObject object = WebModelUtils.loadObject(dto.getType(), dto.getOid(), @@ -266,14 +266,17 @@ private ObjectQuery createQueryFromSelected() { result.computeStatusIfUnknown(); } - //todo here we must create query which select object which have oid from oids list [lazyman] - //todo create IN(oids) filter in schema, objectfilter and repo implementation -// InOidFilter - return null; + //We must also exclude selected org. units from move options + for(OrgTableDto dto: selected){ + oids.add(dto.getOid()); + } + + ObjectFilter oidFilter = InOidFilter.createInOid(oids); + return ObjectQuery.createObjectQuery(NotFilter.createNot(oidFilter)); } private List> initColumns() { - List> columns = new ArrayList>(); + List> columns = new ArrayList<>(); columns.add(new LinkColumn(createStringResource("ObjectType.name"), "name") { @@ -301,13 +304,16 @@ protected void rowSelected(AjaxRequestTarget target, IModel row, Op private ObjectQuery createSearchQuery(){ OrgUnitSearchDto dto = searchModel.getObject(); ObjectQuery query = null; + ObjectQuery moveQuery; if(StringUtils.isEmpty(dto.getText())){ - if(createRootQuery() != null){ - return createRootQuery(); - } else { - return null; - } + if(isMovingRoot()){ + moveQuery = createRootQuery(); + } else { + moveQuery = createQueryFromSelected(); + } + + return moveQuery != null ? moveQuery : null; } try{ @@ -317,8 +323,14 @@ private ObjectQuery createSearchQuery(){ SubstringFilter substring = SubstringFilter.createSubstring(OrgType.F_NAME, OrgType.class, getPageBase().getPrismContext(), PolyStringNormMatchingRule.NAME, normalized); - if(createRootQuery() != null){ - AndFilter and = AndFilter.createAnd(createRootQuery().getFilter(), substring); + if(isMovingRoot()){ + moveQuery = createRootQuery(); + } else { + moveQuery = createQueryFromSelected(); + } + + if(moveQuery != null){ + AndFilter and = AndFilter.createAnd(moveQuery.getFilter(), substring); query = ObjectQuery.createObjectQuery(and); } else { query = ObjectQuery.createObjectQuery(substring); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/TreeTablePanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/TreeTablePanel.java index 91ffb5e096f..c3b5081c42b 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/TreeTablePanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/TreeTablePanel.java @@ -55,7 +55,6 @@ import com.evolveum.midpoint.web.page.admin.users.PageUser; import com.evolveum.midpoint.web.page.admin.users.dto.*; import com.evolveum.midpoint.web.security.SecurityUtils; -import com.evolveum.midpoint.web.session.SessionStorage; import com.evolveum.midpoint.web.session.UserProfileStorage; import com.evolveum.midpoint.web.util.ObjectTypeGuiDescriptor; import com.evolveum.midpoint.web.util.OnePageParameterEncoder; @@ -182,20 +181,6 @@ public ObjectQuery createRootQuery(){ oids.add(getRootFromProvider().getOid()); } - //Selection from table, but only if we are not moving root - if(!isMovingRoot()){ - oids.remove(getRootFromProvider().getOid()); - - List objects = WebMiscUtil.getSelectedData(getTable()); - if(!objects.isEmpty()){ - for(OrgTableDto dto: objects){ - oids.add(dto.getOid()); - - oids.addAll(getOrgParentOids(dto.getOid())); - } - } - } - if(oids.isEmpty()){ return null; } @@ -238,7 +223,7 @@ public ObjectQuery getRemoveProviderQuery(){ treeHeader.add(treeMenu); ISortableTreeProvider provider = new OrgTreeProvider(this, getModel()); - List> columns = new ArrayList>(); + List> columns = new ArrayList<>(); columns.add(new TreeColumn(createStringResource("TreeTablePanel.hierarchy"))); WebMarkupContainer treeContainer = new WebMarkupContainer(ID_TREE_CONTAINER) { @@ -367,7 +352,7 @@ protected void searchPerformed(AjaxRequestTarget target) { } private List createTreeMenu() { - List items = new ArrayList(); + List items = new ArrayList<>(); InlineMenuItem item = new InlineMenuItem(createStringResource("TreeTablePanel.collapseAll"), new InlineMenuItemAction() { @@ -457,7 +442,7 @@ private OrgTreeDto getRootFromProvider() { } private List> createTableColumns() { - List> columns = new ArrayList>(); + List> columns = new ArrayList<>(); columns.add(new CheckBoxHeaderColumn()); columns.add(new IconColumn(createStringResource("")) { @@ -504,7 +489,7 @@ public void onClick(AjaxRequestTarget target, IModel rowModel) { } private List initInlineMenu() { - List headerMenuItems = new ArrayList(); + List headerMenuItems = new ArrayList<>(); headerMenuItems.add(new InlineMenuItem(createStringResource("TreeTablePanel.menu.addOrgUnit"), false, new HeaderMenuAction(this) { From 3d7c4e0b82053c8db57fde3a27d2462ed995e3b8 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Thu, 15 Jan 2015 15:36:23 +0100 Subject: [PATCH 025/215] Tests for MID-2025, discovered MID-2147 --- .../icf/dummy/connector/DummyConnector.java | 33 +- ...bstractConfiguredModelIntegrationTest.java | 15 +- ...stractInitializedModelIntegrationTest.java | 24 +- .../midpoint/model/intest/TestCaseIgnore.java | 303 +++++++++++++++++- .../midpoint/model/intest/TestIntent.java | 2 +- .../model/intest/TestStrangeCases.java | 6 +- .../test/resources/caseignore/role-joker.xml | 49 +++ .../caseignore/role-upcase-basic.xml | 30 ++ .../group-shadow-dummy-upcase-joker.xml | 33 ++ .../src/test/resources/logback-test.xml | 1 + .../test/AbstractModelIntegrationTest.java | 20 ++ .../midpoint/test/DummyResourceContoller.java | 8 + 12 files changed, 491 insertions(+), 33 deletions(-) create mode 100644 model/model-intest/src/test/resources/caseignore/role-joker.xml create mode 100644 model/model-intest/src/test/resources/caseignore/role-upcase-basic.xml create mode 100644 model/model-intest/src/test/resources/common/group-shadow-dummy-upcase-joker.xml diff --git a/icf-connectors/dummy-connector/src/main/java/com/evolveum/icf/dummy/connector/DummyConnector.java b/icf-connectors/dummy-connector/src/main/java/com/evolveum/icf/dummy/connector/DummyConnector.java index 70f516a3792..d140e529755 100644 --- a/icf-connectors/dummy-connector/src/main/java/com/evolveum/icf/dummy/connector/DummyConnector.java +++ b/icf-connectors/dummy-connector/src/main/java/com/evolveum/icf/dummy/connector/DummyConnector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2014 Evolveum + * Copyright (c) 2010-2015 Evolveum * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ import java.io.FileNotFoundException; import java.net.ConnectException; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Date; @@ -345,8 +346,16 @@ public Uid update(ObjectClass objectClass, Uid uid, Set replaceAttrib } else { String name = attr.getName(); + List values = attr.getValue(); + if (attr.is(DummyGroup.ATTR_MEMBERS_NAME) && values != null && configuration.getUpCaseName()) { + List newValues = new ArrayList(values.size()); + for (Object val: values) { + newValues.add(StringUtils.upperCase((String)val)); + } + values = newValues; + } try { - group.replaceAttributeValues(name, attr.getValue()); + group.replaceAttributeValues(name, values); } catch (SchemaViolationException e) { throw new IllegalArgumentException(e.getMessage(),e); } @@ -482,8 +491,16 @@ public Uid addAttributeValues(ObjectClass objectClass, Uid uid, Set v } else { String name = attr.getName(); + List values = attr.getValue(); + if (attr.is(DummyGroup.ATTR_MEMBERS_NAME) && values != null && configuration.getUpCaseName()) { + List newValues = new ArrayList(values.size()); + for (Object val: values) { + newValues.add(StringUtils.upperCase((String)val)); + } + values = newValues; + } try { - group.addAttributeValues(name, attr.getValue()); + group.addAttributeValues(name, values); } catch (SchemaViolationException e) { // we cannot throw checked exceptions. But this one looks suitable. // Note: let's do the bad thing and add exception loaded by this classloader as inner exception here @@ -606,8 +623,16 @@ public Uid removeAttributeValues(ObjectClass objectClass, Uid uid, Set values = attr.getValue(); + if (attr.is(DummyGroup.ATTR_MEMBERS_NAME) && values != null && configuration.getUpCaseName()) { + List newValues = new ArrayList(values.size()); + for (Object val: values) { + newValues.add(StringUtils.upperCase((String)val)); + } + values = newValues; + } try { - group.removeAttributeValues(name, attr.getValue()); + group.removeAttributeValues(name, values); } catch (SchemaViolationException e) { // we cannot throw checked exceptions. But this one looks suitable. // Note: let's do the bad thing and add exception loaded by this classloader as inner exception here diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractConfiguredModelIntegrationTest.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractConfiguredModelIntegrationTest.java index 1067568483d..9e05fb23252 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractConfiguredModelIntegrationTest.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractConfiguredModelIntegrationTest.java @@ -251,27 +251,27 @@ public class AbstractConfiguredModelIntegrationTest extends AbstractModelIntegra public static final String ACCOUNT_HERMAN_OPENDJ_FILENAME = COMMON_DIR + "/account-herman-opendj.xml"; public static final String ACCOUNT_HERMAN_OPENDJ_OID = "22220000-2200-0000-0000-333300003333"; - public static final String ACCOUNT_SHADOW_GUYBRUSH_DUMMY_FILENAME = COMMON_DIR + "/account-shadow-guybrush-dummy.xml"; + public static final File ACCOUNT_SHADOW_GUYBRUSH_DUMMY_FILE = new File(COMMON_DIR, "account-shadow-guybrush-dummy.xml"); public static final String ACCOUNT_SHADOW_GUYBRUSH_OID = "22226666-2200-6666-6666-444400004444"; public static final String ACCOUNT_GUYBRUSH_DUMMY_USERNAME = "guybrush"; public static final String ACCOUNT_GUYBRUSH_DUMMY_FULLNAME = "Guybrush Threepwood"; public static final File ACCOUNT_GUYBRUSH_DUMMY_FILE = new File (COMMON_DIR, "account-guybrush-dummy.xml"); - public static final String ACCOUNT_GUYBRUSH_DUMMY_RED_FILENAME = COMMON_DIR + "/account-guybrush-dummy-red.xml"; + public static final File ACCOUNT_GUYBRUSH_DUMMY_RED_FILE = new File(COMMON_DIR, "account-guybrush-dummy-red.xml"); public static final String ACCOUNT_SHADOW_JACK_DUMMY_FILENAME = COMMON_DIR + "/account-shadow-jack-dummy.xml"; public static final String ACCOUNT_DAVIEJONES_DUMMY_USERNAME = "daviejones"; public static final String ACCOUNT_CALYPSO_DUMMY_USERNAME = "calypso"; - public static final String ACCOUNT_SHADOW_ELAINE_DUMMY_FILENAME = COMMON_DIR + "/account-elaine-dummy.xml"; + public static final File ACCOUNT_SHADOW_ELAINE_DUMMY_FILE = new File(COMMON_DIR, "account-elaine-dummy.xml"); public static final String ACCOUNT_SHADOW_ELAINE_DUMMY_OID = "c0c010c0-d34d-b33f-f00d-22220004000e"; public static final String ACCOUNT_ELAINE_DUMMY_USERNAME = USER_ELAINE_USERNAME; - public static final String ACCOUNT_SHADOW_ELAINE_DUMMY_RED_FILENAME = COMMON_DIR + "/account-elaine-dummy-red.xml"; + public static final File ACCOUNT_SHADOW_ELAINE_DUMMY_RED_FILE = new File(COMMON_DIR, "account-elaine-dummy-red.xml"); public static final String ACCOUNT_SHADOW_ELAINE_DUMMY_RED_OID = "c0c010c0-d34d-b33f-f00d-22220104000e"; public static final String ACCOUNT_ELAINE_DUMMY_RED_USERNAME = USER_ELAINE_USERNAME; - public static final String ACCOUNT_SHADOW_ELAINE_DUMMY_BLUE_FILENAME = COMMON_DIR + "/account-elaine-dummy-blue.xml"; + public static final File ACCOUNT_SHADOW_ELAINE_DUMMY_BLUE_FILE = new File(COMMON_DIR, "account-elaine-dummy-blue.xml"); public static final String ACCOUNT_SHADOW_ELAINE_DUMMY_BLUE_OID = "c0c010c0-d34d-b33f-f00d-22220204000e"; public static final String ACCOUNT_ELAINE_DUMMY_BLUE_USERNAME = USER_ELAINE_USERNAME; @@ -284,6 +284,11 @@ public class AbstractConfiguredModelIntegrationTest extends AbstractModelIntegra public static final String GROUP_DUMMY_TESTERS_NAME = "testers"; public static final String GROUP_DUMMY_TESTERS_DESCRIPTION = "To boldly go where no pirate has gone before"; + public static final File GROUP_SHADOW_JOKER_DUMMY_UPCASE_FILE = new File(COMMON_DIR, "group-shadow-dummy-upcase-joker.xml"); + public static final String GROUP_SHADOW_JOKER_DUMMY_UPCASE_OID = "c0c010c0-d34d-b33f-f00d-22220004000e"; + public static final String GROUP_SHADOW_JOKER_DUMMY_UPCASE_NAME = "joker"; + public static final String GROUP_JOKER_DUMMY_UPCASE_NAME = "JOKER"; + protected static final String PASSWORD_POLICY_GLOBAL_FILENAME = COMMON_DIR + "/password-policy-global.xml"; protected static final String PASSWORD_POLICY_GLOBAL_OID = "12344321-0000-0000-0000-000000000003"; diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractInitializedModelIntegrationTest.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractInitializedModelIntegrationTest.java index 95fb5d0b346..d207af83421 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractInitializedModelIntegrationTest.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractInitializedModelIntegrationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Evolveum + * Copyright (c) 2010-2015 Evolveum * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -219,6 +219,7 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti resourceDummyUpcase = importAndGetObjectFromFile(ResourceType.class, RESOURCE_DUMMY_UPCASE_FILE, RESOURCE_DUMMY_UPCASE_OID, initTask, initResult); resourceDummyUpcaseType = resourceDummyUpcase.asObjectable(); dummyResourceCtlUpcase.setResource(resourceDummyUpcase); + dummyResourceCtlUpcase.addGroup(GROUP_JOKER_DUMMY_UPCASE_NAME); resourceDummySchemaless = importAndGetObjectFromFile(ResourceType.class, RESOURCE_DUMMY_SCHEMALESS_FILENAME, RESOURCE_DUMMY_SCHEMALESS_OID, initTask, initResult); resourceDummySchemalessType = resourceDummySchemaless.asObjectable(); @@ -240,11 +241,12 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti repoAddObjectFromFile(USER_TEMPLATE_COMPLEX_FILENAME, ObjectTemplateType.class, initResult); repoAddObjectFromFile(USER_TEMPLATE_COMPLEX_INCLUDE_FILENAME, ObjectTemplateType.class, initResult); - // Accounts - repoAddObjectFromFile(ACCOUNT_SHADOW_GUYBRUSH_DUMMY_FILENAME, ShadowType.class, initResult); - repoAddObjectFromFile(ACCOUNT_SHADOW_ELAINE_DUMMY_FILENAME, ShadowType.class, initResult); - repoAddObjectFromFile(ACCOUNT_SHADOW_ELAINE_DUMMY_RED_FILENAME, ShadowType.class, initResult); - repoAddObjectFromFile(ACCOUNT_SHADOW_ELAINE_DUMMY_BLUE_FILENAME, ShadowType.class, initResult); + // Shadows + repoAddObjectFromFile(ACCOUNT_SHADOW_GUYBRUSH_DUMMY_FILE, ShadowType.class, initResult); + repoAddObjectFromFile(ACCOUNT_SHADOW_ELAINE_DUMMY_FILE, ShadowType.class, initResult); + repoAddObjectFromFile(ACCOUNT_SHADOW_ELAINE_DUMMY_RED_FILE, ShadowType.class, initResult); + repoAddObjectFromFile(ACCOUNT_SHADOW_ELAINE_DUMMY_BLUE_FILE, ShadowType.class, initResult); + repoAddObjectFromFile(GROUP_SHADOW_JOKER_DUMMY_UPCASE_FILE, ShadowType.class, initResult); // Users userTypeJack = repoAddObjectFromFile(USER_JACK_FILE, UserType.class, true, initResult).asObjectable(); @@ -399,15 +401,5 @@ protected void assertMonkeyIslandOrgSanity() throws ObjectNotFoundException, Sch protected ResultHandler getOrgSanityCheckHandler() { return null; } - - protected void assertGroupMember(String dummyGroupName, String accountId) throws ConnectException, FileNotFoundException { - DummyGroup group = dummyResource.getGroupByName(dummyGroupName); - IntegrationTestTools.assertGroupMember(group, accountId); - } - - protected void assertNoGroupMember(String dummyGroupName, String accountId) throws ConnectException, FileNotFoundException { - DummyGroup group = dummyResource.getGroupByName(dummyGroupName); - IntegrationTestTools.assertNoGroupMember(group, accountId); - } } diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestCaseIgnore.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestCaseIgnore.java index 98c91298530..af6a370c6f5 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestCaseIgnore.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestCaseIgnore.java @@ -128,9 +128,17 @@ public class TestCaseIgnore extends AbstractInitializedModelIntegrationTest { public static final File TEST_DIR = new File("src/test/resources/caseignore"); + protected static final String ACCOUNT_JACK_DUMMY_UPCASE_NAME = "JACK"; + protected static final File ROLE_X_FILE = new File(TEST_DIR, "role-x.xml"); protected static final String ROLE_X_OID = "ef7edff4-813c-11e4-b893-3c970e467874"; + protected static final File ROLE_JOKER_FILE = new File(TEST_DIR, "role-joker.xml"); + protected static final String ROLE_JOKER_OID = "0a736ff6-9ca8-11e4-b820-001e8c717e5b"; + + protected static final File ROLE_UPCASE_BASIC_FILE = new File(TEST_DIR, "role-upcase-basic.xml"); + protected static final String ROLE_UPCASE_BASIC_OID = "008a071a-9cc2-11e4-913d-001e8c717e5b"; + @Autowired(required = true) protected MatchingRuleRegistry matchingRuleRegistry; @@ -146,6 +154,8 @@ public void initSystem(Task initTask, OperationResult initResult) preTestCleanup(AssignmentPolicyEnforcementType.FULL); repoAddObjectFromFile(ROLE_X_FILE, RoleType.class, initResult); + repoAddObjectFromFile(ROLE_JOKER_FILE, RoleType.class, initResult); + repoAddObjectFromFile(ROLE_UPCASE_BASIC_FILE, RoleType.class, initResult); InternalMonitor.reset(); InternalMonitor.setTraceShadowFetchOperation(true); @@ -333,8 +343,8 @@ public void test150JackAssignRoleX() throws Exception { assertShadowFetchOperationCountIncrement(1); assertAccountShadowModel(accountModel, accountOid, "x-jack", resourceDummyUpcaseType, uidMatchingRule); - assertDummyAccount(RESOURCE_DUMMY_UPCASE_NAME, "X-JACK", ACCOUNT_JACK_DUMMY_FULLNAME, true); - assertDummyAccountAttribute(RESOURCE_DUMMY_UPCASE_NAME, "X-JACK", "title", "XXX"); + assertDummyAccount(RESOURCE_DUMMY_UPCASE_NAME, "X-"+ACCOUNT_JACK_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDummyAccountAttribute(RESOURCE_DUMMY_UPCASE_NAME, "X-"+ACCOUNT_JACK_DUMMY_UPCASE_NAME, "title", "XXX"); } @Test @@ -373,10 +383,295 @@ public void test152GetJack() throws Exception { assertShadowFetchOperationCountIncrement(1); assertAccountShadowModel(accountModel, accountOid, "x-jack", resourceDummyUpcaseType, uidMatchingRule); - assertDummyAccount(RESOURCE_DUMMY_UPCASE_NAME, "X-JACK", ACCOUNT_JACK_DUMMY_FULLNAME, true); - assertDummyAccountAttribute(RESOURCE_DUMMY_UPCASE_NAME, "X-JACK", "title", "XXX"); + assertDummyAccount(RESOURCE_DUMMY_UPCASE_NAME, "X-"+ACCOUNT_JACK_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDummyAccountAttribute(RESOURCE_DUMMY_UPCASE_NAME, "X-"+ACCOUNT_JACK_DUMMY_UPCASE_NAME, "title", "XXX"); + } + + @Test + public void test159JackUnAssignRoleX() throws Exception { + final String TEST_NAME = "test159JackUnAssignRoleX"; + TestUtil.displayTestTile(this, TEST_NAME); + + Task task = taskManager.createTaskInstance(TestRbac.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + PrismObject userBefore = getUser(USER_JACK_OID); + display("User jack before", userBefore); + + // WHEN + unassignRole(USER_JACK_OID, ROLE_X_OID, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + result.computeStatus(); + TestUtil.assertSuccess(result); + + // Make sure this is repository so we do not destroy the "evidence" yet. + PrismObject userJack = repositoryService.getObject(UserType.class, USER_JACK_OID, null, result); + + display("User after change execution", userJack); + assertUserJack(userJack); + assertNoAssignments(userJack); + assertLinks(userJack, 0); + + assertNoDummyAccount(RESOURCE_DUMMY_UPCASE_NAME, "X-"+ACCOUNT_JACK_DUMMY_UPCASE_NAME); + } + + @Test + public void test160JackAssignRoleBasic() throws Exception { + final String TEST_NAME = "test160JackAssignRoleBasic"; + TestUtil.displayTestTile(this, TEST_NAME); + + Task task = taskManager.createTaskInstance(TestRbac.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + PrismObject userBefore = getUser(USER_JACK_OID); + display("User jack before", userBefore); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + assignRole(USER_JACK_OID, ROLE_UPCASE_BASIC_OID, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + result.computeStatus(); + TestUtil.assertSuccess(result); + + // Make sure this is repository so we do not destroy the "evidence" yet. + PrismObject userJack = repositoryService.getObject(UserType.class, USER_JACK_OID, null, result); + + display("User after change execution", userJack); + assertUserJack(userJack); + assertAssignedRole(userJack, ROLE_UPCASE_BASIC_OID); + accountOid = getSingleLinkOid(userJack); + + // Check shadow + rememberShadowFetchOperationCount(); + PrismObject accountShadow = repositoryService.getObject(ShadowType.class, accountOid, null, result); + display("Repo shadow", accountShadow); + assertShadowFetchOperationCountIncrement(0); + assertAccountShadowRepo(accountShadow, accountOid, "jack", resourceDummyUpcaseType); + + // Check account + rememberShadowFetchOperationCount(); + PrismObject accountModel = modelService.getObject(ShadowType.class, accountOid, null, task, result); + display("Model shadow", accountModel); + assertShadowFetchOperationCountIncrement(1); + assertAccountShadowModel(accountModel, accountOid, "jack", resourceDummyUpcaseType, uidMatchingRule); + + assertDummyAccount(RESOURCE_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertNoDummyAccountAttribute(RESOURCE_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_UPCASE_NAME, "title"); + assertNoDummyGroupMember(RESOURCE_DUMMY_UPCASE_NAME, GROUP_JOKER_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_UPCASE_NAME); + } + + @Test + public void test161JackAssignRoleJoker() throws Exception { + final String TEST_NAME = "test161JackAssignRoleJoker"; + TestUtil.displayTestTile(this, TEST_NAME); + + Task task = taskManager.createTaskInstance(TestRbac.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + PrismObject userBefore = getUser(USER_JACK_OID); + display("User jack before", userBefore); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + assignRole(USER_JACK_OID, ROLE_JOKER_OID, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + result.computeStatus(); + TestUtil.assertSuccess(result); + + // Make sure this is repository so we do not destroy the "evidence" yet. + PrismObject userJack = repositoryService.getObject(UserType.class, USER_JACK_OID, null, result); + + display("User after change execution", userJack); + assertUserJack(userJack); + assertAssignedRole(userJack, ROLE_JOKER_OID); + assertAssignedRole(userJack, ROLE_UPCASE_BASIC_OID); + accountOid = getSingleLinkOid(userJack); + + // Check shadow + rememberShadowFetchOperationCount(); + PrismObject accountShadow = repositoryService.getObject(ShadowType.class, accountOid, null, result); + display("Repo shadow", accountShadow); + assertShadowFetchOperationCountIncrement(0); + assertAccountShadowRepo(accountShadow, accountOid, "jack", resourceDummyUpcaseType); + + // Check account + rememberShadowFetchOperationCount(); + PrismObject accountModel = modelService.getObject(ShadowType.class, accountOid, null, task, result); + display("Model shadow", accountModel); + assertShadowFetchOperationCountIncrement(1); + assertAccountShadowModel(accountModel, accountOid, "jack", resourceDummyUpcaseType, uidMatchingRule); + + assertDummyAccount(RESOURCE_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDummyAccountAttribute(RESOURCE_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_UPCASE_NAME, "title", "JoKeR"); + assertDummyGroupMember(RESOURCE_DUMMY_UPCASE_NAME, GROUP_JOKER_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_UPCASE_NAME); + } + + @Test + public void test165JackUnAssignRoleJoker() throws Exception { + final String TEST_NAME = "test165JackUnAssignRoleJoker"; + TestUtil.displayTestTile(this, TEST_NAME); + + Task task = taskManager.createTaskInstance(TestRbac.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + PrismObject userBefore = getUser(USER_JACK_OID); + display("User jack before", userBefore); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + unassignRole(USER_JACK_OID, ROLE_JOKER_OID, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + result.computeStatus(); + TestUtil.assertSuccess(result); + + // Make sure this is repository so we do not destroy the "evidence" yet. + PrismObject userJack = repositoryService.getObject(UserType.class, USER_JACK_OID, null, result); + + display("User after change execution", userJack); + assertUserJack(userJack); + assertAssignedRole(userJack, ROLE_UPCASE_BASIC_OID); + accountOid = getSingleLinkOid(userJack); + + // Check shadow + rememberShadowFetchOperationCount(); + PrismObject accountShadow = repositoryService.getObject(ShadowType.class, accountOid, null, result); + display("Repo shadow", accountShadow); + assertShadowFetchOperationCountIncrement(0); + assertAccountShadowRepo(accountShadow, accountOid, "jack", resourceDummyUpcaseType); + + // Check account + rememberShadowFetchOperationCount(); + PrismObject accountModel = modelService.getObject(ShadowType.class, accountOid, null, task, result); + display("Model shadow", accountModel); + assertShadowFetchOperationCountIncrement(1); + assertAccountShadowModel(accountModel, accountOid, "jack", resourceDummyUpcaseType, uidMatchingRule); + + assertDummyAccount(RESOURCE_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertNoDummyAccountAttribute(RESOURCE_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_UPCASE_NAME, "title"); + assertNoDummyGroupMember(RESOURCE_DUMMY_UPCASE_NAME, GROUP_JOKER_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_UPCASE_NAME); + } + + @Test + public void test169JackUnAssignRoleBasic() throws Exception { + final String TEST_NAME = "test169JackUnAssignRoleBasic"; + TestUtil.displayTestTile(this, TEST_NAME); + + Task task = taskManager.createTaskInstance(TestRbac.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + PrismObject userBefore = getUser(USER_JACK_OID); + display("User jack before", userBefore); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + unassignRole(USER_JACK_OID, ROLE_UPCASE_BASIC_OID, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + result.computeStatus(); + TestUtil.assertSuccess(result); + + // Make sure this is repository so we do not destroy the "evidence" yet. + PrismObject userJack = repositoryService.getObject(UserType.class, USER_JACK_OID, null, result); + + display("User after change execution", userJack); + assertUserJack(userJack); + assertUserJack(userJack); + assertNoAssignments(userJack); + assertLinks(userJack, 0); + + assertNoDummyAccount(RESOURCE_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_UPCASE_NAME); + assertNoDummyGroupMember(RESOURCE_DUMMY_UPCASE_NAME, GROUP_JOKER_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_UPCASE_NAME); } + + @Test + public void test170JackAssignRoleJoker() throws Exception { + final String TEST_NAME = "test170JackAssignRoleJoker"; + TestUtil.displayTestTile(this, TEST_NAME); + Task task = taskManager.createTaskInstance(TestRbac.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + PrismObject userBefore = getUser(USER_JACK_OID); + display("User jack before", userBefore); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + assignRole(USER_JACK_OID, ROLE_JOKER_OID, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + result.computeStatus(); + TestUtil.assertSuccess(result); + + // Make sure this is repository so we do not destroy the "evidence" yet. + PrismObject userJack = repositoryService.getObject(UserType.class, USER_JACK_OID, null, result); + + display("User after change execution", userJack); + assertUserJack(userJack); + assertAssignedRole(userJack, ROLE_JOKER_OID); + accountOid = getSingleLinkOid(userJack); + + // Check shadow + rememberShadowFetchOperationCount(); + PrismObject accountShadow = repositoryService.getObject(ShadowType.class, accountOid, null, result); + display("Repo shadow", accountShadow); + assertShadowFetchOperationCountIncrement(0); + assertAccountShadowRepo(accountShadow, accountOid, "jack", resourceDummyUpcaseType); + + // Check account + rememberShadowFetchOperationCount(); + PrismObject accountModel = modelService.getObject(ShadowType.class, accountOid, null, task, result); + display("Model shadow", accountModel); + assertShadowFetchOperationCountIncrement(1); + assertAccountShadowModel(accountModel, accountOid, "jack", resourceDummyUpcaseType, uidMatchingRule); + + assertDummyAccount(RESOURCE_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_FULLNAME, true); + assertDummyAccountAttribute(RESOURCE_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_UPCASE_NAME, "title", "JoKeR"); + assertDummyGroupMember(RESOURCE_DUMMY_UPCASE_NAME, GROUP_JOKER_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_UPCASE_NAME); + } + + @Test + public void test179JackUnAssignRoleJoker() throws Exception { + final String TEST_NAME = "test179JackUnAssignRoleJoker"; + TestUtil.displayTestTile(this, TEST_NAME); + + Task task = taskManager.createTaskInstance(TestRbac.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + PrismObject userBefore = getUser(USER_JACK_OID); + display("User jack before", userBefore); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + unassignRole(USER_JACK_OID, ROLE_JOKER_OID, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + result.computeStatus(); + TestUtil.assertSuccess(result); + + // Make sure this is repository so we do not destroy the "evidence" yet. + PrismObject userJack = repositoryService.getObject(UserType.class, USER_JACK_OID, null, result); + + display("User after change execution", userJack); + assertUserJack(userJack); + assertUserJack(userJack); + assertNoAssignments(userJack); + assertLinks(userJack, 0); + + assertNoDummyAccount(RESOURCE_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_UPCASE_NAME); + // MID-2147 +// assertNoDummyGroupMember(RESOURCE_DUMMY_UPCASE_NAME, GROUP_JOKER_DUMMY_UPCASE_NAME, ACCOUNT_JACK_DUMMY_UPCASE_NAME); + } private void preTestCleanup(AssignmentPolicyEnforcementType enforcementPolicy) throws ObjectNotFoundException, SchemaException, ObjectAlreadyExistsException { assumeAssignmentPolicy(enforcementPolicy); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIntent.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIntent.java index b1460d2c3f6..d31f4ce16b0 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIntent.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIntent.java @@ -202,7 +202,7 @@ public void test132ModifyUserJackAssignAccountTest() throws Exception { // Check account in dummy resource: intent=test assertDefaultDummyAccount("T"+ACCOUNT_JACK_DUMMY_USERNAME, "Jack Sparrow (test)", true); - assertGroupMember(GROUP_DUMMY_TESTERS_NAME, "T"+ACCOUNT_JACK_DUMMY_USERNAME); + assertDefaultDummyGroupMember(GROUP_DUMMY_TESTERS_NAME, "T"+ACCOUNT_JACK_DUMMY_USERNAME); // Check audit display("Audit", dummyAuditService); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestStrangeCases.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestStrangeCases.java index fcf370ebaae..f4ac43c263d 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestStrangeCases.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestStrangeCases.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2014 Evolveum + * Copyright (c) 2010-2015 Evolveum * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -125,7 +125,7 @@ public void initSystem(Task initTask, OperationResult initResult) dummyResourceCtlRed.addAccount(ACCOUNT_GUYBRUSH_DUMMY_USERNAME, "Guybrush Threepwood", "Monkey Island"); - PrismObject accountGuybrushDummyRed = repoAddObjectFromFile(ACCOUNT_GUYBRUSH_DUMMY_RED_FILENAME, ShadowType.class, initResult); + PrismObject accountGuybrushDummyRed = repoAddObjectFromFile(ACCOUNT_GUYBRUSH_DUMMY_RED_FILE, ShadowType.class, initResult); accountGuybrushDummyRedOid = accountGuybrushDummyRed.getOid(); treasureIsland = IOUtils.toString(new FileInputStream(TREASURE_ISLAND_FILE)).replace("\r\n", "\n"); // for Windows compatibility @@ -147,7 +147,7 @@ public void test100ModifyUserGuybrushAddAccountDummyRedNoAttributesConflict() th OperationResult result = task.getResult(); assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE); - PrismObject account = PrismTestUtil.parseObject(new File(ACCOUNT_GUYBRUSH_DUMMY_RED_FILENAME)); + PrismObject account = PrismTestUtil.parseObject(ACCOUNT_GUYBRUSH_DUMMY_RED_FILE); // Remove the attributes. This will allow outbound mapping to take place instead. account.removeContainer(ShadowType.F_ATTRIBUTES); diff --git a/model/model-intest/src/test/resources/caseignore/role-joker.xml b/model/model-intest/src/test/resources/caseignore/role-joker.xml new file mode 100644 index 00000000000..b66e1d7982b --- /dev/null +++ b/model/model-intest/src/test/resources/caseignore/role-joker.xml @@ -0,0 +1,49 @@ + + + Joker + + + + account + + ri:title + + + JoKeR + + + + + ri:group + + + + + + + + + + + + + diff --git a/model/model-intest/src/test/resources/caseignore/role-upcase-basic.xml b/model/model-intest/src/test/resources/caseignore/role-upcase-basic.xml new file mode 100644 index 00000000000..c5fdaaaa239 --- /dev/null +++ b/model/model-intest/src/test/resources/caseignore/role-upcase-basic.xml @@ -0,0 +1,30 @@ + + + Upcase Basic + + + + account + + + + diff --git a/model/model-intest/src/test/resources/common/group-shadow-dummy-upcase-joker.xml b/model/model-intest/src/test/resources/common/group-shadow-dummy-upcase-joker.xml new file mode 100644 index 00000000000..4fbe149ae0f --- /dev/null +++ b/model/model-intest/src/test/resources/common/group-shadow-dummy-upcase-joker.xml @@ -0,0 +1,33 @@ + + + + + JOKER + + ri:GroupObjectClass + entitlement + group + + joker + joker + + diff --git a/model/model-intest/src/test/resources/logback-test.xml b/model/model-intest/src/test/resources/logback-test.xml index 8bfa074b20a..00a5e0df010 100644 --- a/model/model-intest/src/test/resources/logback-test.xml +++ b/model/model-intest/src/test/resources/logback-test.xml @@ -71,6 +71,7 @@ + diff --git a/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java b/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java index e9bfb76f1b9..870dd85c278 100644 --- a/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java +++ b/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java @@ -2305,6 +2305,26 @@ protected void assertDummyGroupAttribute(String dummyInstanceName, String groupn } } + protected void assertDummyGroupMember(String dummyInstanceName, String dummyGroupName, String accountId) throws ConnectException, FileNotFoundException { + DummyResource dummyResource = DummyResource.getInstance(dummyInstanceName); + DummyGroup group = dummyResource.getGroupByName(dummyGroupName); + IntegrationTestTools.assertGroupMember(group, accountId); + } + + protected void assertDefaultDummyGroupMember(String dummyGroupName, String accountId) throws ConnectException, FileNotFoundException { + assertDummyGroupMember(null, dummyGroupName, accountId); + } + + protected void assertNoDummyGroupMember(String dummyInstanceName, String dummyGroupName, String accountId) throws ConnectException, FileNotFoundException { + DummyResource dummyResource = DummyResource.getInstance(dummyInstanceName); + DummyGroup group = dummyResource.getGroupByName(dummyGroupName); + IntegrationTestTools.assertNoGroupMember(group, accountId); + } + + protected void assertNoDefaultDummyGroupMember(String dummyGroupName, String accountId) throws ConnectException, FileNotFoundException { + assertNoDummyGroupMember(null, dummyGroupName, accountId); + } + protected void assertDummyAccountNoAttribute(String dummyInstanceName, String username, String attributeName) { DummyAccount account = getDummyAccount(dummyInstanceName, username); assertNotNull("No dummy account for username "+username, account); diff --git a/repo/repo-test-util/src/main/java/com/evolveum/midpoint/test/DummyResourceContoller.java b/repo/repo-test-util/src/main/java/com/evolveum/midpoint/test/DummyResourceContoller.java index f17fb3504fc..3f825738387 100644 --- a/repo/repo-test-util/src/main/java/com/evolveum/midpoint/test/DummyResourceContoller.java +++ b/repo/repo-test-util/src/main/java/com/evolveum/midpoint/test/DummyResourceContoller.java @@ -31,6 +31,7 @@ import com.evolveum.icf.dummy.resource.DummyAccount; import com.evolveum.icf.dummy.resource.DummyAttributeDefinition; +import com.evolveum.icf.dummy.resource.DummyGroup; import com.evolveum.icf.dummy.resource.DummyObjectClass; import com.evolveum.icf.dummy.resource.DummyResource; import com.evolveum.icf.dummy.resource.ObjectAlreadyExistsException; @@ -315,5 +316,12 @@ public void addAccount(String userId, String fullName, String location) throws O account.addAttributeValues(DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, location); dummyResource.addAccount(account); } + + public void addGroup(String name) throws ObjectAlreadyExistsException, SchemaViolationException, ConnectException, FileNotFoundException { + assertExtendedSchema(); + DummyGroup group = new DummyGroup(name); + group.setEnabled(true); + dummyResource.addGroup(group); + } } From f9b5a0c85bbe703d8f988e59c607031276c0d038 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Thu, 15 Jan 2015 16:05:15 +0100 Subject: [PATCH 026/215] Test for MID-2149 (failing therefore disabled) --- .../sync/AbstractObjTemplateSyncTest.java | 226 ++++++++++++++++++ .../sync/TestObjTemplateLiveSyncTask.java | 70 ++++++ .../sync/resource-dummy-byzantine.xml | 119 +++++++++ .../sync/system-configuration-byzantine.xml | 143 +++++++++++ .../sync/task-dummy-byzantine-livesync.xml | 38 +++ .../sync/task-dummy-byzantine-recon.xml | 45 ++++ .../sync/user-template-byzantine.xml | 80 +++++++ .../test/AbstractModelIntegrationTest.java | 8 +- .../src/test/resources/ldap-complex/org.xml | 26 ++ 9 files changed, 751 insertions(+), 4 deletions(-) create mode 100644 model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/AbstractObjTemplateSyncTest.java create mode 100644 model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestObjTemplateLiveSyncTask.java create mode 100644 model/model-intest/src/test/resources/sync/resource-dummy-byzantine.xml create mode 100644 model/model-intest/src/test/resources/sync/system-configuration-byzantine.xml create mode 100644 model/model-intest/src/test/resources/sync/task-dummy-byzantine-livesync.xml create mode 100644 model/model-intest/src/test/resources/sync/task-dummy-byzantine-recon.xml create mode 100644 model/model-intest/src/test/resources/sync/user-template-byzantine.xml create mode 100644 testing/longtest/src/test/resources/ldap-complex/org.xml diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/AbstractObjTemplateSyncTest.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/AbstractObjTemplateSyncTest.java new file mode 100644 index 00000000000..ce33e1cc6cc --- /dev/null +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/AbstractObjTemplateSyncTest.java @@ -0,0 +1,226 @@ +/* + * Copyright (c) 2010-2015 Evolveum + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.evolveum.midpoint.model.intest.sync; + +import com.evolveum.icf.dummy.resource.DummyAccount; +import com.evolveum.icf.dummy.resource.DummyResource; +import com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest; +import com.evolveum.midpoint.prism.PrismObject; +import com.evolveum.midpoint.prism.xml.XmlTypeConverter; +import com.evolveum.midpoint.schema.constants.MidPointConstants; +import com.evolveum.midpoint.schema.result.OperationResult; +import com.evolveum.midpoint.task.api.Task; +import com.evolveum.midpoint.test.DummyResourceContoller; +import com.evolveum.midpoint.test.util.TestUtil; +import com.evolveum.midpoint.util.MiscUtil; +import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentPolicyEnforcementType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectTemplateType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.SynchronizationSituationType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.annotation.DirtiesContext.ClassMode; +import org.springframework.test.context.ContextConfiguration; +import org.testng.annotations.Test; + +import javax.xml.datatype.XMLGregorianCalendar; +import java.io.File; +import java.io.FileNotFoundException; +import java.util.Date; + +import static com.evolveum.midpoint.test.IntegrationTestTools.display; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertNotNull; + +/** + * @author semancik + * + */ +@ContextConfiguration(locations = {"classpath:ctx-model-intest-test-main.xml"}) +@DirtiesContext(classMode = ClassMode.AFTER_CLASS) +public abstract class AbstractObjTemplateSyncTest extends AbstractInitializedModelIntegrationTest { + + public static final File TEST_DIR = new File("src/test/resources/sync"); + + protected static final File RESOURCE_DUMMY_BYZANTINE_FILE = new File(TEST_DIR, "resource-dummy-byzantine.xml"); + protected static final String RESOURCE_DUMMY_BYZANTINE_OID = "10000000-0000-0000-0000-00000000f904"; + protected static final String RESOURCE_DUMMY_BYZANTINE_NAME = "byzantine"; + + protected static final File TASK_LIVE_SYNC_DUMMY_BYZANTINE_FILE = new File(TEST_DIR, "task-dummy-byzantine-livesync.xml"); + protected static final String TASK_LIVE_SYNC_DUMMY_BYZANTINE_OID = "10000000-0000-0000-5555-55550000f904"; + + protected static final File TASK_RECON_DUMMY_BYZANTINE_FILE = new File(TEST_DIR, "task-dummy-byzantine-recon.xml"); + protected static final String TASK_RECON_DUMMY_BYZANTINE_OID = "10000000-0000-0000-5656-56560000f904"; + + protected static DummyResource dummyResourceByzantine; + protected static DummyResourceContoller dummyResourceCtlByzantine; + protected ResourceType resourceDummyByzantineType; + protected PrismObject resourceDummyByzantine; + + protected static final String ACCOUNT_MANCOMB_DUMMY_USERNAME = "mancomb"; + private static final Date ACCOUNT_MANCOMB_VALID_FROM_DATE = MiscUtil.asDate(2011, 2, 3, 4, 5, 6); + private static final Date ACCOUNT_MANCOMB_VALID_TO_DATE = MiscUtil.asDate(2066, 5, 4, 3, 2, 1); + + protected long timeBeforeSync; + + public static final File SYSTEM_CONFIGURATION_FILE = new File(TEST_DIR, "system-configuration-byzantine.xml"); + + protected static final String ORG_F0001_OID = "00000000-8888-6666-0000-100000000001"; + + public static final File USER_TEMPLATE_FILE = new File(TEST_DIR, "user-template-byzantine.xml"); + + + @Override + protected File getSystemConfigurationFile() { + return SYSTEM_CONFIGURATION_FILE; + } + + @Override + public void initSystem(Task initTask, OperationResult initResult) throws Exception { + super.initSystem(initTask, initResult); + + // templates + repoAddObjectFromFile(USER_TEMPLATE_FILE, ObjectTemplateType.class, initResult); + + assumeAssignmentPolicy(AssignmentPolicyEnforcementType.RELATIVE); + + dummyResourceCtlByzantine = DummyResourceContoller.create(RESOURCE_DUMMY_BYZANTINE_NAME, resourceDummyByzantine); + dummyResourceCtlByzantine.extendSchemaPirate(); + dummyResourceByzantine = dummyResourceCtlByzantine.getDummyResource(); + resourceDummyByzantine = importAndGetObjectFromFile(ResourceType.class, getResourceDummyByzantineFile(), RESOURCE_DUMMY_BYZANTINE_OID, initTask, initResult); + resourceDummyByzantineType = resourceDummyByzantine.asObjectable(); + dummyResourceCtlByzantine.setResource(resourceDummyByzantine); + } + + protected File getResourceDummyByzantineFile() { + return RESOURCE_DUMMY_BYZANTINE_FILE; + } + + protected abstract void importSyncTask(PrismObject resource) throws FileNotFoundException; + + protected abstract String getSyncTaskOid(PrismObject resource); + + protected int getWaitTimeout() { + return DEFAULT_TASK_WAIT_TIMEOUT; + } + + @Test + public void test100ImportLiveSyncTaskDummyByzantine() throws Exception { + final String TEST_NAME = "test100ImportLiveSyncTaskDummyByzantine"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = createTask(AbstractObjTemplateSyncTest.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + /// WHEN + TestUtil.displayWhen(TEST_NAME); + importSyncTask(resourceDummyByzantine); + + // THEN + TestUtil.displayThen(TEST_NAME); + + waitForSyncTaskStart(resourceDummyByzantine); + } + + @Test + public void test110AddDummyByzantineAccountMancomb() throws Exception { + final String TEST_NAME = "test110AddDummyByzantineAccountMancomb"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = createTask(AbstractObjTemplateSyncTest.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + rememberTimeBeforeSync(); + prepareNotifications(); + + // Preconditions + assertUsers(5); + + DummyAccount account = new DummyAccount(ACCOUNT_MANCOMB_DUMMY_USERNAME); + account.setEnabled(true); + account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, "Mancomb Seepgood"); + account.addAttributeValues(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, "Melee Island"); + long loot = ACCOUNT_MANCOMB_VALID_FROM_DATE.getTime(); + account.addAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOOT_NAME, loot); + String gossip = XmlTypeConverter.createXMLGregorianCalendar(ACCOUNT_MANCOMB_VALID_TO_DATE).toXMLFormat(); + account.addAttributeValue(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_GOSSIP_NAME, gossip); + + /// WHEN + TestUtil.displayWhen(TEST_NAME); + + display("Adding dummy account", account.debugDump()); + + dummyResourceByzantine.addAccount(account); + + waitForSyncTaskNextRun(resourceDummyByzantine); + + // THEN + TestUtil.displayThen(TEST_NAME); + + PrismObject accountMancomb = findAccountByUsername(ACCOUNT_MANCOMB_DUMMY_USERNAME, resourceDummyByzantine); + display("Account mancomb", accountMancomb); + assertNotNull("No mancomb account shadow", accountMancomb); + assertEquals("Wrong resourceRef in mancomb account", RESOURCE_DUMMY_BYZANTINE_OID, + accountMancomb.asObjectable().getResourceRef().getOid()); + assertShadowOperationalData(accountMancomb, SynchronizationSituationType.LINKED); + + PrismObject userMancomb = findUserByUsername(ACCOUNT_MANCOMB_DUMMY_USERNAME); + display("User mancomb", userMancomb); + assertNotNull("User mancomb was not created", userMancomb); + assertLinks(userMancomb, 1); + assertAdministrativeStatusEnabled(userMancomb); + + assertLinked(userMancomb, accountMancomb); + + assertEquals("Wrong e-mail address for mancomb", "mancomb.Mr@test.com", userMancomb.asObjectable().getEmailAddress()); + assertAssignedOrg(userMancomb, ORG_F0001_OID); + // this fails (see MID-2149) + //assertHasOrg(userMancomb, ORG_F0001_OID); + + assertUsers(6); + + // notifications + notificationManager.setDisabled(true); + } + + + protected void waitForSyncTaskStart(PrismObject resource) throws Exception { + waitForTaskStart(getSyncTaskOid(resource), false, getWaitTimeout()); + } + + protected void waitForSyncTaskNextRun(PrismObject resource) throws Exception { + waitForTaskNextRun(getSyncTaskOid(resource), false, getWaitTimeout()); + } + + protected void rememberTimeBeforeSync() { + timeBeforeSync = System.currentTimeMillis(); + } + + protected void assertShadowOperationalData(PrismObject shadow, SynchronizationSituationType expectedSituation) { + ShadowType shadowType = shadow.asObjectable(); + SynchronizationSituationType actualSituation = shadowType.getSynchronizationSituation(); + assertEquals("Wrong situation in shadow "+shadow, expectedSituation, actualSituation); + XMLGregorianCalendar actualTimestampCal = shadowType.getSynchronizationTimestamp(); + assert actualTimestampCal != null : "No synchronization timestamp in shadow "+shadow; + long actualTimestamp = XmlTypeConverter.toMillis(actualTimestampCal); + assert actualTimestamp >= timeBeforeSync : "Synchronization timestamp was not updated in shadow "+shadow; + // TODO: assert sync description + } + +} diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestObjTemplateLiveSyncTask.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestObjTemplateLiveSyncTask.java new file mode 100644 index 00000000000..c99768e612a --- /dev/null +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestObjTemplateLiveSyncTask.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2010-2015 Evolveum + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.evolveum.midpoint.model.intest.sync; + +import com.evolveum.icf.dummy.resource.DummySyncStyle; +import com.evolveum.midpoint.prism.PrismObject; +import com.evolveum.midpoint.schema.result.OperationResult; +import com.evolveum.midpoint.task.api.Task; +import com.evolveum.midpoint.test.util.TestUtil; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.annotation.DirtiesContext.ClassMode; +import org.springframework.test.context.ContextConfiguration; + +import java.io.FileNotFoundException; + +import static com.evolveum.midpoint.test.IntegrationTestTools.display; +import static org.testng.AssertJUnit.assertNotNull; +import static org.testng.AssertJUnit.assertNull; + +/** + * @author semancik + * @author mederly + * + */ +@ContextConfiguration(locations = {"classpath:ctx-model-intest-test-main.xml"}) +@DirtiesContext(classMode = ClassMode.AFTER_CLASS) +public class TestObjTemplateLiveSyncTask extends AbstractObjTemplateSyncTest { + + @Override + public void initSystem(Task initTask, OperationResult initResult) throws Exception { + super.initSystem(initTask, initResult); + + dummyResourceByzantine.setSyncStyle(DummySyncStyle.SMART); + } + + @Override + protected void importSyncTask(PrismObject resource) throws FileNotFoundException { + if (resource == resourceDummyByzantine) { + importObjectFromFile(TASK_LIVE_SYNC_DUMMY_BYZANTINE_FILE); + } else { + throw new IllegalArgumentException("Unknown resource "+resource); + } + } + + @Override + protected String getSyncTaskOid(PrismObject resource) { + if (resource == resourceDummyByzantine) { + return TASK_LIVE_SYNC_DUMMY_BYZANTINE_OID; + } else { + throw new IllegalArgumentException("Unknown resource "+resource); + } + } + +} diff --git a/model/model-intest/src/test/resources/sync/resource-dummy-byzantine.xml b/model/model-intest/src/test/resources/sync/resource-dummy-byzantine.xml new file mode 100644 index 00000000000..67a6cfd0c9a --- /dev/null +++ b/model/model-intest/src/test/resources/sync/resource-dummy-byzantine.xml @@ -0,0 +1,119 @@ + + + + + + + + Dummy Resource Byzantine + + + + + connectorType + com.evolveum.icf.dummy.connector.DummyConnector + + + connectorVersion + 2.0 + + + + + + + + byzantine + false + + + + + + + Default Account + true + ri:AccountObjectClass + + icfs:name + Username + + + $c:user/c:name + + + + + + + + + + + + + + + + + true + + + c:name + + $account/attributes/icfs:name + + + + + linked + true + + + deleted + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#inactivateFocus + + + + unlinked + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#addFocus + + + + + + diff --git a/model/model-intest/src/test/resources/sync/system-configuration-byzantine.xml b/model/model-intest/src/test/resources/sync/system-configuration-byzantine.xml new file mode 100644 index 00000000000..610fb16b2d8 --- /dev/null +++ b/model/model-intest/src/test/resources/sync/system-configuration-byzantine.xml @@ -0,0 +1,143 @@ + + + + + + + SystemConfiguration + + c:UserType + + + + File Appender + INFO + + TRACE + com.evolveum.midpoint.model + + + %date [%thread] %-5level \(%logger{46}\): %message%n + target/test.log + true + + + + + + + recipient@evolveum.com + + dummy:accountPasswordNotifier + + + + + + recipient@evolveum.com + + dummy:userPasswordNotifier + + + + success + + + recipient@evolveum.com + + dummy:simpleAccountNotifier-SUCCESS + + + + failure + + + recipient@evolveum.com + + dummy:simpleAccountNotifier-FAILURE + + + + add + success + + + recipient@evolveum.com + + dummy:simpleAccountNotifier-ADD-SUCCESS + + + + delete + success + + + recipient@evolveum.com + + dummy:simpleAccountNotifier-DELETE-SUCCESS + + + + + + recipient@evolveum.com + + dummy:simpleUserNotifier + + + + + add + + + + + recipient@evolveum.com + + dummy:simpleUserNotifier-ADD + + + + + + delete + + + + + recipient@evolveum.com + + dummy:simpleUserNotifier-DELETE + + + + + failure + + + recipient@evolveum.com + + dummy:simpleUserNotifier-FAILURE + + + + target/mail-notifications.log + + + diff --git a/model/model-intest/src/test/resources/sync/task-dummy-byzantine-livesync.xml b/model/model-intest/src/test/resources/sync/task-dummy-byzantine-livesync.xml new file mode 100644 index 00000000000..5ba559ae0d9 --- /dev/null +++ b/model/model-intest/src/test/resources/sync/task-dummy-byzantine-livesync.xml @@ -0,0 +1,38 @@ + + + + + + Live Sync: Emerald Dummy Resource + + 10000000-0000-0000-5555-55550000f904 + + runnable + + http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/live-sync/handler-3 + + recurring + tight + + 1 + + + diff --git a/model/model-intest/src/test/resources/sync/task-dummy-byzantine-recon.xml b/model/model-intest/src/test/resources/sync/task-dummy-byzantine-recon.xml new file mode 100644 index 00000000000..6107881a2ec --- /dev/null +++ b/model/model-intest/src/test/resources/sync/task-dummy-byzantine-recon.xml @@ -0,0 +1,45 @@ + + + + + + + + + Reconciliation: Dummy Emerald + + + 1000 + + + 10000000-0000-0000-5656-56560000f904 + + runnable + + http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/reconciliation/handler-3 + + recurring + tight + + 5 + + + diff --git a/model/model-intest/src/test/resources/sync/user-template-byzantine.xml b/model/model-intest/src/test/resources/sync/user-template-byzantine.xml new file mode 100644 index 00000000000..a5bafaf3b88 --- /dev/null +++ b/model/model-intest/src/test/resources/sync/user-template-byzantine.xml @@ -0,0 +1,80 @@ + + + + + + Default User Template 1 + + + + + + + + Honorific prefix mapping + + + + + honorificPrefix + + + + + Email address mapping + + honorificPrefix + + + name + + + + + + emailAddress + + + + + Org assignment + + honorificPrefix + + + + c:OrgType + 00000000-8888-6666-0000-100000000001 + + + + assignment + + + + \ No newline at end of file diff --git a/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java b/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java index e9bfb76f1b9..2b910732f44 100644 --- a/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java +++ b/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java @@ -233,7 +233,7 @@ public abstract class AbstractModelIntegrationTest extends AbstractIntegrationTe protected DummyAuditService dummyAuditService; - protected boolean verbose = false; + protected boolean verbose = false; private static final Trace LOGGER = TraceManager.getTrace(AbstractModelIntegrationTest.class); @@ -1883,17 +1883,17 @@ private String longTimeToString(Long longTime) { private boolean isError(OperationResult result, boolean checkSubresult) { OperationResult subresult = getSubresult(result, checkSubresult); - return subresult.isError(); + return subresult != null ? subresult.isError() : false; } private boolean isUknown(OperationResult result, boolean checkSubresult) { OperationResult subresult = getSubresult(result, checkSubresult); - return subresult.isUnknown(); + return subresult != null ? subresult.isUnknown() : false; // TODO or return true? } private boolean isInProgress(OperationResult result, boolean checkSubresult) { OperationResult subresult = getSubresult(result, checkSubresult); - return subresult.isInProgress(); + return subresult != null ? subresult.isInProgress() : true; // "true" if there are no subresults } private OperationResult getSubresult(OperationResult result, boolean checkSubresult) { diff --git a/testing/longtest/src/test/resources/ldap-complex/org.xml b/testing/longtest/src/test/resources/ldap-complex/org.xml new file mode 100644 index 00000000000..805c1824f24 --- /dev/null +++ b/testing/longtest/src/test/resources/ldap-complex/org.xml @@ -0,0 +1,26 @@ + + + + + F0001 + The office of the most respectful Governor. + Governor Office + 0001 + functional + CC0 + The Governor's Mansion + From 1e5b1f8d67abff41a26b222cb351f73aabd46a03 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Thu, 15 Jan 2015 16:44:07 +0100 Subject: [PATCH 027/215] Fixing provisioning tests after dummy connector change. --- .../provisioning/test/impl/TestDummy.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/provisioning/provisioning-impl/src/test/java/com/evolveum/midpoint/provisioning/test/impl/TestDummy.java b/provisioning/provisioning-impl/src/test/java/com/evolveum/midpoint/provisioning/test/impl/TestDummy.java index f46be981bca..2867e866d46 100644 --- a/provisioning/provisioning-impl/src/test/java/com/evolveum/midpoint/provisioning/test/impl/TestDummy.java +++ b/provisioning/provisioning-impl/src/test/java/com/evolveum/midpoint/provisioning/test/impl/TestDummy.java @@ -2902,7 +2902,7 @@ public void test220EntitleAccountWillPirates() throws Exception { delta.checkConsistence(); DummyGroup group = getDummyGroupAssert(GROUP_PIRATES_NAME, piratesIcfUid); - assertMember(group, getWillRepoIcfName()); + assertMember(group, transformNameFromResource(getWillRepoIcfName())); syncServiceMock.assertNotifySuccessOnly(); @@ -2937,7 +2937,7 @@ public void test221GetPirateWill() throws Exception { // Just make sure nothing has changed DummyGroup group = getDummyGroupAssert(GROUP_PIRATES_NAME, piratesIcfUid); - assertMember(group, getWillRepoIcfName()); + assertMember(group, transformNameFromResource(getWillRepoIcfName())); assertSteadyResource(); } @@ -2981,7 +2981,7 @@ public void test222EntitleAccountWillPillage() throws Exception { // Make sure that the groups is still there and will is a member DummyGroup group = getDummyGroupAssert(GROUP_PIRATES_NAME, piratesIcfUid); - assertMember(group, getWillRepoIcfName()); + assertMember(group, transformNameFromResource(getWillRepoIcfName())); syncServiceMock.assertNotifySuccessOnly(); @@ -3029,7 +3029,7 @@ public void test222bEntitleAccountWillBargain() throws Exception { // Make sure that the groups is still there and will is a member DummyGroup group = getDummyGroupAssert(GROUP_PIRATES_NAME, piratesIcfUid); - assertMember(group, getWillRepoIcfName()); + assertMember(group, transformNameFromResource(getWillRepoIcfName())); syncServiceMock.assertNotifySuccessOnly(); @@ -3077,7 +3077,7 @@ public void test223GetPillagingPirateWill() throws Exception { assertNotNull("Privilege object (bargain) is gone!", priv2); DummyGroup group = getDummyGroupAssert(GROUP_PIRATES_NAME, piratesIcfUid); - assertMember(group, getWillRepoIcfName()); + assertMember(group, transformNameFromResource(getWillRepoIcfName())); assertSteadyResource(); } @@ -3136,11 +3136,11 @@ public void test224GetFoolishPirateWill() throws Exception { assertNotNull("Privilege object (bargain) is gone!", priv2); DummyGroup group = getDummyGroupAssert(GROUP_PIRATES_NAME, piratesIcfUid); - assertMember(group, getWillRepoIcfName()); + assertMember(group, transformNameFromResource(getWillRepoIcfName())); String foolsIcfUid = getIcfUid(foolsShadow); groupFools = getDummyGroupAssert("fools", foolsIcfUid); - assertMember(group, getWillRepoIcfName()); + assertMember(group, transformNameFromResource(getWillRepoIcfName())); assertSteadyResource(); } @@ -3328,7 +3328,7 @@ public void test230AddAccountLeChuck() throws Exception { assertNotNull("Privilege object is gone!", priv); DummyGroup group = getDummyGroupAssert(GROUP_PIRATES_NAME, piratesIcfUid); - assertMember(group, ACCOUNT_LECHUCK_NAME); + assertMember(group, transformNameFromResource(ACCOUNT_LECHUCK_NAME)); ShadowType accountType = repositoryService.getObject(ShadowType.class, ACCOUNT_LECHUCK_OID, null, result) .asObjectable(); From d84f0f02e2863a4dff4af0def0f91dc573b2afc1 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Thu, 15 Jan 2015 18:53:49 +0100 Subject: [PATCH 028/215] Fixed MID-2073 by retrieving associations in GUI with noFetch option. Fixed ClassCastException in PrismValuePanel. --- .../web/component/prism/PrismValuePanel.java | 4 +++- .../midpoint/web/page/admin/users/PageUser.java | 5 +++-- .../impl/lens/projector/ActivationProcessor.java | 15 ++++++++------- .../midpoint/provisioning/impl/ShadowCache.java | 13 ++++++++----- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/PrismValuePanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/PrismValuePanel.java index 6a12241bd8f..9e95355dcba 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/PrismValuePanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/PrismValuePanel.java @@ -448,7 +448,9 @@ private String createAssociationTooltipText(PrismProperty property){ for (Object realValue : attr.getRealValues()){ sb.append(getAttributeName(attr)); sb.append(":"); - sb.append(((String)realValue).replace(",", ",​").replace("@", "@​")); + if (realValue != null) { + sb.append(realValue.toString().replace(",", ",​").replace("@", "@​")); + } sb.append("
"); } } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUser.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUser.java index 6b7d13f14be..177b69ea8bb 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUser.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUser.java @@ -700,9 +700,10 @@ private List loadAccountWrappers() { List associations = new ArrayList<>(associationContainer.getValues().size()); for (PrismContainerValue associationVal : associationContainer.getValues()){ ShadowAssociationType associationType = (ShadowAssociationType) associationVal.asContainerable(); - PrismObject association = getModelService().getObject(ShadowType.class, associationType.getShadowRef().getOid(), null, task, subResult); + // we can safely eliminate fetching from resource, because we need only the name + PrismObject association = getModelService().getObject(ShadowType.class, associationType.getShadowRef().getOid(), + SelectorOptions.createCollection(GetOperationOptions.createNoFetch()), task, subResult); associations.add(association.findProperty(ShadowType.F_NAME)); - } wrapper.setAssociations(associations); diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ActivationProcessor.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ActivationProcessor.java index 8e2aae76370..47b812ae5bf 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ActivationProcessor.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ActivationProcessor.java @@ -536,15 +536,16 @@ private void evaluateActivationMapping(final LensContex LOGGER.trace("No outbound definition in '{}' definition in activation in projection {}, skipping", desc, accCtxDesc); return; } - - ObjectDelta projectionDelta = projCtx.getDelta(); - PropertyDelta shadowPropertyDelta = LensUtil.findAPrioriDelta(context, projCtx, projectionPropertyPath); + + // commented out unused code +// ObjectDelta projectionDelta = projCtx.getDelta(); +// PropertyDelta shadowPropertyDelta = LensUtil.findAPrioriDelta(context, projCtx, projectionPropertyPath); PrismObject shadowNew = projCtx.getObjectNew(); - PrismProperty shadowPropertyNew = null; - if (shadowNew != null) { - shadowPropertyNew = shadowNew.findProperty(projectionPropertyPath); - } +// PrismProperty shadowPropertyNew = null; +// if (shadowNew != null) { +// shadowPropertyNew = shadowNew.findProperty(projectionPropertyPath); +// } MappingInitializer> initializer = new MappingInitializer>() { @Override diff --git a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCache.java b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCache.java index 1cc05afa62c..e17a14611e8 100644 --- a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCache.java +++ b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCache.java @@ -925,14 +925,17 @@ private PrismObject lookupOrCreateShadowInRepository(ConnectorInstan parentResult); if (repoShadow == null) { - LOGGER.trace( - "Shadow object (in repo) corresponding to the resource object (on the resource) was not found. The repo shadow will be created. The resource object:\n{}", - SchemaDebugUtil.prettyPrint(resourceShadow)); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace( + "Shadow object (in repo) corresponding to the resource object (on the resource) was not found. The repo shadow will be created. The resource object:\n{}", + SchemaDebugUtil.prettyPrint(resourceShadow)); + } repoShadow = createShadowInRepository(connector, resourceShadow, objectClassDef, resourceType, parentResult); } else { - LOGGER.trace("Found shadow object in the repository {}", - SchemaDebugUtil.prettyPrint(repoShadow)); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("Found shadow object in the repository {}", SchemaDebugUtil.prettyPrint(repoShadow)); + } } return repoShadow; From 5f4f76c2fef18c961858382d5fe76a09db8eccfa Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Thu, 15 Jan 2015 19:09:59 +0100 Subject: [PATCH 029/215] Changing ConnId version --- build-system/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-system/pom.xml b/build-system/pom.xml index 39cb9d2c8ff..8a47142bffe 100644 --- a/build-system/pom.xml +++ b/build-system/pom.xml @@ -72,7 +72,7 @@ 5.15.1 1.3 2.0.1 - 1.4.0.1-SNAPSHOT + 1.4.1.0-SNAPSHOT From 6e0382c1ed9521591a1f0b253c99122ea9f924a1 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Fri, 16 Jan 2015 11:42:19 +0100 Subject: [PATCH 030/215] Final ConnId version before the release. --- build-system/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-system/pom.xml b/build-system/pom.xml index 8a47142bffe..403f9405b2d 100644 --- a/build-system/pom.xml +++ b/build-system/pom.xml @@ -72,7 +72,7 @@ 5.15.1 1.3 2.0.1 - 1.4.1.0-SNAPSHOT + 1.4.0.49 From 6f4525c7fc3a6c2d4cc200ad9512a990080622d7 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Fri, 16 Jan 2015 12:05:36 +0100 Subject: [PATCH 031/215] MID-2126 fix --- .../web/component/input/UploadPanel.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/UploadPanel.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/UploadPanel.html index 7407242d77b..76ebdca2a69 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/UploadPanel.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/UploadPanel.html @@ -16,19 +16,19 @@ -
- -
- -
- - + + +
+ +
\ No newline at end of file From f6483584fbc59126244598f59229780805d7a5e4 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Fri, 16 Jan 2015 13:53:26 +0100 Subject: [PATCH 032/215] fix for MID-2042 --- .../web/component/progress/ProgressReporter.java | 11 ++++++++--- .../page/admin/users/DefaultGuiProgressListener.java | 1 - 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/progress/ProgressReporter.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/progress/ProgressReporter.java index a5958aafc89..9b8320d27ee 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/progress/ProgressReporter.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/progress/ProgressReporter.java @@ -35,10 +35,10 @@ import com.evolveum.midpoint.util.logging.Trace; import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.web.component.AjaxSubmitButton; -import com.evolveum.midpoint.web.page.PageBase; import com.evolveum.midpoint.web.page.admin.users.DefaultGuiProgressListener; import com.evolveum.midpoint.web.security.WebApplicationConfiguration; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; +import org.apache.wicket.Component; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior; import org.apache.wicket.behavior.Behavior; @@ -219,13 +219,14 @@ public void showSaveButton(AjaxRequestTarget target) { private void startRefreshingProgressPanel(AjaxRequestTarget target) { if (refreshingBehavior == null) { // i.e. refreshing behavior has not been set yet refreshingBehavior = new AjaxSelfUpdatingTimerBehavior(Duration.milliseconds(refreshInterval)) { + @Override protected void onPostProcessTarget(AjaxRequestTarget target) { super.onPostProcessTarget(target); if (asyncOperationResult != null) { // by checking this we know that async operation has been finished asyncOperationResult.recomputeStatus(); // because we set it to in-progress - //stopRefreshingProgressPanel(); // does not work as expected + stopRefreshingProgressPanel(); if (asyncOperationResult.isFatalError()) { saveButton.setVisible(true); // enable re-saving after fixing (potential) error @@ -238,13 +239,17 @@ protected void onPostProcessTarget(AjaxRequestTarget target) { asyncOperationResult = null; } } + + @Override + public boolean isEnabled(Component component) { + return component != null; + } }; progressPanel.add(refreshingBehavior); target.add(progressPanel); } } - // does not work for some reason (NPE in wicket) private void stopRefreshingProgressPanel() { if (refreshingBehavior != null) { progressPanel.remove(refreshingBehavior); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/DefaultGuiProgressListener.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/DefaultGuiProgressListener.java index c8aadc8b06d..ecc53211769 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/DefaultGuiProgressListener.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/DefaultGuiProgressListener.java @@ -43,7 +43,6 @@ import com.evolveum.midpoint.web.component.progress.ProgressDto; import com.evolveum.midpoint.web.component.progress.ProgressReportActivityDto; import com.evolveum.midpoint.web.component.progress.ProgressReportingAwarePage; -import com.evolveum.midpoint.web.page.PageBase; import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; From fa9bd5f7bc0d1bb24ef4782e5dcf81a8eaf94e18 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Fri, 16 Jan 2015 17:03:58 +0100 Subject: [PATCH 033/215] Fixing LDAP connector version. --- build-system/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-system/pom.xml b/build-system/pom.xml index 403f9405b2d..168bfadb749 100644 --- a/build-system/pom.xml +++ b/build-system/pom.xml @@ -393,7 +393,7 @@ com.evolveum.polygon connector-ldap - 1.4.0.1-SNAPSHOT + 1.4.0.49 From 4249a5b0720a272ba5ef5c74ef408b6faa63d837 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Fri, 16 Jan 2015 17:43:43 +0100 Subject: [PATCH 034/215] Fixing CSVFile connector version. --- build-system/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-system/pom.xml b/build-system/pom.xml index 168bfadb749..7bd622e3074 100644 --- a/build-system/pom.xml +++ b/build-system/pom.xml @@ -388,7 +388,7 @@ com.evolveum.polygon connector-csvfile - 1.4.0.1-SNAPSHOT + 1.4.0.49 com.evolveum.polygon From 3e5be57fd0424c0d0529badbfcc97faeb6d719ef Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Fri, 16 Jan 2015 18:11:01 +0100 Subject: [PATCH 035/215] Fixing LDAp connector version in provisioning --- build-system/pom.xml | 2 +- .../src/test/resources/ucf/connector-ldap.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build-system/pom.xml b/build-system/pom.xml index 7bd622e3074..f8ebd9fecb5 100644 --- a/build-system/pom.xml +++ b/build-system/pom.xml @@ -383,7 +383,7 @@ com.evolveum.polygon connector-databasetable - 1.4.0.1-SNAPSHOT + 1.4.0.49 com.evolveum.polygon diff --git a/provisioning/provisioning-impl/src/test/resources/ucf/connector-ldap.xml b/provisioning/provisioning-impl/src/test/resources/ucf/connector-ldap.xml index 43e5ab465c8..173d5868b4c 100644 --- a/provisioning/provisioning-impl/src/test/resources/ucf/connector-ldap.xml +++ b/provisioning/provisioning-impl/src/test/resources/ucf/connector-ldap.xml @@ -1,6 +1,6 @@ + + + + + + Dummy Resource Tea Green + + + + + connectorType + com.evolveum.icf.dummy.connector.DummyConnector + + + connectorVersion + 2.0 + + + + + + + + tea-green + true + + + + + + + + + + + + + + + icfs:uid + icfs:name + icfs:name + icfs:name + __ACCOUNT__ + + + + + + + + + ICF UID + read + + + + + + + + + + ICF NAME + + + + + + + + + + + + + + + + + + + Default Account + true + ri:AccountObjectClass + + icfs:name + Username + + + name + + + + + icfs:uid + UID + + + ri:fullname + Full Name + + strong + + fullName + + + + + ri:location + Location + + strong + http://midpoint.evolveum.com/xml/ns/public/provisioning/channels-3#import + + + + + description + + + + + ri:ship + Ship + + strong + + + + + organizationalUnit + + + + + ri:loot + Loot + + + + ri:weapon + Weapon + + + + ri:drink + Drink + false + + + + ri:quote + Quote + true + + + + + 5 + + + + daviejones + + + calypso + + + + + + + + + + + + + + + + + + + + + + weak + + + + + + + + + + + + + + + + true + + + + + default account type + true + + + + + + c:name + + $account/attributes/icfs:name + + + + + linked + true + + + deleted + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#inactivateFocus + + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink + + + + unlinked + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#addFocus + + + + + + + diff --git a/model/model-intest/src/test/resources/mapping-inbound/task-dumy-tea-green-livesync.xml b/model/model-intest/src/test/resources/mapping-inbound/task-dumy-tea-green-livesync.xml new file mode 100644 index 00000000000..d006bdb4840 --- /dev/null +++ b/model/model-intest/src/test/resources/mapping-inbound/task-dumy-tea-green-livesync.xml @@ -0,0 +1,38 @@ + + + + + + Live Sync: Tea Green Dummy Resource + + 10000000-0000-0000-5555-55550000c404 + + runnable + + http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/live-sync/handler-3 + + recurring + tight + + 1 + + + diff --git a/model/model-intest/testng.xml b/model/model-intest/testng.xml index 61259ffda30..6cf01b7a4fa 100644 --- a/model/model-intest/testng.xml +++ b/model/model-intest/testng.xml @@ -36,6 +36,7 @@ + From b19b68ee59dec0a27013659a3ee861049ffb1671 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Fri, 16 Jan 2015 19:45:16 +0100 Subject: [PATCH 037/215] Adapting tests to fixed behavior as per MID-2100. --- .../model/intest/sync/AbstractInboundSyncTest.java | 4 ++-- .../model/intest/sync/TestInboundLiveSyncTask.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/AbstractInboundSyncTest.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/AbstractInboundSyncTest.java index e70a9e2103c..8490a8c04e0 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/AbstractInboundSyncTest.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/AbstractInboundSyncTest.java @@ -76,8 +76,8 @@ public abstract class AbstractInboundSyncTest extends AbstractInitializedModelIn protected static final String ACCOUNT_WALLY_DUMMY_USERNAME = "wally"; protected static final String ACCOUNT_MANCOMB_DUMMY_USERNAME = "mancomb"; - private static final Date ACCOUNT_MANCOMB_VALID_FROM_DATE = MiscUtil.asDate(2011, 2, 3, 4, 5, 6); - private static final Date ACCOUNT_MANCOMB_VALID_TO_DATE = MiscUtil.asDate(2066, 5, 4, 3, 2, 1); + protected static final Date ACCOUNT_MANCOMB_VALID_FROM_DATE = MiscUtil.asDate(2011, 2, 3, 4, 5, 6); + protected static final Date ACCOUNT_MANCOMB_VALID_TO_DATE = MiscUtil.asDate(2066, 5, 4, 3, 2, 1); protected static String userWallyOid; diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestInboundLiveSyncTask.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestInboundLiveSyncTask.java index 3bff75b58cb..3b58b484acb 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestInboundLiveSyncTask.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestInboundLiveSyncTask.java @@ -103,10 +103,10 @@ public void test199DeleteDummyEmeraldAccountMancomb() throws Exception { assertLinks(userMancomb, 0); // Disabled by sync reaction assertAdministrativeStatusDisabled(userMancomb); - assertNull("Unexpected valid from in user", userMancomb.asObjectable().getActivation().getValidFrom()); - assertNull("Unexpected valid to in user", userMancomb.asObjectable().getActivation().getValidTo()); -// assertValidFrom(userMancomb, ACCOUNT_MANCOMB_VALID_FROM_DATE); -// assertValidTo(userMancomb, ACCOUNT_MANCOMB_VALID_TO_DATE); +// assertNull("Unexpected valid from in user", userMancomb.asObjectable().getActivation().getValidFrom()); +// assertNull("Unexpected valid to in user", userMancomb.asObjectable().getActivation().getValidTo()); + assertValidFrom(userMancomb, ACCOUNT_MANCOMB_VALID_FROM_DATE); + assertValidTo(userMancomb, ACCOUNT_MANCOMB_VALID_TO_DATE); assertNoDummyAccount(ACCOUNT_MANCOMB_DUMMY_USERNAME); From 1f739674d04b6c697db94dff5f516123139d18e0 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Tue, 20 Jan 2015 12:43:29 +0100 Subject: [PATCH 038/215] fix for MID-2154 --- .../component/data/ObjectDataProvider.java | 8 ++++++-- .../page/admin/resources/PageResources.java | 20 ++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/ObjectDataProvider.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/ObjectDataProvider.java index d255551a2c4..95d8f2ed022 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/ObjectDataProvider.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/ObjectDataProvider.java @@ -91,14 +91,18 @@ public Iterator internalIterator(long first, long count) { } if (!WebMiscUtil.isSuccessOrHandledError(result)) { - getPage().showResultInSession(result); - throw new RestartResponseException(PageError.class); + handleNotSuccessOrHandledErrorInIterator(result); } LOGGER.trace("end::iterator()"); return getAvailableData().iterator(); } + protected void handleNotSuccessOrHandledErrorInIterator(OperationResult result){ + getPage().showResultInSession(result); + throw new RestartResponseException(PageError.class); + } + public W createDataObjectWrapper(PrismObject obj) { return (W) new SelectableBean(obj.asObjectable()); } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResources.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResources.java index 74637b42395..51556ab71ce 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResources.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResources.java @@ -223,6 +223,15 @@ protected void saveProviderPaging(ObjectQuery query, ObjectPaging paging) { ResourcesStorage storage = getSessionStorage().getResources(); storage.setResourcePaging(paging); } + + @Override + protected void handleNotSuccessOrHandledErrorInIterator(OperationResult result) { + if(result.isPartialError()){ + showResult(result); + } else { + super.handleNotSuccessOrHandledErrorInIterator(result); + } + } }; Collection> options = @@ -268,7 +277,7 @@ public void onClick(AjaxRequestTarget target){ } private List> initResourceColumns() { - List> columns = new ArrayList>(); + List> columns = new ArrayList<>(); IColumn column = new CheckBoxHeaderColumn(); columns.add(column); @@ -295,6 +304,7 @@ protected IModel createIconModel(final IModel rowModel) { @Override public String getObject() { +// testResourcePerformed(getRequestCycle().find(AjaxRequestTarget.class), rowModel); ResourceDto dto = rowModel.getObject(); ResourceController.updateLastAvailabilityState(dto.getState(), dto.getLastAvailabilityStatus()); @@ -361,7 +371,7 @@ public void entitlementsPerformed(AjaxRequestTarget target) { } private List initInlineMenu() { - List headerMenuItems = new ArrayList(); + List headerMenuItems = new ArrayList<>(); headerMenuItems.add(new InlineMenuItem(createStringResource("PageBase.button.delete"), new HeaderMenuAction(this) { @@ -375,7 +385,7 @@ public void onClick(AjaxRequestTarget target) { } private List> initConnectorHostsColumns() { - List> columns = new ArrayList>(); + List> columns = new ArrayList<>(); IColumn column = new CheckBoxHeaderColumn(); columns.add(column); @@ -407,7 +417,7 @@ public void onClick(AjaxRequestTarget target, IModel initInlineHostsMenu() { - List headerMenuItems = new ArrayList(); + List headerMenuItems = new ArrayList<>(); headerMenuItems.add(new InlineMenuItem(createStringResource("PageBase.button.delete"), new HeaderMenuAction(this) { @@ -535,7 +545,7 @@ private void deleteHostConfirmedPerformed(AjaxRequestTarget target) { } private void deleteResourceConfirmedPerformed(AjaxRequestTarget target) { - List selected = new ArrayList(); + List selected = new ArrayList<>(); if(singleDelete != null){ selected.add(singleDelete); From 57c59e38f6bece53f0b314f4ef20d4b566e5f9df Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Tue, 20 Jan 2015 13:17:34 +0100 Subject: [PATCH 039/215] additional fix for MID-2154 - improving handling of resource status when resource contains partial error. --- .../web/page/admin/resources/dto/ResourceDto.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/dto/ResourceDto.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/dto/ResourceDto.java index 9921acb8da3..c03a8594bed 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/dto/ResourceDto.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/dto/ResourceDto.java @@ -26,6 +26,7 @@ import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem; import com.evolveum.midpoint.web.util.WebMiscUtil; +import com.evolveum.midpoint.xml.ns._public.common.common_3.*; import org.apache.commons.lang.Validate; import com.evolveum.midpoint.common.refinery.RefinedResourceSchema; @@ -35,10 +36,6 @@ import com.evolveum.midpoint.schema.processor.ResourceSchema; import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.web.component.util.Selectable; -import com.evolveum.midpoint.xml.ns._public.common.common_3.AvailabilityStatusType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType; import javax.xml.namespace.QName; @@ -81,6 +78,12 @@ public ResourceDto(PrismObject resource) { version = connector != null ? connector.getConnectorVersion() : null; type = connector != null ? connector.getConnectorType() : null; lastAvailabilityStatus = resource.asObjectable().getOperationalState() != null ? resource.asObjectable().getOperationalState().getLastAvailabilityStatus() : null; + + if(resource.asObjectable().getFetchResult() != null && resource.asObjectable().getFetchResult().getStatus() != null){ + if(OperationResultStatusType.PARTIAL_ERROR.equals(resource.asObjectable().getFetchResult().getStatus())){ + lastAvailabilityStatus = null; + } + } } public ResourceDto(PrismObject resource, PrismContext prismContext, ConnectorType connector, List capabilities) { From 0a6d563cbb0a92abb4b8a6b1503c343806670cfd Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Tue, 20 Jan 2015 17:15:17 +0100 Subject: [PATCH 040/215] REST login/logout auditing (MID-1842) --- .../schema/constants/SchemaConstants.java | 2 + .../midpoint/model/impl/ModelRestService.java | 425 +++++++++++------- .../MidpointRestAuthenticationHandler.java | 79 ++-- 3 files changed, 313 insertions(+), 193 deletions(-) diff --git a/infra/schema/src/main/java/com/evolveum/midpoint/schema/constants/SchemaConstants.java b/infra/schema/src/main/java/com/evolveum/midpoint/schema/constants/SchemaConstants.java index d882507b4ee..8fd00fafaba 100644 --- a/infra/schema/src/main/java/com/evolveum/midpoint/schema/constants/SchemaConstants.java +++ b/infra/schema/src/main/java/com/evolveum/midpoint/schema/constants/SchemaConstants.java @@ -159,6 +159,8 @@ public abstract class SchemaConstants { public static final String CHANNEL_WEB_SERVICE_URI = QNameUtil.qNameToUri(CHANNEL_WEB_SERVICE_QNAME); public static final QName CHANNEL_OBJECT_IMPORT_QNAME = new QName(NS_MODEL_CHANNEL, "objectImport"); public static final String CHANNEL_OBJECT_IMPORT_URI = QNameUtil.qNameToUri(CHANNEL_OBJECT_IMPORT_QNAME); + public static final QName CHANNEL_REST_QNAME = new QName(NS_MODEL_CHANNEL, "rest"); + public static final String CHANNEL_REST_URI = QNameUtil.qNameToUri(CHANNEL_REST_QNAME); public static final String NS_MODEL_SERVICE = NS_MODEL + "/service-3"; diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/ModelRestService.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/ModelRestService.java index c86fc22e159..f2baa0d4f87 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/ModelRestService.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/ModelRestService.java @@ -29,6 +29,10 @@ import antlr.Utils; +import com.evolveum.midpoint.audit.api.AuditEventRecord; +import com.evolveum.midpoint.audit.api.AuditEventStage; +import com.evolveum.midpoint.audit.api.AuditEventType; +import com.evolveum.midpoint.audit.api.AuditService; import com.evolveum.midpoint.model.api.ModelExecuteOptions; import com.evolveum.midpoint.model.api.PolicyViolationException; import com.evolveum.midpoint.model.impl.rest.PATCH; @@ -43,6 +47,7 @@ import com.evolveum.midpoint.schema.SelectorOptions; import com.evolveum.midpoint.schema.constants.MidPointConstants; import com.evolveum.midpoint.schema.constants.ObjectTypes; +import com.evolveum.midpoint.schema.constants.SchemaConstants; import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.schema.result.OperationResultStatus; import com.evolveum.midpoint.task.api.Task; @@ -68,6 +73,7 @@ import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType; import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; import com.evolveum.prism.xml.ns._public.query_3.QueryType; +import com.evolveum.prism.xml.ns._public.types_3.PolyStringType; @Service @Produces({"application/xml", "application/json"}) @@ -79,6 +85,9 @@ public class ModelRestService { @Autowired(required = true) private TaskManager taskManager; + @Autowired(required = true) + private AuditService auditService; + @Autowired(required = true) private PrismContext prismContext; @@ -88,60 +97,62 @@ public class ModelRestService { public static final long WAIT_FOR_TASK_STOP = 2000L; private static final String OPTIONS = "options"; - public ModelRestService(){ - + public ModelRestService() { + // nothing to do } - - @GET @Path("/{type}/{id}") // @Produces({"application/xml"}) - public Response getObject(@PathParam("type") String type, @PathParam("id") String id){ + public Response getObject(@PathParam("type") String type, @PathParam("id") String id, + @Context MessageContext mc){ LOGGER.info("model rest service for get operation start"); - Task task = taskManager.createTaskInstance(); - OperationResult parentResult = new OperationResult("get"); -// try{ - - Class clazz = ObjectTypes.getClassFromRestType(type); - + Task task = taskManager.createTaskInstance("get"); + OperationResult parentResult = task.getResult(); + initRequest(task, mc); + + Class clazz = ObjectTypes.getClassFromRestType(type); + Response response; try { PrismObject object = model.getObject(clazz, id, null, task, parentResult); ResponseBuilder builder = Response.ok(); builder.entity(object); - return builder.build(); + response = builder.build(); } catch (ObjectNotFoundException e) { - return Response.status(Status.NOT_FOUND).entity(e.getMessage()).build(); + response = Response.status(Status.NOT_FOUND).entity(e.getMessage()).build(); } catch (SchemaException e) { - return Response.status(Status.CONFLICT).type(MediaType.TEXT_HTML).entity(e.getMessage()).build(); + response = Response.status(Status.CONFLICT).type(MediaType.TEXT_HTML).entity(e.getMessage()).build(); } catch (CommunicationException e) { - return Response.status(Status.GATEWAY_TIMEOUT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.GATEWAY_TIMEOUT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (ConfigurationException e) { - return Response.status(Status.BAD_GATEWAY).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.BAD_GATEWAY).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (SecurityViolationException e) { - return Response.status(Status.FORBIDDEN).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.FORBIDDEN).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } + parentResult.computeStatus(); + auditLogout(task); + return response; } - - - + + @POST @Path("/{type}") // @Produces({"text/html", "application/xml"}) @Consumes({"application/xml", "application/json"}) - public Response addObject(@PathParam("type") String type, PrismObject object, @QueryParam("options") List options, @Context UriInfo uriInfo, @Context MessageContext mc){ + public Response addObject(@PathParam("type") String type, PrismObject object, @QueryParam("options") List options, + @Context UriInfo uriInfo, @Context MessageContext mc) { LOGGER.info("model rest service for add operation start"); - UserType user = (UserType) mc.get("authenticatedUser"); - - Task task = taskManager.createTaskInstance(); - task.setOwner(user.asPrismObject()); - OperationResult parentResult = new OperationResult("add"); + Task task = taskManager.createTaskInstance("add"); + initRequest(task, mc); + OperationResult parentResult = task.getResult(); + Class clazz = ObjectTypes.getClassFromRestType(type); if (!object.getCompileTimeClass().equals(clazz)){ + auditLogout(task); return Response.status(Status.BAD_REQUEST).entity( "Request to add object of type " + object.getCompileTimeClass().getSimpleName() @@ -152,6 +163,7 @@ public Response addObject(@PathParam("type") String type, ModelExecuteOptions modelExecuteOptions = ModelExecuteOptions.fromRestOptions(options); String oid; + Response response; try { oid = model.addObject(object, modelExecuteOptions, task, parentResult); LOGGER.info("returned oid : {}", oid ); @@ -159,43 +171,46 @@ public Response addObject(@PathParam("type") String type, URI resourceURI = uriInfo.getAbsolutePathBuilder().path(oid).build(oid); ResponseBuilder builder = clazz.isAssignableFrom(TaskType.class) ? Response.accepted().location(resourceURI) : Response.created(resourceURI); - return builder.build(); + response = builder.build(); } catch (ObjectAlreadyExistsException e) { - return Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (ObjectNotFoundException e) { - return Response.status(Status.NOT_FOUND).entity(e.getMessage()).build(); + response = Response.status(Status.NOT_FOUND).entity(e.getMessage()).build(); } catch (SchemaException e) { - return Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (ExpressionEvaluationException e) { - return Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (CommunicationException e) { - return Response.status(Status.GATEWAY_TIMEOUT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.GATEWAY_TIMEOUT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (ConfigurationException e) { - return Response.status(Status.BAD_GATEWAY).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.BAD_GATEWAY).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (PolicyViolationException e) { - return Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (SecurityViolationException e) { - return Response.status(Status.FORBIDDEN).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.FORBIDDEN).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } + parentResult.computeStatus(); + auditLogout(task); + return response; } @PUT @Path("/{type}/{id}") // @Produces({"text/html", "application/xml"}) - public Response addObject(@PathParam("type") String type, @PathParam("id") String id, PrismObject object, @QueryParam("options") List options, @Context UriInfo uriInfo, @Context Request request, @Context MessageContext mc){ + public Response addObject(@PathParam("type") String type, @PathParam("id") String id, + PrismObject object, @QueryParam("options") List options, @Context UriInfo uriInfo, + @Context Request request, @Context MessageContext mc){ -LOGGER.info("model rest service for add operation start"); - - - UserType user = (UserType) mc.get("authenticatedUser"); + LOGGER.info("model rest service for add operation start"); - Task task = taskManager.createTaskInstance(); - task.setOwner(user.asPrismObject()); - OperationResult parentResult = new OperationResult("add"); + Task task = taskManager.createTaskInstance("add"); + initRequest(task, mc); + OperationResult parentResult = task.getResult(); Class clazz = ObjectTypes.getClassFromRestType(type); if (!object.getCompileTimeClass().equals(clazz)){ + auditLogout(task); return Response.status(Status.BAD_REQUEST).entity( "Request to add object of type " + object.getCompileTimeClass().getSimpleName() @@ -208,6 +223,7 @@ public Response addObject(@PathParam("type") String type, } String oid; + Response response; try { oid = model.addObject(object, modelExecuteOptions, task, parentResult); LOGGER.info("returned oid : {}", oid ); @@ -215,46 +231,49 @@ public Response addObject(@PathParam("type") String type, URI resourceURI = uriInfo.getAbsolutePathBuilder().path(oid).build(oid); ResponseBuilder builder = clazz.isAssignableFrom(TaskType.class) ? Response.accepted().location(resourceURI) : Response.created(resourceURI); - return builder.build(); + response = builder.build(); } catch (ObjectAlreadyExistsException e) { - return Response.serverError().entity(e.getMessage()).build(); + response = Response.serverError().entity(e.getMessage()).build(); } catch (ObjectNotFoundException e) { - return Response.status(Status.NOT_FOUND).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.NOT_FOUND).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (SchemaException e) { - return Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (ExpressionEvaluationException e) { - return Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (CommunicationException e) { - return Response.status(Status.GATEWAY_TIMEOUT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.GATEWAY_TIMEOUT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (ConfigurationException e) { - return Response.status(Status.BAD_GATEWAY).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.BAD_GATEWAY).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (PolicyViolationException e) { - return Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (SecurityViolationException e) { - return Response.status(Status.FORBIDDEN).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.FORBIDDEN).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } - + parentResult.computeStatus(); + auditLogout(task); + return response; } @DELETE @Path("/{type}/{id}") // @Produces({"text/html", "application/xml"}) - public Response deleteObject(@PathParam("type") String type, @PathParam("id") String id, @QueryParam("options") List options){ + public Response deleteObject(@PathParam("type") String type, @PathParam("id") String id, + @QueryParam("options") List options, @Context MessageContext mc){ LOGGER.info("model rest service for delete operation start"); - Task task = taskManager.createTaskInstance(); - OperationResult parentResult = new OperationResult("delete"); - + Task task = taskManager.createTaskInstance("delete"); + initRequest(task, mc); + OperationResult parentResult = task.getResult(); Class clazz = ObjectTypes.getClassFromRestType(type); - + Response response; try { if (clazz.isAssignableFrom(TaskType.class)){ model.suspendAndDeleteTasks(MiscUtil.createCollection(id), WAIT_FOR_TASK_STOP, true, parentResult); parentResult.computeStatus(); - + auditLogout(task); if (parentResult.isSuccess()){ return Response.noContent().build(); } @@ -266,25 +285,27 @@ public Response deleteObject(@PathParam("type") String type, @PathParam("id") St ModelExecuteOptions modelExecuteOptions = ModelExecuteOptions.fromRestOptions(options); model.deleteObject(clazz, id, modelExecuteOptions, task, parentResult); - return Response.noContent().build(); + response = Response.noContent().build(); } catch (ObjectNotFoundException e) { - return Response.status(Status.NOT_FOUND).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.NOT_FOUND).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (ConsistencyViolationException e) { - return Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (CommunicationException e) { - return Response.status(Status.GATEWAY_TIMEOUT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.GATEWAY_TIMEOUT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (SchemaException e) { - return Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (ConfigurationException e) { - return Response.status(Status.BAD_GATEWAY).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.BAD_GATEWAY).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (PolicyViolationException e) { - return Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (SecurityViolationException e) { - return Response.status(Status.FORBIDDEN).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.FORBIDDEN).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } - + parentResult.computeStatus(); + auditLogout(task); + return response; } @@ -292,67 +313,75 @@ public Response deleteObject(@PathParam("type") String type, @PathParam("id") St @Path("/{type}/{oid}") // @Produces({"text/html", "application/xml"}) public Response modifyObject(@PathParam("type") String type, @PathParam("oid") String oid, - ObjectModificationType modificationType, @QueryParam("options") List options){ + ObjectModificationType modificationType, @QueryParam("options") List options, @Context MessageContext mc) { LOGGER.info("model rest service for modify operation start"); - Task task = taskManager.createTaskInstance(); - OperationResult parentResult = new OperationResult("modifyObject"); - + Task task = taskManager.createTaskInstance("modifyObject"); + initRequest(task, mc); + OperationResult parentResult = task.getResult(); Class clazz = ObjectTypes.getClassFromRestType(type); - - - - + Response response; try { ModelExecuteOptions modelExecuteOptions = ModelExecuteOptions.fromRestOptions(options); Collection modifications = DeltaConvertor.toModifications(modificationType, clazz, prismContext); model.modifyObject(clazz, oid, modifications, modelExecuteOptions, task, parentResult); - return Response.noContent().build(); + response = Response.noContent().build(); } catch (ObjectNotFoundException e) { - return Response.status(Status.NOT_FOUND).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.NOT_FOUND).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (SchemaException e) { - return Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (ExpressionEvaluationException e) { - return Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (CommunicationException e) { - return Response.status(Status.GATEWAY_TIMEOUT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.GATEWAY_TIMEOUT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (ConfigurationException e) { - return Response.status(Status.BAD_GATEWAY).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.BAD_GATEWAY).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (ObjectAlreadyExistsException e) { - return Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (PolicyViolationException e) { - return Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (SecurityViolationException e) { - return Response.status(Status.FORBIDDEN).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.FORBIDDEN).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } + parentResult.computeStatus(); + auditLogout(task); + return response; } @POST @Path("/notifyChange") - public Response notifyChange(ResourceObjectShadowChangeDescriptionType changeDescription, @Context UriInfo uriInfo){ + public Response notifyChange(ResourceObjectShadowChangeDescriptionType changeDescription, + @Context UriInfo uriInfo, @Context MessageContext mc) { LOGGER.info("model rest service for notify change operation start"); - Task task = taskManager.createTaskInstance(); - OperationResult parentResult = new OperationResult("find shadow owner"); + Task task = taskManager.createTaskInstance("notifyChange"); + initRequest(task, mc); + OperationResult parentResult = task.getResult(); + + Response response; try { model.notifyChange(changeDescription, parentResult, task); - return Response.seeOther((uriInfo.getBaseUriBuilder().path(this.getClass(), "getObject").build(ObjectTypes.TASK.getRestType(), task.getOid()))).build(); + response = Response.seeOther((uriInfo.getBaseUriBuilder().path(this.getClass(), "getObject").build(ObjectTypes.TASK.getRestType(), task.getOid()))).build(); } catch (ObjectAlreadyExistsException e) { - return Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (ObjectNotFoundException e) { - return Response.status(Status.NOT_FOUND).entity(e.getMessage()).build(); + response = Response.status(Status.NOT_FOUND).entity(e.getMessage()).build(); } catch (SchemaException e) { - return Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (CommunicationException e) { - return Response.status(Status.GATEWAY_TIMEOUT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.GATEWAY_TIMEOUT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (ConfigurationException e) { - return Response.status(Status.BAD_GATEWAY).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.BAD_GATEWAY).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (SecurityViolationException e) { - return Response.status(Status.FORBIDDEN).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.FORBIDDEN).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } + + parentResult.computeStatus(); + auditLogout(task); + return response; } @@ -360,170 +389,195 @@ public Response notifyChange(ResourceObjectShadowChangeDescriptionType changeDes @GET @Path("/shadows/{oid}/owner") // @Produces({"text/html", "application/xml"}) - public Response findShadowOwner(@PathParam("oid") String shadowOid){ + public Response findShadowOwner(@PathParam("oid") String shadowOid, @Context MessageContext mc){ LOGGER.info("model rest service for find shadow owner operation start"); - Task task = taskManager.createTaskInstance(); - OperationResult parentResult = new OperationResult("find shadow owner"); - + Task task = taskManager.createTaskInstance("find shadow owner"); + initRequest(task, mc); + OperationResult parentResult = task.getResult(); + Response response; try { PrismObject user = model.findShadowOwner(shadowOid, task, parentResult); - return Response.ok().entity(user).build(); + response = Response.ok().entity(user).build(); } catch (ObjectNotFoundException e) { - return Response.status(Status.NOT_FOUND).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.NOT_FOUND).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (SecurityViolationException e) { - return Response.status(Status.FORBIDDEN).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.FORBIDDEN).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (SchemaException e) { - return Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } - + parentResult.computeStatus(); + auditLogout(task); + return response; } @POST @Path("/{type}/search") // @Produces({"text/html", "application/xml"}) - public Response searchObjects(@PathParam("type") String type, QueryType queryType){ + public Response searchObjects(@PathParam("type") String type, QueryType queryType, @Context MessageContext mc){ LOGGER.info("model rest service for find shadow owner operation start"); - Task task = taskManager.createTaskInstance(); - OperationResult parentResult = new OperationResult("find shadow owner"); + Task task = taskManager.createTaskInstance("searchObjects"); + initRequest(task, mc); + OperationResult parentResult = task.getResult(); Class clazz = ObjectTypes.getClassFromRestType(type); + Response response; try { - ObjectQuery query = QueryJaxbConvertor.createObjectQuery(clazz, queryType, prismContext); - -// Collection> options = MiscSchemaUtil.optionsTypeToOptions(optionsType); + ObjectQuery query = QueryJaxbConvertor.createObjectQuery(clazz, queryType, prismContext); - List> objects = model.searchObjects(clazz, query, null, task, parentResult); + List> objects = model.searchObjects(clazz, query, null, task, parentResult); - ObjectListType listType = new ObjectListType(); - for (PrismObject o : objects) { - listType.getObject().add(o.asObjectable()); - } + ObjectListType listType = new ObjectListType(); + for (PrismObject o : objects) { + listType.getObject().add(o.asObjectable()); + } - return Response.ok().entity(listType).build(); + response = Response.ok().entity(listType).build(); } catch (SchemaException e) { - return Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (ObjectNotFoundException e) { - return Response.status(Status.NOT_FOUND).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.NOT_FOUND).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (CommunicationException e) { - return Response.status(Status.GATEWAY_TIMEOUT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.GATEWAY_TIMEOUT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (ConfigurationException e) { - return Response.status(Status.BAD_GATEWAY).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.BAD_GATEWAY).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (SecurityViolationException e) { - return Response.status(Status.FORBIDDEN).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.FORBIDDEN).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } - + parentResult.computeStatus(); + auditLogout(task); + return response; } @POST @Path("/resources/{resourceOid}/import/{objectClass}") // @Produces({"text/html", "application/xml"}) - public Response importFromResource(@PathParam("resourceOid") String resourceOid, @PathParam("objectClass") String objectClass, @Context MessageContext mc, @Context UriInfo uriInfo) - { - + public Response importFromResource(@PathParam("resourceOid") String resourceOid, @PathParam("objectClass") String objectClass, + @Context MessageContext mc, @Context UriInfo uriInfo) { LOGGER.info("model rest service for import from resource operation start"); - UserType user = (UserType) mc.get("authenticatedUser"); - - Task task = taskManager.createTaskInstance(); - task.setOwner(user.asPrismObject()); - - OperationResult parentResult = new OperationResult("find shadow owner"); + Task task = taskManager.createTaskInstance("importFromResource"); + initRequest(task, mc); + OperationResult parentResult = task.getResult(); - QName objClass = new QName(MidPointConstants.NS_RI, objectClass); - + Response response; try { model.importFromResource(resourceOid, objClass, task, parentResult); - return Response.seeOther((uriInfo.getBaseUriBuilder().path(this.getClass(), "getObject").build(ObjectTypes.TASK.getRestType(), task.getOid()))).build(); + response = Response.seeOther((uriInfo.getBaseUriBuilder().path(this.getClass(), "getObject").build(ObjectTypes.TASK.getRestType(), task.getOid()))).build(); } catch (ObjectNotFoundException e) { - return Response.status(Status.NOT_FOUND).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.NOT_FOUND).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (SchemaException e) { - return Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.CONFLICT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (CommunicationException e) { - return Response.status(Status.GATEWAY_TIMEOUT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.GATEWAY_TIMEOUT).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (ConfigurationException e) { - return Response.status(Status.BAD_GATEWAY).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.BAD_GATEWAY).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } catch (SecurityViolationException e) { - return Response.status(Status.FORBIDDEN).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.FORBIDDEN).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } - + parentResult.computeStatus(); + auditLogout(task); + return response; } @POST @Path("/resources/{resourceOid}/test") // @Produces({"text/html", "application/xml"}) - public Response testResource(@PathParam("resourceOid") String resourceOid){ - + public Response testResource(@PathParam("resourceOid") String resourceOid, @Context MessageContext mc) { LOGGER.info("model rest service for test resource operation start"); - Task task = taskManager.createTaskInstance(); + Task task = taskManager.createTaskInstance("testResource"); + initRequest(task, mc); + Response response; try { OperationResult result = model.testResource(resourceOid, task); - return Response.ok(result).build(); + response = Response.ok(result).build(); } catch (ObjectNotFoundException e) { - return Response.status(Status.NOT_FOUND).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); + response = Response.status(Status.NOT_FOUND).entity(e.getMessage()).type(MediaType.TEXT_HTML).build(); } + auditLogout(task); + return response; } @POST @Path("/tasks/{oid}/suspend") - public Response suspendTasks(@PathParam("oid") String taskOid) { - OperationResult parentResult = new OperationResult("suspend task."); + public Response suspendTasks(@PathParam("oid") String taskOid, @Context MessageContext mc) { + + Task task = taskManager.createTaskInstance("suspendTasks"); + initRequest(task, mc); + OperationResult parentResult = task.getResult(); + + Response response; Collection taskOids = MiscUtil.createCollection(taskOid); boolean suspended = model.suspendTasks(taskOids, WAIT_FOR_TASK_STOP, parentResult); parentResult.computeStatus(); if (parentResult.isSuccess()){ - return Response.noContent().build(); - } - - return Response.status(Status.INTERNAL_SERVER_ERROR).entity(parentResult.getMessage()).build(); + response = Response.noContent().build(); + } else { + response = Response.status(Status.INTERNAL_SERVER_ERROR).entity(parentResult.getMessage()).build(); + } + auditLogout(task); + return response; } // @DELETE // @Path("tasks/{oid}/suspend") - public Response suspendAndDeleteTasks(@PathParam("oid") String taskOid) { - OperationResult parentResult = new OperationResult("suspend task."); + public Response suspendAndDeleteTasks(@PathParam("oid") String taskOid, @Context MessageContext mc) { + Task task = taskManager.createTaskInstance("suspendAndDeleteTasks"); + initRequest(task, mc); + OperationResult parentResult = task.getResult(); + + Response response; Collection taskOids = MiscUtil.createCollection(taskOid); model.suspendAndDeleteTasks(taskOids, WAIT_FOR_TASK_STOP, true, parentResult); + parentResult.computeStatus(); if (parentResult.isSuccess()){ - return Response.accepted().build(); - } + response = Response.accepted().build(); + } else { + response = Response.status(Status.INTERNAL_SERVER_ERROR).entity(parentResult.getMessage()).build(); + } - return Response.status(Status.INTERNAL_SERVER_ERROR).entity(parentResult.getMessage()).build(); + auditLogout(task); + return response; } @POST @Path("/tasks/{oid}/resume") - public Response resumeTasks(@PathParam("oid") String taskOid) { - OperationResult parentResult = new OperationResult("suspend task."); + public Response resumeTasks(@PathParam("oid") String taskOid, @Context MessageContext mc) { + Task task = taskManager.createTaskInstance("resumeTasks"); + initRequest(task, mc); + OperationResult parentResult = task.getResult(); + + Response response; Collection taskOids = MiscUtil.createCollection(taskOid); model.resumeTasks(taskOids, parentResult); parentResult.computeStatus(); if (parentResult.isSuccess()){ - return Response.accepted().build(); - } - - return Response.status(Status.INTERNAL_SERVER_ERROR).entity(parentResult.getMessage()).build(); - + response = Response.accepted().build(); + } else { + response = Response.status(Status.INTERNAL_SERVER_ERROR).entity(parentResult.getMessage()).build(); + } + auditLogout(task); + return response; } @@ -597,4 +651,49 @@ private ModelExecuteOptions getOptions(UriInfo uriInfo){ List options = uriInfo.getQueryParameters().get(OPTIONS); return ModelExecuteOptions.fromRestOptions(options); } + + private void initRequest(Task task, MessageContext mc) { + UserType user = (UserType) mc.get("authenticatedUser"); + task.setOwner(user.asPrismObject()); + auditLoginSuccess(task); + } + + private void auditLoginSuccess(Task task) { + AuditEventRecord record = new AuditEventRecord(AuditEventType.CREATE_SESSION, AuditEventStage.REQUEST); + PrismObject owner = task.getOwner(); + if (owner != null) { + record.setInitiator(owner); + PolyStringType name = owner.asObjectable().getName(); + if (name != null) { + record.setParameter(name.getOrig()); + } + } + + record.setChannel(SchemaConstants.CHANNEL_REST_URI); + record.setTimestamp(System.currentTimeMillis()); + record.setSessionIdentifier(task.getTaskIdentifier()); + + record.setOutcome(OperationResultStatus.SUCCESS); + auditService.audit(record, task); + } + + private void auditLogout(Task task) { + AuditEventRecord record = new AuditEventRecord(AuditEventType.TERMINATE_SESSION, AuditEventStage.REQUEST); + PrismObject owner = task.getOwner(); + if (owner != null) { + record.setInitiator(owner); + PolyStringType name = owner.asObjectable().getName(); + if (name != null) { + record.setParameter(name.getOrig()); + } + } + + record.setChannel(SchemaConstants.CHANNEL_REST_URI); + record.setTimestamp(System.currentTimeMillis()); + record.setSessionIdentifier(task.getTaskIdentifier()); + + record.setOutcome(OperationResultStatus.SUCCESS); + + auditService.audit(record, task); + } } diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/MidpointRestAuthenticationHandler.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/MidpointRestAuthenticationHandler.java index fd977d6ad2f..b867555f168 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/MidpointRestAuthenticationHandler.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/MidpointRestAuthenticationHandler.java @@ -25,6 +25,7 @@ import javax.ws.rs.core.Response.StatusType; import javax.ws.rs.core.SecurityContext; +import com.evolveum.prism.xml.ns._public.types_3.PolyStringType; import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType; import org.apache.cxf.configuration.security.AuthorizationPolicy; @@ -34,14 +35,22 @@ import org.apache.cxf.message.Message; import org.springframework.beans.factory.annotation.Autowired; +import com.evolveum.midpoint.audit.api.AuditEventRecord; +import com.evolveum.midpoint.audit.api.AuditEventStage; +import com.evolveum.midpoint.audit.api.AuditEventType; +import com.evolveum.midpoint.audit.api.AuditService; import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.prism.crypto.EncryptionException; import com.evolveum.midpoint.prism.crypto.Protector; +import com.evolveum.midpoint.schema.constants.SchemaConstants; import com.evolveum.midpoint.schema.result.OperationResult; +import com.evolveum.midpoint.schema.result.OperationResultStatus; import com.evolveum.midpoint.security.api.AuthorizationConstants; import com.evolveum.midpoint.security.api.MidPointPrincipal; import com.evolveum.midpoint.security.api.SecurityEnforcer; import com.evolveum.midpoint.security.api.UserProfileService; +import com.evolveum.midpoint.task.api.Task; +import com.evolveum.midpoint.task.api.TaskManager; import com.evolveum.midpoint.util.exception.ObjectNotFoundException; import com.evolveum.midpoint.util.exception.SchemaException; import com.evolveum.midpoint.util.exception.SecurityViolationException; @@ -59,6 +68,12 @@ public class MidpointRestAuthenticationHandler implements ContainerRequestFilter @Autowired(required = true) private Protector protector; + @Autowired(required = true) + private TaskManager taskManager; + + @Autowired(required = true) + private AuditService auditService; + public void handleRequest(Message m, ContainerRequestContext requestCtx) { AuthorizationPolicy policy = (AuthorizationPolicy)m.get(AuthorizationPolicy.class); @@ -77,6 +92,7 @@ public void handleRequest(Message m, ContainerRequestContext requestCtx) { try { principal = userDetails.getPrincipal(username); } catch (ObjectNotFoundException e) { + auditLoginFailure(username); requestCtx.abortWith(Response.status(401).header("WWW-Authenticate", "Basic authentication failed. Cannot authenticate user.").build()); return; } @@ -90,42 +106,49 @@ public void handleRequest(Message m, ContainerRequestContext requestCtx) { String password = policy.getPassword(); - if (password == null){ + if (password == null) { + auditLoginFailure(username); requestCtx.abortWith(Response.status(401).header("WWW-Authenticate", "Basic authentication failed. Cannot authenticate user without password").build()); return; } - if (userToAuthenticate.getCredentials() == null){ + if (userToAuthenticate.getCredentials() == null) { + auditLoginFailure(username); requestCtx.abortWith(Response.status(401).header("WWW-Authenticate", "Basic authentication failed. Cannot authenticate user.").build()); return; } PasswordType pass = userToAuthenticate.getCredentials().getPassword(); - if (pass == null){ + if (pass == null) { + auditLoginFailure(username); requestCtx.abortWith(Response.status(401).header("WWW-Authenticate", "Basic authentication failed. Cannot authenticate user.").build()); return; } ProtectedStringType protectedPass = pass.getValue(); - if (protectedPass.getClearValue() != null){ - if (!password.equals(protectedPass.getClearValue())){ + if (protectedPass.getClearValue() != null) { + if (!password.equals(protectedPass.getClearValue())) { + auditLoginFailure(username); requestCtx.abortWith(Response.status(401).header("WWW-Authenticate", "Basic").build()); return; } - } else if (protectedPass.getEncryptedDataType() != null){ + } else if (protectedPass.getEncryptedDataType() != null) { try{ String decrypted = protector.decryptString(protectedPass); - if (!password.equals(decrypted)){ + if (!password.equals(decrypted)) { + auditLoginFailure(username); requestCtx.abortWith(Response.status(401).header("WWW-Authenticate", "Basic").build()); return; } - } catch (EncryptionException ex){ + } catch (EncryptionException ex) { + auditLoginFailure(username); requestCtx.abortWith(Response.status(401).header("WWW-Authenticate", "Basic").build()); return; } } else { + auditLoginFailure(username); requestCtx.abortWith(Response.status(401).header("WWW-Authenticate", "Basic authentication fialed. Cannot obtain password value.").build()); return; } @@ -139,38 +162,20 @@ public void handleRequest(Message m, ContainerRequestContext requestCtx) { try { securityEnforcer.authorize(AuthorizationConstants.AUTZ_REST_URL, null, null, null, null, null, authorizeResult); } catch (SecurityViolationException e){ + auditLoginFailure(username); requestCtx.abortWith(Response.status(403).header("WWW-Authenticate", "Basic").build()); return; } catch (SchemaException e) { + auditLoginFailure(username); requestCtx.abortWith(Response.status(Status.BAD_REQUEST).build()); return; } - - -// authorizationEvaluator.isAuthorized(principal, action); - -// if (isAuthenticated(username, password)) { -// // let request to continue -// return null; -// } else { -// // authentication failed, request the authetication, add the realm name if needed to the value of WWW-Authenticate -// return Response.status(401).header("WWW-Authenticate", "Basic").build(); -// } } -// -// @Override -// public Response handleResponse(Message m, Response response) { -// securityEnforcer.setupPreAuthenticatedSecurityContext((PrismObject) null); -// return null; -// } @Override public void filter(ContainerRequestContext request, ContainerResponseContext response) throws IOException { - - -// handleResponse(m, ori, response) - + // nothing to do } @Override @@ -178,5 +183,19 @@ public void filter(ContainerRequestContext requestCtx) throws IOException { Message m = JAXRSUtils.getCurrentMessage(); handleRequest(m, requestCtx); } - + + private void auditLoginFailure(String username) { + Task task = taskManager.createTaskInstance(); + task.setChannel(SchemaConstants.CHANNEL_REST_URI); + + AuditEventRecord record = new AuditEventRecord(AuditEventType.CREATE_SESSION, AuditEventStage.REQUEST); + record.setParameter(username); + + record.setChannel(SchemaConstants.CHANNEL_WEB_SERVICE_URI); + record.setTimestamp(System.currentTimeMillis()); + record.setOutcome(OperationResultStatus.FATAL_ERROR); + + auditService.audit(record, task); + } + } From 043a73ace2a0e19a9ab86720fc7f51153963c173 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Wed, 21 Jan 2015 13:03:09 +0100 Subject: [PATCH 041/215] switching to deployment mode before testing --- gui/admin-gui/src/main/webapp/WEB-INF/web.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/admin-gui/src/main/webapp/WEB-INF/web.xml b/gui/admin-gui/src/main/webapp/WEB-INF/web.xml index f1cbaea1ab3..683cdc1b5ee 100644 --- a/gui/admin-gui/src/main/webapp/WEB-INF/web.xml +++ b/gui/admin-gui/src/main/webapp/WEB-INF/web.xml @@ -71,8 +71,8 @@ org.apache.wicket.protocol.http.WicketFilter configuration - development - + + deployment applicationBean From 804fefb06f839e142b54cf2a51b1f58c66a75442 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Wed, 21 Jan 2015 14:30:07 +0100 Subject: [PATCH 042/215] Fixing handling of some runtime exception in resource lists --- .../model/impl/controller/ModelController.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java index a71b7728313..5d5e09dfd6b 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java @@ -1567,7 +1567,20 @@ private void postProcessObjectTypes(Collection objectT private void postProcessObjects(Collection> objects, GetOperationOptions options, OperationResult result) throws SecurityViolationException, SchemaException { for (PrismObject object: objects) { - postProcessObject(object, options, result); + OperationResult subresult = new OperationResult(ModelController.class.getName()+".postProcessObject"); + try { + postProcessObject(object, options, subresult); + } catch (IllegalArgumentException|IllegalStateException|SchemaException|SecurityViolationException e) { + LOGGER.error("Error post-processing object {}: {}", new Object[]{object, e.getMessage(), e}); + OperationResultType fetchResult = object.asObjectable().getFetchResult(); + if (fetchResult == null) { + fetchResult = subresult.createOperationResultType(); + object.asObjectable().setFetchResult(fetchResult); + } else { + fetchResult.getPartialResults().add(subresult.createOperationResultType()); + } + fetchResult.setStatus(OperationResultStatusType.FATAL_ERROR); + } } } From ced8382cef481e5b8c87b4dc21670ca2d1573686 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Wed, 21 Jan 2015 14:40:49 +0100 Subject: [PATCH 043/215] vlvSortOrderingRule in OpenLDAP example --- samples/resources/openldap/openldap-localhost-medium.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/resources/openldap/openldap-localhost-medium.xml b/samples/resources/openldap/openldap-localhost-medium.xml index 162eb11b819..715476d65e0 100644 --- a/samples/resources/openldap/openldap-localhost-medium.xml +++ b/samples/resources/openldap/openldap-localhost-medium.xml @@ -80,6 +80,7 @@ It also contains inbound mappings and definition to enable synchronization. member uid=idm,ou=Administrators,dc=example,dc=com uid + 2.5.13.3 true true From 450369de29ee3c97350cd7f4834ce80aba72a78a Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Wed, 21 Jan 2015 15:45:19 +0100 Subject: [PATCH 044/215] fix attempt for MID-2157. --- .../web/component/wizard/resource/SchemaHandlingStep.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java index 839e3f8d2f7..8100615235c 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java @@ -135,6 +135,11 @@ private SchemaHandlingDto lodObjectTypes(){ if(resourceModel != null && resourceModel.getObject() != null && resourceModel.getObject().asObjectable() != null){ + + if(resourceModel.getObject().asObjectable().getSchemaHandling() == null){ + resourceModel.getObject().asObjectable().setSchemaHandling(new SchemaHandlingType()); + } + SchemaHandlingType schemaHandling = resourceModel.getObject().asObjectable().getSchemaHandling(); ResourceObjectTypeDefinitionTypeDto obj; @@ -789,6 +794,7 @@ private void addObjectTypePerformed(AjaxRequestTarget target){ dto.setSelected(true); model.getObject().setSelected(dto.getObjectType()); model.getObject().getObjectTypeList().add(dto); + resourceModel.getObject().asObjectable().getSchemaHandling().getObjectType().add(objectType); insertEmptyThirdRow(); target.add(getObjectListTable(), getNavigator(), getObjectTypeEditor(), getThirdRowContainer()); } From ebb2935faf36626173dc3276f867cfa853bf97a5 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Wed, 21 Jan 2015 16:00:48 +0100 Subject: [PATCH 045/215] MID-2157 fix for sync step. --- .../web/component/wizard/resource/SynchronizationStep.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.java index a1748bcb59a..4ccac89958d 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.java @@ -37,7 +37,6 @@ import com.evolveum.midpoint.web.component.wizard.resource.component.synchronization.SynchronizationReactionEditor; import com.evolveum.midpoint.web.component.wizard.resource.dto.ObjectSynchronizationTypeDto; import com.evolveum.midpoint.web.component.wizard.resource.dto.ResourceSynchronizationDto; -import com.evolveum.midpoint.web.page.admin.resources.PageResources; import com.evolveum.midpoint.web.session.UserProfileStorage; import com.evolveum.midpoint.web.util.InfoTooltipBehavior; import com.evolveum.midpoint.web.util.WebMiscUtil; @@ -139,6 +138,10 @@ private ResourceSynchronizationDto loadResourceSynchronization(){ if(resourceModel != null && resourceModel.getObject() != null && resourceModel.getObject().asObjectable() != null){ + if(resourceModel.getObject().asObjectable().getSynchronization() == null){ + resourceModel.getObject().asObjectable().setSynchronization(new SynchronizationType()); + } + SynchronizationType sync = resourceModel.getObject().asObjectable().getSynchronization(); ObjectSynchronizationTypeDto obj; @@ -816,6 +819,7 @@ private void addSyncObjectPerformed(AjaxRequestTarget target){ dto.setSelected(true); model.getObject().setSelected(dto.getSyncType()); model.getObject().getObjectSyncList().add(dto); + resourceModel.getObject().asObjectable().getSynchronization().getObjectSynchronization().add(syncObject); insertEmptyThirdRow(); target.add(getSyncObjectTable(), getNavigator(), getSyncObjectEditor(), getThirdRowContainer()); } From 348e8f5ae5e4123c403f50c36f09165647533b1a Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Wed, 21 Jan 2015 19:22:57 +0100 Subject: [PATCH 046/215] Better error message for empty target path in inbound mappings. --- .../model/impl/lens/projector/InboundProcessor.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/InboundProcessor.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/InboundProcessor.java index 0d030073713..adc1e5bd406 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/InboundProcessor.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/InboundProcessor.java @@ -99,7 +99,7 @@ public class InboundProcessor { @Autowired(required = true) private MappingEvaluationHelper mappingEvaluatorHelper; - void processInbound(LensContext context, XMLGregorianCalendar now, Task task, OperationResult result) throws SchemaException, ExpressionEvaluationException, ObjectNotFoundException { + void processInbound(LensContext context, XMLGregorianCalendar now, Task task, OperationResult result) throws SchemaException, ExpressionEvaluationException, ObjectNotFoundException, ConfigurationException { LensFocusContext focusContext = context.getFocusContext(); if (focusContext == null) { LOGGER.trace("Skipping inbound because there is no focus"); @@ -113,7 +113,7 @@ void processInbound(LensContext context, XMLGregorianC processInboundFocal((LensContext)context, task, now, result); } - void processInboundFocal(LensContext context, Task task, XMLGregorianCalendar now, OperationResult result) throws SchemaException, ExpressionEvaluationException, ObjectNotFoundException { + void processInboundFocal(LensContext context, Task task, XMLGregorianCalendar now, OperationResult result) throws SchemaException, ExpressionEvaluationException, ObjectNotFoundException, ConfigurationException { LensFocusContext focusContext = context.getFocusContext(); if (focusContext == null) { LOGGER.trace("Skipping inbound processing because focus is null"); @@ -179,7 +179,7 @@ private boolean isDeleteAccountDelta(LensProjectionContext accountContext) throw private void processInboundExpressionsForAccount(LensContext context, LensProjectionContext accContext, RefinedObjectClassDefinition accountDefinition, ObjectDelta aPrioriDelta, Task task, XMLGregorianCalendar now, OperationResult result) - throws SchemaException, ExpressionEvaluationException, ObjectNotFoundException { + throws SchemaException, ExpressionEvaluationException, ObjectNotFoundException, ConfigurationException { if (aPrioriDelta == null && accContext.getObjectCurrent() == null) { LOGGER.trace("Nothing to process in inbound, both a priori delta and current account were null."); @@ -344,7 +344,7 @@ private boolean checkWeakSkip(Mapping inbound, PrismOb private PropertyDelta evaluateInboundMapping(final LensContext context, MappingType inboundMappingType, QName accountAttributeName, PrismProperty oldAccountProperty, PropertyDelta accountAttributeDelta, - PrismObject focusNew, PrismObject account, ResourceType resource, Task task, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException { + PrismObject focusNew, PrismObject account, ResourceType resource, Task task, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException, ConfigurationException { if (oldAccountProperty != null && oldAccountProperty.hasRaw()) { throw new SystemException("Property "+oldAccountProperty+" has raw parsing state, such property cannot be used in inbound expressions"); @@ -376,6 +376,9 @@ private PropertyDelta evaluateInboundMapping(final } ItemPath targetFocusPropertyPath = mapping.getOutputPath(); + if (targetFocusPropertyPath == null || targetFocusPropertyPath.isEmpty()) { + throw new ConfigurationException("Empty target path in "+mapping.getContextDescription()); + } PrismProperty targetFocusProperty = null; if (focusNew != null) { targetFocusProperty = focusNew.findProperty(targetFocusPropertyPath); From b3f6145368426157201027761f98a5493864c8b1 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Thu, 22 Jan 2015 15:49:42 +0100 Subject: [PATCH 047/215] Some cosmetic changes (message when no sysconfig, avoiding empty deltas when filter reevaluation) --- .../midpoint/model/impl/controller/ModelController.java | 4 +++- .../java/com/evolveum/midpoint/model/impl/util/Utils.java | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java index 5d5e09dfd6b..c8f73a012c5 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java @@ -609,7 +609,9 @@ private void reevaluateSearchFilters(Class objectTypeC if (LOGGER.isTraceEnabled()) { LOGGER.trace("reevaluateSearchFilters found delta: {}", delta.debugDump()); } - cacheRepositoryService.modifyObject(objectTypeClass, oid, delta.getModifications(), result); + if (!delta.isEmpty()) { + cacheRepositoryService.modifyObject(objectTypeClass, oid, delta.getModifications(), result); + } result.recordSuccess(); } catch (SchemaException|ObjectNotFoundException|ObjectAlreadyExistsException|RuntimeException e) { result.recordFatalError("Couldn't reevaluate search filters: "+e.getMessage(), e); diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/util/Utils.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/util/Utils.java index da546394150..57d56ad2c75 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/util/Utils.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/util/Utils.java @@ -528,6 +528,7 @@ public static String getPolicyDesc(ObjectSynchronizationType synchronizationPoli private static long cachedSystemConfigurationRetrieveTimestamp = 0; private static final long CACHED_SYSTEM_CONFIGURATION_TTL = 120000L; // just to avoid stalled data if version is not incremented for any reason + private static final String NO_SYSTEM_CONFIG_MSG = "System configuration object was not found (should not happen in production except for initial repository loading)"; public static PrismObject getSystemConfiguration(RepositoryService repositoryService, OperationResult result) throws SchemaException { PrismObject systemConfiguration = null; if (cachedSystemConfiguration != null && cachedSystemConfigurationRetrieveTimestamp + CACHED_SYSTEM_CONFIGURATION_TTL >= System.currentTimeMillis()) { @@ -536,7 +537,7 @@ public static PrismObject getSystemConfiguration(Reposi currentVersion = repositoryService.getVersion(SystemConfigurationType.class, SystemObjectsType.SYSTEM_CONFIGURATION.value(), result); } catch (ObjectNotFoundException e) { // see below - LOGGER.warn("System configuration object was not found (should not happen!)"); + LOGGER.warn(NO_SYSTEM_CONFIG_MSG); return null; } if (currentVersion != null && currentVersion.equals(cachedSystemConfiguration.getVersion())) { @@ -555,7 +556,7 @@ public static PrismObject getSystemConfiguration(Reposi if (systemConfiguration == null) { // throw new SystemException("System configuration object is null (should not happen!)"); // This should not happen, but it happens in tests. And it is a convenient short cut. Tolerate it for now. - LOGGER.warn("System configuration object is null (should not happen!)"); + LOGGER.warn(NO_SYSTEM_CONFIG_MSG); return null; } cachedSystemConfiguration = systemConfiguration.clone(); From d5e0ce3a677f839d69bc7d32a8d50928490b2572 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Thu, 22 Jan 2015 16:11:28 +0100 Subject: [PATCH 048/215] fixing activation handling in resource wizard --- .../wizard/resource/SchemaHandlingStep.java | 152 ++++++++++++++++++ .../component/wizard/resource/SchemaStep.java | 2 - .../ResourceActivationEditor.java | 116 ++++++++++++- .../ResourceActivationEditor.properties | 6 +- .../wizard/resource/dto/MappingTypeDto.java | 11 +- 5 files changed, 268 insertions(+), 19 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java index 8100615235c..341714f092c 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java @@ -39,6 +39,7 @@ import com.evolveum.midpoint.web.util.WebModelUtils; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; +import com.evolveum.prism.xml.ns._public.types_3.ItemPathType; import org.apache.wicket.AttributeModifier; import org.apache.wicket.Component; import org.apache.wicket.ajax.AjaxRequestTarget; @@ -832,7 +833,158 @@ private void removeEmptyContainers(PrismObject resourcePrism){ } objectType.getAssociation().clear(); objectType.getAssociation().addAll(newAssociationList); + + prepareActivation(objectType.getActivation()); + } + } + } + + private void prepareActivation(ResourceActivationDefinitionType activation){ + if(activation == null){ + return; + } + + if(activation.getAdministrativeStatus() != null){ + ResourceBidirectionalMappingType administrativeStatus = activation.getAdministrativeStatus(); + + List inbounds = administrativeStatus.getInbound(); + List outbounds = administrativeStatus.getOutbound(); + + List newInbounds = prepareActivationMappings(inbounds, + ResourceActivationEditor.ADM_STATUS_IN_SOURCE_DEFAULT, ResourceActivationEditor.ADM_STATUS_IN_TARGET_DEFAULT); + administrativeStatus.getInbound().clear(); + administrativeStatus.getInbound().addAll(newInbounds); + + List newOutbounds = prepareActivationMappings(outbounds, + ResourceActivationEditor.ADM_STATUS_OUT_SOURCE_DEFAULT, ResourceActivationEditor.ADM_STATUS_OUT_TARGET_DEFAULT); + administrativeStatus.getOutbound().clear(); + administrativeStatus.getOutbound().addAll(newOutbounds); + + if(isBidirectionalMappingEmpty(administrativeStatus)){ + activation.setAdministrativeStatus(null); + } + } + + if(activation.getValidTo() != null){ + ResourceBidirectionalMappingType validTo = activation.getValidTo(); + + List inbounds = validTo.getInbound(); + List outbounds = validTo.getOutbound(); + + List newInbounds = prepareActivationMappings(inbounds, + ResourceActivationEditor.VALID_TO_IN_SOURCE_DEFAULT, ResourceActivationEditor.VALID_TO_IN_TARGET_DEFAULT); + validTo.getInbound().clear(); + validTo.getInbound().addAll(newInbounds); + + List newOutbounds = prepareActivationMappings(outbounds, + ResourceActivationEditor.VALID_TO_OUT_SOURCE_DEFAULT, ResourceActivationEditor.VALID_TO_OUT_TARGET_DEFAULT); + validTo.getOutbound().clear(); + validTo.getOutbound().addAll(newOutbounds); + + if(isBidirectionalMappingEmpty(validTo)){ + activation.setValidTo(null); + } + } + + if(activation.getValidFrom() != null){ + ResourceBidirectionalMappingType validFrom = activation.getValidFrom(); + + List inbounds = validFrom.getInbound(); + List outbounds = validFrom.getOutbound(); + + List newInbounds = prepareActivationMappings(inbounds, + ResourceActivationEditor.VALID_FROM_IN_SOURCE_DEFAULT, ResourceActivationEditor.VALID_FROM_IN_TARGET_DEFAULT); + validFrom.getInbound().clear(); + validFrom.getInbound().addAll(newInbounds); + + List newOutbounds = prepareActivationMappings(outbounds, + ResourceActivationEditor.VALID_FROM_OUT_SOURCE_DEFAULT, ResourceActivationEditor.VALID_FROM_OUT_TARGET_DEFAULT); + validFrom.getOutbound().clear(); + validFrom.getOutbound().addAll(newOutbounds); + + if(isBidirectionalMappingEmpty(validFrom)){ + activation.setValidFrom(null); + } + } + + if(activation.getExistence() != null){ + ResourceBidirectionalMappingType existence = activation.getExistence(); + + List inbounds = existence.getInbound(); + List newInbounds = new ArrayList<>(); + + for(MappingType inbound: inbounds){ + if(inbound.equals(new MappingType())){ + continue; + } + + if(inbound.getSource().size() == 0 && compareItemPath(inbound.getSource().get(0).getPath(), ResourceActivationEditor.EXISTENCE_DEFAULT_SOURCE)){ + newInbounds.add(new MappingType()); + continue; + } + + newInbounds.add(inbound); + } + + existence.getInbound().clear(); + existence.getInbound().addAll(newInbounds); + + List outbounds = existence.getOutbound(); + List newOutbounds = existence.getOutbound(); + + for(MappingType outbound: outbounds){ + if(!outbound.equals(new MappingType())){ + newOutbounds.add(outbound); + } + } + + existence.getOutbound().clear(); + existence.getOutbound().addAll(newOutbounds); + + if(isBidirectionalMappingEmpty(existence)){ + activation.setExistence(null); } } } + + private boolean isBidirectionalMappingEmpty(ResourceBidirectionalMappingType mapping){ + return mapping.getFetchStrategy() == null && mapping.getInbound().isEmpty() && mapping.getOutbound().isEmpty(); + + } + + private List prepareActivationMappings(List list, String defaultSource, String defaultTarget){ + List newMappings = new ArrayList<>(); + + for(MappingType mapping: list){ + if(mapping.equals(new MappingType())){ + continue; + } + + if(mapping.getTarget() != null){ + if(compareItemPath(mapping.getTarget().getPath(), defaultTarget)){ + mapping.setTarget(null); + } + } + + if(mapping.getSource().size() == 1){ + if(compareItemPath(mapping.getSource().get(0).getPath(), defaultSource)){ + mapping.getSource().clear(); + } + } + + newMappings.add(mapping); + } + + return newMappings; + } + + private boolean compareItemPath(ItemPathType itemPath, String comparePath){ + if(itemPath != null && itemPath.getItemPath() != null){ + if(comparePath.equals(itemPath.getItemPath().toString())){ + return true; + } + } + + return false; + } } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaStep.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaStep.java index 9de096d8956..726dd0f3d47 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaStep.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaStep.java @@ -20,7 +20,6 @@ import com.evolveum.midpoint.prism.PrismContext; import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.schema.SchemaConstantsGenerated; -import com.evolveum.midpoint.util.DOMUtil; import com.evolveum.midpoint.web.component.AjaxButton; import com.evolveum.midpoint.web.component.TabbedPanel; import com.evolveum.midpoint.web.component.wizard.WizardStep; @@ -35,7 +34,6 @@ import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.model.IModel; import org.apache.wicket.model.StringResourceModel; -import org.w3c.dom.Element; import java.util.ArrayList; import java.util.List; diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceActivationEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceActivationEditor.java index e9bd0cf350f..15fe67d8cac 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceActivationEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceActivationEditor.java @@ -16,6 +16,7 @@ package com.evolveum.midpoint.web.component.wizard.resource.component.schemahandling; +import com.evolveum.midpoint.schema.constants.ExpressionConstants; import com.evolveum.midpoint.util.logging.Trace; import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel; @@ -24,10 +25,8 @@ import com.evolveum.midpoint.web.component.wizard.resource.dto.MappingTypeDto; import com.evolveum.midpoint.web.util.InfoTooltipBehavior; import com.evolveum.midpoint.web.util.WebMiscUtil; -import com.evolveum.midpoint.xml.ns._public.common.common_3.AttributeFetchStrategyType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.MappingType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceActivationDefinitionType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceBidirectionalMappingType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.*; +import com.evolveum.prism.xml.ns._public.types_3.ItemPathType; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; import org.apache.wicket.markup.html.basic.Label; @@ -72,6 +71,23 @@ public class ResourceActivationEditor extends SimplePanel model){ super(id, model); } @@ -84,25 +100,110 @@ public IModel getModel() { activationModel.setObject(new ResourceActivationDefinitionType()); } - ResourceActivationDefinitionType activation = activationModel.getObject(); + if(!isInitialized){ + prepareActivationObject(activationModel.getObject()); + isInitialized = true; + } + + return activationModel; + } + private void prepareActivationObject(ResourceActivationDefinitionType activation){ if(activation.getExistence() == null){ activation.setExistence(new ResourceBidirectionalMappingType()); + } else { + for(MappingType mapping: activation.getExistence().getInbound()){ + if(mapping.equals(new MappingType())){ + MappingSourceDeclarationType source = new MappingSourceDeclarationType(); + source.setPath(new ItemPathType(EXISTENCE_DEFAULT_SOURCE)); + mapping.getSource().add(source); + } + } } if(activation.getAdministrativeStatus() == null){ activation.setAdministrativeStatus(new ResourceBidirectionalMappingType()); + } else { + for(MappingType outbound: activation.getAdministrativeStatus().getOutbound()){ + if(outbound.equals(new MappingType())){ + MappingSourceDeclarationType source = new MappingSourceDeclarationType(); + source.setPath(new ItemPathType(ADM_STATUS_OUT_SOURCE_DEFAULT)); + outbound.getSource().add(source); + + MappingTargetDeclarationType target = new MappingTargetDeclarationType(); + target.setPath(new ItemPathType(ADM_STATUS_OUT_TARGET_DEFAULT)); + outbound.setTarget(target); + } + } + + for(MappingType inbound: activation.getAdministrativeStatus().getInbound()){ + if(inbound.equals(new MappingType())){ + MappingSourceDeclarationType source = new MappingSourceDeclarationType(); + source.setPath(new ItemPathType(ADM_STATUS_IN_SOURCE_DEFAULT)); + inbound.getSource().add(source); + + MappingTargetDeclarationType target = new MappingTargetDeclarationType(); + target.setPath(new ItemPathType(ADM_STATUS_IN_TARGET_DEFAULT)); + inbound.setTarget(target); + } + } } if(activation.getValidFrom() == null){ activation.setValidFrom(new ResourceBidirectionalMappingType()); + } else { + for(MappingType outbound: activation.getValidFrom().getOutbound()){ + if(outbound.equals(new MappingType())){ + MappingSourceDeclarationType source = new MappingSourceDeclarationType(); + source.setPath(new ItemPathType(VALID_FROM_OUT_SOURCE_DEFAULT)); + outbound.getSource().add(source); + + MappingTargetDeclarationType target = new MappingTargetDeclarationType(); + target.setPath(new ItemPathType(VALID_FROM_OUT_TARGET_DEFAULT)); + outbound.setTarget(target); + } + } + + for(MappingType inbound: activation.getValidFrom().getInbound()){ + if(inbound.equals(new MappingType())){ + MappingSourceDeclarationType source = new MappingSourceDeclarationType(); + source.setPath(new ItemPathType(VALID_FROM_IN_SOURCE_DEFAULT)); + inbound.getSource().add(source); + + MappingTargetDeclarationType target = new MappingTargetDeclarationType(); + target.setPath(new ItemPathType(VALID_FROM_IN_TARGET_DEFAULT)); + inbound.setTarget(target); + } + } } if(activation.getValidTo() == null){ activation.setValidTo(new ResourceBidirectionalMappingType()); - } + } else { + for(MappingType outbound: activation.getValidTo().getOutbound()){ + if(outbound.equals(new MappingType())){ + MappingSourceDeclarationType source = new MappingSourceDeclarationType(); + source.setPath(new ItemPathType(VALID_TO_OUT_SOURCE_DEFAULT)); + outbound.getSource().add(source); + + MappingTargetDeclarationType target = new MappingTargetDeclarationType(); + target.setPath(new ItemPathType(VALID_TO_OUT_TARGET_DEFAULT)); + outbound.setTarget(target); + } + } - return activationModel; + for(MappingType inbound: activation.getValidTo().getInbound()){ + if(inbound.equals(new MappingType())){ + MappingSourceDeclarationType source = new MappingSourceDeclarationType(); + source.setPath(new ItemPathType(VALID_TO_IN_SOURCE_DEFAULT)); + inbound.getSource().add(source); + + MappingTargetDeclarationType target = new MappingTargetDeclarationType(); + target.setPath(new ItemPathType(VALID_TO_IN_TARGET_DEFAULT)); + inbound.setTarget(target); + } + } + } } @Override @@ -175,6 +276,7 @@ private void prepareActivationPanelBody(String containerValue, String fetchStrat new PropertyModel(getModel(), containerValue + ".fetchStrategy"), WebMiscUtil.createReadonlyModelFromEnum(AttributeFetchStrategyType.class), new EnumChoiceRenderer(this)); + fetchStrategy.setNullValid(true); add(fetchStrategy); MultiValueTextEditPanel outbound = new MultiValueTextEditPanel(outboundId, diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceActivationEditor.properties b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceActivationEditor.properties index 38cb8ca0707..144d25a3972 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceActivationEditor.properties +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceActivationEditor.properties @@ -22,4 +22,8 @@ ResourceActivationEditor.label.fetchStrategy=Fetch Strategy ResourceActivationEditor.label.outbound=Outbound ResourceActivationEditor.label.inbound=Inbound AttributeFetchStrategyType.IMPLICIT=Implicit -AttributeFetchStrategyType.EXPLICIT=Explicit \ No newline at end of file +AttributeFetchStrategyType.EXPLICIT=Explicit +existenceFetchStrategy.nullValid=Choose One +admStatusFetchStrategy.nullValid=Choose One +validFromFetchStrategy.nullValid=Choose One +validToFetchStrategy.nullValid=Choose One \ No newline at end of file diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/dto/MappingTypeDto.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/dto/MappingTypeDto.java index e5ed0bdbaa3..5069023d286 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/dto/MappingTypeDto.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/dto/MappingTypeDto.java @@ -163,17 +163,10 @@ public MappingType prepareDtoToSave(PrismContext prismContext) throws SchemaExce mappingObject.setTarget(mappingTarget); } - List existingSources = new ArrayList<>(); - for(MappingSourceDeclarationType s: mappingObject.getSource()){ - if(s.getPath() != null && s.getPath().getItemPath() != null){ - existingSources.add(s.getPath().getItemPath().toString()); - } - } - + mappingObject.getSource().clear(); List mappingSourceList = new ArrayList<>(); for(String s: source){ - - if(s == null || existingSources.contains(s)){ + if(s == null){ continue; } From c45c59fc416223f09138fe276e1fc9ee22928d86 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Thu, 22 Jan 2015 21:30:26 +0100 Subject: [PATCH 049/215] fix for MID-2159 --- .../web/component/wizard/resource/SchemaHandlingStep.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java index 341714f092c..d7cb4f9d83f 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java @@ -393,7 +393,9 @@ public String getObject() { @Override protected ResourceAttributeDefinitionType createNewEmptyItem(){ - return new ResourceAttributeDefinitionType(); + ResourceAttributeDefinitionType attribute = new ResourceAttributeDefinitionType(); + attribute.setTolerant(true); + return attribute; } @Override From 57c016903ed0a7e740fd01f48207efb712ed0d9d Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Thu, 22 Jan 2015 22:07:54 +0100 Subject: [PATCH 050/215] fix for MID-2158 --- .../web/component/wizard/WizardUtil.java | 37 +++++++++++++++++++ .../wizard/resource/SchemaHandlingStep.java | 7 ++-- .../ResourceActivationEditor.java | 5 ++- .../ResourceAssociationEditor.java | 3 +- .../ResourceAttributeEditor.java | 3 +- .../ResourceCredentialsEditor.java | 3 +- .../wizard/resource/dto/MappingTypeDto.java | 4 +- 7 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/WizardUtil.java diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/WizardUtil.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/WizardUtil.java new file mode 100644 index 00000000000..6979f080f6b --- /dev/null +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/WizardUtil.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2010-2014 Evolveum + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.evolveum.midpoint.web.component.wizard; + +import com.evolveum.midpoint.xml.ns._public.common.common_3.MappingType; + +/** + * @author shood + * */ +public class WizardUtil { + + public static MappingType createEmptyMapping(){ + MappingType mapping = new MappingType(); + mapping.setAuthoritative(true); + + return mapping; + } + + public static boolean isEmptyMapping(MappingType toCompare){ + return createEmptyMapping().equals(toCompare); + + } +} diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java index d7cb4f9d83f..15f3d97fcfe 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java @@ -30,6 +30,7 @@ import com.evolveum.midpoint.web.component.util.LoadableModel; import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour; import com.evolveum.midpoint.web.component.wizard.WizardStep; +import com.evolveum.midpoint.web.component.wizard.WizardUtil; import com.evolveum.midpoint.web.component.wizard.resource.component.schemahandling.*; import com.evolveum.midpoint.web.component.wizard.resource.dto.ResourceObjectTypeDefinitionTypeDto; import com.evolveum.midpoint.web.component.wizard.resource.dto.SchemaHandlingDto; @@ -916,7 +917,7 @@ private void prepareActivation(ResourceActivationDefinitionType activation){ List newInbounds = new ArrayList<>(); for(MappingType inbound: inbounds){ - if(inbound.equals(new MappingType())){ + if(WizardUtil.isEmptyMapping(inbound)){ continue; } @@ -935,7 +936,7 @@ private void prepareActivation(ResourceActivationDefinitionType activation){ List newOutbounds = existence.getOutbound(); for(MappingType outbound: outbounds){ - if(!outbound.equals(new MappingType())){ + if(!WizardUtil.isEmptyMapping(outbound)){ newOutbounds.add(outbound); } } @@ -958,7 +959,7 @@ private List prepareActivationMappings(List list, Stri List newMappings = new ArrayList<>(); for(MappingType mapping: list){ - if(mapping.equals(new MappingType())){ + if(WizardUtil.isEmptyMapping(mapping)){ continue; } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceActivationEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceActivationEditor.java index 15fe67d8cac..82888413f68 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceActivationEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceActivationEditor.java @@ -21,6 +21,7 @@ import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel; import com.evolveum.midpoint.web.component.util.SimplePanel; +import com.evolveum.midpoint.web.component.wizard.WizardUtil; import com.evolveum.midpoint.web.component.wizard.resource.component.schemahandling.modal.MappingEditorDialog; import com.evolveum.midpoint.web.component.wizard.resource.dto.MappingTypeDto; import com.evolveum.midpoint.web.util.InfoTooltipBehavior; @@ -296,7 +297,7 @@ public String getObject() { @Override protected MappingType createNewEmptyItem(){ - return new MappingType(); + return WizardUtil.createEmptyMapping(); } @Override @@ -323,7 +324,7 @@ public String getObject() { @Override protected MappingType createNewEmptyItem(){ - return new MappingType(); + return WizardUtil.createEmptyMapping(); } @Override diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java index 582e740fe09..959952c8676 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java @@ -29,6 +29,7 @@ import com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextPanel; import com.evolveum.midpoint.web.component.input.QNameEditorPanel; import com.evolveum.midpoint.web.component.util.SimplePanel; +import com.evolveum.midpoint.web.component.wizard.WizardUtil; import com.evolveum.midpoint.web.component.wizard.resource.component.schemahandling.modal.LimitationsEditorDialog; import com.evolveum.midpoint.web.component.wizard.resource.component.schemahandling.modal.MappingEditorDialog; import com.evolveum.midpoint.web.component.wizard.resource.dto.MappingTypeDto; @@ -308,7 +309,7 @@ public String getObject() { @Override protected MappingType createNewEmptyItem(){ - return new MappingType(); + return WizardUtil.createEmptyMapping(); } @Override diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java index 084e4e49dc8..8221751ff8d 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java @@ -28,6 +28,7 @@ import com.evolveum.midpoint.web.component.input.QNameEditorPanel; import com.evolveum.midpoint.web.component.util.SimplePanel; import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour; +import com.evolveum.midpoint.web.component.wizard.WizardUtil; import com.evolveum.midpoint.web.component.wizard.resource.component.schemahandling.modal.LimitationsEditorDialog; import com.evolveum.midpoint.web.component.wizard.resource.component.schemahandling.modal.MappingEditorDialog; import com.evolveum.midpoint.web.component.wizard.resource.dto.MappingTypeDto; @@ -296,7 +297,7 @@ public String getObject() { @Override protected MappingType createNewEmptyItem(){ - return new MappingType(); + return WizardUtil.createEmptyMapping(); } @Override diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceCredentialsEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceCredentialsEditor.java index 530b3956426..4b511715fcc 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceCredentialsEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceCredentialsEditor.java @@ -25,6 +25,7 @@ import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel; import com.evolveum.midpoint.web.component.util.SimplePanel; +import com.evolveum.midpoint.web.component.wizard.WizardUtil; import com.evolveum.midpoint.web.component.wizard.resource.component.schemahandling.modal.MappingEditorDialog; import com.evolveum.midpoint.web.component.wizard.resource.dto.MappingTypeDto; import com.evolveum.midpoint.web.util.InfoTooltipBehavior; @@ -140,7 +141,7 @@ public String getObject() { @Override protected MappingType createNewEmptyItem(){ - return new MappingType(); + return WizardUtil.createEmptyMapping(); } @Override diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/dto/MappingTypeDto.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/dto/MappingTypeDto.java index 5069023d286..ced1dd3d3e3 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/dto/MappingTypeDto.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/dto/MappingTypeDto.java @@ -73,7 +73,9 @@ public MappingTypeDto(MappingType mapping, PrismContext prismContext){ } if(mapping == null){ - mappingObject = new MappingType(); + MappingType newMapping = new MappingType(); + newMapping.setAuthoritative(true); + mappingObject = newMapping; } else { mappingObject = mapping; } From 77c337ad214921ec9278b58af594f6842e5a7690 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Sat, 24 Jan 2015 17:19:03 +0100 Subject: [PATCH 051/215] Fixed a typo. --- samples/resources/ad/ad-resource-advanced-sync.xml | 2 +- samples/resources/dsee/odsee-localhost-advanced-sync.xml | 2 +- samples/resources/opendj/opendj-localhost-medium.xml | 2 +- .../opendj/opendj-localhost-resource-sync-advanced.xml | 2 +- ...pendj-localhost-resource-sync-no-extension-advanced-test.xml | 2 +- .../opendj-localhost-resource-sync-no-extension-advanced.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/resources/ad/ad-resource-advanced-sync.xml b/samples/resources/ad/ad-resource-advanced-sync.xml index e0db050ca8a..03c0ce26801 100644 --- a/samples/resources/ad/ad-resource-advanced-sync.xml +++ b/samples/resources/ad/ad-resource-advanced-sync.xml @@ -408,7 +408,7 @@ to "false". The only way of resetting the flag is to change user's password. Synchronization: Active Directory - Definition of a live sychnronization task. It will poll changelog and pull in changes + Definition of a live synchronization task. It will poll changelog and pull in changes 91919191-76e0-59e2-86d6-444f02d3ffff diff --git a/samples/resources/dsee/odsee-localhost-advanced-sync.xml b/samples/resources/dsee/odsee-localhost-advanced-sync.xml index 08ff115e4f3..6bd59a02dff 100644 --- a/samples/resources/dsee/odsee-localhost-advanced-sync.xml +++ b/samples/resources/dsee/odsee-localhost-advanced-sync.xml @@ -382,7 +382,7 @@ object. Synchronization: Embedded Test Oracle DSEE7 - Definition of a live sychnronization task. It will poll changelog and pull in changes + Definition of a live synchronization task. It will poll changelog and pull in changes 91919191-76e0-59e2-86d6-3d4f02d3afaf diff --git a/samples/resources/opendj/opendj-localhost-medium.xml b/samples/resources/opendj/opendj-localhost-medium.xml index 5d42ca57a22..8a4da5dd5af 100644 --- a/samples/resources/opendj/opendj-localhost-medium.xml +++ b/samples/resources/opendj/opendj-localhost-medium.xml @@ -517,7 +517,7 @@ It also contains inbound mappings and definition to enable synchronization. Synchronization: Embedded Test OpenDJ (no extensions schema) - Definition of a live sychnronization task. It will poll changelog and pull in changes + Definition of a live synchronization task. It will poll changelog and pull in changes 91919191-76e0-59e2-86d6-3d4f02d3ffff diff --git a/samples/resources/opendj/opendj-localhost-resource-sync-advanced.xml b/samples/resources/opendj/opendj-localhost-resource-sync-advanced.xml index 98fd3d7c295..b39a7cd9202 100644 --- a/samples/resources/opendj/opendj-localhost-resource-sync-advanced.xml +++ b/samples/resources/opendj/opendj-localhost-resource-sync-advanced.xml @@ -613,7 +613,7 @@ object. Synchronization: Embedded Test OpenDJ - Definition of a live sychnronization task. It will poll changelog and pull in changes + Definition of a live synchronization task. It will poll changelog and pull in changes 91919191-76e0-59e2-86d6-3d4f02d3ffff diff --git a/samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced-test.xml b/samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced-test.xml index 0a7544b2e64..3ae009b32a2 100644 --- a/samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced-test.xml +++ b/samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced-test.xml @@ -594,7 +594,7 @@ object. Synchronization: Embedded Test OpenDJ (no extensions schema) test - Definition of a live sychnronization task. It will poll changelog and pull in changes + Definition of a live synchronization task. It will poll changelog and pull in changes 91919191-76e0-59e2-86d6-3d4f02d3ffff diff --git a/samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced.xml b/samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced.xml index f358296b2ad..50e2cb841f4 100644 --- a/samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced.xml +++ b/samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced.xml @@ -637,7 +637,7 @@ object. Synchronization: Embedded Test OpenDJ (no extensions schema) - Definition of a live sychnronization task. It will poll changelog and pull in changes + Definition of a live synchronization task. It will poll changelog and pull in changes 91919191-76e0-59e2-86d6-3d4f02d3ffff From 61e14cbffaa20f4ecb32005e224da565f37466c2 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Mon, 26 Jan 2015 10:34:02 +0100 Subject: [PATCH 052/215] Disabling filtered results handler for LDAP samples (except for those that have caseInsensitiveFilter=true) --- .../resources/dsee/odsee-localhost-advanced-nosync.xml | 3 +++ samples/resources/dsee/odsee-localhost-advanced-sync.xml | 4 ++++ samples/resources/opendj/opendj-localhost-basic.xml | 7 +++++-- samples/resources/opendj/opendj-localhost-medium.xml | 8 +++++--- .../opendj/opendj-localhost-resource-sync-advanced.xml | 8 +++++--- ...dj-localhost-resource-sync-no-extension-advanced-2.xml | 8 +++++--- ...localhost-resource-sync-no-extension-advanced-test.xml | 5 ++++- ...endj-localhost-resource-sync-no-extension-advanced.xml | 3 +++ samples/resources/opendj/opendj-resource-genericsync.xml | 3 +++ 9 files changed, 37 insertions(+), 12 deletions(-) diff --git a/samples/resources/dsee/odsee-localhost-advanced-nosync.xml b/samples/resources/dsee/odsee-localhost-advanced-nosync.xml index e17c2a37558..c05d3a60cb7 100644 --- a/samples/resources/dsee/odsee-localhost-advanced-nosync.xml +++ b/samples/resources/dsee/odsee-localhost-advanced-nosync.xml @@ -87,6 +87,9 @@ object. 100 + + false + diff --git a/samples/resources/dsee/odsee-localhost-advanced-sync.xml b/samples/resources/dsee/odsee-localhost-advanced-sync.xml index 6bd59a02dff..a0b279e4ff3 100644 --- a/samples/resources/dsee/odsee-localhost-advanced-sync.xml +++ b/samples/resources/dsee/odsee-localhost-advanced-sync.xml @@ -90,6 +90,10 @@ object. 100 + + false + + diff --git a/samples/resources/opendj/opendj-localhost-basic.xml b/samples/resources/opendj/opendj-localhost-basic.xml index 4bfa187a786..6828972391b 100644 --- a/samples/resources/opendj/opendj-localhost-basic.xml +++ b/samples/resources/opendj/opendj-localhost-basic.xml @@ -64,8 +64,11 @@ This resource definition contains only the very basic definitions for midPoint t uid true - - + + false + + + - + 1389 @@ -83,8 +83,10 @@ It also contains inbound mappings and definition to enable synchronization. true true - - + + false + + - + 1389 @@ -107,8 +107,10 @@ object. -1 -1 - - + + false + + - + 1389 @@ -107,8 +107,10 @@ object. -1 -1 - - + + false + + - + 1389 @@ -107,6 +107,9 @@ object. -1 -1 + + false + diff --git a/samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced.xml b/samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced.xml index 50e2cb841f4..849bb2b963e 100644 --- a/samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced.xml +++ b/samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced.xml @@ -107,6 +107,9 @@ object. -1 -1 + + false + diff --git a/samples/resources/opendj/opendj-resource-genericsync.xml b/samples/resources/opendj/opendj-resource-genericsync.xml index a970e2e86ac..840f7c61009 100644 --- a/samples/resources/opendj/opendj-resource-genericsync.xml +++ b/samples/resources/opendj/opendj-resource-genericsync.xml @@ -55,6 +55,9 @@ uid ds-pwp-account-disabled + + false + From 6be84c06f0f5b82254669f50d936d427624128d7 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Mon, 26 Jan 2015 10:34:17 +0100 Subject: [PATCH 053/215] Some unimportant fixes --- .../impl/sync/CorrelationConfirmationEvaluator.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/sync/CorrelationConfirmationEvaluator.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/sync/CorrelationConfirmationEvaluator.java index 1c050b261fb..427c6ccd5a6 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/sync/CorrelationConfirmationEvaluator.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/sync/CorrelationConfirmationEvaluator.java @@ -181,7 +181,7 @@ private List> findUsersByCorrelationRule(Cl return null; } - ObjectQuery q = null; + ObjectQuery q; try { q = QueryJaxbConvertor.createObjectQuery(focusType, conditionalFilter, prismContext); q = updateFilterWithAccountValues(currentShadow, resourceType, configurationType, q, "Correlation expression", task, result); @@ -248,11 +248,13 @@ private boolean matchUserCorrelationRule(Class focusTyp return false; } - ObjectQuery q = null; + ObjectQuery q; try { q = QueryJaxbConvertor.createObjectQuery(focusType, conditionalFilter, prismContext); q = updateFilterWithAccountValues(currentShadow.asObjectable(), resourceType, configurationType, q, "Correlation expression", task, result); - LOGGER.debug("Start matching user {} with correlation eqpression {}", userType, q.debugDump()); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Start matching user {} with correlation expression {}", userType, q != null ? q.debugDump() : "(null)"); + } if (q == null) { // Null is OK here, it means that the value in the filter // evaluated @@ -354,7 +356,7 @@ private ObjectQuery updateFilterWithAccountValues(ShadowType currentShadow, Reso ObjectQuery origQuery, String shortDesc, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException { if (origQuery.getFilter() == null) { - LOGGER.trace("No filter provivided, skipping updating filter"); + LOGGER.trace("No filter provided, skipping updating filter"); return origQuery; } From cc436791343a8a20401c623e78c71363a309633f Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Mon, 26 Jan 2015 10:58:19 +0100 Subject: [PATCH 054/215] MR case ignore for icfs:name and ri:uid for OpenDJ sample --- .../opendj/opendj-localhost-resource-sync-advanced.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/samples/resources/opendj/opendj-localhost-resource-sync-advanced.xml b/samples/resources/opendj/opendj-localhost-resource-sync-advanced.xml index e5b3fe613ea..482d39aa6dc 100644 --- a/samples/resources/opendj/opendj-localhost-resource-sync-advanced.xml +++ b/samples/resources/opendj/opendj-localhost-resource-sync-advanced.xml @@ -37,7 +37,8 @@ object. xmlns:icfc="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3" xmlns:my="http://whatever.com/my" xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" - xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"> + xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" + xmlns:mr="http://prism.evolveum.com/xml/ns/public/matching-rule-3"> @@ -268,6 +269,7 @@ object. icfs:name Distinguished Name + mr:stringIgnoreCase 0 @@ -359,6 +361,7 @@ object. ri:uid Login Name + mr:stringIgnoreCase true From 9505f26c0f1307f243e1c32b36078aa63cfa1ad9 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Mon, 26 Jan 2015 13:01:25 +0100 Subject: [PATCH 055/215] fix for MID-2166 - upper links in RW now behave as they should before. --- .../midpoint/web/component/wizard/Wizard.java | 10 ++++-- .../web/component/wizard/WizardSteps.html | 6 +++- .../web/component/wizard/WizardSteps.java | 34 +++++++++++-------- .../resource/component/SchemaListPanel.java | 2 +- 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/Wizard.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/Wizard.java index 505672c6d0b..56977b8e1f0 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/Wizard.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/Wizard.java @@ -203,10 +203,14 @@ private void changeStep(AjaxRequestTarget target, WizardStepDto dto){ } } - Wizard.this.onActiveStepChanged(newStep); WizardModel model = (WizardModel) getWizardModel(); - model.setActiveStep(newStep); - getWizardModel().getActiveStep().applyState(); + IWizardStep currentStep = model.getActiveStep(); + currentStep.applyState(); + + if(currentStep.isComplete()){ + model.setActiveStep(newStep); + onActiveStepChanged(newStep); + } target.add(this); } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/WizardSteps.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/WizardSteps.html index acf97fbf8bc..2135b1e4327 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/WizardSteps.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/WizardSteps.html @@ -20,7 +20,11 @@ diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.java index 4817cb2b031..ab17b9bdb7f 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.java @@ -47,7 +47,7 @@ public class PageInternals extends PageAdminConfiguration { @SpringBean(name = "clock") private Clock clock; - private IModel model; + private LoadableModel model; private IModel internalsModel; public PageInternals() { @@ -84,6 +84,20 @@ protected void onError(AjaxRequestTarget target, Form form) { }; mainForm.add(saveButton); + AjaxSubmitButton resetButton = new AjaxSubmitButton("reset", createStringResource("PageInternals.button.resetTimeChange")) { + + @Override + protected void onSubmit(AjaxRequestTarget target, Form form) { + resetPerformed(target); + } + + @Override + protected void onError(AjaxRequestTarget target, Form form) { + target.add(getFeedbackPanel()); + } + }; + mainForm.add(resetButton); + initDebugUtilForm(); initInternalsConfigForm(); } @@ -164,4 +178,14 @@ private void savePerformed(AjaxRequestTarget target) { target.add(getFeedbackPanel()); } + + private void resetPerformed(AjaxRequestTarget target) { + OperationResult result = new OperationResult(PageInternals.class.getName() + ".changeTimeReset"); + clock.resetOverride(); + model.reset(); + result.recordSuccess(); + showResult(result); + target.add(this); + target.add(getFeedbackPanel()); + } } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.properties b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.properties index d3b3413e580..5dfe7101a37 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.properties +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.properties @@ -16,6 +16,7 @@ page.title=Internals configuration PageInternals.offset=Offset PageInternals.button.changeTime=Change time +PageInternals.button.resetTimeChange=Reset to using system time PageInternals.title.internalsConfig=Internals config PageInternals.title.debugUtil=Debug util PageInternals.title.timeChange=Time change diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/security/MidPointApplication.properties b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/security/MidPointApplication.properties index f49e63ed45d..3d0e18d9c13 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/security/MidPointApplication.properties +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/security/MidPointApplication.properties @@ -463,6 +463,7 @@ operation.com.evolveum.midpoint.web.page.admin.configuration.PageImportObject.im operation.com.evolveum.midpoint.web.page.admin.configuration.PageLogging.loadLoggingConfiguration=Load logging configuration (Gui) operation.com.evolveum.midpoint.web.page.admin.configuration.PageLogging.updateLoggingConfiguration=Update logging configuration (Gui) operation.com.evolveum.midpoint.web.page.admin.configuration.PageInternals.changeTime=Change time (Gui) +operation.com.evolveum.midpoint.web.page.admin.configuration.PageInternals.changeTimeReset=Change time - reset (Gui) LoggingComponentType.ALL=All LoggingComponentType.MODEL=Model logger From ac29dd3ce0ef16c38da88ad2d65305bb10da6c61 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Mon, 26 Jan 2015 19:16:34 +0100 Subject: [PATCH 060/215] A couple of typos and logging improvements --- .../src/main/resources/xml/ns/public/common/common-3.xsd | 4 ++-- .../com/evolveum/midpoint/provisioning/impl/ShadowCache.java | 3 +++ .../evolveum/midpoint/provisioning/impl/ShadowManager.java | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd index b89a083aa6a..5840e27173e 100644 --- a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd +++ b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd @@ -2246,14 +2246,14 @@ - Name or (preferrably) immutable identifier of organization that the user belongs to. + Name or (preferably) immutable identifier of organization that the user belongs to. The format is deployment-specific. This property together with organizationalUnit may be used to provide easy-to-use data about organizational membership of the user. This is multi-valued property to allow membership of a user to several organizations. Please note that midPoint does not maintain ordering in multi-value properties therefore this is not usable to model a complex - organization hierachies. Use OrgType instead. + organization hierarchies. Use OrgType instead. Organization diff --git a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCache.java b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCache.java index e17a14611e8..c731260a94a 100644 --- a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCache.java +++ b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCache.java @@ -1277,6 +1277,9 @@ void processChange(ResourceType resourceType, RefinedObjectClassDefinition refin // FIXME: hack. the object delta must have oid specified. if (change.getObjectDelta() != null && change.getObjectDelta().getOid() == null) { + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("No OID present, assuming delta of type DELETE; change = {}\nobjectDelta: {}", change, change.getObjectDelta().debugDump()); + } ObjectDelta objDelta = new ObjectDelta(ShadowType.class, ChangeType.DELETE, prismContext); change.setObjectDelta(objDelta); change.getObjectDelta().setOid(oldShadow.getOid()); diff --git a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowManager.java b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowManager.java index 0974c005352..d54961f95cb 100644 --- a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowManager.java +++ b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowManager.java @@ -462,7 +462,7 @@ private ObjectQuery createSearchShadowQuery(Collection> ide } if (conditions.size() < 1) { - throw new SchemaException("Identifier not specifier. Cannot create search query by identifier."); + throw new SchemaException("Identifier not specified. Cannot create search query by identifier."); } RefFilter resourceRefFilter = RefFilter.createReferenceEqual(ShadowType.F_RESOURCE_REF, ShadowType.class, resource); From bc8f7eb76a172151004b69e9d8717adcd334c81c Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Mon, 26 Jan 2015 20:17:57 +0100 Subject: [PATCH 061/215] fix for MID-2033, issue 20 - these strange objectClass values no longer generate --- .../MultiValueAutoCompleteTextPanel.java | 11 ++-- .../wizard/resource/SynchronizationStep.java | 54 ++++++++++++------- .../dto/ResourceSynchronizationDto.java | 4 ++ 3 files changed, 47 insertions(+), 22 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueAutoCompleteTextPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueAutoCompleteTextPanel.java index 784fb251dec..cf31e35e455 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueAutoCompleteTextPanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueAutoCompleteTextPanel.java @@ -19,6 +19,7 @@ import com.evolveum.midpoint.web.component.util.SimplePanel; import org.apache.wicket.AttributeModifier; import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; import org.apache.wicket.ajax.markup.html.AjaxLink; import org.apache.wicket.behavior.AttributeAppender; import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteSettings; @@ -77,7 +78,6 @@ private void initLayout(final boolean inputEnabled, boolean prepareModel){ @Override protected void populateItem(final ListItem item) { - AutoCompleteSettings autoCompleteSettings = new AutoCompleteSettings(); autoCompleteSettings.setShowListOnEmptyInput(true); AutoCompleteTextField autoCompleteEditor = new AutoCompleteTextField(ID_TEXT, @@ -85,10 +85,15 @@ protected void populateItem(final ListItem item) { @Override protected Iterator getChoices(String input) { - return createAutocompleteObjectList(input); + return createAutoCompleteObjectList(input); } }; autoCompleteEditor.add(createAutoCompleteValidator()); + autoCompleteEditor.add(new AjaxFormComponentUpdatingBehavior("onchange") { + + @Override + protected void onUpdate(AjaxRequestTarget target) {} + }); item.add(autoCompleteEditor); autoCompleteEditor.add(AttributeAppender.replace("placeholder", createEmptyItemPlaceholder())); @@ -106,7 +111,7 @@ protected Iterator getChoices(String input) { add(repeater); } - private Iterator createAutocompleteObjectList(String input) { + private Iterator createAutoCompleteObjectList(String input) { List list = createObjectList(); List choices = new ArrayList<>(AUTO_COMPLETE_LIST_SIZE); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.java index 4ccac89958d..203d5e7c95f 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.java @@ -169,7 +169,6 @@ private ResourceSynchronizationDto loadResourceSynchronization(){ dto.setSelected(createPlaceholderObjectType()); dto.setObjectSyncList(list); dto.setObjectClassList(loadResourceObjectClassList(resourceModel, LOGGER, getString("SynchronizationStep.message.errorLoadingObjectSyncList"))); - return dto; } @@ -318,17 +317,7 @@ protected String load() { @Override protected IModel createTextModel(final IModel model) { - return new Model(){ - - @Override - public String getObject(){ - if(model.getObject() != null){ - return model.getObject().getLocalPart(); - } - - return " - "; - } - }; + return new PropertyModel<>(model, "localPart"); } @Override @@ -749,6 +738,8 @@ private void savePerformed(){ ModelService modelService = getPageBase().getModelService(); ObjectDelta delta; + prepareResourceToSave(newResource.asObjectable()); + try{ oldResource = WebModelUtils.loadObject(ResourceType.class, newResource.getOid(), result, getPageBase()); if(oldResource != null){ @@ -775,6 +766,35 @@ private void savePerformed(){ } } + private void prepareResourceToSave(ResourceType resource){ + if(resource.getSynchronization() == null){ + return; + } + + if(model == null || model.getObject() == null){ + return; + } + + ResourceSynchronizationDto dto = model.getObject(); + + SynchronizationType sync = resource.getSynchronization(); + for(ObjectSynchronizationType syncObject: sync.getObjectSynchronization()){ + List newObjectClassList = new ArrayList<>(); + + for(QName objectClass: syncObject.getObjectClass()){ + for(QName objClazz: dto.getObjectClassList()){ + if(objClazz.getLocalPart().equals(objectClass.getLocalPart())){ + QName newObjectClass = new QName(objClazz.getNamespaceURI(), objClazz.getLocalPart()); + newObjectClassList.add(newObjectClass); + } + } + } + + syncObject.getObjectClass().clear(); + syncObject.getObjectClass().addAll(newObjectClassList); + } + } + private void editSyncObjectPerformed(AjaxRequestTarget target, ObjectSynchronizationTypeDto syncObject){ resetSelected(); syncObject.setSelected(true); @@ -785,22 +805,18 @@ private void editSyncObjectPerformed(AjaxRequestTarget target, ObjectSynchroniza } private void deleteSyncObjectPerformed(AjaxRequestTarget target, ObjectSynchronizationTypeDto syncObject){ - ArrayList list = (ArrayList)model.getObject().getObjectSyncList(); + ArrayList list = (ArrayList) model.getObject().getObjectSyncList(); list.remove(syncObject); if(syncObject.isSelected()){ - model.getObject().setSelected(createPlaceholderObjectType()); insertEmptyThirdRow(); target.add(getThirdRowContainer()); } if(list.isEmpty()){ - ObjectSynchronizationType newObj = new ObjectSynchronizationType(); - newObj.setName(getString("SynchronizationStep.label.newObjectType")); - ObjectSynchronizationTypeDto dto = new ObjectSynchronizationTypeDto(newObj); - dto.setSelected(true); - list.add(dto); + insertEmptyThirdRow(); + target.add(getThirdRowContainer()); } target.add(getSyncObjectEditor(), getSyncObjectTable(), getNavigator()); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/dto/ResourceSynchronizationDto.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/dto/ResourceSynchronizationDto.java index d25700f3dfd..4e6329dc645 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/dto/ResourceSynchronizationDto.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/dto/ResourceSynchronizationDto.java @@ -56,6 +56,10 @@ public void setSelected(ObjectSynchronizationType selected) { } public List getObjectClassList() { + if(objectClassList == null){ + objectClassList = new ArrayList<>(); + } + return objectClassList; } From ce5b75b738e47883e0e8f433b994214cf1758fd7 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Mon, 26 Jan 2015 23:51:21 +0100 Subject: [PATCH 062/215] Fixing samples. --- .../opendj/opendj-localhost-resource-sync-advanced.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/resources/opendj/opendj-localhost-resource-sync-advanced.xml b/samples/resources/opendj/opendj-localhost-resource-sync-advanced.xml index 482d39aa6dc..4abbf009d05 100644 --- a/samples/resources/opendj/opendj-localhost-resource-sync-advanced.xml +++ b/samples/resources/opendj/opendj-localhost-resource-sync-advanced.xml @@ -269,7 +269,6 @@ object. icfs:name Distinguished Name - mr:stringIgnoreCase 0 @@ -278,6 +277,7 @@ object. false + mr:stringIgnoreCase weak @@ -361,13 +361,13 @@ object. ri:uid Login Name - mr:stringIgnoreCase true true + mr:stringIgnoreCase Source may have description From d85395351891a3879bbecae8543c6205dbb60124 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Tue, 27 Jan 2015 00:41:49 +0100 Subject: [PATCH 063/215] Attempt to fix MID-2170 --- .../midpoint/provisioning/impl/ShadowCache.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCache.java b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCache.java index c731260a94a..1be40939f4f 100644 --- a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCache.java +++ b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCache.java @@ -1277,11 +1277,11 @@ void processChange(ResourceType resourceType, RefinedObjectClassDefinition refin // FIXME: hack. the object delta must have oid specified. if (change.getObjectDelta() != null && change.getObjectDelta().getOid() == null) { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("No OID present, assuming delta of type DELETE; change = {}\nobjectDelta: {}", change, change.getObjectDelta().debugDump()); - } - ObjectDelta objDelta = new ObjectDelta(ShadowType.class, ChangeType.DELETE, prismContext); - change.setObjectDelta(objDelta); +// if (LOGGER.isTraceEnabled()) { +// LOGGER.trace("No OID present, assuming delta of type DELETE; change = {}\nobjectDelta: {}", change, change.getObjectDelta().debugDump()); +// } +// ObjectDelta objDelta = new ObjectDelta(ShadowType.class, ChangeType.DELETE, prismContext); +// change.setObjectDelta(objDelta); change.getObjectDelta().setOid(oldShadow.getOid()); } } else { From 1e6fcfb4e6f56ebcd52c19d420a3e224bef17e84 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Tue, 27 Jan 2015 14:24:42 +0100 Subject: [PATCH 064/215] Attempt to fix MID-2174 --- .../midpoint/provisioning/impl/ShadowCacheReconciler.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCacheReconciler.java b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCacheReconciler.java index 15c7583c6a0..80baa573de9 100644 --- a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCacheReconciler.java +++ b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCacheReconciler.java @@ -96,6 +96,12 @@ private void cleanShadowInRepository(PrismObject shadow, OperationRe ObjectDelta delta = oldShadow.diff(normalizedShadow); + // TODO: remove this ugly hack (problem is in prism - objectChange does not get deleted by delta produced by diff method) + PropertyDelta clearObjectChange = PropertyDelta.createModificationReplaceProperty( + ShadowType.F_OBJECT_CHANGE, oldShadow.getDefinition()); + delta.removePropertyModification(ShadowType.F_OBJECT_CHANGE); + delta.addModification(clearObjectChange); + LOGGER.trace("Normalizing shadow: change description: {}", delta.debugDump()); // prismContext.adopt(shadow); try { From 91397e84094f57a603300edb6618670c24b7b8b7 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Wed, 28 Jan 2015 11:44:56 +0100 Subject: [PATCH 065/215] Fixing workflow samples. --- samples/roles/approvals-complete.xml | 294 ++++++++---------- .../roles/users-for-approval-processes.xml | 186 ++++------- 2 files changed, 188 insertions(+), 292 deletions(-) diff --git a/samples/roles/approvals-complete.xml b/samples/roles/approvals-complete.xml index cefa66e1991..04fbb2d9bb1 100644 --- a/samples/roles/approvals-complete.xml +++ b/samples/roles/approvals-complete.xml @@ -18,177 +18,127 @@ - - - boss2 - boss2 - - - enabled - - - Boss2 - boss2 - - - - - - - - 4HXeUejV93Vd3JuIZz7sbs5bVko= - - - SSwafbAyWjmD3c039qQJlj9Rqx1c45q2mVg+z+w/l0M/9vWqCTRjEUi1SFLUxd6K - - - - - - - - - security - security - - - enabled - - - Security Manager - security manager - - - - - - - - 4HXeUejV93Vd3JuIZz7sbs5bVko= - - - iimZ2lYWAEatFmD8C3ZLp0Kw+Bp0+de6vQTfNiE5aK6A1CVDx1homddXQzc7edYL - - - - - - - - - boss1 - boss1 - - - enabled - - - Boss1 - boss1 - - - - - - - - 4HXeUejV93Vd3JuIZz7sbs5bVko= - - - J39QnxGpKzA121JSoa0f9lbu8i+ggGRQNv8aCTu3uaeGUA0ipSIzZsVG9MkweGWs - - - - - - + + + boss2 + boss2 + + + enabled + + + Boss2 + boss2 + + + + + 123456 + + + + + + + security + security + + + enabled + + + Security Manager + security manager + + + + + 123456 + + + + + + + boss1 + boss1 + + + enabled + + + Boss1 + boss1 + + + + + 123456 + + + + + + Sensitive Role 1 + Security-sensitive role, whose assignment to a user must be approved by the responsible person - in + this simple case, by the administrator. + + + Approval by the administrator + + - - Sensitive Role 1 - Security-sensitive role, whose assignment to a user must be approved by the responsible person - in this simple case, by the administrator. - - Approval by the administrator - - - - - Sensitive Role 2 - Security-sensitive role, whose assignment to a user must be approved by various persons, as described by the approval schema. - - Sample Complex Schema 1 - A sample complex approval schema, involving the security administrator - - Bosses - At this level, either one of the company directors has to approve the assignment. - - Big boss #1 approval - - - Big boss #2 approval - - firstDecides - - - Administrators - At this level, system administrator as well as security manager must approve. - - Administrator approval - - - Security Manager approval - - allMustApprove - - - + + Sensitive Role 2 + Security-sensitive role, whose assignment to a user must be approved by various persons, as + described by the approval schema. + + + Sample Complex Schema 1 + A sample complex approval schema, involving the security administrator + + Bosses + At this level, either one of the company directors has to approve the assignment. + + + Big boss #1 approval + + + Big boss #2 approval + + firstDecides + + + Administrators + At this level, system administrator as well as security manager must approve. + + Administrator approval + + + Security Manager approval + + allMustApprove + + + diff --git a/samples/roles/users-for-approval-processes.xml b/samples/roles/users-for-approval-processes.xml index 56f9bb5ab05..f05c5656f57 100644 --- a/samples/roles/users-for-approval-processes.xml +++ b/samples/roles/users-for-approval-processes.xml @@ -18,124 +18,70 @@ - - - boss2 - boss2 - - - enabled - - - Boss2 - boss2 - - - - - - - - 4HXeUejV93Vd3JuIZz7sbs5bVko= - - - SSwafbAyWjmD3c039qQJlj9Rqx1c45q2mVg+z+w/l0M/9vWqCTRjEUi1SFLUxd6K - - - - - - - - - security - security - - - enabled - - - Security Manager - security manager - - - - - - - - 4HXeUejV93Vd3JuIZz7sbs5bVko= - - - iimZ2lYWAEatFmD8C3ZLp0Kw+Bp0+de6vQTfNiE5aK6A1CVDx1homddXQzc7edYL - - - - - - - - - boss1 - boss1 - - - enabled - - - Boss1 - boss1 - - - - - - - - 4HXeUejV93Vd3JuIZz7sbs5bVko= - - - J39QnxGpKzA121JSoa0f9lbu8i+ggGRQNv8aCTu3uaeGUA0ipSIzZsVG9MkweGWs - - - - - - + + + boss2 + boss2 + + + enabled + + + Boss2 + boss2 + + + + + 123456 + + + + + + + security + security + + + enabled + + + Security Manager + security manager + + + + + 123456 + + + + + + + boss1 + boss1 + + + enabled + + + Boss1 + boss1 + + + + + 123456 + + + + From 928d56dd9d74cfad810fbcac492835ab25032341 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Wed, 28 Jan 2015 11:45:22 +0100 Subject: [PATCH 066/215] Changing 'no task owner' message. --- .../main/java/com/evolveum/midpoint/init/AuditServiceProxy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repo/system-init/src/main/java/com/evolveum/midpoint/init/AuditServiceProxy.java b/repo/system-init/src/main/java/com/evolveum/midpoint/init/AuditServiceProxy.java index 4dc90fd8d32..e38c19a185a 100644 --- a/repo/system-init/src/main/java/com/evolveum/midpoint/init/AuditServiceProxy.java +++ b/repo/system-init/src/main/java/com/evolveum/midpoint/init/AuditServiceProxy.java @@ -90,7 +90,7 @@ private void assertCorrectness(AuditEventRecord record, Task task) { LOGGER.warn("Task is null in a call to audit service"); } else { if (task.getOwner() == null) { - LOGGER.warn("Task '{}' has no owner in a call to audit service", new Object[]{task.getName()}); + LOGGER.warn("Task '{}' has no owner in a call to audit service (should not happen except for initial repository loading)", new Object[]{task.getName()}); } } } From a95f9a28b4a0633e5342aaec58439f6f4112df41 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Wed, 28 Jan 2015 12:06:52 +0100 Subject: [PATCH 067/215] fix for handling multiValue objects (not all yet) in wizard concerning mappings, attributes, associations etc. --- .../multivalue/MultiValueTextEditPanel.html | 8 ++ .../multivalue/MultiValueTextEditPanel.java | 95 ++++++++++++------- .../wizard/resource/SchemaHandlingStep.java | 37 ++------ .../wizard/resource/SynchronizationStep.java | 19 +--- .../ResourceActivationEditor.java | 4 +- .../ResourceAssociationEditor.java | 2 +- .../ResourceAttributeEditor.java | 2 +- .../ResourceCredentialsEditor.java | 2 +- .../ResourceIterationEditor.java | 2 +- .../SynchronizationReactionEditor.java | 2 +- 10 files changed, 90 insertions(+), 83 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueTextEditPanel.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueTextEditPanel.html index 036f62d0906..c070321f29b 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueTextEditPanel.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueTextEditPanel.html @@ -16,6 +16,14 @@ + +
+ + + +
+ +
diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueTextEditPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueTextEditPanel.java index ce909c8956a..36e39fafcd7 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueTextEditPanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueTextEditPanel.java @@ -17,6 +17,7 @@ package com.evolveum.midpoint.web.component.form.multivalue; import com.evolveum.midpoint.web.component.util.SimplePanel; +import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour; import org.apache.wicket.AttributeModifier; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; @@ -33,8 +34,6 @@ import org.apache.wicket.model.StringResourceModel; import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; import java.util.Iterator; import java.util.List; @@ -43,6 +42,8 @@ * */ public class MultiValueTextEditPanel extends SimplePanel> { + private static final String ID_PLACEHOLDER_CONTAINER = "placeholderContainer"; + private static final String ID_PLACEHOLDER_ADD = "placeholderAdd"; private static final String ID_REPEATER = "repeater"; private static final String ID_TEXT = "input"; private static final String ID_BUTTON_GROUP = "buttonGroup"; @@ -52,28 +53,49 @@ public class MultiValueTextEditPanel extends SimplePanel private static final String CSS_DISABLED = " disabled"; - public MultiValueTextEditPanel(String id, IModel> model, boolean inputEnabled, - boolean prepareModel){ + public MultiValueTextEditPanel(String id, IModel> model, boolean inputEnabled){ super(id, model); setOutputMarkupId(true); - initLayout(inputEnabled, prepareModel); + initLayout(inputEnabled); } - private IModel> prepareModel(boolean prepareModel){ - if(prepareModel){ - if(getModel().getObject() == null){ - getModel().setObject(new ArrayList<>(Arrays.asList(createNewEmptyItem()))); - } else if(getModel().getObject().isEmpty()){ - getModel().getObject().add(createNewEmptyItem()); + private void initLayout(final boolean inputEnabled){ + WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER); + placeholderContainer.setOutputMarkupPlaceholderTag(true); + placeholderContainer.setOutputMarkupPlaceholderTag(true); + placeholderContainer.add(new VisibleEnableBehaviour(){ + + @Override + public boolean isVisible() { + return getModel().getObject().isEmpty(); } - } - return getModel(); - } + }); + add(placeholderContainer); + + AjaxLink placeholderAdd = new AjaxLink(ID_PLACEHOLDER_ADD) { + + @Override + public void onClick(AjaxRequestTarget target) { + addValuePerformed(target); + } + }; + placeholderAdd.add(new AttributeAppender("class", new AbstractReadOnlyModel() { - private void initLayout(final boolean inputEnabled, boolean prepareModel){ + @Override + public String getObject() { + if (buttonsDisabled()) { + return " " + CSS_DISABLED; + } - ListView repeater = new ListView(ID_REPEATER, prepareModel(prepareModel)){ + return ""; + } + })); + placeholderAdd.setOutputMarkupId(true); + placeholderAdd.setOutputMarkupPlaceholderTag(true); + placeholderContainer.add(placeholderAdd); + + ListView repeater = new ListView(ID_REPEATER, getModel()){ @Override protected void populateItem(final ListItem item) { @@ -95,6 +117,15 @@ protected void onUpdate(AjaxRequestTarget target) {} initButtons(buttonGroup, item); } }; + repeater.setOutputMarkupId(true); + repeater.setOutputMarkupPlaceholderTag(true); + repeater.add(new VisibleEnableBehaviour(){ + + @Override + public boolean isVisible() { + return !getModel().getObject().isEmpty(); + } + }); add(repeater); } @@ -110,10 +141,11 @@ protected void onSubmit(AjaxRequestTarget target, Form form) { @Override public String getObject() { - if(buttonsDisabled()){ - return " disabled"; + if (buttonsDisabled()) { + return " " + CSS_DISABLED; } - return null; + + return ""; } })); buttonGroup.add(edit); @@ -156,12 +188,11 @@ protected String getPlusClassModifier(ListItem item){ } protected String getMinusClassModifier(){ - int size = getModelObject().size(); - if (size > 1) { - return ""; + if(buttonsDisabled()){ + return CSS_DISABLED; } - return CSS_DISABLED; + return ""; } protected T createNewEmptyItem(){ @@ -214,10 +245,14 @@ protected void removeValuePerformed(AjaxRequestTarget target, ListItem item){ target.add(this); } - protected void editPerformed(AjaxRequestTarget target, T object){ - //override me - } + /** + * Override to provide handling of edit event (edit button clicked) + * */ + protected void editPerformed(AjaxRequestTarget target, T object){} + /** + * Override to provide the information about buttons enabled/disabled status + * */ protected boolean buttonsDisabled(){ return false; } @@ -225,14 +260,10 @@ protected boolean buttonsDisabled(){ /** * Override to provide custom hook when adding new value * */ - protected void performAddValueHook(AjaxRequestTarget target){ - - } + protected void performAddValueHook(AjaxRequestTarget target){} /** * Override to provide custom hook when removing value from list * */ - protected void performRemoveValueHook(AjaxRequestTarget target, ListItem item){ - - } + protected void performRemoveValueHook(AjaxRequestTarget target, ListItem item){} } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java index f92f49bfa86..69e4dbc213d 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java @@ -44,6 +44,7 @@ import org.apache.wicket.AttributeModifier; import org.apache.wicket.Component; import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; import org.apache.wicket.ajax.markup.html.AjaxLink; import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink; import org.apache.wicket.behavior.AttributeAppender; @@ -147,16 +148,6 @@ private SchemaHandlingDto lodObjectTypes(){ ResourceObjectTypeDefinitionTypeDto obj; if(schemaHandling != null && schemaHandling.getObjectType() != null){ for(ResourceObjectTypeDefinitionType objectType: schemaHandling.getObjectType()){ - - // temporary fix - think about better solution - if(objectType.getAttribute().isEmpty()){ - objectType.getAttribute().add(createEmptyAttributeObject()); - } - - if(objectType.getAssociation().isEmpty()){ - objectType.getAssociation().add(createEmptyAssociationObject()); - } - obj = new ResourceObjectTypeDefinitionTypeDto(objectType); list.add(obj); } @@ -170,12 +161,7 @@ private SchemaHandlingDto lodObjectTypes(){ } private ResourceObjectTypeDefinitionType createPlaceholderObjectType(){ - //TODO temporary fix - think about better solution - ResourceObjectTypeDefinitionType placeholder = new ResourceObjectTypeDefinitionType(); - placeholder.getAttribute().add(createEmptyAttributeObject()); - placeholder.getAssociation().add(createEmptyAssociationObject()); - - return placeholder; + return new ResourceObjectTypeDefinitionType(); } private boolean isAnySelected(){ @@ -356,6 +342,11 @@ protected Iterator getChoices(String input) { return getObjectClassChoices(input); } }; + editorObjectClass.add(new AjaxFormComponentUpdatingBehavior("onchange") { + + @Override + protected void onUpdate(AjaxRequestTarget target) {} + }); editorObjectClass.add(createObjectClassValidator(new LoadableModel>(false) { @Override @@ -367,7 +358,7 @@ protected List load() { MultiValueTextEditPanel editorAttributes = new MultiValueTextEditPanel(ID_EDITOR_ATTRIBUTES, new PropertyModel>(model, SchemaHandlingDto.F_SELECTED + "." + - ResourceObjectTypeDefinitionType.F_ATTRIBUTE.getLocalPart()), false, false){ + ResourceObjectTypeDefinitionType.F_ATTRIBUTE.getLocalPart()), false){ @Override protected IModel createTextModel(final IModel model) { @@ -418,7 +409,7 @@ protected void performRemoveValueHook(AjaxRequestTarget target, ListItem(ID_EDITOR_ASSOCIATIONS, new PropertyModel>(model, SchemaHandlingDto.F_SELECTED + "." + - ResourceObjectTypeDefinitionType.F_ASSOCIATION.getLocalPart()), false, false){ + ResourceObjectTypeDefinitionType.F_ASSOCIATION.getLocalPart()), false){ @Override protected IModel createTextModel(final IModel model) { @@ -749,14 +740,6 @@ private void editObjectTypePerformed(AjaxRequestTarget target, ResourceObjectTyp resetSelected(); objectType.setSelected(true); - if(objectType.getObjectType().getAssociation().isEmpty()){ - objectType.getObjectType().getAssociation().add(createEmptyAssociationObject()); - } - - if(objectType.getObjectType().getAttribute().isEmpty()){ - objectType.getObjectType().getAttribute().add(createEmptyAttributeObject()); - } - model.getObject().setSelected(objectType.getObjectType()); insertEmptyThirdRow(); @@ -783,8 +766,6 @@ private void deleteObjectTypePerformed(AjaxRequestTarget target, ResourceObjectT private void addObjectTypePerformed(AjaxRequestTarget target){ ResourceObjectTypeDefinitionType objectType = new ResourceObjectTypeDefinitionType(); - objectType.getAttribute().add(createEmptyAttributeObject()); - objectType.getAssociation().add(createEmptyAssociationObject()); objectType.setDisplayName(getString("SchemaHandlingStep.label.newObjectType")); ResourceObjectTypeDefinitionTypeDto dto = new ResourceObjectTypeDefinitionTypeDto(objectType); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.java index 203d5e7c95f..ecbb5b9c296 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.java @@ -152,14 +152,6 @@ private ResourceSynchronizationDto loadResourceSynchronization(){ syncObject.getObjectClass().add(new QName("")); } - if(syncObject.getCorrelation().isEmpty()){ - syncObject.getCorrelation().add(new ConditionalSearchFilterType()); - } - - if(syncObject.getReaction().isEmpty()){ - syncObject.getReaction().add(new SynchronizationReactionType()); - } - obj = new ObjectSynchronizationTypeDto(syncObject); list.add(obj); } @@ -173,10 +165,7 @@ private ResourceSynchronizationDto loadResourceSynchronization(){ } private ObjectSynchronizationType createPlaceholderObjectType(){ - ObjectSynchronizationType syncObject = new ObjectSynchronizationType(); - syncObject.getCorrelation().add(new ConditionalSearchFilterType()); - syncObject.getReaction().add(new SynchronizationReactionType()); - return syncObject; + return new ObjectSynchronizationType(); } private boolean isAnySelected(){ @@ -432,7 +421,7 @@ public String getIdValue(ObjectReferenceType object, int index) { editor.add(editorOpportunistic); MultiValueTextEditPanel editorCorrelation = new MultiValueTextEditPanel(ID_EDITOR_EDITOR_CORRELATION, - new PropertyModel>(model, ObjectSynchronizationTypeDto.F_SELECTED + ".correlation"), false, false){ + new PropertyModel>(model, ObjectSynchronizationTypeDto.F_SELECTED + ".correlation"), false){ @Override protected IModel createTextModel(final IModel model) { @@ -474,7 +463,7 @@ protected boolean buttonsDisabled(){ editor.add(editorCorrelation); MultiValueTextEditPanel editorReaction = new MultiValueTextEditPanel(ID_EDITOR_REACTION, - new PropertyModel>(model, ObjectSynchronizationTypeDto.F_SELECTED + ".reaction"), false, false){ + new PropertyModel>(model, ObjectSynchronizationTypeDto.F_SELECTED + ".reaction"), false){ @Override protected IModel createTextModel(final IModel model) { @@ -824,8 +813,6 @@ private void deleteSyncObjectPerformed(AjaxRequestTarget target, ObjectSynchroni private void addSyncObjectPerformed(AjaxRequestTarget target){ ObjectSynchronizationType syncObject = new ObjectSynchronizationType(); - syncObject.getCorrelation().add(new ConditionalSearchFilterType()); - syncObject.getReaction().add(new SynchronizationReactionType()); syncObject.getObjectClass().add(new QName("")); syncObject.setName(getString("SynchronizationStep.label.newObjectType")); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceActivationEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceActivationEditor.java index 82888413f68..b067b6c3a73 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceActivationEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceActivationEditor.java @@ -281,7 +281,7 @@ private void prepareActivationPanelBody(String containerValue, String fetchStrat add(fetchStrategy); MultiValueTextEditPanel outbound = new MultiValueTextEditPanel(outboundId, - new PropertyModel>(getModel(), containerValue + ".outbound"), false, true){ + new PropertyModel>(getModel(), containerValue + ".outbound"), false){ @Override protected IModel createTextModel(final IModel model) { @@ -308,7 +308,7 @@ protected void editPerformed(AjaxRequestTarget target, MappingType object){ add(outbound); MultiValueTextEditPanel inbound = new MultiValueTextEditPanel(inboundId, - new PropertyModel>(getModel(), containerValue + ".inbound"), false, true){ + new PropertyModel>(getModel(), containerValue + ".inbound"), false){ @Override protected IModel createTextModel(final IModel model) { diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java index 959952c8676..ad06897d6e1 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java @@ -293,7 +293,7 @@ protected void onSubmit(AjaxRequestTarget target, Form form) { add(outbound); MultiValueTextEditPanel inbound = new MultiValueTextEditPanel(ID_INBOUND, - new PropertyModel>(getModel(), "inbound"), false, true){ + new PropertyModel>(getModel(), "inbound"), false){ @Override protected IModel createTextModel(final IModel model) { diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java index 8221751ff8d..4d677e0a3e8 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java @@ -281,7 +281,7 @@ protected void onSubmit(AjaxRequestTarget target, Form form) { add(outbound); MultiValueTextEditPanel inbound = new MultiValueTextEditPanel(ID_INBOUND, - new PropertyModel>(getModel(), "inbound"), false, true){ + new PropertyModel>(getModel(), "inbound"), false){ @Override protected IModel createTextModel(final IModel model) { diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceCredentialsEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceCredentialsEditor.java index 4b511715fcc..f36bc472482 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceCredentialsEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceCredentialsEditor.java @@ -125,7 +125,7 @@ protected void onSubmit(AjaxRequestTarget target, Form form) { add(outbound); MultiValueTextEditPanel inbound = new MultiValueTextEditPanel(ID_INBOUND, - new PropertyModel>(getModel(), "password.inbound"), false, true){ + new PropertyModel>(getModel(), "password.inbound"), false){ @Override protected IModel createTextModel(final IModel model) { diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceIterationEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceIterationEditor.java index cdbd7e57cbf..2376d5b8ec1 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceIterationEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceIterationEditor.java @@ -199,7 +199,7 @@ private void prepareIterationSubsectionBody(String containerValue, String descri MultiValueTextEditPanel variableList = new MultiValueTextEditPanel(variableId, new PropertyModel>(model, - IterationSpecificationTypeDto.F_ITERATION + "." + containerValue + ".variable"), false, true){ + IterationSpecificationTypeDto.F_ITERATION + "." + containerValue + ".variable"), false){ @Override protected IModel createTextModel(final IModel model) { diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/synchronization/SynchronizationReactionEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/synchronization/SynchronizationReactionEditor.java index 403dbad319b..ae0c4d3a8a9 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/synchronization/SynchronizationReactionEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/synchronization/SynchronizationReactionEditor.java @@ -178,7 +178,7 @@ public String getIdValue(ObjectReferenceType object, int index) { add(objectTemplateRef); MultiValueTextEditPanel action = new MultiValueTextEditPanel(ID_ACTION, - new PropertyModel>(getModel(), "action"), false, true){ + new PropertyModel>(getModel(), "action"), false){ @Override protected IModel createTextModel(final IModel model) { From 27ee93cdfa8e8a7e004648d5093a32ad3ebea2ad Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Wed, 28 Jan 2015 12:06:54 +0100 Subject: [PATCH 068/215] Bringing back Save button functionality when correcting errors in a form --- .../midpoint/web/component/progress/ProgressReporter.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/progress/ProgressReporter.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/progress/ProgressReporter.java index 9b8320d27ee..b16abc3d632 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/progress/ProgressReporter.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/progress/ProgressReporter.java @@ -228,6 +228,7 @@ protected void onPostProcessTarget(AjaxRequestTarget target) { stopRefreshingProgressPanel(); + // TODO this is a bit of heuristics - we give user a chance to retry the operation if the error is fatal (RETHINK/REVISE THIS "POLICY") if (asyncOperationResult.isFatalError()) { saveButton.setVisible(true); // enable re-saving after fixing (potential) error target.add(saveButton); @@ -253,6 +254,7 @@ public boolean isEnabled(Component component) { private void stopRefreshingProgressPanel() { if (refreshingBehavior != null) { progressPanel.remove(refreshingBehavior); + refreshingBehavior = null; // causes re-adding this behavior when re-saving changes } } From 8ef81dd3f9e957c12c82c7195f34913fff5abf30 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Wed, 28 Jan 2015 12:37:16 +0100 Subject: [PATCH 069/215] Fixing a sample --- .../csvfile/localhost-csvfile-resource-bulk-action.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/samples/resources/csvfile/localhost-csvfile-resource-bulk-action.xml b/samples/resources/csvfile/localhost-csvfile-resource-bulk-action.xml index 47558b07cad..c50f9848472 100644 --- a/samples/resources/csvfile/localhost-csvfile-resource-bulk-action.xml +++ b/samples/resources/csvfile/localhost-csvfile-resource-bulk-action.xml @@ -232,7 +232,10 @@ object. From cdd9f36cf1b4dc966e53f7cf5484ce8edf20145b Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Wed, 28 Jan 2015 16:37:56 +0100 Subject: [PATCH 070/215] Improving remaining multi value components on RW - prevents saving empty objects. --- .../MultiValueAutoCompleteTextPanel.html | 6 ++ .../MultiValueAutoCompleteTextPanel.java | 75 ++++++++++++----- .../multivalue/MultiValueDropDownPanel.html | 6 ++ .../multivalue/MultiValueDropDownPanel.java | 78 ++++++++++++------ .../form/multivalue/MultiValueTextPanel.html | 6 ++ .../form/multivalue/MultiValueTextPanel.java | 80 +++++++++++++++---- .../wizard/resource/SynchronizationStep.java | 8 +- .../ResourceIterationEditor.java | 1 - .../modal/MappingEditorDialog.java | 4 +- .../SynchronizationReactionEditor.java | 2 +- .../wizard/resource/dto/MappingTypeDto.java | 13 --- 11 files changed, 196 insertions(+), 83 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueAutoCompleteTextPanel.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueAutoCompleteTextPanel.html index 24985938d92..9f6e1521af3 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueAutoCompleteTextPanel.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueAutoCompleteTextPanel.html @@ -17,6 +17,12 @@ +
+ + + +
+
diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueAutoCompleteTextPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueAutoCompleteTextPanel.java index cf31e35e455..ab81e9c425e 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueAutoCompleteTextPanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueAutoCompleteTextPanel.java @@ -17,6 +17,7 @@ package com.evolveum.midpoint.web.component.form.multivalue; import com.evolveum.midpoint.web.component.util.SimplePanel; +import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour; import org.apache.wicket.AttributeModifier; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; @@ -27,6 +28,7 @@ import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.list.ListItem; import org.apache.wicket.markup.html.list.ListView; +import org.apache.wicket.model.AbstractReadOnlyModel; import org.apache.wicket.model.IModel; import org.apache.wicket.model.StringResourceModel; import org.apache.wicket.util.string.Strings; @@ -40,6 +42,8 @@ * */ public class MultiValueAutoCompleteTextPanel extends SimplePanel>{ + private static final String ID_PLACEHOLDER_CONTAINER = "placeholderContainer"; + private static final String ID_PLACEHOLDER_ADD = "placeholderAdd"; private static final String ID_REPEATER = "repeater"; private static final String ID_TEXT = "input"; private static final String ID_BUTTON_GROUP = "buttonGroup"; @@ -49,32 +53,49 @@ public class MultiValueAutoCompleteTextPanel extends Sim private static final String CSS_DISABLED = " disabled"; private static final Integer AUTO_COMPLETE_LIST_SIZE = 10; - public MultiValueAutoCompleteTextPanel(String id, IModel> model, boolean inputEnabled, boolean prepareModel){ + public MultiValueAutoCompleteTextPanel(String id, IModel> model, boolean inputEnabled){ super(id, model); - setOutputMarkupId(true); - initLayout(inputEnabled, prepareModel); + initLayout(inputEnabled); } - private IModel> prepareModel(boolean prepareModel){ - if(prepareModel){ - if(getModel().getObject() == null){ - getModel().setObject(new ArrayList<>(Arrays.asList(createNewEmptyItem()))); - } else if(getModel().getObject().isEmpty()){ - getModel().getObject().add(createNewEmptyItem()); + private void initLayout(final boolean inputEnabled){ + WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER); + placeholderContainer.setOutputMarkupPlaceholderTag(true); + placeholderContainer.setOutputMarkupPlaceholderTag(true); + placeholderContainer.add(new VisibleEnableBehaviour(){ + + @Override + public boolean isVisible() { + return getModel().getObject().isEmpty(); } - } - return getModel(); - } + }); + add(placeholderContainer); - protected T createNewEmptyItem(){ - return null; - } + AjaxLink placeholderAdd = new AjaxLink(ID_PLACEHOLDER_ADD) { - private void initLayout(final boolean inputEnabled, boolean prepareModel){ + @Override + public void onClick(AjaxRequestTarget target) { + addValuePerformed(target); + } + }; + placeholderAdd.add(new AttributeAppender("class", new AbstractReadOnlyModel() { - ListView repeater = new ListView(ID_REPEATER, prepareModel(prepareModel)){ + @Override + public String getObject() { + if (buttonsDisabled()) { + return " " + CSS_DISABLED; + } + + return ""; + } + })); + placeholderAdd.setOutputMarkupId(true); + placeholderAdd.setOutputMarkupPlaceholderTag(true); + placeholderContainer.add(placeholderAdd); + + ListView repeater = new ListView(ID_REPEATER, getModel()){ @Override protected void populateItem(final ListItem item) { @@ -108,9 +129,22 @@ protected void onUpdate(AjaxRequestTarget target) {} initButtons(buttonGroup, item); } }; + repeater.setOutputMarkupId(true); + repeater.setOutputMarkupPlaceholderTag(true); + repeater.add(new VisibleEnableBehaviour(){ + + @Override + public boolean isVisible() { + return !getModel().getObject().isEmpty(); + } + }); add(repeater); } + protected T createNewEmptyItem(){ + return null; + } + private Iterator createAutoCompleteObjectList(String input) { List list = createObjectList(); List choices = new ArrayList<>(AUTO_COMPLETE_LIST_SIZE); @@ -179,12 +213,11 @@ protected String getPlusClassModifier(ListItem item){ } protected String getMinusClassModifier(){ - int size = getModelObject().size(); - if (size > 1) { - return ""; + if(buttonsDisabled()){ + return CSS_DISABLED; } - return CSS_DISABLED; + return ""; } /** diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueDropDownPanel.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueDropDownPanel.html index 7ee6792ff72..aa66a2b90f9 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueDropDownPanel.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueDropDownPanel.html @@ -17,6 +17,12 @@ +
+ + + +
+
diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueDropDownPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueDropDownPanel.java index b06aba6dced..2bb64116545 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueDropDownPanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueDropDownPanel.java @@ -17,11 +17,10 @@ package com.evolveum.midpoint.web.component.form.multivalue; import com.evolveum.midpoint.web.component.util.SimplePanel; -import org.apache.wicket.AttributeModifier; +import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.AjaxLink; import org.apache.wicket.behavior.AttributeAppender; -import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.form.DropDownChoice; import org.apache.wicket.markup.html.form.IChoiceRenderer; @@ -29,8 +28,6 @@ import org.apache.wicket.markup.html.list.ListView; import org.apache.wicket.model.AbstractReadOnlyModel; import org.apache.wicket.model.IModel; -import org.apache.wicket.model.Model; -import org.apache.wicket.util.string.Strings; import java.io.Serializable; import java.util.*; @@ -40,6 +37,8 @@ * */ public class MultiValueDropDownPanel extends SimplePanel>{ + private static final String ID_PLACEHOLDER_CONTAINER = "placeholderContainer"; + private static final String ID_PLACEHOLDER_ADD = "placeholderAdd"; private static final String ID_REPEATER = "repeater"; private static final String ID_INPUT = "input"; private static final String ID_BUTTON_GROUP = "buttonGroup"; @@ -48,30 +47,49 @@ public class MultiValueDropDownPanel extends SimplePanel private static final String CSS_DISABLED = " disabled"; - public MultiValueDropDownPanel(String id, IModel> model, boolean prepareModel, boolean nullValid){ + public MultiValueDropDownPanel(String id, IModel> model, boolean nullValid){ super(id, model); setOutputMarkupId(true); - initLayout(prepareModel, nullValid); + initLayout(nullValid); } - private IModel> prepareModel(boolean prepareModel){ - if(prepareModel){ - if(getModel().getObject() == null){ - getModel().setObject(new ArrayList<>(Arrays.asList(createNewEmptyItem()))); - } else if(getModel().getObject().isEmpty()){ - getModel().getObject().add(createNewEmptyItem()); + private void initLayout(final boolean nullValid){ + WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER); + placeholderContainer.setOutputMarkupPlaceholderTag(true); + placeholderContainer.setOutputMarkupPlaceholderTag(true); + placeholderContainer.add(new VisibleEnableBehaviour(){ + + @Override + public boolean isVisible() { + return getModel().getObject().isEmpty(); } - } - return getModel(); - } + }); + add(placeholderContainer); - protected T createNewEmptyItem(){ - return null; - } + AjaxLink placeholderAdd = new AjaxLink(ID_PLACEHOLDER_ADD) { - private void initLayout(final boolean prepareModel, final boolean nullValid){ - ListView repeater = new ListView(ID_REPEATER, prepareModel(prepareModel)){ + @Override + public void onClick(AjaxRequestTarget target) { + addValuePerformed(target); + } + }; + placeholderAdd.add(new AttributeAppender("class", new AbstractReadOnlyModel() { + + @Override + public String getObject() { + if (buttonsDisabled()) { + return " " + CSS_DISABLED; + } + + return ""; + } + })); + placeholderAdd.setOutputMarkupId(true); + placeholderAdd.setOutputMarkupPlaceholderTag(true); + placeholderContainer.add(placeholderAdd); + + ListView repeater = new ListView(ID_REPEATER, getModel()){ @Override protected void populateItem(final ListItem item) { @@ -86,6 +104,15 @@ protected void populateItem(final ListItem item) { initButtons(buttonGroup, item); } }; + repeater.setOutputMarkupId(true); + repeater.setOutputMarkupPlaceholderTag(true); + repeater.add(new VisibleEnableBehaviour(){ + + @Override + public boolean isVisible() { + return !getModel().getObject().isEmpty(); + } + }); add(repeater); } @@ -130,6 +157,10 @@ public void onClick(AjaxRequestTarget target) { buttonGroup.add(remove); } + protected T createNewEmptyItem(){ + return null; + } + protected String getPlusClassModifier(ListItem item){ if(buttonsDisabled()){ return CSS_DISABLED; @@ -147,12 +178,11 @@ protected String getPlusClassModifier(ListItem item){ } protected String getMinusClassModifier(){ - int size = getModelObject().size(); - if (size > 1) { - return ""; + if(buttonsDisabled()){ + return CSS_DISABLED; } - return CSS_DISABLED; + return ""; } protected void addValuePerformed(AjaxRequestTarget target){ diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueTextPanel.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueTextPanel.html index 769aef63c94..8fdc5d332d6 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueTextPanel.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueTextPanel.html @@ -17,6 +17,12 @@ +
+ + + +
+
diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueTextPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueTextPanel.java index 729a4a62681..bbc1d842bb1 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueTextPanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/form/multivalue/MultiValueTextPanel.java @@ -16,6 +16,7 @@ package com.evolveum.midpoint.web.component.form.multivalue; import com.evolveum.midpoint.web.component.util.SimplePanel; +import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; import org.apache.wicket.ajax.markup.html.AjaxLink; @@ -24,22 +25,22 @@ import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.list.ListItem; import org.apache.wicket.markup.html.list.ListView; +import org.apache.wicket.model.AbstractReadOnlyModel; import org.apache.wicket.model.IModel; import org.apache.wicket.model.StringResourceModel; import java.io.Serializable; import java.util.ArrayList; -import java.util.Arrays; import java.util.Iterator; import java.util.List; /** * @author shood - * - * TODO - move this to multivalue component package and rename it properly * */ public class MultiValueTextPanel extends SimplePanel> { + private static final String ID_PLACEHOLDER_CONTAINER = "placeholderContainer"; + private static final String ID_PLACEHOLDER_ADD = "placeholderAdd"; private static final String ID_REPEATER = "repeater"; private static final String ID_TEXT = "input"; private static final String ID_BUTTON_GROUP = "buttonGroup"; @@ -52,17 +53,53 @@ public MultiValueTextPanel(String id, IModel> value){ super(id, value); setOutputMarkupId(true); - initLayout(true); + initPanelLayout(); } - private void initLayout(boolean unused){ - - if(getModel().getObject() == null){ - getModel().setObject(new ArrayList<>(Arrays.asList(createNewEmptyItem()))); - } else if(getModel().getObject().isEmpty()){ - getModel().getObject().add(createNewEmptyItem()); + @Override + public IModel> getModel(){ + if(super.getModel().getObject() == null){ + super.getModel().setObject(new ArrayList()); } + return super.getModel(); + } + + protected void initPanelLayout(){ + WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER); + placeholderContainer.setOutputMarkupPlaceholderTag(true); + placeholderContainer.setOutputMarkupPlaceholderTag(true); + placeholderContainer.add(new VisibleEnableBehaviour(){ + + @Override + public boolean isVisible() { + return getModel().getObject().isEmpty(); + } + }); + add(placeholderContainer); + + AjaxLink placeholderAdd = new AjaxLink(ID_PLACEHOLDER_ADD) { + + @Override + public void onClick(AjaxRequestTarget target) { + addValuePerformed(target); + } + }; + placeholderAdd.add(new AttributeAppender("class", new AbstractReadOnlyModel() { + + @Override + public String getObject() { + if (buttonsDisabled()) { + return " " + CSS_DISABLED; + } + + return ""; + } + })); + placeholderAdd.setOutputMarkupId(true); + placeholderAdd.setOutputMarkupPlaceholderTag(true); + placeholderContainer.add(placeholderAdd); + ListView repeater = new ListView(ID_REPEATER, getModel()){ @Override @@ -80,6 +117,15 @@ protected void onUpdate(AjaxRequestTarget target) {} initButtons(buttonGroup, item); } }; + repeater.setOutputMarkupId(true); + repeater.setOutputMarkupPlaceholderTag(true); + repeater.add(new VisibleEnableBehaviour(){ + + @Override + public boolean isVisible() { + return !getModel().getObject().isEmpty(); + } + }); add(repeater); } @@ -118,12 +164,11 @@ protected String getPlusClassModifier(ListItem item){ } protected String getMinusClassModifier(){ - int size = getModelObject().size(); - if (size > 1) { - return ""; + if(buttonsDisabled()){ + return CSS_DISABLED; } - return CSS_DISABLED; + return ""; } protected IModel createTextModel(final IModel model) { @@ -160,6 +205,13 @@ protected StringResourceModel createEmptyItemPlaceholder(){ return createStringResource("TextField.universal.placeholder"); } + /** + * Override to provide the information about buttons enabled/disabled status + * */ + protected boolean buttonsDisabled(){ + return false; + } + protected void removeValuePerformed(AjaxRequestTarget target, ListItem item){ List objects = getModelObject(); Iterator iterator = objects.iterator(); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.java index ecbb5b9c296..d8884db31a3 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.java @@ -147,11 +147,6 @@ private ResourceSynchronizationDto loadResourceSynchronization(){ ObjectSynchronizationTypeDto obj; if(sync != null && sync.getObjectSynchronization() != null){ for(ObjectSynchronizationType syncObject: sync.getObjectSynchronization()){ - - if(syncObject.getObjectClass().isEmpty()){ - syncObject.getObjectClass().add(new QName("")); - } - obj = new ObjectSynchronizationTypeDto(syncObject); list.add(obj); } @@ -302,7 +297,7 @@ protected String load() { editor.add(editorIntent); MultiValueAutoCompleteTextPanel editorObjectClass = new MultiValueAutoCompleteTextPanel(ID_EDITOR_OBJECT_CLASS, - new PropertyModel>(model, ResourceSynchronizationDto.F_SELECTED + ".objectClass"), true, false){ + new PropertyModel>(model, ResourceSynchronizationDto.F_SELECTED + ".objectClass"), true){ @Override protected IModel createTextModel(final IModel model) { @@ -813,7 +808,6 @@ private void deleteSyncObjectPerformed(AjaxRequestTarget target, ObjectSynchroni private void addSyncObjectPerformed(AjaxRequestTarget target){ ObjectSynchronizationType syncObject = new ObjectSynchronizationType(); - syncObject.getObjectClass().add(new QName("")); syncObject.setName(getString("SynchronizationStep.label.newObjectType")); ObjectSynchronizationTypeDto dto = new ObjectSynchronizationTypeDto(syncObject); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceIterationEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceIterationEditor.java index 2376d5b8ec1..cd7942819f2 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceIterationEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceIterationEditor.java @@ -129,7 +129,6 @@ private void loadModel(){ @Override protected IterationSpecificationTypeDto load() { return new IterationSpecificationTypeDto(getModel().getObject()); -// return new IterationSpecificationTypeDto(getModel().getObject(), getPageBase().getPrismContext()); } }; } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/modal/MappingEditorDialog.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/modal/MappingEditorDialog.java index 6916fad3ee2..e7fda3727ce 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/modal/MappingEditorDialog.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/modal/MappingEditorDialog.java @@ -198,7 +198,7 @@ public void initLayout(WebMarkupContainer content){ form.add(strength); MultiValueDropDownPanel channel = new MultiValueDropDownPanel(ID_CHANNEL, - new PropertyModel>(model, MappingTypeDto.F_MAPPING + ".channel"), true, true){ + new PropertyModel>(model, MappingTypeDto.F_MAPPING + ".channel"), true){ @Override protected String createNewEmptyItem() { @@ -239,7 +239,7 @@ public String getIdValue(String object, int index) { form.add(channel); MultiValueDropDownPanel exceptChannel = new MultiValueDropDownPanel(ID_EXCEPT_CHANNEL, - new PropertyModel>(model, MappingTypeDto.F_MAPPING + ".exceptChannel"), true, true){ + new PropertyModel>(model, MappingTypeDto.F_MAPPING + ".exceptChannel"), true){ @Override protected String createNewEmptyItem() { diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/synchronization/SynchronizationReactionEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/synchronization/SynchronizationReactionEditor.java index ae0c4d3a8a9..6435e2d9c88 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/synchronization/SynchronizationReactionEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/synchronization/SynchronizationReactionEditor.java @@ -109,7 +109,7 @@ public String getObject() { add(situation); MultiValueDropDownPanel channel = new MultiValueDropDownPanel(ID_CHANNEL, - new PropertyModel>(getModel(), "channel"), true, true){ + new PropertyModel>(getModel(), "channel"), true){ @Override protected String createNewEmptyItem() { diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/dto/MappingTypeDto.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/dto/MappingTypeDto.java index ced1dd3d3e3..0117d253fb9 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/dto/MappingTypeDto.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/dto/MappingTypeDto.java @@ -80,24 +80,12 @@ public MappingTypeDto(MappingType mapping, PrismContext prismContext){ mappingObject = mapping; } - if(mappingObject.getChannel().isEmpty()){ - mappingObject.getChannel().add(new String()); - } - - if(mappingObject.getExceptChannel().isEmpty()){ - mappingObject.getExceptChannel().add(new String()); - } - for(MappingSourceDeclarationType mappingSource: mappingObject.getSource()){ if(mappingSource.getPath() != null && mappingSource.getPath().getItemPath() != null){ source.add(mappingSource.getPath().getItemPath().toString()); } } - if(source.isEmpty()){ - source.add(new String()); - } - if(mappingObject.getTarget() != null && mappingObject.getTarget().getPath() != null && mappingObject.getTarget().getPath().getItemPath() != null){ target = mappingObject.getTarget().getPath().getItemPath().toString(); @@ -375,5 +363,4 @@ public static String createMappingLabel(MappingType mapping, Trace LOGGER, Prism return sb.toString(); } - } From 8f8afa9422db73f3e3cb68d0560ff3422da927c8 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Wed, 28 Jan 2015 16:40:04 +0100 Subject: [PATCH 071/215] Removing old scannotation dependency. --- provisioning/provisioning-impl/pom.xml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/provisioning/provisioning-impl/pom.xml b/provisioning/provisioning-impl/pom.xml index 09aa8d4628d..e815b0e4d4d 100644 --- a/provisioning/provisioning-impl/pom.xml +++ b/provisioning/provisioning-impl/pom.xml @@ -31,13 +31,6 @@ git@github.com:Evolveum/midpoint.git https://fisheye.evolveum.com/browse/midPoint - - - - jboss - https://repository.jboss.org/nexus/content/groups/public-jboss/ - - com.evolveum.midpoint.infra @@ -75,10 +68,6 @@ commons-pool - - org.scannotation - scannotation - net.tirasa.connid connector-framework From 9096cd3465d45d72392e9539563fc9678bf6f7b1 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Wed, 28 Jan 2015 17:45:15 +0100 Subject: [PATCH 072/215] Dependency check plugins, commented out for now. --- build-system/pom.xml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/build-system/pom.xml b/build-system/pom.xml index f8ebd9fecb5..fbcbe66a6c9 100644 --- a/build-system/pom.xml +++ b/build-system/pom.xml @@ -773,6 +773,40 @@ com.evolveum.midpoint.* + From 2c770c2c60ec976c336823587e46f3d88dedaefe Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Wed, 28 Jan 2015 18:07:29 +0100 Subject: [PATCH 073/215] Removing obsolete version of c3p0 --- build-system/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build-system/pom.xml b/build-system/pom.xml index f8ebd9fecb5..ff1d64254d8 100644 --- a/build-system/pom.xml +++ b/build-system/pom.xml @@ -431,6 +431,12 @@ org.quartz-scheduler quartz ${quartz.version} + + + c3p0 + c3p0 + + org.apache.santuario From fdc8f02e8957d732fe74b71e4e72db36e5ea29e1 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Thu, 29 Jan 2015 10:19:38 +0100 Subject: [PATCH 074/215] adding warning, that deprecated part of schema (action ref in sync reaction) is not supported in resource wizard (MID-2183) --- .../web/component/wizard/resource/SynchronizationStep.java | 7 +++++++ .../wizard/resource/SynchronizationStep.properties | 2 ++ 2 files changed, 9 insertions(+) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.java index d8884db31a3..c24d657e001 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.java @@ -707,6 +707,13 @@ private void reactionEditPerformed(AjaxRequestTarget target, SynchronizationReac new Model<>(reaction)); getThirdRowContainer().replaceWith(newContainer); + for(SynchronizationActionType action: reaction.getAction()){ + if(action.getRef() != null){ + warn(getString("SynchronizationStep.message.unsupportedActionFormat")); + break; + } + } + target.add(getThirdRowContainer(), get(ID_OBJECT_SYNC_EDITOR), getPageBase().getFeedbackPanel()); } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.properties b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.properties index 118f1630fb0..21e1bddf393 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.properties +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SynchronizationStep.properties @@ -44,6 +44,8 @@ SynchronizationStep.message.errorLoadingObjectSyncList=Couldn't load object sync SynchronizationStep.message.errorLoadingObjectTemplates=Couldn't load object templates from repository. SynchronizationStep.message.cantSave=Couldn't save resource synchronization. +SynchronizationStep.message.unsupportedActionFormat=You are using deprecated attribute 'ref' to define reaction action. Use element 'handlerUri' instead. Actions with 'ref' attribute will not be shown in this wizard. + objectSyncConfig.editorKind.nullValid=Choose One objectSyncConfig.editorFocus.nullValid=Choose One objectSyncConfig.editorObjectTemplate.nullValid=Choose One From 9b0981bc92c8173095d45ed6913f0504c24eec6f Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Thu, 29 Jan 2015 10:41:49 +0100 Subject: [PATCH 075/215] Button label fix --- .../page/admin/workflow/PageWorkItem_sk_SK.utf8.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/admin-gui-sk-SK/src/main/resources/com/evolveum/midpoint/web/page/admin/workflow/PageWorkItem_sk_SK.utf8.properties b/gui/admin-gui-sk-SK/src/main/resources/com/evolveum/midpoint/web/page/admin/workflow/PageWorkItem_sk_SK.utf8.properties index 48b261b15bb..8c4f70e436f 100644 --- a/gui/admin-gui-sk-SK/src/main/resources/com/evolveum/midpoint/web/page/admin/workflow/PageWorkItem_sk_SK.utf8.properties +++ b/gui/admin-gui-sk-SK/src/main/resources/com/evolveum/midpoint/web/page/admin/workflow/PageWorkItem_sk_SK.utf8.properties @@ -8,10 +8,10 @@ pageWorkItem.accordionLabel.requester=Requester (detailed) pageWorkItem.additionalData.description=Role to be added pageWorkItem.additionalInfo=Supplementary information (do not edit) pageWorkItem.assignee=Assigned to\: -pageWorkItem.button.approve=Schváliť (neimpl) +pageWorkItem.button.approve=Schváliť pageWorkItem.button.cancel=Zrušiť pageWorkItem.button.claim=Claim -pageWorkItem.button.reject=Zamietnuť (neimpl) +pageWorkItem.button.reject=Zamietnuť pageWorkItem.button.release=Release pageWorkItem.candidates=Candidate assignees\: pageWorkItem.delta=Delta to be approved From 7f5c79350d033582df653fae9c88ada54b197421 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Thu, 29 Jan 2015 10:44:49 +0100 Subject: [PATCH 076/215] Fixing schema problems in wf samples --- samples/roles/approvals-complete.xml | 9 +++++---- samples/roles/users-for-approval-processes.xml | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/samples/roles/approvals-complete.xml b/samples/roles/approvals-complete.xml index 04fbb2d9bb1..08c3433f922 100644 --- a/samples/roles/approvals-complete.xml +++ b/samples/roles/approvals-complete.xml @@ -17,7 +17,8 @@ + xmlns:org='http://midpoint.evolveum.com/xml/ns/public/common/org-3' + xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3"> @@ -35,7 +36,7 @@ - 123456 + 123456 @@ -57,7 +58,7 @@ - 123456 + 123456 @@ -79,7 +80,7 @@ - 123456 + 123456 diff --git a/samples/roles/users-for-approval-processes.xml b/samples/roles/users-for-approval-processes.xml index f05c5656f57..dc492dc2abb 100644 --- a/samples/roles/users-for-approval-processes.xml +++ b/samples/roles/users-for-approval-processes.xml @@ -17,7 +17,8 @@ + xmlns:org='http://midpoint.evolveum.com/xml/ns/public/common/org-3' + xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3"> @@ -35,7 +36,7 @@ - 123456 + 123456 @@ -57,7 +58,7 @@ - 123456 + 123456 @@ -79,7 +80,7 @@ - 123456 + 123456 From c15a0c06871644d817e28128af22d046f3394a76 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Thu, 29 Jan 2015 10:55:07 +0100 Subject: [PATCH 077/215] fix for MID-2184 --- .../synchronization/SynchronizationReactionEditor.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/synchronization/SynchronizationReactionEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/synchronization/SynchronizationReactionEditor.java index 6435e2d9c88..8109b8ef505 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/synchronization/SynchronizationReactionEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/synchronization/SynchronizationReactionEditor.java @@ -242,7 +242,7 @@ private void initModals(){ @Override public void updateComponents(AjaxRequestTarget target){ - target.add(SynchronizationReactionEditor.this); + target.add(SynchronizationReactionEditor.this.get(ID_ACTION)); } }; add(actionEditor); @@ -288,5 +288,4 @@ private void actionEditPerformed(AjaxRequestTarget target, SynchronizationAction window.updateModel(target, action); window.show(target); } - } From 15c3b9f942f878feceb624717acbd43668391785 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Thu, 29 Jan 2015 11:41:42 +0100 Subject: [PATCH 078/215] fix for MID-2180 - adding partial error handling to resource provider when selecting resource to add account to on PageUser. --- .../web/page/admin/users/PageUser.java | 8 ++++++- .../users/dto/SimpleUserResourceProvider.java | 22 ++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUser.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUser.java index 177b69ea8bb..1ff6ef9bbc9 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUser.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUser.java @@ -970,7 +970,13 @@ private void initResourceModal() { ModalWindow window = createModalWindow(MODAL_ID_RESOURCE, createStringResource("pageUser.title.selectResource"), 1100, 560); - final SimpleUserResourceProvider provider = new SimpleUserResourceProvider(this, accountsModel); + final SimpleUserResourceProvider provider = new SimpleUserResourceProvider(this, accountsModel){ + + @Override + protected void handlePartialError(OperationResult result) { + showResult(result); + } + }; window.setContent(new ResourcesPopup(window.getContentId()) { @Override diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/dto/SimpleUserResourceProvider.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/dto/SimpleUserResourceProvider.java index 323aeb292b6..1b20616fd9f 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/dto/SimpleUserResourceProvider.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/dto/SimpleUserResourceProvider.java @@ -20,6 +20,7 @@ import com.evolveum.midpoint.prism.PrismReference; import com.evolveum.midpoint.prism.PrismReferenceValue; import com.evolveum.midpoint.prism.query.ObjectQuery; +import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.web.component.data.BaseSortableDataProvider; import com.evolveum.midpoint.web.component.data.ObjectDataProvider; import com.evolveum.midpoint.web.component.util.SelectableBean; @@ -50,16 +51,31 @@ public SimpleUserResourceProvider(Component component, IModel> internalIterator(long first, long count) { getAvailableData().clear(); Set alreadyUsedResources = createUsedResourceOidSet(); - List> allData = new ArrayList>(); + List> allData = new ArrayList<>(); Iterator> iterator = resourceProvider.iterator(0, resourceProvider.size()); while (iterator.hasNext()) { SelectableBean bean = iterator.next(); @@ -81,7 +97,7 @@ public void setResourceProviderQuery(ObjectQuery query){ } private Set createUsedResourceOidSet() { - Set set = new HashSet(); + Set set = new HashSet<>(); List accounts = accountsModel.getObject(); if (accounts == null) { From b56c5948691cbcbcfa302102f2d819c9cdabc055 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Thu, 29 Jan 2015 12:03:36 +0100 Subject: [PATCH 079/215] Temporarily disabled filling-in createApproverRef/modifyApproverRef because of MID-2178. --- .../model/impl/lens/ChangeExecutor.java | 65 ++++++++++--------- .../wf/impl/TestUserChangeApproval.java | 8 ++- 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/ChangeExecutor.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/ChangeExecutor.java index 7a6322e1519..2d88d1fe9ec 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/ChangeExecutor.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/ChangeExecutor.java @@ -1045,7 +1045,8 @@ private void applyMetadata(LensCont metaData.setCreatorRef(ObjectTypeUtil.createObjectRef(task.getOwner())); } if (workflowManager != null) { - metaData.getCreateApproverRef().addAll(workflowManager.getApprovedBy(task, result)); + // FIXME temporarily disabled because of MID-2178 +// metaData.getCreateApproverRef().addAll(workflowManager.getApprovedBy(task, result)); } objectTypeToAdd.setMetadata(metaData); @@ -1085,37 +1086,37 @@ private void applyMetadata(ObjectDe approverReferenceValues.add(new PrismReferenceValue(approverRef.getOid())); } } - - if (!approverReferenceValues.isEmpty()) { - ReferenceDelta refDelta = ReferenceDelta.createModificationReplace((new ItemPath(ObjectType.F_METADATA, - MetadataType.F_MODIFY_APPROVER_REF)), def, approverReferenceValues); - ((Collection) change.getModifications()).add(refDelta); - } else { - - // a bit of hack - we want to replace all existing values with empty set of values; - // however, it is not possible to do this using REPLACE, so we have to explicitly remove all existing values - - if (objectContext != null && objectContext.getObjectOld() != null) { - // a null value of objectOld means that we execute MODIFY delta that is a part of primary ADD operation (in a wave greater than 0) - // i.e. there are NO modifyApprovers set (theoretically they could be set in previous waves, but because in these waves the data - // are taken from the same source as in this step - so there are none modify approvers). - - if (objectContext.getObjectOld().asObjectable().getMetadata() != null) { - List existingModifyApproverRefs = objectContext.getObjectOld().asObjectable().getMetadata().getModifyApproverRef(); - LOGGER.trace("Original values of MODIFY_APPROVER_REF: {}", existingModifyApproverRefs); - - if (!existingModifyApproverRefs.isEmpty()) { - List valuesToDelete = new ArrayList(); - for (ObjectReferenceType approverRef : objectContext.getObjectOld().asObjectable().getMetadata().getModifyApproverRef()) { - valuesToDelete.add(approverRef.asReferenceValue().clone()); - } - ReferenceDelta refDelta = ReferenceDelta.createModificationDelete((new ItemPath(ObjectType.F_METADATA, - MetadataType.F_MODIFY_APPROVER_REF)), def, valuesToDelete); - ((Collection) change.getModifications()).add(refDelta); - } - } - } - } + // FIXME temporarily disabled because of MID-2178 +// if (!approverReferenceValues.isEmpty()) { +// ReferenceDelta refDelta = ReferenceDelta.createModificationReplace((new ItemPath(ObjectType.F_METADATA, +// MetadataType.F_MODIFY_APPROVER_REF)), def, approverReferenceValues); +// ((Collection) change.getModifications()).add(refDelta); +// } else { +// +// // a bit of hack - we want to replace all existing values with empty set of values; +// // however, it is not possible to do this using REPLACE, so we have to explicitly remove all existing values +// +// if (objectContext != null && objectContext.getObjectOld() != null) { +// // a null value of objectOld means that we execute MODIFY delta that is a part of primary ADD operation (in a wave greater than 0) +// // i.e. there are NO modifyApprovers set (theoretically they could be set in previous waves, but because in these waves the data +// // are taken from the same source as in this step - so there are none modify approvers). +// +// if (objectContext.getObjectOld().asObjectable().getMetadata() != null) { +// List existingModifyApproverRefs = objectContext.getObjectOld().asObjectable().getMetadata().getModifyApproverRef(); +// LOGGER.trace("Original values of MODIFY_APPROVER_REF: {}", existingModifyApproverRefs); +// +// if (!existingModifyApproverRefs.isEmpty()) { +// List valuesToDelete = new ArrayList(); +// for (ObjectReferenceType approverRef : objectContext.getObjectOld().asObjectable().getMetadata().getModifyApproverRef()) { +// valuesToDelete.add(approverRef.asReferenceValue().clone()); +// } +// ReferenceDelta refDelta = ReferenceDelta.createModificationDelete((new ItemPath(ObjectType.F_METADATA, +// MetadataType.F_MODIFY_APPROVER_REF)), def, valuesToDelete); +// ((Collection) change.getModifications()).add(refDelta); +// } +// } +// } +// } } diff --git a/model/workflow-impl/src/test/java/com/evolveum/midpoint/wf/impl/TestUserChangeApproval.java b/model/workflow-impl/src/test/java/com/evolveum/midpoint/wf/impl/TestUserChangeApproval.java index 3dc7777eaaf..aea6f3fb50f 100644 --- a/model/workflow-impl/src/test/java/com/evolveum/midpoint/wf/impl/TestUserChangeApproval.java +++ b/model/workflow-impl/src/test/java/com/evolveum/midpoint/wf/impl/TestUserChangeApproval.java @@ -196,12 +196,14 @@ boolean decideOnApproval(String executionId) throws Exception { private void checkUserApprovers(String oid, List expectedApprovers, OperationResult result) throws SchemaException, ObjectNotFoundException { PrismObject user = repositoryService.getObject(UserType.class, oid, null, result); - checkUserApprovers(user, expectedApprovers, user.asObjectable().getMetadata().getModifyApproverRef(), result); + // FIXME reenable after fixing MID-2178 +// checkUserApprovers(user, expectedApprovers, user.asObjectable().getMetadata().getModifyApproverRef(), result); } private void checkUserApproversForCreate(String oid, List expectedApprovers, OperationResult result) throws SchemaException, ObjectNotFoundException { PrismObject user = repositoryService.getObject(UserType.class, oid, null, result); - checkUserApprovers(user, expectedApprovers, user.asObjectable().getMetadata().getCreateApproverRef(), result); + // FIXME reenable after fixing MID-2178 +// checkUserApprovers(user, expectedApprovers, user.asObjectable().getMetadata().getCreateApproverRef(), result); } private void checkUserApprovers(PrismObject user, List expectedApprovers, List realApprovers, OperationResult result) throws SchemaException, ObjectNotFoundException { @@ -210,7 +212,7 @@ private void checkUserApprovers(PrismObject user, List expecte realApproversSet.add(approver.getOid()); assertEquals("Unexpected target type in approverRef", UserType.COMPLEX_TYPE, approver.getType()); } - assertEquals("Mismatch in modifyApproverRef in metadata", new HashSet(expectedApprovers), realApproversSet); + assertEquals("Mismatch in approvers in metadata", new HashSet(expectedApprovers), realApproversSet); } private Map createResultMap(String oid, WorkflowResult result) { From 88ac7e2761930947dcee44fc714c15bb65d6c9c8 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Thu, 29 Jan 2015 17:23:33 +0100 Subject: [PATCH 080/215] Updated activiti db scripts (5.13->5.15.1). Renamed 3.0 scripts to 3.1. Deleted obsolete 2.2 scripts. --- .../_all/{h2-3.0-all.sql => h2-3.1-all.sql} | 664 +++++----- .../{mysql-3.0-all.sql => mysql-3.1-all.sql} | 35 +- ...{oracle-3.0-all.sql => oracle-3.1-all.sql} | 663 +++++----- ...sql-3.0-all.sql => postgresql-3.1-all.sql} | 35 +- ...rver-3.0-all.sql => sqlserver-3.1-all.sql} | 652 +++++----- .../activiti/activiti.db2.create.identity.sql | 46 - .../sql/activiti/activiti.db2.drop.engine.sql | 74 -- .../activiti/activiti.db2.drop.history.sql | 24 - .../activiti/activiti.db2.drop.identity.sql | 10 - .../activiti/activiti.h2.create.engine.sql | 19 +- .../activiti/activiti.h2.create.history.sql | 12 +- .../sql/activiti/activiti.h2.drop.engine.sql | 19 - .../sql/activiti/activiti.h2.drop.history.sql | 24 - .../activiti/activiti.h2.drop.identity.sql | 4 - .../activiti/activiti.mssql.create.engine.sql | 23 +- .../activiti.mssql.create.history.sql | 9 +- .../activiti/activiti.mssql.drop.engine.sql | 39 - .../activiti/activiti.mssql.drop.history.sql | 24 - .../activiti/activiti.mssql.drop.identity.sql | 7 - .../activiti/activiti.mysql.create.engine.sql | 34 +- .../activiti.mysql.create.history.sql | 31 +- .../activiti/activiti.mysql.drop.engine.sql | 74 -- .../activiti/activiti.mysql.drop.history.sql | 25 - .../activiti/activiti.mysql.drop.identity.sql | 10 - ...sql => activiti.mysql55.create.engine.sql} | 112 +- ...ql => activiti.mysql55.create.history.sql} | 63 +- .../activiti.oracle.create.engine.sql | 19 +- .../activiti.oracle.create.history.sql | 13 +- .../activiti/activiti.oracle.drop.engine.sql | 94 -- .../activiti/activiti.oracle.drop.history.sql | 24 - .../activiti.oracle.drop.identity.sql | 13 - .../activiti.postgres.create.engine.sql | 24 +- .../activiti.postgres.create.history.sql | 11 +- .../activiti.postgres.drop.engine.sql | 11 - .../activiti.postgres.drop.history.sql | 8 - .../activiti.postgres.drop.identity.sql | 4 - config/sql/midpoint/2.2/h2/h2-2.2.sql | 964 -------------- .../2.2/h2/h2-upgrade-2.2-to-2.2.1.sql | 14 - config/sql/midpoint/2.2/mysql/mysql-2.2.sql | 1145 ----------------- .../2.2/mysql/mysql-upgrade-2.2-to-2.2.1.sql | 15 - config/sql/midpoint/2.2/oracle/oracle-2.2.sql | 964 -------------- .../oracle/oracle-upgrade-2.2-to-2.2.1.sql | 14 - .../2.2/postgresql/postgresql-2.2.sql | 964 -------------- .../postgresql-upgrade-2.2-to-2.2.1.sql | 14 - .../midpoint/2.2/sqlserver/sqlserver-2.2.sql | 968 -------------- .../sqlserver-upgrade-2.2-to-2.2.1.sql | 15 - .../h2/h2-3.1-closure-upgrade.sql} | 0 .../{3.0/h2/h2-3.0.sql => 3.1/h2/h2-3.1.sql} | 0 .../mysql/mysql-3.1-closure-upgrade.sql} | 0 .../mysql-3.0.sql => 3.1/mysql/mysql-3.1.sql} | 0 .../oracle/oracle-3.1-closure-upgrade.sql} | 0 .../oracle/oracle-3.1.sql} | 0 .../postgresql-3.1-closure-upgrade.sql} | 0 .../postgresql/postgresql-3.1.sql} | 0 .../sqlserver-3.1-closure-upgrade.sql} | 0 .../sqlserver/sqlserver-3.1.sql} | 0 56 files changed, 1270 insertions(+), 6760 deletions(-) rename config/sql/_all/{h2-3.0-all.sql => h2-3.1-all.sql} (76%) rename config/sql/_all/{mysql-3.0-all.sql => mysql-3.1-all.sql} (98%) rename config/sql/_all/{oracle-3.0-all.sql => oracle-3.1-all.sql} (79%) rename config/sql/_all/{postgresql-3.0-all.sql => postgresql-3.1-all.sql} (98%) rename config/sql/_all/{sqlserver-3.0-all.sql => sqlserver-3.1-all.sql} (82%) delete mode 100644 config/sql/activiti/activiti.db2.create.identity.sql delete mode 100644 config/sql/activiti/activiti.db2.drop.engine.sql delete mode 100644 config/sql/activiti/activiti.db2.drop.history.sql delete mode 100644 config/sql/activiti/activiti.db2.drop.identity.sql delete mode 100644 config/sql/activiti/activiti.h2.drop.engine.sql delete mode 100644 config/sql/activiti/activiti.h2.drop.history.sql delete mode 100644 config/sql/activiti/activiti.h2.drop.identity.sql delete mode 100644 config/sql/activiti/activiti.mssql.drop.engine.sql delete mode 100644 config/sql/activiti/activiti.mssql.drop.history.sql delete mode 100644 config/sql/activiti/activiti.mssql.drop.identity.sql delete mode 100644 config/sql/activiti/activiti.mysql.drop.engine.sql delete mode 100644 config/sql/activiti/activiti.mysql.drop.history.sql delete mode 100644 config/sql/activiti/activiti.mysql.drop.identity.sql rename config/sql/activiti/{activiti.db2.create.engine.sql => activiti.mysql55.create.engine.sql} (76%) rename config/sql/activiti/{activiti.db2.create.history.sql => activiti.mysql55.create.history.sql} (77%) delete mode 100644 config/sql/activiti/activiti.oracle.drop.engine.sql delete mode 100644 config/sql/activiti/activiti.oracle.drop.history.sql delete mode 100644 config/sql/activiti/activiti.oracle.drop.identity.sql delete mode 100644 config/sql/activiti/activiti.postgres.drop.engine.sql delete mode 100644 config/sql/activiti/activiti.postgres.drop.history.sql delete mode 100644 config/sql/activiti/activiti.postgres.drop.identity.sql delete mode 100644 config/sql/midpoint/2.2/h2/h2-2.2.sql delete mode 100644 config/sql/midpoint/2.2/h2/h2-upgrade-2.2-to-2.2.1.sql delete mode 100644 config/sql/midpoint/2.2/mysql/mysql-2.2.sql delete mode 100644 config/sql/midpoint/2.2/mysql/mysql-upgrade-2.2-to-2.2.1.sql delete mode 100644 config/sql/midpoint/2.2/oracle/oracle-2.2.sql delete mode 100644 config/sql/midpoint/2.2/oracle/oracle-upgrade-2.2-to-2.2.1.sql delete mode 100644 config/sql/midpoint/2.2/postgresql/postgresql-2.2.sql delete mode 100644 config/sql/midpoint/2.2/postgresql/postgresql-upgrade-2.2-to-2.2.1.sql delete mode 100644 config/sql/midpoint/2.2/sqlserver/sqlserver-2.2.sql delete mode 100644 config/sql/midpoint/2.2/sqlserver/sqlserver-upgrade-2.2-to-2.2.1.sql rename config/sql/midpoint/{3.0/h2/h2-3.0-closure-upgrade.sql => 3.1/h2/h2-3.1-closure-upgrade.sql} (100%) rename config/sql/midpoint/{3.0/h2/h2-3.0.sql => 3.1/h2/h2-3.1.sql} (100%) rename config/sql/midpoint/{3.0/mysql/mysql-3.0-closure-upgrade.sql => 3.1/mysql/mysql-3.1-closure-upgrade.sql} (100%) rename config/sql/midpoint/{3.0/mysql/mysql-3.0.sql => 3.1/mysql/mysql-3.1.sql} (100%) rename config/sql/midpoint/{3.0/oracle/oracle-3.0-closure-upgrade.sql => 3.1/oracle/oracle-3.1-closure-upgrade.sql} (100%) rename config/sql/midpoint/{3.0/oracle/oracle-3.0.sql => 3.1/oracle/oracle-3.1.sql} (100%) rename config/sql/midpoint/{3.0/postgresql/postgresql-3.0-closure-upgrade.sql => 3.1/postgresql/postgresql-3.1-closure-upgrade.sql} (100%) rename config/sql/midpoint/{3.0/postgresql/postgresql-3.0.sql => 3.1/postgresql/postgresql-3.1.sql} (100%) rename config/sql/midpoint/{3.0/sqlserver/sqlserver-3.0-closure-upgrade.sql => 3.1/sqlserver/sqlserver-3.1-closure-upgrade.sql} (100%) rename config/sql/midpoint/{3.0/sqlserver/sqlserver-3.0.sql => 3.1/sqlserver/sqlserver-3.1.sql} (100%) diff --git a/config/sql/_all/h2-3.0-all.sql b/config/sql/_all/h2-3.1-all.sql similarity index 76% rename from config/sql/_all/h2-3.0-all.sql rename to config/sql/_all/h2-3.1-all.sql index 6a39a854e22..f23241952b9 100644 --- a/config/sql/_all/h2-3.0-all.sql +++ b/config/sql/_all/h2-3.1-all.sql @@ -1086,173 +1086,179 @@ ALTER TABLE QRTZ_TRIGGERS ADD ); create table ACT_GE_PROPERTY ( - NAME_ varchar(64) not null, - VALUE_ varchar(300), - REV_ integer, - primary key (NAME_) + NAME_ varchar(64), + VALUE_ varchar(300), + REV_ integer, + primary key (NAME_) ); insert into ACT_GE_PROPERTY -values ('schema.version', '5.13', 1); +values ('schema.version', '5.15.1', 1); insert into ACT_GE_PROPERTY -values ('schema.history', 'create(5.13)', 1); +values ('schema.history', 'create(5.15.1)', 1); insert into ACT_GE_PROPERTY values ('next.dbid', '1', 1); create table ACT_GE_BYTEARRAY ( - ID_ varchar(64) not null, - REV_ integer, - NAME_ varchar(255), - DEPLOYMENT_ID_ varchar(64), - BYTES_ BLOB, - GENERATED_ smallint check(GENERATED_ in (1,0)), - primary key (ID_) + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + DEPLOYMENT_ID_ varchar(64), + BYTES_ longvarbinary, + GENERATED_ bit, + primary key (ID_) ); create table ACT_RE_DEPLOYMENT ( - ID_ varchar(64) not null, - NAME_ varchar(255), - CATEGORY_ varchar(255), - DEPLOY_TIME_ timestamp, - primary key (ID_) + ID_ varchar(64), + NAME_ varchar(255), + CATEGORY_ varchar(255), + TENANT_ID_ varchar(255) default '', + DEPLOY_TIME_ timestamp, + primary key (ID_) ); create table ACT_RE_MODEL ( - ID_ varchar(64) not null, - REV_ integer, - NAME_ varchar(255), - KEY_ varchar(255), - CATEGORY_ varchar(255), - CREATE_TIME_ timestamp, - LAST_UPDATE_TIME_ timestamp, - VERSION_ integer, - META_INFO_ varchar(4000), - DEPLOYMENT_ID_ varchar(64), - EDITOR_SOURCE_VALUE_ID_ varchar(64), - EDITOR_SOURCE_EXTRA_VALUE_ID_ varchar(64), - primary key (ID_) + ID_ varchar(64) not null, + REV_ integer, + NAME_ varchar(255), + KEY_ varchar(255), + CATEGORY_ varchar(255), + CREATE_TIME_ timestamp, + LAST_UPDATE_TIME_ timestamp, + VERSION_ integer, + META_INFO_ varchar(4000), + DEPLOYMENT_ID_ varchar(64), + EDITOR_SOURCE_VALUE_ID_ varchar(64), + EDITOR_SOURCE_EXTRA_VALUE_ID_ varchar(64), + TENANT_ID_ varchar(255) default '', + primary key (ID_) ); create table ACT_RU_EXECUTION ( - ID_ varchar(64) not null, - REV_ integer, - PROC_INST_ID_ varchar(64), - BUSINESS_KEY_ varchar(255), - PARENT_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), - SUPER_EXEC_ varchar(64), - ACT_ID_ varchar(255), - IS_ACTIVE_ smallint check(IS_ACTIVE_ in (1,0)), - IS_CONCURRENT_ smallint check(IS_CONCURRENT_ in (1,0)), - IS_SCOPE_ smallint check(IS_SCOPE_ in (1,0)), - IS_EVENT_SCOPE_ smallint check(IS_EVENT_SCOPE_ in (1,0)), - UNI_BUSINESS_KEY varchar (255) not null generated always as (case when "BUSINESS_KEY_" is null then "ID_" else "BUSINESS_KEY_" end), - UNI_PROC_DEF_ID varchar (64) not null generated always as (case when "PROC_DEF_ID_" is null then "ID_" else "PROC_DEF_ID_" end), - SUSPENSION_STATE_ integer, - CACHED_ENT_STATE_ integer, - primary key (ID_) + ID_ varchar(64), + REV_ integer, + PROC_INST_ID_ varchar(64), + BUSINESS_KEY_ varchar(255), + PARENT_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + SUPER_EXEC_ varchar(64), + ACT_ID_ varchar(255), + IS_ACTIVE_ bit, + IS_CONCURRENT_ bit, + IS_SCOPE_ bit, + IS_EVENT_SCOPE_ bit, + SUSPENSION_STATE_ integer, + CACHED_ENT_STATE_ integer, + TENANT_ID_ varchar(255) default '', + primary key (ID_) ); create table ACT_RU_JOB ( - ID_ varchar(64) not null, - REV_ integer, - TYPE_ varchar(255) not null, - LOCK_EXP_TIME_ timestamp, - LOCK_OWNER_ varchar(255), - EXCLUSIVE_ smallint check(EXCLUSIVE_ in (1,0)), - EXECUTION_ID_ varchar(64), - PROCESS_INSTANCE_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), - RETRIES_ integer, - EXCEPTION_STACK_ID_ varchar(64), - EXCEPTION_MSG_ varchar(4000), - DUEDATE_ timestamp, - REPEAT_ varchar(255), - HANDLER_TYPE_ varchar(255), - HANDLER_CFG_ varchar(4000), - primary key (ID_) + ID_ varchar(64) NOT NULL, + REV_ integer, + TYPE_ varchar(255) NOT NULL, + LOCK_EXP_TIME_ timestamp, + LOCK_OWNER_ varchar(255), + EXCLUSIVE_ boolean, + EXECUTION_ID_ varchar(64), + PROCESS_INSTANCE_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + RETRIES_ integer, + EXCEPTION_STACK_ID_ varchar(64), + EXCEPTION_MSG_ varchar(4000), + DUEDATE_ timestamp, + REPEAT_ varchar(255), + HANDLER_TYPE_ varchar(255), + HANDLER_CFG_ varchar(4000), + TENANT_ID_ varchar(255) default '', + primary key (ID_) ); create table ACT_RE_PROCDEF ( - ID_ varchar(64) not null, - REV_ integer, - CATEGORY_ varchar(255), - NAME_ varchar(255), - KEY_ varchar(255) not null, - VERSION_ integer not null, - DEPLOYMENT_ID_ varchar(64), - RESOURCE_NAME_ varchar(4000), - DGRM_RESOURCE_NAME_ varchar(4000), - DESCRIPTION_ varchar(4000), - HAS_START_FORM_KEY_ smallint check(HAS_START_FORM_KEY_ in (1,0)), - SUSPENSION_STATE_ integer, - primary key (ID_) + ID_ varchar(64) NOT NULL, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) NOT NULL, + VERSION_ integer NOT NULL, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + DESCRIPTION_ varchar(4000), + HAS_START_FORM_KEY_ bit, + SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(255) default '', + primary key (ID_) ); create table ACT_RU_TASK ( - ID_ varchar(64) not null, - REV_ integer, - EXECUTION_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), - NAME_ varchar(255), - PARENT_TASK_ID_ varchar(64), - DESCRIPTION_ varchar(4000), - TASK_DEF_KEY_ varchar(255), - OWNER_ varchar(255), - ASSIGNEE_ varchar(255), - DELEGATION_ varchar(64), - PRIORITY_ integer, - CREATE_TIME_ timestamp, - DUE_DATE_ timestamp, - SUSPENSION_STATE_ integer, - primary key (ID_) + ID_ varchar(64), + REV_ integer, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + NAME_ varchar(255), + PARENT_TASK_ID_ varchar(64), + DESCRIPTION_ varchar(4000), + TASK_DEF_KEY_ varchar(255), + OWNER_ varchar(255), + ASSIGNEE_ varchar(255), + DELEGATION_ varchar(64), + PRIORITY_ integer, + CREATE_TIME_ timestamp, + DUE_DATE_ timestamp, + CATEGORY_ varchar(255), + SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(255) default '', + primary key (ID_) ); create table ACT_RU_IDENTITYLINK ( - ID_ varchar(64) not null, - REV_ integer, - GROUP_ID_ varchar(255), - TYPE_ varchar(255), - USER_ID_ varchar(255), - TASK_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), - primary key (ID_) + ID_ varchar(64), + REV_ integer, + GROUP_ID_ varchar(255), + TYPE_ varchar(255), + USER_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_INST_ID_ varchar(64) null, + PROC_DEF_ID_ varchar(64), + primary key (ID_) ); create table ACT_RU_VARIABLE ( - ID_ varchar(64) not null, - REV_ integer, - TYPE_ varchar(255) not null, - NAME_ varchar(255) not null, - EXECUTION_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - TASK_ID_ varchar(64), - BYTEARRAY_ID_ varchar(64), - DOUBLE_ double precision, - LONG_ bigint, - TEXT_ varchar(4000), - TEXT2_ varchar(4000), - primary key (ID_) + ID_ varchar(64) not null, + REV_ integer, + TYPE_ varchar(255) not null, + NAME_ varchar(255) not null, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + TASK_ID_ varchar(64), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ varchar(4000), + TEXT2_ varchar(4000), + primary key (ID_) ); create table ACT_RU_EVENT_SUBSCR ( - ID_ varchar(64) not null, - REV_ integer, - EVENT_TYPE_ varchar(255) not null, - EVENT_NAME_ varchar(255), - EXECUTION_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - ACTIVITY_ID_ varchar(64), - CONFIGURATION_ varchar(255), - CREATED_ timestamp not null, - primary key (ID_) -); - -create unique index ACT_UNIQ_RU_BUS_KEY on ACT_RU_EXECUTION(UNI_PROC_DEF_ID, UNI_BUSINESS_KEY); + ID_ varchar(64) not null, + REV_ integer, + EVENT_TYPE_ varchar(255) not null, + EVENT_NAME_ varchar(255), + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + ACTIVITY_ID_ varchar(64), + CONFIGURATION_ varchar(255), + CREATED_ timestamp not null, + PROC_DEF_ID_ varchar(64), + TENANT_ID_ varchar(255) default '', + primary key (ID_) +); + create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_); create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_); create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_); @@ -1262,229 +1268,235 @@ create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_); create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_); alter table ACT_GE_BYTEARRAY - add constraint ACT_FK_BYTEARR_DEPL - foreign key (DEPLOYMENT_ID_) - references ACT_RE_DEPLOYMENT (ID_); +add constraint ACT_FK_BYTEARR_DEPL +foreign key (DEPLOYMENT_ID_) +references ACT_RE_DEPLOYMENT; alter table ACT_RE_PROCDEF - add constraint ACT_UNIQ_PROCDEF - unique (KEY_,VERSION_); +add constraint ACT_UNIQ_PROCDEF +unique (KEY_,VERSION_, TENANT_ID_); alter table ACT_RU_EXECUTION - add constraint ACT_FK_EXE_PROCINST - foreign key (PROC_INST_ID_) - references ACT_RU_EXECUTION (ID_); +add constraint ACT_FK_EXE_PROCINST +foreign key (PROC_INST_ID_) +references ACT_RU_EXECUTION; alter table ACT_RU_EXECUTION - add constraint ACT_FK_EXE_PARENT - foreign key (PARENT_ID_) - references ACT_RU_EXECUTION (ID_); +add constraint ACT_FK_EXE_PARENT +foreign key (PARENT_ID_) +references ACT_RU_EXECUTION; alter table ACT_RU_EXECUTION - add constraint ACT_FK_EXE_SUPER - foreign key (SUPER_EXEC_) - references ACT_RU_EXECUTION (ID_); +add constraint ACT_FK_EXE_SUPER +foreign key (SUPER_EXEC_) +references ACT_RU_EXECUTION; alter table ACT_RU_EXECUTION - add constraint ACT_FK_EXE_PROCDEF - foreign key (PROC_DEF_ID_) - references ACT_RE_PROCDEF (ID_); +add constraint ACT_FK_EXE_PROCDEF +foreign key (PROC_DEF_ID_) +references ACT_RE_PROCDEF (ID_); alter table ACT_RU_IDENTITYLINK - add constraint ACT_FK_TSKASS_TASK - foreign key (TASK_ID_) - references ACT_RU_TASK (ID_); +add constraint ACT_FK_TSKASS_TASK +foreign key (TASK_ID_) +references ACT_RU_TASK; alter table ACT_RU_IDENTITYLINK - add constraint ACT_FK_ATHRZ_PROCEDEF - foreign key (PROC_DEF_ID_) - references ACT_RE_PROCDEF (ID_); +add constraint ACT_FK_ATHRZ_PROCEDEF +foreign key (PROC_DEF_ID_) +references ACT_RE_PROCDEF; alter table ACT_RU_IDENTITYLINK - add constraint ACT_FK_IDL_PROCINST - foreign key (PROC_INST_ID_) - references ACT_RU_EXECUTION (ID_); +add constraint ACT_FK_IDL_PROCINST +foreign key (PROC_INST_ID_) +references ACT_RU_EXECUTION (ID_); alter table ACT_RU_TASK - add constraint ACT_FK_TASK_EXE - foreign key (EXECUTION_ID_) - references ACT_RU_EXECUTION (ID_); +add constraint ACT_FK_TASK_EXE +foreign key (EXECUTION_ID_) +references ACT_RU_EXECUTION; alter table ACT_RU_TASK - add constraint ACT_FK_TASK_PROCINST - foreign key (PROC_INST_ID_) - references ACT_RU_EXECUTION (ID_); +add constraint ACT_FK_TASK_PROCINST +foreign key (PROC_INST_ID_) +references ACT_RU_EXECUTION; alter table ACT_RU_TASK - add constraint ACT_FK_TASK_PROCDEF - foreign key (PROC_DEF_ID_) - references ACT_RE_PROCDEF (ID_); +add constraint ACT_FK_TASK_PROCDEF +foreign key (PROC_DEF_ID_) +references ACT_RE_PROCDEF; alter table ACT_RU_VARIABLE - add constraint ACT_FK_VAR_EXE - foreign key (EXECUTION_ID_) - references ACT_RU_EXECUTION (ID_); +add constraint ACT_FK_VAR_EXE +foreign key (EXECUTION_ID_) +references ACT_RU_EXECUTION; alter table ACT_RU_VARIABLE - add constraint ACT_FK_VAR_PROCINST - foreign key (PROC_INST_ID_) - references ACT_RU_EXECUTION(ID_); +add constraint ACT_FK_VAR_PROCINST +foreign key (PROC_INST_ID_) +references ACT_RU_EXECUTION; alter table ACT_RU_VARIABLE - add constraint ACT_FK_VAR_BYTEARRAY - foreign key (BYTEARRAY_ID_) - references ACT_GE_BYTEARRAY (ID_); +add constraint ACT_FK_VAR_BYTEARRAY +foreign key (BYTEARRAY_ID_) +references ACT_GE_BYTEARRAY; alter table ACT_RU_JOB - add constraint ACT_FK_JOB_EXCEPTION - foreign key (EXCEPTION_STACK_ID_) - references ACT_GE_BYTEARRAY (ID_); +add constraint ACT_FK_JOB_EXCEPTION +foreign key (EXCEPTION_STACK_ID_) +references ACT_GE_BYTEARRAY; alter table ACT_RU_EVENT_SUBSCR - add constraint ACT_FK_EVENT_EXEC - foreign key (EXECUTION_ID_) - references ACT_RU_EXECUTION(ID_); +add constraint ACT_FK_EVENT_EXEC +foreign key (EXECUTION_ID_) +references ACT_RU_EXECUTION; alter table ACT_RE_MODEL - add constraint ACT_FK_MODEL_SOURCE - foreign key (EDITOR_SOURCE_VALUE_ID_) - references ACT_GE_BYTEARRAY (ID_); +add constraint ACT_FK_MODEL_SOURCE +foreign key (EDITOR_SOURCE_VALUE_ID_) +references ACT_GE_BYTEARRAY (ID_); alter table ACT_RE_MODEL - add constraint ACT_FK_MODEL_SOURCE_EXTRA - foreign key (EDITOR_SOURCE_EXTRA_VALUE_ID_) - references ACT_GE_BYTEARRAY (ID_); +add constraint ACT_FK_MODEL_SOURCE_EXTRA +foreign key (EDITOR_SOURCE_EXTRA_VALUE_ID_) +references ACT_GE_BYTEARRAY (ID_); alter table ACT_RE_MODEL - add constraint ACT_FK_MODEL_DEPLOYMENT - foreign key (DEPLOYMENT_ID_) - references ACT_RE_DEPLOYMENT (ID_); +add constraint ACT_FK_MODEL_DEPLOYMENT +foreign key (DEPLOYMENT_ID_) +references ACT_RE_DEPLOYMENT (ID_); create table ACT_HI_PROCINST ( - ID_ varchar(64) not null, - PROC_INST_ID_ varchar(64) not null, - BUSINESS_KEY_ varchar(255), - PROC_DEF_ID_ varchar(64) not null, - START_TIME_ timestamp not null, - END_TIME_ timestamp, - DURATION_ bigint, - START_USER_ID_ varchar(255), - START_ACT_ID_ varchar(255), - END_ACT_ID_ varchar(255), - SUPER_PROCESS_INSTANCE_ID_ varchar(64), - DELETE_REASON_ varchar(4000), - primary key (ID_), - unique (PROC_INST_ID_) + ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) not null, + BUSINESS_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64) not null, + START_TIME_ timestamp not null, + END_TIME_ timestamp, + DURATION_ bigint, + START_USER_ID_ varchar(255), + START_ACT_ID_ varchar(255), + END_ACT_ID_ varchar(255), + SUPER_PROCESS_INSTANCE_ID_ varchar(64), + DELETE_REASON_ varchar(4000), + TENANT_ID_ varchar(255) default '', + primary key (ID_), + unique (PROC_INST_ID_) ); create table ACT_HI_ACTINST ( - ID_ varchar(64) not null, - PROC_DEF_ID_ varchar(64) not null, - PROC_INST_ID_ varchar(64) not null, - EXECUTION_ID_ varchar(64) not null, - ACT_ID_ varchar(255) not null, - TASK_ID_ varchar(64), - CALL_PROC_INST_ID_ varchar(64), - ACT_NAME_ varchar(255), - ACT_TYPE_ varchar(255) not null, - ASSIGNEE_ varchar(64), - START_TIME_ timestamp not null, - END_TIME_ timestamp, - DURATION_ bigint, - primary key (ID_) + ID_ varchar(64) not null, + PROC_DEF_ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) not null, + EXECUTION_ID_ varchar(64) not null, + ACT_ID_ varchar(255) not null, + TASK_ID_ varchar(64), + CALL_PROC_INST_ID_ varchar(64), + ACT_NAME_ varchar(255), + ACT_TYPE_ varchar(255) not null, + ASSIGNEE_ varchar(255), + START_TIME_ timestamp not null, + END_TIME_ timestamp, + DURATION_ bigint, + TENANT_ID_ varchar(255) default '', + primary key (ID_) ); create table ACT_HI_TASKINST ( - ID_ varchar(64) not null, - PROC_DEF_ID_ varchar(64), - TASK_DEF_KEY_ varchar(255), - PROC_INST_ID_ varchar(64), - EXECUTION_ID_ varchar(64), - NAME_ varchar(255), - PARENT_TASK_ID_ varchar(64), - DESCRIPTION_ varchar(4000), - OWNER_ varchar(255), - ASSIGNEE_ varchar(255), - START_TIME_ timestamp not null, - CLAIM_TIME_ timestamp, - END_TIME_ timestamp, - DURATION_ bigint, - DELETE_REASON_ varchar(4000), - PRIORITY_ integer, - DUE_DATE_ timestamp, - FORM_KEY_ varchar(255), - primary key (ID_) + ID_ varchar(64) not null, + PROC_DEF_ID_ varchar(64), + TASK_DEF_KEY_ varchar(255), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + NAME_ varchar(255), + PARENT_TASK_ID_ varchar(64), + DESCRIPTION_ varchar(4000), + OWNER_ varchar(255), + ASSIGNEE_ varchar(255), + START_TIME_ timestamp not null, + CLAIM_TIME_ timestamp, + END_TIME_ timestamp, + DURATION_ bigint, + DELETE_REASON_ varchar(4000), + PRIORITY_ integer, + DUE_DATE_ timestamp, + FORM_KEY_ varchar(255), + CATEGORY_ varchar(255), + TENANT_ID_ varchar(255) default '', + primary key (ID_) ); create table ACT_HI_VARINST ( - ID_ varchar(64) not null, - PROC_INST_ID_ varchar(64), - EXECUTION_ID_ varchar(64), - TASK_ID_ varchar(64), - NAME_ varchar(255) not null, - VAR_TYPE_ varchar(100), - REV_ integer, - BYTEARRAY_ID_ varchar(64), - DOUBLE_ double, - LONG_ bigint, - TEXT_ varchar(4000), - TEXT2_ varchar(4000), - primary key (ID_) + ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + NAME_ varchar(255) not null, + VAR_TYPE_ varchar(100), + REV_ integer, + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ varchar(4000), + TEXT2_ varchar(4000), + CREATE_TIME_ timestamp, + LAST_UPDATED_TIME_ timestamp, + primary key (ID_) ); create table ACT_HI_DETAIL ( - ID_ varchar(64) not null, - TYPE_ varchar(255) not null, - TIME_ timestamp not null, - NAME_ varchar(255), - PROC_INST_ID_ varchar(64), - EXECUTION_ID_ varchar(64), - TASK_ID_ varchar(64), - ACT_INST_ID_ varchar(64), - VAR_TYPE_ varchar(255), - REV_ integer, - BYTEARRAY_ID_ varchar(64), - DOUBLE_ double, - LONG_ bigint, - TEXT_ varchar(4000), - TEXT2_ varchar(4000), - primary key (ID_) + ID_ varchar(64) not null, + TYPE_ varchar(255) not null, + TIME_ timestamp not null, + NAME_ varchar(255), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + VAR_TYPE_ varchar(255), + REV_ integer, + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ varchar(4000), + TEXT2_ varchar(4000), + primary key (ID_) ); create table ACT_HI_COMMENT ( - ID_ varchar(64) not null, - TYPE_ varchar(255), - TIME_ timestamp not null, - USER_ID_ varchar(255), - TASK_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - ACTION_ varchar(255), - MESSAGE_ varchar(4000), - FULL_MSG_ longvarbinary, - primary key (ID_) + ID_ varchar(64) not null, + TYPE_ varchar(255), + TIME_ timestamp not null, + USER_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + ACTION_ varchar(255), + MESSAGE_ varchar(4000), + FULL_MSG_ longvarbinary, + primary key (ID_) ); create table ACT_HI_ATTACHMENT ( - ID_ varchar(64) not null, - REV_ integer, - USER_ID_ varchar(255), - NAME_ varchar(255), - DESCRIPTION_ varchar(4000), - TYPE_ varchar(255), - TASK_ID_ varchar(64), - PROC_INST_ID_ varchar(64), - URL_ varchar(4000), - CONTENT_ID_ varchar(64), - primary key (ID_) + ID_ varchar(64) not null, + REV_ integer, + USER_ID_ varchar(255), + NAME_ varchar(255), + DESCRIPTION_ varchar(4000), + TYPE_ varchar(255), + TASK_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + URL_ varchar(4000), + CONTENT_ID_ varchar(64), + primary key (ID_) ); create table ACT_HI_IDENTITYLINK ( - ID_ varchar(64), - GROUP_ID_ varchar(255), - TYPE_ varchar(255), - USER_ID_ varchar(255), - TASK_ID_ varchar(64), - PROC_INST_ID_ varchar(64) null, - primary key (ID_) + ID_ varchar(64), + GROUP_ID_ varchar(255), + TYPE_ varchar(255), + USER_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_INST_ID_ varchar(64) null, + primary key (ID_) ); create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_); @@ -1503,57 +1515,53 @@ create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); create index ACT_IDX_HI_IDENT_LNK_TASK on ACT_HI_IDENTITYLINK(TASK_ID_); create index ACT_IDX_HI_IDENT_LNK_PROCINST on ACT_HI_IDENTITYLINK(PROC_INST_ID_); -alter table ACT_HI_PROCINST - add constraint ACT_UNIQ_HI_BUS_KEY - unique(PROC_DEF_ID_, BUSINESS_KEY_); - create index ACT_IDX_HI_ACT_INST_EXEC on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_); create table ACT_ID_GROUP ( - ID_ varchar(64), - REV_ integer, - NAME_ varchar(255), - TYPE_ varchar(255), - primary key (ID_) + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + TYPE_ varchar(255), + primary key (ID_) ); create table ACT_ID_MEMBERSHIP ( - USER_ID_ varchar(64), - GROUP_ID_ varchar(64), - primary key (USER_ID_, GROUP_ID_) + USER_ID_ varchar(64), + GROUP_ID_ varchar(64), + primary key (USER_ID_, GROUP_ID_) ); create table ACT_ID_USER ( - ID_ varchar(64), - REV_ integer, - FIRST_ varchar(255), - LAST_ varchar(255), - EMAIL_ varchar(255), - PWD_ varchar(255), - PICTURE_ID_ varchar(64), - primary key (ID_) + ID_ varchar(64), + REV_ integer, + FIRST_ varchar(255), + LAST_ varchar(255), + EMAIL_ varchar(255), + PWD_ varchar(255), + PICTURE_ID_ varchar(64), + primary key (ID_) ); create table ACT_ID_INFO ( - ID_ varchar(64), - REV_ integer, - USER_ID_ varchar(64), - TYPE_ varchar(64), - KEY_ varchar(255), - VALUE_ varchar(255), - PASSWORD_ longvarbinary, - PARENT_ID_ varchar(255), - primary key (ID_) + ID_ varchar(64), + REV_ integer, + USER_ID_ varchar(64), + TYPE_ varchar(64), + KEY_ varchar(255), + VALUE_ varchar(255), + PASSWORD_ longvarbinary, + PARENT_ID_ varchar(255), + primary key (ID_) ); alter table ACT_ID_MEMBERSHIP - add constraint ACT_FK_MEMB_GROUP - foreign key (GROUP_ID_) - references ACT_ID_GROUP; +add constraint ACT_FK_MEMB_GROUP +foreign key (GROUP_ID_) +references ACT_ID_GROUP; alter table ACT_ID_MEMBERSHIP - add constraint ACT_FK_MEMB_USER - foreign key (USER_ID_) - references ACT_ID_USER; +add constraint ACT_FK_MEMB_USER +foreign key (USER_ID_) +references ACT_ID_USER; commit; diff --git a/config/sql/_all/mysql-3.0-all.sql b/config/sql/_all/mysql-3.1-all.sql similarity index 98% rename from config/sql/_all/mysql-3.0-all.sql rename to config/sql/_all/mysql-3.1-all.sql index 840b224d6c6..43f2f6f277f 100644 --- a/config/sql/_all/mysql-3.0-all.sql +++ b/config/sql/_all/mysql-3.1-all.sql @@ -1,3 +1,7 @@ +# Activiti scripts are for MySQL 5.6.4+ +# see http://jira.codehaus.org/browse/ACT-1867 for more information +#------------------------------ + # use for db create # CREATE DATABASE # CHARACTER SET utf8 @@ -1219,10 +1223,10 @@ create table ACT_GE_PROPERTY ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; insert into ACT_GE_PROPERTY -values ('schema.version', '5.13', 1); +values ('schema.version', '5.15.1', 1); insert into ACT_GE_PROPERTY -values ('schema.history', 'create(5.13)', 1); +values ('schema.history', 'create(5.15.1)', 1); insert into ACT_GE_PROPERTY values ('next.dbid', '1', 1); @@ -1241,6 +1245,7 @@ create table ACT_RE_DEPLOYMENT ( ID_ varchar(64), NAME_ varchar(255), CATEGORY_ varchar(255), + TENANT_ID_ varchar(255) default '', DEPLOY_TIME_ timestamp, primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; @@ -1258,6 +1263,7 @@ create table ACT_RE_MODEL ( DEPLOYMENT_ID_ varchar(64), EDITOR_SOURCE_VALUE_ID_ varchar(64), EDITOR_SOURCE_EXTRA_VALUE_ID_ varchar(64), + TENANT_ID_ varchar(255) default '', primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; @@ -1276,8 +1282,8 @@ create table ACT_RU_EXECUTION ( IS_EVENT_SCOPE_ TINYINT, SUSPENSION_STATE_ integer, CACHED_ENT_STATE_ integer, - primary key (ID_), - unique ACT_UNIQ_RU_BUS_KEY (PROC_DEF_ID_, BUSINESS_KEY_) + TENANT_ID_ varchar(255) default '', + primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; create table ACT_RU_JOB ( @@ -1297,6 +1303,7 @@ create table ACT_RU_JOB ( REPEAT_ varchar(255), HANDLER_TYPE_ varchar(255), HANDLER_CFG_ varchar(4000), + TENANT_ID_ varchar(255) default '', primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; @@ -1313,6 +1320,7 @@ create table ACT_RE_PROCDEF ( DESCRIPTION_ varchar(4000), HAS_START_FORM_KEY_ TINYINT, SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(255) default '', primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; @@ -1332,7 +1340,9 @@ create table ACT_RU_TASK ( PRIORITY_ integer, CREATE_TIME_ timestamp, DUE_DATE_ datetime, + CATEGORY_ varchar(255), SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(255) default '', primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; @@ -1373,7 +1383,9 @@ create table ACT_RU_EVENT_SUBSCR ( PROC_INST_ID_ varchar(64), ACTIVITY_ID_ varchar(64), CONFIGURATION_ varchar(255), - CREATED_ timestamp not null, + CREATED_ timestamp not null DEFAULT CURRENT_TIMESTAMP, + PROC_DEF_ID_ varchar(64), + TENANT_ID_ varchar(255) default '', primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; @@ -1392,7 +1404,7 @@ references ACT_RE_DEPLOYMENT (ID_); alter table ACT_RE_PROCDEF add constraint ACT_UNIQ_PROCDEF -unique (KEY_,VERSION_); +unique (KEY_,VERSION_, TENANT_ID_); alter table ACT_RU_EXECUTION add constraint ACT_FK_EXE_PROCINST @@ -1497,9 +1509,9 @@ create table ACT_HI_PROCINST ( END_ACT_ID_ varchar(255), SUPER_PROCESS_INSTANCE_ID_ varchar(64), DELETE_REASON_ varchar(4000), + TENANT_ID_ varchar(255) default '', primary key (ID_), - unique (PROC_INST_ID_), - unique ACT_UNIQ_HI_BUS_KEY (PROC_DEF_ID_, BUSINESS_KEY_) + unique (PROC_INST_ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; create table ACT_HI_ACTINST ( @@ -1512,10 +1524,11 @@ create table ACT_HI_ACTINST ( CALL_PROC_INST_ID_ varchar(64), ACT_NAME_ varchar(255), ACT_TYPE_ varchar(255) not null, - ASSIGNEE_ varchar(64), + ASSIGNEE_ varchar(255), START_TIME_ datetime not null, END_TIME_ datetime, DURATION_ bigint, + TENANT_ID_ varchar(255) default '', primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; @@ -1538,6 +1551,8 @@ create table ACT_HI_TASKINST ( PRIORITY_ integer, DUE_DATE_ datetime, FORM_KEY_ varchar(255), + CATEGORY_ varchar(255), + TENANT_ID_ varchar(255) default '', primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; @@ -1554,6 +1569,8 @@ create table ACT_HI_VARINST ( LONG_ bigint, TEXT_ varchar(4000), TEXT2_ varchar(4000), + CREATE_TIME_ datetime, + LAST_UPDATED_TIME_ datetime, primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; diff --git a/config/sql/_all/oracle-3.0-all.sql b/config/sql/_all/oracle-3.1-all.sql similarity index 79% rename from config/sql/_all/oracle-3.0-all.sql rename to config/sql/_all/oracle-3.1-all.sql index 9353fa8e80c..5f52568c4d2 100644 --- a/config/sql/_all/oracle-3.0-all.sql +++ b/config/sql/_all/oracle-3.1-all.sql @@ -1030,168 +1030,177 @@ create index idx_qrtz_ft_t_g on qrtz_fired_triggers(SCHED_NAME,TRIGGER_NAME,TRIG create index idx_qrtz_ft_tg on qrtz_fired_triggers(SCHED_NAME,TRIGGER_GROUP); create table ACT_GE_PROPERTY ( - NAME_ NVARCHAR2(64), - VALUE_ NVARCHAR2(300), - REV_ INTEGER, - primary key (NAME_) + NAME_ NVARCHAR2(64), + VALUE_ NVARCHAR2(300), + REV_ INTEGER, + primary key (NAME_) ); insert into ACT_GE_PROPERTY -values ('schema.version', '5.13', 1); +values ('schema.version', '5.15.1', 1); insert into ACT_GE_PROPERTY -values ('schema.history', 'create(5.13)', 1); +values ('schema.history', 'create(5.15.1)', 1); insert into ACT_GE_PROPERTY values ('next.dbid', '1', 1); create table ACT_GE_BYTEARRAY ( - ID_ NVARCHAR2(64), - REV_ INTEGER, - NAME_ NVARCHAR2(255), - DEPLOYMENT_ID_ NVARCHAR2(64), - BYTES_ BLOB, - GENERATED_ NUMBER(1,0) CHECK (GENERATED_ IN (1,0)), - primary key (ID_) + ID_ NVARCHAR2(64), + REV_ INTEGER, + NAME_ NVARCHAR2(255), + DEPLOYMENT_ID_ NVARCHAR2(64), + BYTES_ BLOB, + GENERATED_ NUMBER(1,0) CHECK (GENERATED_ IN (1,0)), + primary key (ID_) ); create table ACT_RE_DEPLOYMENT ( - ID_ NVARCHAR2(64), - NAME_ NVARCHAR2(255), - CATEGORY_ NVARCHAR2(255), - DEPLOY_TIME_ TIMESTAMP(6), - primary key (ID_) + ID_ NVARCHAR2(64), + NAME_ NVARCHAR2(255), + CATEGORY_ NVARCHAR2(255), + TENANT_ID_ NVARCHAR2(255) DEFAULT '', + DEPLOY_TIME_ TIMESTAMP(6), + primary key (ID_) ); create table ACT_RE_MODEL ( - ID_ NVARCHAR2(64) not null, - REV_ INTEGER, - NAME_ NVARCHAR2(255), - KEY_ NVARCHAR2(255), - CATEGORY_ NVARCHAR2(255), - CREATE_TIME_ TIMESTAMP(6), - LAST_UPDATE_TIME_ TIMESTAMP(6), - VERSION_ INTEGER, - META_INFO_ NVARCHAR2(2000), - DEPLOYMENT_ID_ NVARCHAR2(64), - EDITOR_SOURCE_VALUE_ID_ NVARCHAR2(64), - EDITOR_SOURCE_EXTRA_VALUE_ID_ NVARCHAR2(64), - primary key (ID_) + ID_ NVARCHAR2(64) not null, + REV_ INTEGER, + NAME_ NVARCHAR2(255), + KEY_ NVARCHAR2(255), + CATEGORY_ NVARCHAR2(255), + CREATE_TIME_ TIMESTAMP(6), + LAST_UPDATE_TIME_ TIMESTAMP(6), + VERSION_ INTEGER, + META_INFO_ NVARCHAR2(2000), + DEPLOYMENT_ID_ NVARCHAR2(64), + EDITOR_SOURCE_VALUE_ID_ NVARCHAR2(64), + EDITOR_SOURCE_EXTRA_VALUE_ID_ NVARCHAR2(64), + TENANT_ID_ NVARCHAR2(255) DEFAULT '', + primary key (ID_) ); create table ACT_RU_EXECUTION ( - ID_ NVARCHAR2(64), - REV_ INTEGER, - PROC_INST_ID_ NVARCHAR2(64), - BUSINESS_KEY_ NVARCHAR2(255), - PARENT_ID_ NVARCHAR2(64), - PROC_DEF_ID_ NVARCHAR2(64), - SUPER_EXEC_ NVARCHAR2(64), - ACT_ID_ NVARCHAR2(255), - IS_ACTIVE_ NUMBER(1,0) CHECK (IS_ACTIVE_ IN (1,0)), - IS_CONCURRENT_ NUMBER(1,0) CHECK (IS_CONCURRENT_ IN (1,0)), - IS_SCOPE_ NUMBER(1,0) CHECK (IS_SCOPE_ IN (1,0)), - IS_EVENT_SCOPE_ NUMBER(1,0) CHECK (IS_EVENT_SCOPE_ IN (1,0)), - SUSPENSION_STATE_ INTEGER, - CACHED_ENT_STATE_ INTEGER, - primary key (ID_) + ID_ NVARCHAR2(64), + REV_ INTEGER, + PROC_INST_ID_ NVARCHAR2(64), + BUSINESS_KEY_ NVARCHAR2(255), + PARENT_ID_ NVARCHAR2(64), + PROC_DEF_ID_ NVARCHAR2(64), + SUPER_EXEC_ NVARCHAR2(64), + ACT_ID_ NVARCHAR2(255), + IS_ACTIVE_ NUMBER(1,0) CHECK (IS_ACTIVE_ IN (1,0)), + IS_CONCURRENT_ NUMBER(1,0) CHECK (IS_CONCURRENT_ IN (1,0)), + IS_SCOPE_ NUMBER(1,0) CHECK (IS_SCOPE_ IN (1,0)), + IS_EVENT_SCOPE_ NUMBER(1,0) CHECK (IS_EVENT_SCOPE_ IN (1,0)), + SUSPENSION_STATE_ INTEGER, + CACHED_ENT_STATE_ INTEGER, + TENANT_ID_ NVARCHAR2(255) DEFAULT '', + primary key (ID_) ); create table ACT_RU_JOB ( - ID_ NVARCHAR2(64) NOT NULL, - REV_ INTEGER, - TYPE_ NVARCHAR2(255) NOT NULL, - LOCK_EXP_TIME_ TIMESTAMP(6), - LOCK_OWNER_ NVARCHAR2(255), - EXCLUSIVE_ NUMBER(1,0) CHECK (EXCLUSIVE_ IN (1,0)), - EXECUTION_ID_ NVARCHAR2(64), - PROCESS_INSTANCE_ID_ NVARCHAR2(64), - PROC_DEF_ID_ NVARCHAR2(64), - RETRIES_ INTEGER, - EXCEPTION_STACK_ID_ NVARCHAR2(64), - EXCEPTION_MSG_ NVARCHAR2(2000), - DUEDATE_ TIMESTAMP(6), - REPEAT_ NVARCHAR2(255), - HANDLER_TYPE_ NVARCHAR2(255), - HANDLER_CFG_ NVARCHAR2(2000), - primary key (ID_) + ID_ NVARCHAR2(64) NOT NULL, + REV_ INTEGER, + TYPE_ NVARCHAR2(255) NOT NULL, + LOCK_EXP_TIME_ TIMESTAMP(6), + LOCK_OWNER_ NVARCHAR2(255), + EXCLUSIVE_ NUMBER(1,0) CHECK (EXCLUSIVE_ IN (1,0)), + EXECUTION_ID_ NVARCHAR2(64), + PROCESS_INSTANCE_ID_ NVARCHAR2(64), + PROC_DEF_ID_ NVARCHAR2(64), + RETRIES_ INTEGER, + EXCEPTION_STACK_ID_ NVARCHAR2(64), + EXCEPTION_MSG_ NVARCHAR2(2000), + DUEDATE_ TIMESTAMP(6), + REPEAT_ NVARCHAR2(255), + HANDLER_TYPE_ NVARCHAR2(255), + HANDLER_CFG_ NVARCHAR2(2000), + TENANT_ID_ NVARCHAR2(255) DEFAULT '', + primary key (ID_) ); create table ACT_RE_PROCDEF ( - ID_ NVARCHAR2(64) NOT NULL, - REV_ INTEGER, - CATEGORY_ NVARCHAR2(255), - NAME_ NVARCHAR2(255), - KEY_ NVARCHAR2(255) NOT NULL, - VERSION_ INTEGER NOT NULL, - DEPLOYMENT_ID_ NVARCHAR2(64), - RESOURCE_NAME_ NVARCHAR2(2000), - DGRM_RESOURCE_NAME_ varchar(4000), - DESCRIPTION_ NVARCHAR2(2000), - HAS_START_FORM_KEY_ NUMBER(1,0) CHECK (HAS_START_FORM_KEY_ IN (1,0)), - SUSPENSION_STATE_ INTEGER, - primary key (ID_) + ID_ NVARCHAR2(64) NOT NULL, + REV_ INTEGER, + CATEGORY_ NVARCHAR2(255), + NAME_ NVARCHAR2(255), + KEY_ NVARCHAR2(255) NOT NULL, + VERSION_ INTEGER NOT NULL, + DEPLOYMENT_ID_ NVARCHAR2(64), + RESOURCE_NAME_ NVARCHAR2(2000), + DGRM_RESOURCE_NAME_ varchar(4000), + DESCRIPTION_ NVARCHAR2(2000), + HAS_START_FORM_KEY_ NUMBER(1,0) CHECK (HAS_START_FORM_KEY_ IN (1,0)), + SUSPENSION_STATE_ INTEGER, + TENANT_ID_ NVARCHAR2(255) DEFAULT '', + primary key (ID_) ); create table ACT_RU_TASK ( - ID_ NVARCHAR2(64), - REV_ INTEGER, - EXECUTION_ID_ NVARCHAR2(64), - PROC_INST_ID_ NVARCHAR2(64), - PROC_DEF_ID_ NVARCHAR2(64), - NAME_ NVARCHAR2(255), - PARENT_TASK_ID_ NVARCHAR2(64), - DESCRIPTION_ NVARCHAR2(2000), - TASK_DEF_KEY_ NVARCHAR2(255), - OWNER_ NVARCHAR2(255), - ASSIGNEE_ NVARCHAR2(255), - DELEGATION_ NVARCHAR2(64), - PRIORITY_ INTEGER, - CREATE_TIME_ TIMESTAMP(6), - DUE_DATE_ TIMESTAMP(6), - SUSPENSION_STATE_ INTEGER, - primary key (ID_) + ID_ NVARCHAR2(64), + REV_ INTEGER, + EXECUTION_ID_ NVARCHAR2(64), + PROC_INST_ID_ NVARCHAR2(64), + PROC_DEF_ID_ NVARCHAR2(64), + NAME_ NVARCHAR2(255), + PARENT_TASK_ID_ NVARCHAR2(64), + DESCRIPTION_ NVARCHAR2(2000), + TASK_DEF_KEY_ NVARCHAR2(255), + OWNER_ NVARCHAR2(255), + ASSIGNEE_ NVARCHAR2(255), + DELEGATION_ NVARCHAR2(64), + PRIORITY_ INTEGER, + CREATE_TIME_ TIMESTAMP(6), + DUE_DATE_ TIMESTAMP(6), + CATEGORY_ NVARCHAR2(255), + SUSPENSION_STATE_ INTEGER, + TENANT_ID_ NVARCHAR2(255) DEFAULT '', + primary key (ID_) ); create table ACT_RU_IDENTITYLINK ( - ID_ NVARCHAR2(64), - REV_ INTEGER, - GROUP_ID_ NVARCHAR2(255), - TYPE_ NVARCHAR2(255), - USER_ID_ NVARCHAR2(255), - TASK_ID_ NVARCHAR2(64), - PROC_INST_ID_ NVARCHAR2(64), - PROC_DEF_ID_ NVARCHAR2(64), - primary key (ID_) + ID_ NVARCHAR2(64), + REV_ INTEGER, + GROUP_ID_ NVARCHAR2(255), + TYPE_ NVARCHAR2(255), + USER_ID_ NVARCHAR2(255), + TASK_ID_ NVARCHAR2(64), + PROC_INST_ID_ NVARCHAR2(64), + PROC_DEF_ID_ NVARCHAR2(64), + primary key (ID_) ); create table ACT_RU_VARIABLE ( - ID_ NVARCHAR2(64) not null, - REV_ INTEGER, - TYPE_ NVARCHAR2(255) not null, - NAME_ NVARCHAR2(255) not null, - EXECUTION_ID_ NVARCHAR2(64), - PROC_INST_ID_ NVARCHAR2(64), - TASK_ID_ NVARCHAR2(64), - BYTEARRAY_ID_ NVARCHAR2(64), - DOUBLE_ NUMBER(*,10), - LONG_ NUMBER(19,0), - TEXT_ NVARCHAR2(2000), - TEXT2_ NVARCHAR2(2000), - primary key (ID_) + ID_ NVARCHAR2(64) not null, + REV_ INTEGER, + TYPE_ NVARCHAR2(255) not null, + NAME_ NVARCHAR2(255) not null, + EXECUTION_ID_ NVARCHAR2(64), + PROC_INST_ID_ NVARCHAR2(64), + TASK_ID_ NVARCHAR2(64), + BYTEARRAY_ID_ NVARCHAR2(64), + DOUBLE_ NUMBER(*,10), + LONG_ NUMBER(19,0), + TEXT_ NVARCHAR2(2000), + TEXT2_ NVARCHAR2(2000), + primary key (ID_) ); create table ACT_RU_EVENT_SUBSCR ( - ID_ NVARCHAR2(64) not null, - REV_ integer, - EVENT_TYPE_ NVARCHAR2(255) not null, - EVENT_NAME_ NVARCHAR2(255), - EXECUTION_ID_ NVARCHAR2(64), - PROC_INST_ID_ NVARCHAR2(64), - ACTIVITY_ID_ NVARCHAR2(64), - CONFIGURATION_ NVARCHAR2(255), - CREATED_ TIMESTAMP(6) not null, - primary key (ID_) + ID_ NVARCHAR2(64) not null, + REV_ integer, + EVENT_TYPE_ NVARCHAR2(255) not null, + EVENT_NAME_ NVARCHAR2(255), + EXECUTION_ID_ NVARCHAR2(64), + PROC_INST_ID_ NVARCHAR2(64), + ACTIVITY_ID_ NVARCHAR2(64), + CONFIGURATION_ NVARCHAR2(255), + CREATED_ TIMESTAMP(6) not null, + PROC_DEF_ID_ NVARCHAR2(64), + TENANT_ID_ NVARCHAR2(255) DEFAULT '', + primary key (ID_) ); create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_); @@ -1203,253 +1212,254 @@ create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_); create index ACT_IDX_BYTEAR_DEPL on ACT_GE_BYTEARRAY(DEPLOYMENT_ID_); alter table ACT_GE_BYTEARRAY - add constraint ACT_FK_BYTEARR_DEPL - foreign key (DEPLOYMENT_ID_) - references ACT_RE_DEPLOYMENT (ID_); +add constraint ACT_FK_BYTEARR_DEPL +foreign key (DEPLOYMENT_ID_) +references ACT_RE_DEPLOYMENT (ID_); alter table ACT_RE_PROCDEF - add constraint ACT_UNIQ_PROCDEF - unique (KEY_,VERSION_); +add constraint ACT_UNIQ_PROCDEF +unique (KEY_,VERSION_, TENANT_ID_); create index ACT_IDX_EXE_PROCINST on ACT_RU_EXECUTION(PROC_INST_ID_); alter table ACT_RU_EXECUTION - add constraint ACT_FK_EXE_PROCINST - foreign key (PROC_INST_ID_) - references ACT_RU_EXECUTION (ID_); +add constraint ACT_FK_EXE_PROCINST +foreign key (PROC_INST_ID_) +references ACT_RU_EXECUTION (ID_); create index ACT_IDX_EXE_PARENT on ACT_RU_EXECUTION(PARENT_ID_); alter table ACT_RU_EXECUTION - add constraint ACT_FK_EXE_PARENT - foreign key (PARENT_ID_) - references ACT_RU_EXECUTION (ID_); +add constraint ACT_FK_EXE_PARENT +foreign key (PARENT_ID_) +references ACT_RU_EXECUTION (ID_); create index ACT_IDX_EXE_SUPER on ACT_RU_EXECUTION(SUPER_EXEC_); alter table ACT_RU_EXECUTION - add constraint ACT_FK_EXE_SUPER - foreign key (SUPER_EXEC_) - references ACT_RU_EXECUTION (ID_); +add constraint ACT_FK_EXE_SUPER +foreign key (SUPER_EXEC_) +references ACT_RU_EXECUTION (ID_); create index ACT_IDX_EXE_PROCDEF on ACT_RU_EXECUTION(PROC_DEF_ID_); alter table ACT_RU_EXECUTION - add constraint ACT_FK_EXE_PROCDEF - foreign key (PROC_DEF_ID_) - references ACT_RE_PROCDEF (ID_); +add constraint ACT_FK_EXE_PROCDEF +foreign key (PROC_DEF_ID_) +references ACT_RE_PROCDEF (ID_); create index ACT_IDX_TSKASS_TASK on ACT_RU_IDENTITYLINK(TASK_ID_); alter table ACT_RU_IDENTITYLINK - add constraint ACT_FK_TSKASS_TASK - foreign key (TASK_ID_) - references ACT_RU_TASK (ID_); +add constraint ACT_FK_TSKASS_TASK +foreign key (TASK_ID_) +references ACT_RU_TASK (ID_); create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_); alter table ACT_RU_IDENTITYLINK - add constraint ACT_FK_ATHRZ_PROCEDEF - foreign key (PROC_DEF_ID_) - references ACT_RE_PROCDEF (ID_); +add constraint ACT_FK_ATHRZ_PROCEDEF +foreign key (PROC_DEF_ID_) +references ACT_RE_PROCDEF (ID_); create index ACT_IDX_IDL_PROCINST on ACT_RU_IDENTITYLINK(PROC_INST_ID_); alter table ACT_RU_IDENTITYLINK - add constraint ACT_FK_IDL_PROCINST - foreign key (PROC_INST_ID_) - references ACT_RU_EXECUTION (ID_); +add constraint ACT_FK_IDL_PROCINST +foreign key (PROC_INST_ID_) +references ACT_RU_EXECUTION (ID_); create index ACT_IDX_TASK_EXEC on ACT_RU_TASK(EXECUTION_ID_); alter table ACT_RU_TASK - add constraint ACT_FK_TASK_EXE - foreign key (EXECUTION_ID_) - references ACT_RU_EXECUTION (ID_); +add constraint ACT_FK_TASK_EXE +foreign key (EXECUTION_ID_) +references ACT_RU_EXECUTION (ID_); create index ACT_IDX_TASK_PROCINST on ACT_RU_TASK(PROC_INST_ID_); alter table ACT_RU_TASK - add constraint ACT_FK_TASK_PROCINST - foreign key (PROC_INST_ID_) - references ACT_RU_EXECUTION (ID_); +add constraint ACT_FK_TASK_PROCINST +foreign key (PROC_INST_ID_) +references ACT_RU_EXECUTION (ID_); create index ACT_IDX_TASK_PROCDEF on ACT_RU_TASK(PROC_DEF_ID_); alter table ACT_RU_TASK - add constraint ACT_FK_TASK_PROCDEF - foreign key (PROC_DEF_ID_) - references ACT_RE_PROCDEF (ID_); +add constraint ACT_FK_TASK_PROCDEF +foreign key (PROC_DEF_ID_) +references ACT_RE_PROCDEF (ID_); create index ACT_IDX_VAR_EXE on ACT_RU_VARIABLE(EXECUTION_ID_); alter table ACT_RU_VARIABLE - add constraint ACT_FK_VAR_EXE - foreign key (EXECUTION_ID_) - references ACT_RU_EXECUTION (ID_); +add constraint ACT_FK_VAR_EXE +foreign key (EXECUTION_ID_) +references ACT_RU_EXECUTION (ID_); create index ACT_IDX_VAR_PROCINST on ACT_RU_VARIABLE(PROC_INST_ID_); alter table ACT_RU_VARIABLE - add constraint ACT_FK_VAR_PROCINST - foreign key (PROC_INST_ID_) - references ACT_RU_EXECUTION(ID_); +add constraint ACT_FK_VAR_PROCINST +foreign key (PROC_INST_ID_) +references ACT_RU_EXECUTION(ID_); create index ACT_IDX_VAR_BYTEARRAY on ACT_RU_VARIABLE(BYTEARRAY_ID_); alter table ACT_RU_VARIABLE - add constraint ACT_FK_VAR_BYTEARRAY - foreign key (BYTEARRAY_ID_) - references ACT_GE_BYTEARRAY (ID_); +add constraint ACT_FK_VAR_BYTEARRAY +foreign key (BYTEARRAY_ID_) +references ACT_GE_BYTEARRAY (ID_); create index ACT_IDX_JOB_EXCEPTION on ACT_RU_JOB(EXCEPTION_STACK_ID_); alter table ACT_RU_JOB - add constraint ACT_FK_JOB_EXCEPTION - foreign key (EXCEPTION_STACK_ID_) - references ACT_GE_BYTEARRAY (ID_); +add constraint ACT_FK_JOB_EXCEPTION +foreign key (EXCEPTION_STACK_ID_) +references ACT_GE_BYTEARRAY (ID_); create index ACT_IDX_EVENT_SUBSCR on ACT_RU_EVENT_SUBSCR(EXECUTION_ID_); alter table ACT_RU_EVENT_SUBSCR - add constraint ACT_FK_EVENT_EXEC - foreign key (EXECUTION_ID_) - references ACT_RU_EXECUTION(ID_); +add constraint ACT_FK_EVENT_EXEC +foreign key (EXECUTION_ID_) +references ACT_RU_EXECUTION(ID_); create index ACT_IDX_MODEL_SOURCE on ACT_RE_MODEL(EDITOR_SOURCE_VALUE_ID_); alter table ACT_RE_MODEL - add constraint ACT_FK_MODEL_SOURCE - foreign key (EDITOR_SOURCE_VALUE_ID_) - references ACT_GE_BYTEARRAY (ID_); +add constraint ACT_FK_MODEL_SOURCE +foreign key (EDITOR_SOURCE_VALUE_ID_) +references ACT_GE_BYTEARRAY (ID_); create index ACT_IDX_MODEL_SOURCE_EXTRA on ACT_RE_MODEL(EDITOR_SOURCE_EXTRA_VALUE_ID_); alter table ACT_RE_MODEL - add constraint ACT_FK_MODEL_SOURCE_EXTRA - foreign key (EDITOR_SOURCE_EXTRA_VALUE_ID_) - references ACT_GE_BYTEARRAY (ID_); +add constraint ACT_FK_MODEL_SOURCE_EXTRA +foreign key (EDITOR_SOURCE_EXTRA_VALUE_ID_) +references ACT_GE_BYTEARRAY (ID_); create index ACT_IDX_MODEL_DEPLOYMENT on ACT_RE_MODEL(DEPLOYMENT_ID_); alter table ACT_RE_MODEL - add constraint ACT_FK_MODEL_DEPLOYMENT - foreign key (DEPLOYMENT_ID_) - references ACT_RE_DEPLOYMENT (ID_); - --- see http://stackoverflow.com/questions/675398/how-can-i-constrain-multiple-columns-to-prevent-duplicates-but-ignore-null-value -create unique index ACT_UNIQ_RU_BUS_KEY on ACT_RU_EXECUTION - (case when BUSINESS_KEY_ is null then null else PROC_DEF_ID_ end, - case when BUSINESS_KEY_ is null then null else BUSINESS_KEY_ end); +add constraint ACT_FK_MODEL_DEPLOYMENT +foreign key (DEPLOYMENT_ID_) +references ACT_RE_DEPLOYMENT (ID_); create table ACT_HI_PROCINST ( - ID_ NVARCHAR2(64) not null, - PROC_INST_ID_ NVARCHAR2(64) not null, - BUSINESS_KEY_ NVARCHAR2(255), - PROC_DEF_ID_ NVARCHAR2(64) not null, - START_TIME_ TIMESTAMP(6) not null, - END_TIME_ TIMESTAMP(6), - DURATION_ NUMBER(19,0), - START_USER_ID_ NVARCHAR2(255), - START_ACT_ID_ NVARCHAR2(255), - END_ACT_ID_ NVARCHAR2(255), - SUPER_PROCESS_INSTANCE_ID_ NVARCHAR2(64), - DELETE_REASON_ NVARCHAR2(2000), - primary key (ID_), - unique (PROC_INST_ID_) + ID_ NVARCHAR2(64) not null, + PROC_INST_ID_ NVARCHAR2(64) not null, + BUSINESS_KEY_ NVARCHAR2(255), + PROC_DEF_ID_ NVARCHAR2(64) not null, + START_TIME_ TIMESTAMP(6) not null, + END_TIME_ TIMESTAMP(6), + DURATION_ NUMBER(19,0), + START_USER_ID_ NVARCHAR2(255), + START_ACT_ID_ NVARCHAR2(255), + END_ACT_ID_ NVARCHAR2(255), + SUPER_PROCESS_INSTANCE_ID_ NVARCHAR2(64), + DELETE_REASON_ NVARCHAR2(2000), + TENANT_ID_ NVARCHAR2(255) default '', + primary key (ID_), + unique (PROC_INST_ID_) ); create table ACT_HI_ACTINST ( - ID_ NVARCHAR2(64) not null, - PROC_DEF_ID_ NVARCHAR2(64) not null, - PROC_INST_ID_ NVARCHAR2(64) not null, - EXECUTION_ID_ NVARCHAR2(64) not null, - ACT_ID_ NVARCHAR2(255) not null, - TASK_ID_ NVARCHAR2(64), - CALL_PROC_INST_ID_ NVARCHAR2(64), - ACT_NAME_ NVARCHAR2(255), - ACT_TYPE_ NVARCHAR2(255) not null, - ASSIGNEE_ NVARCHAR2(64), - START_TIME_ TIMESTAMP(6) not null, - END_TIME_ TIMESTAMP(6), - DURATION_ NUMBER(19,0), - primary key (ID_) + ID_ NVARCHAR2(64) not null, + PROC_DEF_ID_ NVARCHAR2(64) not null, + PROC_INST_ID_ NVARCHAR2(64) not null, + EXECUTION_ID_ NVARCHAR2(64) not null, + ACT_ID_ NVARCHAR2(255) not null, + TASK_ID_ NVARCHAR2(64), + CALL_PROC_INST_ID_ NVARCHAR2(64), + ACT_NAME_ NVARCHAR2(255), + ACT_TYPE_ NVARCHAR2(255) not null, + ASSIGNEE_ NVARCHAR2(255), + START_TIME_ TIMESTAMP(6) not null, + END_TIME_ TIMESTAMP(6), + DURATION_ NUMBER(19,0), + TENANT_ID_ NVARCHAR2(255) default '', + primary key (ID_) ); create table ACT_HI_TASKINST ( - ID_ NVARCHAR2(64) not null, - PROC_DEF_ID_ NVARCHAR2(64), - TASK_DEF_KEY_ NVARCHAR2(255), - PROC_INST_ID_ NVARCHAR2(64), - EXECUTION_ID_ NVARCHAR2(64), - PARENT_TASK_ID_ NVARCHAR2(64), - NAME_ NVARCHAR2(255), - DESCRIPTION_ NVARCHAR2(2000), - OWNER_ NVARCHAR2(255), - ASSIGNEE_ NVARCHAR2(255), - START_TIME_ TIMESTAMP(6) not null, - CLAIM_TIME_ TIMESTAMP(6), - END_TIME_ TIMESTAMP(6), - DURATION_ NUMBER(19,0), - DELETE_REASON_ NVARCHAR2(2000), - PRIORITY_ INTEGER, - DUE_DATE_ TIMESTAMP(6), - FORM_KEY_ NVARCHAR2(255), - primary key (ID_) + ID_ NVARCHAR2(64) not null, + PROC_DEF_ID_ NVARCHAR2(64), + TASK_DEF_KEY_ NVARCHAR2(255), + PROC_INST_ID_ NVARCHAR2(64), + EXECUTION_ID_ NVARCHAR2(64), + PARENT_TASK_ID_ NVARCHAR2(64), + NAME_ NVARCHAR2(255), + DESCRIPTION_ NVARCHAR2(2000), + OWNER_ NVARCHAR2(255), + ASSIGNEE_ NVARCHAR2(255), + START_TIME_ TIMESTAMP(6) not null, + CLAIM_TIME_ TIMESTAMP(6), + END_TIME_ TIMESTAMP(6), + DURATION_ NUMBER(19,0), + DELETE_REASON_ NVARCHAR2(2000), + PRIORITY_ INTEGER, + DUE_DATE_ TIMESTAMP(6), + FORM_KEY_ NVARCHAR2(255), + CATEGORY_ NVARCHAR2(255), + TENANT_ID_ NVARCHAR2(255) default '', + primary key (ID_) ); create table ACT_HI_VARINST ( - ID_ NVARCHAR2(64) not null, - PROC_INST_ID_ NVARCHAR2(64), - EXECUTION_ID_ NVARCHAR2(64), - TASK_ID_ NVARCHAR2(64), - NAME_ NVARCHAR2(255) not null, - VAR_TYPE_ NVARCHAR2(100), - REV_ INTEGER, - BYTEARRAY_ID_ NVARCHAR2(64), - DOUBLE_ NUMBER(*,10), - LONG_ NUMBER(19,0), - TEXT_ NVARCHAR2(2000), - TEXT2_ NVARCHAR2(2000), - primary key (ID_) + ID_ NVARCHAR2(64) not null, + PROC_INST_ID_ NVARCHAR2(64), + EXECUTION_ID_ NVARCHAR2(64), + TASK_ID_ NVARCHAR2(64), + NAME_ NVARCHAR2(255) not null, + VAR_TYPE_ NVARCHAR2(100), + REV_ INTEGER, + BYTEARRAY_ID_ NVARCHAR2(64), + DOUBLE_ NUMBER(*,10), + LONG_ NUMBER(19,0), + TEXT_ NVARCHAR2(2000), + TEXT2_ NVARCHAR2(2000), + CREATE_TIME_ TIMESTAMP(6), + LAST_UPDATED_TIME_ TIMESTAMP(6), + primary key (ID_) ); create table ACT_HI_DETAIL ( - ID_ NVARCHAR2(64) not null, - TYPE_ NVARCHAR2(255) not null, - PROC_INST_ID_ NVARCHAR2(64), - EXECUTION_ID_ NVARCHAR2(64), - TASK_ID_ NVARCHAR2(64), - ACT_INST_ID_ NVARCHAR2(64), - NAME_ NVARCHAR2(255) not null, - VAR_TYPE_ NVARCHAR2(64), - REV_ INTEGER, - TIME_ TIMESTAMP(6) not null, - BYTEARRAY_ID_ NVARCHAR2(64), - DOUBLE_ NUMBER(*,10), - LONG_ NUMBER(19,0), - TEXT_ NVARCHAR2(2000), - TEXT2_ NVARCHAR2(2000), - primary key (ID_) + ID_ NVARCHAR2(64) not null, + TYPE_ NVARCHAR2(255) not null, + PROC_INST_ID_ NVARCHAR2(64), + EXECUTION_ID_ NVARCHAR2(64), + TASK_ID_ NVARCHAR2(64), + ACT_INST_ID_ NVARCHAR2(64), + NAME_ NVARCHAR2(255) not null, + VAR_TYPE_ NVARCHAR2(64), + REV_ INTEGER, + TIME_ TIMESTAMP(6) not null, + BYTEARRAY_ID_ NVARCHAR2(64), + DOUBLE_ NUMBER(*,10), + LONG_ NUMBER(19,0), + TEXT_ NVARCHAR2(2000), + TEXT2_ NVARCHAR2(2000), + primary key (ID_) ); create table ACT_HI_COMMENT ( - ID_ NVARCHAR2(64) not null, - TYPE_ NVARCHAR2(255), - TIME_ TIMESTAMP(6) not null, - USER_ID_ NVARCHAR2(255), - TASK_ID_ NVARCHAR2(64), - PROC_INST_ID_ NVARCHAR2(64), - ACTION_ NVARCHAR2(255), - MESSAGE_ NVARCHAR2(2000), - FULL_MSG_ BLOB, - primary key (ID_) + ID_ NVARCHAR2(64) not null, + TYPE_ NVARCHAR2(255), + TIME_ TIMESTAMP(6) not null, + USER_ID_ NVARCHAR2(255), + TASK_ID_ NVARCHAR2(64), + PROC_INST_ID_ NVARCHAR2(64), + ACTION_ NVARCHAR2(255), + MESSAGE_ NVARCHAR2(2000), + FULL_MSG_ BLOB, + primary key (ID_) ); create table ACT_HI_ATTACHMENT ( - ID_ NVARCHAR2(64) not null, - REV_ INTEGER, - USER_ID_ NVARCHAR2(255), - NAME_ NVARCHAR2(255), - DESCRIPTION_ NVARCHAR2(2000), - TYPE_ NVARCHAR2(255), - TASK_ID_ NVARCHAR2(64), - PROC_INST_ID_ NVARCHAR2(64), - URL_ NVARCHAR2(2000), - CONTENT_ID_ NVARCHAR2(64), - primary key (ID_) + ID_ NVARCHAR2(64) not null, + REV_ INTEGER, + USER_ID_ NVARCHAR2(255), + NAME_ NVARCHAR2(255), + DESCRIPTION_ NVARCHAR2(2000), + TYPE_ NVARCHAR2(255), + TASK_ID_ NVARCHAR2(64), + PROC_INST_ID_ NVARCHAR2(64), + URL_ NVARCHAR2(2000), + CONTENT_ID_ NVARCHAR2(64), + primary key (ID_) ); create table ACT_HI_IDENTITYLINK ( - ID_ NVARCHAR2(64), - GROUP_ID_ NVARCHAR2(255), - TYPE_ NVARCHAR2(255), - USER_ID_ NVARCHAR2(255), - TASK_ID_ NVARCHAR2(64), - PROC_INST_ID_ NVARCHAR2(64), - primary key (ID_) + ID_ NVARCHAR2(64), + GROUP_ID_ NVARCHAR2(255), + TYPE_ NVARCHAR2(255), + USER_ID_ NVARCHAR2(255), + TASK_ID_ NVARCHAR2(64), + PROC_INST_ID_ NVARCHAR2(64), + primary key (ID_) ); create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_); @@ -1467,61 +1477,56 @@ create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); create index ACT_IDX_HI_IDENT_LNK_TASK on ACT_HI_IDENTITYLINK(TASK_ID_); create index ACT_IDX_HI_IDENT_LNK_PROCINST on ACT_HI_IDENTITYLINK(PROC_INST_ID_); --- see http://stackoverflow.com/questions/675398/how-can-i-constrain-multiple-columns-to-prevent-duplicates-but-ignore-null-value -create unique index ACT_UNIQ_HI_BUS_KEY on ACT_HI_PROCINST - (case when BUSINESS_KEY_ is null then null else PROC_DEF_ID_ end, - case when BUSINESS_KEY_ is null then null else BUSINESS_KEY_ end); - create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_); create index ACT_IDX_HI_ACT_INST_EXEC on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_); create table ACT_ID_GROUP ( - ID_ NVARCHAR2(64), - REV_ INTEGER, - NAME_ NVARCHAR2(255), - TYPE_ NVARCHAR2(255), - primary key (ID_) + ID_ NVARCHAR2(64), + REV_ INTEGER, + NAME_ NVARCHAR2(255), + TYPE_ NVARCHAR2(255), + primary key (ID_) ); create table ACT_ID_MEMBERSHIP ( - USER_ID_ NVARCHAR2(64), - GROUP_ID_ NVARCHAR2(64), - primary key (USER_ID_, GROUP_ID_) + USER_ID_ NVARCHAR2(64), + GROUP_ID_ NVARCHAR2(64), + primary key (USER_ID_, GROUP_ID_) ); create table ACT_ID_USER ( - ID_ NVARCHAR2(64), - REV_ INTEGER, - FIRST_ NVARCHAR2(255), - LAST_ NVARCHAR2(255), - EMAIL_ NVARCHAR2(255), - PWD_ NVARCHAR2(255), - PICTURE_ID_ NVARCHAR2(64), - primary key (ID_) + ID_ NVARCHAR2(64), + REV_ INTEGER, + FIRST_ NVARCHAR2(255), + LAST_ NVARCHAR2(255), + EMAIL_ NVARCHAR2(255), + PWD_ NVARCHAR2(255), + PICTURE_ID_ NVARCHAR2(64), + primary key (ID_) ); create table ACT_ID_INFO ( - ID_ NVARCHAR2(64), - REV_ INTEGER, - USER_ID_ NVARCHAR2(64), - TYPE_ NVARCHAR2(64), - KEY_ NVARCHAR2(255), - VALUE_ NVARCHAR2(255), - PASSWORD_ BLOB, - PARENT_ID_ NVARCHAR2(255), - primary key (ID_) + ID_ NVARCHAR2(64), + REV_ INTEGER, + USER_ID_ NVARCHAR2(64), + TYPE_ NVARCHAR2(64), + KEY_ NVARCHAR2(255), + VALUE_ NVARCHAR2(255), + PASSWORD_ BLOB, + PARENT_ID_ NVARCHAR2(255), + primary key (ID_) ); create index ACT_IDX_MEMB_GROUP on ACT_ID_MEMBERSHIP(GROUP_ID_); alter table ACT_ID_MEMBERSHIP - add constraint ACT_FK_MEMB_GROUP - foreign key (GROUP_ID_) - references ACT_ID_GROUP (ID_); +add constraint ACT_FK_MEMB_GROUP +foreign key (GROUP_ID_) +references ACT_ID_GROUP (ID_); create index ACT_IDX_MEMB_USER on ACT_ID_MEMBERSHIP(USER_ID_); alter table ACT_ID_MEMBERSHIP - add constraint ACT_FK_MEMB_USER - foreign key (USER_ID_) - references ACT_ID_USER (ID_); +add constraint ACT_FK_MEMB_USER +foreign key (USER_ID_) +references ACT_ID_USER (ID_); commit; diff --git a/config/sql/_all/postgresql-3.0-all.sql b/config/sql/_all/postgresql-3.1-all.sql similarity index 98% rename from config/sql/_all/postgresql-3.0-all.sql rename to config/sql/_all/postgresql-3.1-all.sql index d81b34ef7b7..1db1b93b1be 100644 --- a/config/sql/_all/postgresql-3.0-all.sql +++ b/config/sql/_all/postgresql-3.1-all.sql @@ -1040,10 +1040,10 @@ create table ACT_GE_PROPERTY ( ); insert into ACT_GE_PROPERTY -values ('schema.version', '5.13', 1); +values ('schema.version', '5.15.1', 1); insert into ACT_GE_PROPERTY -values ('schema.history', 'create(5.13)', 1); +values ('schema.history', 'create(5.15.1)', 1); insert into ACT_GE_PROPERTY values ('next.dbid', '1', 1); @@ -1062,6 +1062,7 @@ create table ACT_RE_DEPLOYMENT ( ID_ varchar(64), NAME_ varchar(255), CATEGORY_ varchar(255), + TENANT_ID_ varchar(255) default '', DEPLOY_TIME_ timestamp, primary key (ID_) ); @@ -1079,6 +1080,7 @@ create table ACT_RE_MODEL ( DEPLOYMENT_ID_ varchar(64), EDITOR_SOURCE_VALUE_ID_ varchar(64), EDITOR_SOURCE_EXTRA_VALUE_ID_ varchar(64), + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -1094,11 +1096,11 @@ create table ACT_RU_EXECUTION ( IS_ACTIVE_ boolean, IS_CONCURRENT_ boolean, IS_SCOPE_ boolean, - IS_EVENT_SCOPE_ boolean, - SUSPENSION_STATE_ integer, - CACHED_ENT_STATE_ integer, - primary key (ID_), - unique (PROC_DEF_ID_, BUSINESS_KEY_) + IS_EVENT_SCOPE_ boolean, + SUSPENSION_STATE_ integer, + CACHED_ENT_STATE_ integer, + TENANT_ID_ varchar(255) default '', + primary key (ID_) ); create table ACT_RU_JOB ( @@ -1118,6 +1120,7 @@ create table ACT_RU_JOB ( REPEAT_ varchar(255), HANDLER_TYPE_ varchar(255), HANDLER_CFG_ varchar(4000), + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -1134,6 +1137,7 @@ create table ACT_RE_PROCDEF ( DESCRIPTION_ varchar(4000), HAS_START_FORM_KEY_ boolean, SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -1153,7 +1157,9 @@ create table ACT_RU_TASK ( PRIORITY_ integer, CREATE_TIME_ timestamp, DUE_DATE_ timestamp, + CATEGORY_ varchar(255), SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -1195,6 +1201,8 @@ create table ACT_RU_EVENT_SUBSCR ( ACTIVITY_ID_ varchar(64), CONFIGURATION_ varchar(255), CREATED_ timestamp not null, + PROC_DEF_ID_ varchar(64), + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -1213,7 +1221,7 @@ alter table ACT_GE_BYTEARRAY alter table ACT_RE_PROCDEF add constraint ACT_UNIQ_PROCDEF - unique (KEY_,VERSION_); + unique (KEY_,VERSION_, TENANT_ID_); create index ACT_IDX_EXE_PROCINST on ACT_RU_EXECUTION(PROC_INST_ID_); alter table ACT_RU_EXECUTION @@ -1337,9 +1345,9 @@ create table ACT_HI_PROCINST ( END_ACT_ID_ varchar(255), SUPER_PROCESS_INSTANCE_ID_ varchar(64), DELETE_REASON_ varchar(4000), + TENANT_ID_ varchar(255) default '', primary key (ID_), - unique (PROC_INST_ID_), - unique (PROC_DEF_ID_, BUSINESS_KEY_) + unique (PROC_INST_ID_) ); create table ACT_HI_ACTINST ( @@ -1352,10 +1360,11 @@ create table ACT_HI_ACTINST ( CALL_PROC_INST_ID_ varchar(64), ACT_NAME_ varchar(255), ACT_TYPE_ varchar(255) not null, - ASSIGNEE_ varchar(64), + ASSIGNEE_ varchar(255), START_TIME_ timestamp not null, END_TIME_ timestamp, DURATION_ bigint, + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -1378,6 +1387,8 @@ create table ACT_HI_TASKINST ( PRIORITY_ integer, DUE_DATE_ timestamp, FORM_KEY_ varchar(255), + CATEGORY_ varchar(255), + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -1394,6 +1405,8 @@ create table ACT_HI_VARINST ( LONG_ bigint, TEXT_ varchar(4000), TEXT2_ varchar(4000), + CREATE_TIME_ timestamp, + LAST_UPDATED_TIME_ timestamp, primary key (ID_) ); diff --git a/config/sql/_all/sqlserver-3.0-all.sql b/config/sql/_all/sqlserver-3.1-all.sql similarity index 82% rename from config/sql/_all/sqlserver-3.0-all.sql rename to config/sql/_all/sqlserver-3.1-all.sql index d5722721750..2bad3c0e505 100644 --- a/config/sql/_all/sqlserver-3.0-all.sql +++ b/config/sql/_all/sqlserver-3.1-all.sql @@ -1201,168 +1201,177 @@ ALTER TABLE [dbo].[QRTZ_TRIGGERS] ADD -- GO; create table ACT_GE_PROPERTY ( - NAME_ nvarchar(64), - VALUE_ nvarchar(300), - REV_ int, - primary key (NAME_) + NAME_ nvarchar(64), + VALUE_ nvarchar(300), + REV_ int, + primary key (NAME_) ); insert into ACT_GE_PROPERTY -values ('schema.version', '5.13', 1); +values ('schema.version', '5.15.1', 1); insert into ACT_GE_PROPERTY -values ('schema.history', 'create(5.13)', 1); +values ('schema.history', 'create(5.15.1)', 1); insert into ACT_GE_PROPERTY values ('next.dbid', '1', 1); create table ACT_GE_BYTEARRAY ( - ID_ nvarchar(64), - REV_ int, - NAME_ nvarchar(255), - DEPLOYMENT_ID_ nvarchar(64), - BYTES_ varbinary(max), - GENERATED_ tinyint, - primary key (ID_) + ID_ nvarchar(64), + REV_ int, + NAME_ nvarchar(255), + DEPLOYMENT_ID_ nvarchar(64), + BYTES_ varbinary(max), + GENERATED_ tinyint, + primary key (ID_) ); create table ACT_RE_DEPLOYMENT ( - ID_ nvarchar(64), - NAME_ nvarchar(255), - CATEGORY_ nvarchar(255), - DEPLOY_TIME_ datetime, - primary key (ID_) + ID_ nvarchar(64), + NAME_ nvarchar(255), + CATEGORY_ nvarchar(255), + TENANT_ID_ nvarchar(255) default '', + DEPLOY_TIME_ datetime, + primary key (ID_) ); create table ACT_RE_MODEL ( - ID_ nvarchar(64) not null, - REV_ int, - NAME_ nvarchar(255), - KEY_ nvarchar(255), - CATEGORY_ nvarchar(255), - CREATE_TIME_ datetime, - LAST_UPDATE_TIME_ datetime, - VERSION_ int, - META_INFO_ nvarchar(4000), - DEPLOYMENT_ID_ nvarchar(64), - EDITOR_SOURCE_VALUE_ID_ nvarchar(64), - EDITOR_SOURCE_EXTRA_VALUE_ID_ nvarchar(64), - primary key (ID_) + ID_ nvarchar(64) not null, + REV_ int, + NAME_ nvarchar(255), + KEY_ nvarchar(255), + CATEGORY_ nvarchar(255), + CREATE_TIME_ datetime, + LAST_UPDATE_TIME_ datetime, + VERSION_ int, + META_INFO_ nvarchar(4000), + DEPLOYMENT_ID_ nvarchar(64), + EDITOR_SOURCE_VALUE_ID_ nvarchar(64), + EDITOR_SOURCE_EXTRA_VALUE_ID_ nvarchar(64), + TENANT_ID_ nvarchar(255) default '', + primary key (ID_) ); create table ACT_RU_EXECUTION ( - ID_ nvarchar(64), - REV_ int, - PROC_INST_ID_ nvarchar(64), - BUSINESS_KEY_ nvarchar(255), - PARENT_ID_ nvarchar(64), - PROC_DEF_ID_ nvarchar(64), - SUPER_EXEC_ nvarchar(64), - ACT_ID_ nvarchar(255), - IS_ACTIVE_ tinyint, - IS_CONCURRENT_ tinyint, - IS_SCOPE_ tinyint, - IS_EVENT_SCOPE_ tinyint, - SUSPENSION_STATE_ tinyint, - CACHED_ENT_STATE_ int, - primary key (ID_) + ID_ nvarchar(64), + REV_ int, + PROC_INST_ID_ nvarchar(64), + BUSINESS_KEY_ nvarchar(255), + PARENT_ID_ nvarchar(64), + PROC_DEF_ID_ nvarchar(64), + SUPER_EXEC_ nvarchar(64), + ACT_ID_ nvarchar(255), + IS_ACTIVE_ tinyint, + IS_CONCURRENT_ tinyint, + IS_SCOPE_ tinyint, + IS_EVENT_SCOPE_ tinyint, + SUSPENSION_STATE_ tinyint, + CACHED_ENT_STATE_ int, + TENANT_ID_ nvarchar(255) default '', + primary key (ID_) ); create table ACT_RU_JOB ( - ID_ nvarchar(64) NOT NULL, + ID_ nvarchar(64) NOT NULL, REV_ int, - TYPE_ nvarchar(255) NOT NULL, - LOCK_EXP_TIME_ datetime, - LOCK_OWNER_ nvarchar(255), - EXCLUSIVE_ bit, - EXECUTION_ID_ nvarchar(64), - PROCESS_INSTANCE_ID_ nvarchar(64), - PROC_DEF_ID_ nvarchar(64), - RETRIES_ int, - EXCEPTION_STACK_ID_ nvarchar(64), - EXCEPTION_MSG_ nvarchar(4000), - DUEDATE_ datetime NULL, - REPEAT_ nvarchar(255), - HANDLER_TYPE_ nvarchar(255), - HANDLER_CFG_ nvarchar(4000), - primary key (ID_) + TYPE_ nvarchar(255) NOT NULL, + LOCK_EXP_TIME_ datetime, + LOCK_OWNER_ nvarchar(255), + EXCLUSIVE_ bit, + EXECUTION_ID_ nvarchar(64), + PROCESS_INSTANCE_ID_ nvarchar(64), + PROC_DEF_ID_ nvarchar(64), + RETRIES_ int, + EXCEPTION_STACK_ID_ nvarchar(64), + EXCEPTION_MSG_ nvarchar(4000), + DUEDATE_ datetime NULL, + REPEAT_ nvarchar(255), + HANDLER_TYPE_ nvarchar(255), + HANDLER_CFG_ nvarchar(4000), + TENANT_ID_ nvarchar(255) default '', + primary key (ID_) ); create table ACT_RE_PROCDEF ( - ID_ nvarchar(64) not null, - REV_ int, - CATEGORY_ nvarchar(255), - NAME_ nvarchar(255), - KEY_ nvarchar(255) not null, - VERSION_ int not null, - DEPLOYMENT_ID_ nvarchar(64), - RESOURCE_NAME_ nvarchar(4000), - DGRM_RESOURCE_NAME_ nvarchar(4000), - DESCRIPTION_ nvarchar(4000), - HAS_START_FORM_KEY_ tinyint, - SUSPENSION_STATE_ tinyint, - primary key (ID_) + ID_ nvarchar(64) not null, + REV_ int, + CATEGORY_ nvarchar(255), + NAME_ nvarchar(255), + KEY_ nvarchar(255) not null, + VERSION_ int not null, + DEPLOYMENT_ID_ nvarchar(64), + RESOURCE_NAME_ nvarchar(4000), + DGRM_RESOURCE_NAME_ nvarchar(4000), + DESCRIPTION_ nvarchar(4000), + HAS_START_FORM_KEY_ tinyint, + SUSPENSION_STATE_ tinyint, + TENANT_ID_ nvarchar(255) default '', + primary key (ID_) ); create table ACT_RU_TASK ( - ID_ nvarchar(64), - REV_ int, - EXECUTION_ID_ nvarchar(64), - PROC_INST_ID_ nvarchar(64), - PROC_DEF_ID_ nvarchar(64), - NAME_ nvarchar(255), - PARENT_TASK_ID_ nvarchar(64), - DESCRIPTION_ nvarchar(4000), - TASK_DEF_KEY_ nvarchar(255), - OWNER_ nvarchar(255), - ASSIGNEE_ nvarchar(255), - DELEGATION_ nvarchar(64), - PRIORITY_ int, - CREATE_TIME_ datetime, - DUE_DATE_ datetime, - SUSPENSION_STATE_ int, - primary key (ID_) + ID_ nvarchar(64), + REV_ int, + EXECUTION_ID_ nvarchar(64), + PROC_INST_ID_ nvarchar(64), + PROC_DEF_ID_ nvarchar(64), + NAME_ nvarchar(255), + PARENT_TASK_ID_ nvarchar(64), + DESCRIPTION_ nvarchar(4000), + TASK_DEF_KEY_ nvarchar(255), + OWNER_ nvarchar(255), + ASSIGNEE_ nvarchar(255), + DELEGATION_ nvarchar(64), + PRIORITY_ int, + CREATE_TIME_ datetime, + DUE_DATE_ datetime, + CATEGORY_ nvarchar(255), + SUSPENSION_STATE_ int, + TENANT_ID_ nvarchar(255) default '', + primary key (ID_) ); create table ACT_RU_IDENTITYLINK ( - ID_ nvarchar(64), - REV_ int, - GROUP_ID_ nvarchar(255), - TYPE_ nvarchar(255), - USER_ID_ nvarchar(255), - TASK_ID_ nvarchar(64), - PROC_INST_ID_ nvarchar(64), - PROC_DEF_ID_ nvarchar(64), - primary key (ID_) + ID_ nvarchar(64), + REV_ int, + GROUP_ID_ nvarchar(255), + TYPE_ nvarchar(255), + USER_ID_ nvarchar(255), + TASK_ID_ nvarchar(64), + PROC_INST_ID_ nvarchar(64), + PROC_DEF_ID_ nvarchar(64), + primary key (ID_) ); create table ACT_RU_VARIABLE ( - ID_ nvarchar(64) not null, - REV_ int, - TYPE_ nvarchar(255) not null, - NAME_ nvarchar(255) not null, - EXECUTION_ID_ nvarchar(64), - PROC_INST_ID_ nvarchar(64), - TASK_ID_ nvarchar(64), - BYTEARRAY_ID_ nvarchar(64), - DOUBLE_ double precision, - LONG_ numeric(19,0), - TEXT_ nvarchar(4000), - TEXT2_ nvarchar(4000), - primary key (ID_) + ID_ nvarchar(64) not null, + REV_ int, + TYPE_ nvarchar(255) not null, + NAME_ nvarchar(255) not null, + EXECUTION_ID_ nvarchar(64), + PROC_INST_ID_ nvarchar(64), + TASK_ID_ nvarchar(64), + BYTEARRAY_ID_ nvarchar(64), + DOUBLE_ double precision, + LONG_ numeric(19,0), + TEXT_ nvarchar(4000), + TEXT2_ nvarchar(4000), + primary key (ID_) ); create table ACT_RU_EVENT_SUBSCR ( - ID_ nvarchar(64) not null, - REV_ int, - EVENT_TYPE_ nvarchar(255) not null, - EVENT_NAME_ nvarchar(255), - EXECUTION_ID_ nvarchar(64), - PROC_INST_ID_ nvarchar(64), - ACTIVITY_ID_ nvarchar(64), - CONFIGURATION_ nvarchar(255), - CREATED_ datetime not null, - primary key (ID_) + ID_ nvarchar(64) not null, + REV_ int, + EVENT_TYPE_ nvarchar(255) not null, + EVENT_NAME_ nvarchar(255), + EXECUTION_ID_ nvarchar(64), + PROC_INST_ID_ nvarchar(64), + ACTIVITY_ID_ nvarchar(64), + CONFIGURATION_ nvarchar(255), + CREATED_ datetime not null, + PROC_DEF_ID_ nvarchar(64), + TENANT_ID_ nvarchar(255) default '', + primary key (ID_) ); create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_); @@ -1371,7 +1380,6 @@ create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_); create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_); create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_); create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_); -create unique index ACT_UNIQ_RU_BUS_KEY on ACT_RU_EXECUTION (PROC_DEF_ID_, BUSINESS_KEY_) where BUSINESS_KEY_ is not null; create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_); create index ACT_IDX_EXECUTION_PROC on ACT_RU_EXECUTION(PROC_DEF_ID_); create index ACT_IDX_EXECUTION_PARENT on ACT_RU_EXECUTION(PARENT_ID_); @@ -1382,230 +1390,239 @@ create index ACT_IDX_VARIABLE_EXEC on ACT_RU_VARIABLE(EXECUTION_ID_); create index ACT_IDX_VARIABLE_PROCINST on ACT_RU_VARIABLE(PROC_INST_ID_); create index ACT_IDX_IDENT_LNK_TASK on ACT_RU_IDENTITYLINK(TASK_ID_); create index ACT_IDX_IDENT_LNK_PROCINST on ACT_RU_IDENTITYLINK(PROC_INST_ID_); -create index ACT_IDX_IDENT_LNK_PROCDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_); create index ACT_IDX_TASK_EXEC on ACT_RU_TASK(EXECUTION_ID_); create index ACT_IDX_TASK_PROCINST on ACT_RU_TASK(PROC_INST_ID_); +create index ACT_IDX_EXEC_PROC_INST_ID on ACT_RU_EXECUTION(PROC_INST_ID_); +create index ACT_IDX_TASK_PROC_DEF_ID on ACT_RU_TASK(PROC_DEF_ID_); +create index ACT_IDX_EVENT_SUBSCR_EXEC_ID on ACT_RU_EVENT_SUBSCR(EXECUTION_ID_); +create index ACT_IDX_JOB_EXCEPTION_STACK_ID on ACT_RU_JOB(EXCEPTION_STACK_ID_); alter table ACT_GE_BYTEARRAY - add constraint ACT_FK_BYTEARR_DEPL - foreign key (DEPLOYMENT_ID_) - references ACT_RE_DEPLOYMENT (ID_); +add constraint ACT_FK_BYTEARR_DEPL +foreign key (DEPLOYMENT_ID_) +references ACT_RE_DEPLOYMENT (ID_); alter table ACT_RE_PROCDEF - add constraint ACT_UNIQ_PROCDEF - unique (KEY_,VERSION_); +add constraint ACT_UNIQ_PROCDEF +unique (KEY_,VERSION_, TENANT_ID_); alter table ACT_RU_EXECUTION - add constraint ACT_FK_EXE_PARENT - foreign key (PARENT_ID_) - references ACT_RU_EXECUTION (ID_); +add constraint ACT_FK_EXE_PARENT +foreign key (PARENT_ID_) +references ACT_RU_EXECUTION (ID_); alter table ACT_RU_EXECUTION - add constraint ACT_FK_EXE_SUPER - foreign key (SUPER_EXEC_) - references ACT_RU_EXECUTION (ID_); +add constraint ACT_FK_EXE_SUPER +foreign key (SUPER_EXEC_) +references ACT_RU_EXECUTION (ID_); alter table ACT_RU_EXECUTION - add constraint ACT_FK_EXE_PROCDEF - foreign key (PROC_DEF_ID_) - references ACT_RE_PROCDEF (ID_); +add constraint ACT_FK_EXE_PROCDEF +foreign key (PROC_DEF_ID_) +references ACT_RE_PROCDEF (ID_); alter table ACT_RU_IDENTITYLINK - add constraint ACT_FK_TSKASS_TASK - foreign key (TASK_ID_) - references ACT_RU_TASK (ID_); +add constraint ACT_FK_TSKASS_TASK +foreign key (TASK_ID_) +references ACT_RU_TASK (ID_); alter table ACT_RU_IDENTITYLINK - add constraint ACT_FK_ATHRZ_PROCEDEF - foreign key (PROC_DEF_ID_) - references ACT_RE_PROCDEF (ID_); +add constraint ACT_FK_ATHRZ_PROCEDEF +foreign key (PROC_DEF_ID_) +references ACT_RE_PROCDEF (ID_); alter table ACT_RU_IDENTITYLINK - add constraint ACT_FK_IDL_PROCINST - foreign key (PROC_INST_ID_) - references ACT_RU_EXECUTION (ID_); +add constraint ACT_FK_IDL_PROCINST +foreign key (PROC_INST_ID_) +references ACT_RU_EXECUTION (ID_); alter table ACT_RU_TASK - add constraint ACT_FK_TASK_EXE - foreign key (EXECUTION_ID_) - references ACT_RU_EXECUTION (ID_); +add constraint ACT_FK_TASK_EXE +foreign key (EXECUTION_ID_) +references ACT_RU_EXECUTION (ID_); alter table ACT_RU_TASK - add constraint ACT_FK_TASK_PROCINST - foreign key (PROC_INST_ID_) - references ACT_RU_EXECUTION (ID_); +add constraint ACT_FK_TASK_PROCINST +foreign key (PROC_INST_ID_) +references ACT_RU_EXECUTION (ID_); alter table ACT_RU_TASK - add constraint ACT_FK_TASK_PROCDEF - foreign key (PROC_DEF_ID_) - references ACT_RE_PROCDEF (ID_); +add constraint ACT_FK_TASK_PROCDEF +foreign key (PROC_DEF_ID_) +references ACT_RE_PROCDEF (ID_); alter table ACT_RU_VARIABLE - add constraint ACT_FK_VAR_EXE - foreign key (EXECUTION_ID_) - references ACT_RU_EXECUTION (ID_); +add constraint ACT_FK_VAR_EXE +foreign key (EXECUTION_ID_) +references ACT_RU_EXECUTION (ID_); alter table ACT_RU_VARIABLE - add constraint ACT_FK_VAR_PROCINST - foreign key (PROC_INST_ID_) - references ACT_RU_EXECUTION(ID_); +add constraint ACT_FK_VAR_PROCINST +foreign key (PROC_INST_ID_) +references ACT_RU_EXECUTION(ID_); alter table ACT_RU_VARIABLE - add constraint ACT_FK_VAR_BYTEARRAY - foreign key (BYTEARRAY_ID_) - references ACT_GE_BYTEARRAY (ID_); +add constraint ACT_FK_VAR_BYTEARRAY +foreign key (BYTEARRAY_ID_) +references ACT_GE_BYTEARRAY (ID_); alter table ACT_RU_JOB - add constraint ACT_FK_JOB_EXCEPTION - foreign key (EXCEPTION_STACK_ID_) - references ACT_GE_BYTEARRAY (ID_); +add constraint ACT_FK_JOB_EXCEPTION +foreign key (EXCEPTION_STACK_ID_) +references ACT_GE_BYTEARRAY (ID_); alter table ACT_RU_EVENT_SUBSCR - add constraint ACT_FK_EVENT_EXEC - foreign key (EXECUTION_ID_) - references ACT_RU_EXECUTION(ID_); +add constraint ACT_FK_EVENT_EXEC +foreign key (EXECUTION_ID_) +references ACT_RU_EXECUTION(ID_); alter table ACT_RE_MODEL - add constraint ACT_FK_MODEL_SOURCE - foreign key (EDITOR_SOURCE_VALUE_ID_) - references ACT_GE_BYTEARRAY (ID_); +add constraint ACT_FK_MODEL_SOURCE +foreign key (EDITOR_SOURCE_VALUE_ID_) +references ACT_GE_BYTEARRAY (ID_); alter table ACT_RE_MODEL - add constraint ACT_FK_MODEL_SOURCE_EXTRA - foreign key (EDITOR_SOURCE_EXTRA_VALUE_ID_) - references ACT_GE_BYTEARRAY (ID_); +add constraint ACT_FK_MODEL_SOURCE_EXTRA +foreign key (EDITOR_SOURCE_EXTRA_VALUE_ID_) +references ACT_GE_BYTEARRAY (ID_); alter table ACT_RE_MODEL - add constraint ACT_FK_MODEL_DEPLOYMENT - foreign key (DEPLOYMENT_ID_) - references ACT_RE_DEPLOYMENT (ID_); +add constraint ACT_FK_MODEL_DEPLOYMENT +foreign key (DEPLOYMENT_ID_) +references ACT_RE_DEPLOYMENT (ID_); create table ACT_HI_PROCINST ( - ID_ nvarchar(64) not null, - PROC_INST_ID_ nvarchar(64) not null, - BUSINESS_KEY_ nvarchar(255), - PROC_DEF_ID_ nvarchar(64) not null, - START_TIME_ datetime not null, - END_TIME_ datetime, - DURATION_ numeric(19,0), - START_USER_ID_ nvarchar(255), - START_ACT_ID_ nvarchar(255), - END_ACT_ID_ nvarchar(255), - SUPER_PROCESS_INSTANCE_ID_ nvarchar(64), - DELETE_REASON_ nvarchar(4000), - primary key (ID_), - unique (PROC_INST_ID_) + ID_ nvarchar(64) not null, + PROC_INST_ID_ nvarchar(64) not null, + BUSINESS_KEY_ nvarchar(255), + PROC_DEF_ID_ nvarchar(64) not null, + START_TIME_ datetime not null, + END_TIME_ datetime, + DURATION_ numeric(19,0), + START_USER_ID_ nvarchar(255), + START_ACT_ID_ nvarchar(255), + END_ACT_ID_ nvarchar(255), + SUPER_PROCESS_INSTANCE_ID_ nvarchar(64), + DELETE_REASON_ nvarchar(4000), + TENANT_ID_ nvarchar(255) default '', + primary key (ID_), + unique (PROC_INST_ID_) ); create table ACT_HI_ACTINST ( - ID_ nvarchar(64) not null, - PROC_DEF_ID_ nvarchar(64) not null, - PROC_INST_ID_ nvarchar(64) not null, - EXECUTION_ID_ nvarchar(64) not null, - ACT_ID_ nvarchar(255) not null, - TASK_ID_ nvarchar(64), - CALL_PROC_INST_ID_ nvarchar(64), - ACT_NAME_ nvarchar(255), - ACT_TYPE_ nvarchar(255) not null, - ASSIGNEE_ nvarchar(64), - START_TIME_ datetime not null, - END_TIME_ datetime, - DURATION_ numeric(19,0), - primary key (ID_) + ID_ nvarchar(64) not null, + PROC_DEF_ID_ nvarchar(64) not null, + PROC_INST_ID_ nvarchar(64) not null, + EXECUTION_ID_ nvarchar(64) not null, + ACT_ID_ nvarchar(255) not null, + TASK_ID_ nvarchar(64), + CALL_PROC_INST_ID_ nvarchar(64), + ACT_NAME_ nvarchar(255), + ACT_TYPE_ nvarchar(255) not null, + ASSIGNEE_ nvarchar(255), + START_TIME_ datetime not null, + END_TIME_ datetime, + DURATION_ numeric(19,0), + TENANT_ID_ nvarchar(255) default '', + primary key (ID_) ); create table ACT_HI_TASKINST ( - ID_ nvarchar(64) not null, - PROC_DEF_ID_ nvarchar(64), - TASK_DEF_KEY_ nvarchar(255), - PROC_INST_ID_ nvarchar(64), - EXECUTION_ID_ nvarchar(64), - NAME_ nvarchar(255), - PARENT_TASK_ID_ nvarchar(64), - DESCRIPTION_ nvarchar(4000), - OWNER_ nvarchar(255), - ASSIGNEE_ nvarchar(255), - START_TIME_ datetime not null, - CLAIM_TIME_ datetime, - END_TIME_ datetime, - DURATION_ numeric(19,0), - DELETE_REASON_ nvarchar(4000), - PRIORITY_ int, - DUE_DATE_ datetime, - FORM_KEY_ nvarchar(255), - primary key (ID_) + ID_ nvarchar(64) not null, + PROC_DEF_ID_ nvarchar(64), + TASK_DEF_KEY_ nvarchar(255), + PROC_INST_ID_ nvarchar(64), + EXECUTION_ID_ nvarchar(64), + NAME_ nvarchar(255), + PARENT_TASK_ID_ nvarchar(64), + DESCRIPTION_ nvarchar(4000), + OWNER_ nvarchar(255), + ASSIGNEE_ nvarchar(255), + START_TIME_ datetime not null, + CLAIM_TIME_ datetime, + END_TIME_ datetime, + DURATION_ numeric(19,0), + DELETE_REASON_ nvarchar(4000), + PRIORITY_ int, + DUE_DATE_ datetime, + FORM_KEY_ nvarchar(255), + CATEGORY_ nvarchar(255), + TENANT_ID_ nvarchar(255) default '', + primary key (ID_) ); create table ACT_HI_VARINST ( - ID_ nvarchar(64) not null, - PROC_INST_ID_ nvarchar(64), - EXECUTION_ID_ nvarchar(64), - TASK_ID_ nvarchar(64), - NAME_ nvarchar(255) not null, - VAR_TYPE_ nvarchar(100), - REV_ int, - BYTEARRAY_ID_ nvarchar(64), - DOUBLE_ double precision, - LONG_ numeric(19,0), - TEXT_ nvarchar(4000), - TEXT2_ nvarchar(4000), - primary key (ID_) + ID_ nvarchar(64) not null, + PROC_INST_ID_ nvarchar(64), + EXECUTION_ID_ nvarchar(64), + TASK_ID_ nvarchar(64), + NAME_ nvarchar(255) not null, + VAR_TYPE_ nvarchar(100), + REV_ int, + BYTEARRAY_ID_ nvarchar(64), + DOUBLE_ double precision, + LONG_ numeric(19,0), + TEXT_ nvarchar(4000), + TEXT2_ nvarchar(4000), + CREATE_TIME_ datetime, + LAST_UPDATED_TIME_ datetime, + primary key (ID_) ); create table ACT_HI_DETAIL ( - ID_ nvarchar(64) not null, - TYPE_ nvarchar(255) not null, - PROC_INST_ID_ nvarchar(64), - EXECUTION_ID_ nvarchar(64), - TASK_ID_ nvarchar(64), - ACT_INST_ID_ nvarchar(64), - NAME_ nvarchar(255) not null, - VAR_TYPE_ nvarchar(255), - REV_ int, - TIME_ datetime not null, - BYTEARRAY_ID_ nvarchar(64), - DOUBLE_ double precision, - LONG_ numeric(19,0), - TEXT_ nvarchar(4000), - TEXT2_ nvarchar(4000), - primary key (ID_) + ID_ nvarchar(64) not null, + TYPE_ nvarchar(255) not null, + PROC_INST_ID_ nvarchar(64), + EXECUTION_ID_ nvarchar(64), + TASK_ID_ nvarchar(64), + ACT_INST_ID_ nvarchar(64), + NAME_ nvarchar(255) not null, + VAR_TYPE_ nvarchar(255), + REV_ int, + TIME_ datetime not null, + BYTEARRAY_ID_ nvarchar(64), + DOUBLE_ double precision, + LONG_ numeric(19,0), + TEXT_ nvarchar(4000), + TEXT2_ nvarchar(4000), + primary key (ID_) ); create table ACT_HI_COMMENT ( - ID_ nvarchar(64) not null, - TYPE_ nvarchar(255), - TIME_ datetime not null, - USER_ID_ nvarchar(255), - TASK_ID_ nvarchar(64), - PROC_INST_ID_ nvarchar(64), - ACTION_ nvarchar(255), - MESSAGE_ nvarchar(4000), - FULL_MSG_ varbinary(max), - primary key (ID_) + ID_ nvarchar(64) not null, + TYPE_ nvarchar(255), + TIME_ datetime not null, + USER_ID_ nvarchar(255), + TASK_ID_ nvarchar(64), + PROC_INST_ID_ nvarchar(64), + ACTION_ nvarchar(255), + MESSAGE_ nvarchar(4000), + FULL_MSG_ varbinary(max), + primary key (ID_) ); create table ACT_HI_ATTACHMENT ( - ID_ nvarchar(64) not null, - REV_ integer, - USER_ID_ nvarchar(255), - NAME_ nvarchar(255), - DESCRIPTION_ nvarchar(4000), - TYPE_ nvarchar(255), - TASK_ID_ nvarchar(64), - PROC_INST_ID_ nvarchar(64), - URL_ nvarchar(4000), - CONTENT_ID_ nvarchar(64), - primary key (ID_) + ID_ nvarchar(64) not null, + REV_ integer, + USER_ID_ nvarchar(255), + NAME_ nvarchar(255), + DESCRIPTION_ nvarchar(4000), + TYPE_ nvarchar(255), + TASK_ID_ nvarchar(64), + PROC_INST_ID_ nvarchar(64), + URL_ nvarchar(4000), + CONTENT_ID_ nvarchar(64), + primary key (ID_) ); create table ACT_HI_IDENTITYLINK ( - ID_ nvarchar(64), - GROUP_ID_ nvarchar(255), - TYPE_ nvarchar(255), - USER_ID_ nvarchar(255), - TASK_ID_ nvarchar(64), - PROC_INST_ID_ nvarchar(64), - primary key (ID_) + ID_ nvarchar(64), + GROUP_ID_ nvarchar(255), + TYPE_ nvarchar(255), + USER_ID_ nvarchar(255), + TASK_ID_ nvarchar(64), + PROC_INST_ID_ nvarchar(64), + primary key (ID_) ); create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_); @@ -1619,7 +1636,6 @@ create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_); create index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL(TASK_ID_); create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_); create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_); -create unique index ACT_UNIQ_HI_BUS_KEY on ACT_HI_PROCINST (PROC_DEF_ID_, BUSINESS_KEY_) where BUSINESS_KEY_ is not null; create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_); create index ACT_IDX_HI_ACT_INST_EXEC on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_); create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); @@ -1627,50 +1643,50 @@ create index ACT_IDX_HI_IDENT_LNK_TASK on ACT_HI_IDENTITYLINK(TASK_ID_); create index ACT_IDX_HI_IDENT_LNK_PROCINST on ACT_HI_IDENTITYLINK(PROC_INST_ID_); create table ACT_ID_GROUP ( - ID_ nvarchar(64), - REV_ int, - NAME_ nvarchar(255), - TYPE_ nvarchar(255), - primary key (ID_) + ID_ nvarchar(64), + REV_ int, + NAME_ nvarchar(255), + TYPE_ nvarchar(255), + primary key (ID_) ); create table ACT_ID_MEMBERSHIP ( - USER_ID_ nvarchar(64), - GROUP_ID_ nvarchar(64), - primary key (USER_ID_, GROUP_ID_) + USER_ID_ nvarchar(64), + GROUP_ID_ nvarchar(64), + primary key (USER_ID_, GROUP_ID_) ); create table ACT_ID_USER ( - ID_ nvarchar(64), - REV_ int, - FIRST_ nvarchar(255), - LAST_ nvarchar(255), - EMAIL_ nvarchar(255), - PWD_ nvarchar(255), - PICTURE_ID_ nvarchar(64), - primary key (ID_) + ID_ nvarchar(64), + REV_ int, + FIRST_ nvarchar(255), + LAST_ nvarchar(255), + EMAIL_ nvarchar(255), + PWD_ nvarchar(255), + PICTURE_ID_ nvarchar(64), + primary key (ID_) ); create table ACT_ID_INFO ( - ID_ nvarchar(64), - REV_ int, - USER_ID_ nvarchar(64), - TYPE_ nvarchar(64), - KEY_ nvarchar(255), - VALUE_ nvarchar(255), - PASSWORD_ varbinary(max), - PARENT_ID_ nvarchar(255), - primary key (ID_) + ID_ nvarchar(64), + REV_ int, + USER_ID_ nvarchar(64), + TYPE_ nvarchar(64), + KEY_ nvarchar(255), + VALUE_ nvarchar(255), + PASSWORD_ varbinary(max), + PARENT_ID_ nvarchar(255), + primary key (ID_) ); alter table ACT_ID_MEMBERSHIP - add constraint ACT_FK_MEMB_GROUP - foreign key (GROUP_ID_) - references ACT_ID_GROUP (ID_); +add constraint ACT_FK_MEMB_GROUP +foreign key (GROUP_ID_) +references ACT_ID_GROUP (ID_); alter table ACT_ID_MEMBERSHIP - add constraint ACT_FK_MEMB_USER - foreign key (USER_ID_) - references ACT_ID_USER (ID_); +add constraint ACT_FK_MEMB_USER +foreign key (USER_ID_) +references ACT_ID_USER (ID_); commit; diff --git a/config/sql/activiti/activiti.db2.create.identity.sql b/config/sql/activiti/activiti.db2.create.identity.sql deleted file mode 100644 index 33df3173ea4..00000000000 --- a/config/sql/activiti/activiti.db2.create.identity.sql +++ /dev/null @@ -1,46 +0,0 @@ -create table ACT_ID_GROUP ( - ID_ varchar(64) not null, - REV_ integer, - NAME_ varchar(255), - TYPE_ varchar(255), - primary key (ID_) -); - -create table ACT_ID_MEMBERSHIP ( - USER_ID_ varchar(64) not null, - GROUP_ID_ varchar(64) not null, - primary key (USER_ID_, GROUP_ID_) -); - -create table ACT_ID_USER ( - ID_ varchar(64) not null, - REV_ integer, - FIRST_ varchar(255), - LAST_ varchar(255), - EMAIL_ varchar(255), - PWD_ varchar(255), - PICTURE_ID_ varchar(64), - primary key (ID_) -); - -create table ACT_ID_INFO ( - ID_ varchar(64) not null, - REV_ integer, - USER_ID_ varchar(64), - TYPE_ varchar(64), - KEY_ varchar(255), - VALUE_ varchar(255), - PASSWORD_ BLOB, - PARENT_ID_ varchar(255), - primary key (ID_) -); - -alter table ACT_ID_MEMBERSHIP - add constraint ACT_FK_MEMB_GROUP - foreign key (GROUP_ID_) - references ACT_ID_GROUP (ID_); - -alter table ACT_ID_MEMBERSHIP - add constraint ACT_FK_MEMB_USER - foreign key (USER_ID_) - references ACT_ID_USER (ID_); diff --git a/config/sql/activiti/activiti.db2.drop.engine.sql b/config/sql/activiti/activiti.db2.drop.engine.sql deleted file mode 100644 index 8c4678df7ec..00000000000 --- a/config/sql/activiti/activiti.db2.drop.engine.sql +++ /dev/null @@ -1,74 +0,0 @@ -drop index ACT_IDX_EXEC_BUSKEY; -drop index ACT_IDX_TASK_CREATE; -drop index ACT_IDX_IDENT_LNK_USER; -drop index ACT_IDX_IDENT_LNK_GROUP; -drop index ACT_IDX_VARIABLE_TASK_ID; - -alter table ACT_GE_BYTEARRAY - drop foreign key ACT_FK_BYTEARR_DEPL; - -alter table ACT_RU_EXECUTION - drop foreign key ACT_FK_EXE_PROCINST; - -alter table ACT_RU_EXECUTION - drop foreign key ACT_FK_EXE_PARENT; - -alter table ACT_RU_EXECUTION - drop foreign key ACT_FK_EXE_SUPER; - -alter table ACT_RU_EXECUTION - drop foreign key ACT_FK_EXE_PROCDEF; - -alter table ACT_RU_IDENTITYLINK - drop foreign key ACT_FK_TSKASS_TASK; - -alter table ACT_RU_IDENTITYLINK - drop foreign key ACT_FK_ATHRZ_PROCEDEF; - -alter table ACT_RU_TASK - drop foreign key ACT_FK_TASK_EXE; - -alter table ACT_RU_TASK - drop foreign key ACT_FK_TASK_PROCINST; - -alter table ACT_RU_TASK - drop foreign key ACT_FK_TASK_PROCDEF; - -alter table ACT_RU_VARIABLE - drop foreign key ACT_FK_VAR_EXE; - -alter table ACT_RU_VARIABLE - drop foreign key ACT_FK_VAR_PROCINST; - -alter table ACT_RU_VARIABLE - drop foreign key ACT_FK_VAR_BYTEARRAY; - -alter table ACT_RU_JOB - drop foreign key ACT_FK_JOB_EXCEPTION; - -alter table ACT_RU_EVENT_SUBSCR - drop foreign key ACT_FK_EVENT_EXEC; - -alter table ACT_RE_MODEL - drop foreign key ACT_FK_MODEL_SOURCE; - -alter table ACT_RE_MODEL - drop foreign key ACT_FK_MODEL_SOURCE_EXTRA; - -alter table ACT_RE_MODEL - drop foreign key ACT_FK_MODEL_DEPLOYMENT; - -drop index ACT_IDX_EVENT_SUBSCR_CONFIG_; -drop index ACT_IDX_ATHRZ_PROCEDEF; - -drop table ACT_GE_PROPERTY; -drop table ACT_GE_BYTEARRAY; -drop table ACT_RE_DEPLOYMENT; -drop table ACT_RE_MODEL; -drop table ACT_RE_PROCDEF; -drop table ACT_RU_VARIABLE; -drop table ACT_RU_IDENTITYLINK; -drop table ACT_RU_TASK; -drop table ACT_RU_EXECUTION; -drop table ACT_RU_JOB; -drop table ACT_RU_EVENT_SUBSCR; diff --git a/config/sql/activiti/activiti.db2.drop.history.sql b/config/sql/activiti/activiti.db2.drop.history.sql deleted file mode 100644 index ce1a1e59e2e..00000000000 --- a/config/sql/activiti/activiti.db2.drop.history.sql +++ /dev/null @@ -1,24 +0,0 @@ -drop index ACT_IDX_HI_PRO_INST_END; -drop index ACT_IDX_HI_PRO_I_BUSKEY; -drop index ACT_IDX_HI_ACT_INST_START; -drop index ACT_IDX_HI_ACT_INST_END; -drop index ACT_IDX_HI_DETAIL_PROC_INST; -drop index ACT_IDX_HI_DETAIL_ACT_INST; -drop index ACT_IDX_HI_DETAIL_TIME; -drop index ACT_IDX_HI_DETAIL_NAME; -drop index ACT_IDX_HI_DETAIL_TASK_ID; -drop index ACT_IDX_HI_PROCVAR_PROC_INST; -drop index ACT_IDX_HI_PROCVAR_NAME_TYPE; -drop index ACT_IDX_HI_ACT_INST_PROCINST; -drop index ACT_IDX_HI_IDENT_LNK_USER; -drop index ACT_IDX_HI_IDENT_LNK_TASK; -drop index ACT_IDX_HI_IDENT_LNK_PROCINST; - -drop table ACT_HI_PROCINST; -drop table ACT_HI_ACTINST; -drop table ACT_HI_VARINST; -drop table ACT_HI_TASKINST; -drop table ACT_HI_DETAIL; -drop table ACT_HI_COMMENT; -drop table ACT_HI_ATTACHMENT; -drop table ACT_HI_IDENTITYLINK; diff --git a/config/sql/activiti/activiti.db2.drop.identity.sql b/config/sql/activiti/activiti.db2.drop.identity.sql deleted file mode 100644 index 64242a6b0a9..00000000000 --- a/config/sql/activiti/activiti.db2.drop.identity.sql +++ /dev/null @@ -1,10 +0,0 @@ -alter table ACT_ID_MEMBERSHIP - drop foreign key ACT_FK_MEMB_GROUP; - -alter table ACT_ID_MEMBERSHIP - drop foreign key ACT_FK_MEMB_USER; - -drop table ACT_ID_INFO; -drop table ACT_ID_MEMBERSHIP; -drop table ACT_ID_GROUP; -drop table ACT_ID_USER; diff --git a/config/sql/activiti/activiti.h2.create.engine.sql b/config/sql/activiti/activiti.h2.create.engine.sql index d4f4291b4df..71bbe29ec69 100644 --- a/config/sql/activiti/activiti.h2.create.engine.sql +++ b/config/sql/activiti/activiti.h2.create.engine.sql @@ -6,10 +6,10 @@ create table ACT_GE_PROPERTY ( ); insert into ACT_GE_PROPERTY -values ('schema.version', '5.13', 1); +values ('schema.version', '5.15.1', 1); insert into ACT_GE_PROPERTY -values ('schema.history', 'create(5.13)', 1); +values ('schema.history', 'create(5.15.1)', 1); insert into ACT_GE_PROPERTY values ('next.dbid', '1', 1); @@ -28,6 +28,7 @@ create table ACT_RE_DEPLOYMENT ( ID_ varchar(64), NAME_ varchar(255), CATEGORY_ varchar(255), + TENANT_ID_ varchar(255) default '', DEPLOY_TIME_ timestamp, primary key (ID_) ); @@ -45,6 +46,7 @@ create table ACT_RE_MODEL ( DEPLOYMENT_ID_ varchar(64), EDITOR_SOURCE_VALUE_ID_ varchar(64), EDITOR_SOURCE_EXTRA_VALUE_ID_ varchar(64), + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -63,6 +65,7 @@ create table ACT_RU_EXECUTION ( IS_EVENT_SCOPE_ bit, SUSPENSION_STATE_ integer, CACHED_ENT_STATE_ integer, + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -83,6 +86,7 @@ create table ACT_RU_JOB ( REPEAT_ varchar(255), HANDLER_TYPE_ varchar(255), HANDLER_CFG_ varchar(4000), + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -99,6 +103,7 @@ create table ACT_RE_PROCDEF ( DESCRIPTION_ varchar(4000), HAS_START_FORM_KEY_ bit, SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -118,7 +123,9 @@ create table ACT_RU_TASK ( PRIORITY_ integer, CREATE_TIME_ timestamp, DUE_DATE_ timestamp, + CATEGORY_ varchar(255), SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -160,6 +167,8 @@ create table ACT_RU_EVENT_SUBSCR ( ACTIVITY_ID_ varchar(64), CONFIGURATION_ varchar(255), CREATED_ timestamp not null, + PROC_DEF_ID_ varchar(64), + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -178,7 +187,7 @@ alter table ACT_GE_BYTEARRAY alter table ACT_RE_PROCDEF add constraint ACT_UNIQ_PROCDEF - unique (KEY_,VERSION_); + unique (KEY_,VERSION_, TENANT_ID_); alter table ACT_RU_EXECUTION add constraint ACT_FK_EXE_PROCINST @@ -200,10 +209,6 @@ alter table ACT_RU_EXECUTION foreign key (PROC_DEF_ID_) references ACT_RE_PROCDEF (ID_); -alter table ACT_RU_EXECUTION - add constraint ACT_UNIQ_RU_BUS_KEY - unique(PROC_DEF_ID_, BUSINESS_KEY_); - alter table ACT_RU_IDENTITYLINK add constraint ACT_FK_TSKASS_TASK foreign key (TASK_ID_) diff --git a/config/sql/activiti/activiti.h2.create.history.sql b/config/sql/activiti/activiti.h2.create.history.sql index 5c2fb572061..ae3eac0b63c 100644 --- a/config/sql/activiti/activiti.h2.create.history.sql +++ b/config/sql/activiti/activiti.h2.create.history.sql @@ -11,6 +11,7 @@ create table ACT_HI_PROCINST ( END_ACT_ID_ varchar(255), SUPER_PROCESS_INSTANCE_ID_ varchar(64), DELETE_REASON_ varchar(4000), + TENANT_ID_ varchar(255) default '', primary key (ID_), unique (PROC_INST_ID_) ); @@ -25,10 +26,11 @@ create table ACT_HI_ACTINST ( CALL_PROC_INST_ID_ varchar(64), ACT_NAME_ varchar(255), ACT_TYPE_ varchar(255) not null, - ASSIGNEE_ varchar(64), + ASSIGNEE_ varchar(255), START_TIME_ timestamp not null, END_TIME_ timestamp, DURATION_ bigint, + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -51,6 +53,8 @@ create table ACT_HI_TASKINST ( PRIORITY_ integer, DUE_DATE_ timestamp, FORM_KEY_ varchar(255), + CATEGORY_ varchar(255), + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -67,6 +71,8 @@ create table ACT_HI_VARINST ( LONG_ bigint, TEXT_ varchar(4000), TEXT2_ varchar(4000), + CREATE_TIME_ timestamp, + LAST_UPDATED_TIME_ timestamp, primary key (ID_) ); @@ -141,8 +147,4 @@ create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); create index ACT_IDX_HI_IDENT_LNK_TASK on ACT_HI_IDENTITYLINK(TASK_ID_); create index ACT_IDX_HI_IDENT_LNK_PROCINST on ACT_HI_IDENTITYLINK(PROC_INST_ID_); -alter table ACT_HI_PROCINST - add constraint ACT_UNIQ_HI_BUS_KEY - unique(PROC_DEF_ID_, BUSINESS_KEY_); - create index ACT_IDX_HI_ACT_INST_EXEC on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_); diff --git a/config/sql/activiti/activiti.h2.drop.engine.sql b/config/sql/activiti/activiti.h2.drop.engine.sql deleted file mode 100644 index f9affd4f7c2..00000000000 --- a/config/sql/activiti/activiti.h2.drop.engine.sql +++ /dev/null @@ -1,19 +0,0 @@ -drop table if exists ACT_GE_PROPERTY cascade constraints; -drop table if exists ACT_GE_BYTEARRAY cascade constraints; -drop table if exists ACT_RE_DEPLOYMENT cascade constraints; -drop table if exists ACT_RE_MODEL cascade constraints; -drop table if exists ACT_RU_EXECUTION cascade constraints; -drop table if exists ACT_RU_JOB cascade constraints; -drop table if exists ACT_RE_PROCDEF cascade constraints; -drop table if exists ACT_RU_TASK cascade constraints; -drop table if exists ACT_RU_IDENTITYLINK cascade constraints; -drop table if exists ACT_RU_VARIABLE cascade constraints; -drop table if exists ACT_RU_EVENT_SUBSCR cascade constraints; - -drop index if exists ACT_IDX_EXEC_BUSKEY; -drop index if exists ACT_IDX_TASK_CREATE; -drop index if exists ACT_IDX_IDENT_LNK_USER; -drop index if exists ACT_IDX_IDENT_LNK_GROUP; -drop index if exists ACT_IDX_VARIABLE_TASK_ID; -drop index if exists ACT_IDX_EVENT_SUBSCR_CONFIG_; -drop index if exists ACT_IDX_ATHRZ_PROCEDEF; \ No newline at end of file diff --git a/config/sql/activiti/activiti.h2.drop.history.sql b/config/sql/activiti/activiti.h2.drop.history.sql deleted file mode 100644 index a1573b63e24..00000000000 --- a/config/sql/activiti/activiti.h2.drop.history.sql +++ /dev/null @@ -1,24 +0,0 @@ -drop table if exists ACT_HI_PROCINST cascade constraints; -drop table if exists ACT_HI_ACTINST cascade constraints; -drop table if exists ACT_HI_VARINST cascade constraints; -drop table if exists ACT_HI_TASKINST cascade constraints; -drop table if exists ACT_HI_DETAIL cascade constraints; -drop table if exists ACT_HI_COMMENT cascade constraints; -drop table if exists ACT_HI_ATTACHMENT cascade constraints; -drop table if exists ACT_HI_IDENTITYLINK cascade constraints; - -drop index if exists ACT_IDX_HI_PRO_INST_END; -drop index if exists ACT_IDX_HI_PRO_I_BUSKEY; -drop index if exists ACT_IDX_HI_ACT_INST_START; -drop index if exists ACT_IDX_HI_ACT_INST_END; -drop index if exists ACT_IDX_HI_DETAIL_PROC_INST; -drop index if exists ACT_IDX_HI_DETAIL_ACT_INST; -drop index if exists ACT_IDX_HI_DETAIL_TIME; -drop index if exists ACT_IDX_HI_DETAIL_NAME; -drop index if exists ACT_IDX_HI_DETAIL_TASK_ID; -drop index if exists ACT_IDX_HI_PROCVAR_PROC_INST; -drop index if exists ACT_IDX_HI_PROCVAR_NAME_TYPE; -drop index if exists ACT_IDX_HI_ACT_INST_PROCINST; -drop index if exists ACT_IDX_HI_IDENT_LNK_USER; -drop index if exists ACT_IDX_HI_IDENT_LNK_TASK; -drop index if exists ACT_IDX_HI_IDENT_LNK_PROCINST; diff --git a/config/sql/activiti/activiti.h2.drop.identity.sql b/config/sql/activiti/activiti.h2.drop.identity.sql deleted file mode 100644 index 26c7379e91c..00000000000 --- a/config/sql/activiti/activiti.h2.drop.identity.sql +++ /dev/null @@ -1,4 +0,0 @@ -drop table if exists ACT_ID_INFO cascade constraints; -drop table if exists ACT_ID_GROUP cascade constraints; -drop table if exists ACT_ID_MEMBERSHIP cascade constraints; -drop table if exists ACT_ID_USER cascade constraints; diff --git a/config/sql/activiti/activiti.mssql.create.engine.sql b/config/sql/activiti/activiti.mssql.create.engine.sql index 4e6d2568094..9ad5645bdf1 100644 --- a/config/sql/activiti/activiti.mssql.create.engine.sql +++ b/config/sql/activiti/activiti.mssql.create.engine.sql @@ -6,10 +6,10 @@ create table ACT_GE_PROPERTY ( ); insert into ACT_GE_PROPERTY -values ('schema.version', '5.13', 1); +values ('schema.version', '5.15.1', 1); insert into ACT_GE_PROPERTY -values ('schema.history', 'create(5.13)', 1); +values ('schema.history', 'create(5.15.1)', 1); insert into ACT_GE_PROPERTY values ('next.dbid', '1', 1); @@ -28,6 +28,7 @@ create table ACT_RE_DEPLOYMENT ( ID_ nvarchar(64), NAME_ nvarchar(255), CATEGORY_ nvarchar(255), + TENANT_ID_ nvarchar(255) default '', DEPLOY_TIME_ datetime, primary key (ID_) ); @@ -45,6 +46,7 @@ create table ACT_RE_MODEL ( DEPLOYMENT_ID_ nvarchar(64), EDITOR_SOURCE_VALUE_ID_ nvarchar(64), EDITOR_SOURCE_EXTRA_VALUE_ID_ nvarchar(64), + TENANT_ID_ nvarchar(255) default '', primary key (ID_) ); @@ -63,6 +65,7 @@ create table ACT_RU_EXECUTION ( IS_EVENT_SCOPE_ tinyint, SUSPENSION_STATE_ tinyint, CACHED_ENT_STATE_ int, + TENANT_ID_ nvarchar(255) default '', primary key (ID_) ); @@ -83,6 +86,7 @@ create table ACT_RU_JOB ( REPEAT_ nvarchar(255), HANDLER_TYPE_ nvarchar(255), HANDLER_CFG_ nvarchar(4000), + TENANT_ID_ nvarchar(255) default '', primary key (ID_) ); @@ -99,6 +103,7 @@ create table ACT_RE_PROCDEF ( DESCRIPTION_ nvarchar(4000), HAS_START_FORM_KEY_ tinyint, SUSPENSION_STATE_ tinyint, + TENANT_ID_ nvarchar(255) default '', primary key (ID_) ); @@ -118,7 +123,9 @@ create table ACT_RU_TASK ( PRIORITY_ int, CREATE_TIME_ datetime, DUE_DATE_ datetime, + CATEGORY_ nvarchar(255), SUSPENSION_STATE_ int, + TENANT_ID_ nvarchar(255) default '', primary key (ID_) ); @@ -160,6 +167,8 @@ create table ACT_RU_EVENT_SUBSCR ( ACTIVITY_ID_ nvarchar(64), CONFIGURATION_ nvarchar(255), CREATED_ datetime not null, + PROC_DEF_ID_ nvarchar(64), + TENANT_ID_ nvarchar(255) default '', primary key (ID_) ); @@ -169,7 +178,6 @@ create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_); create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_); create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_); create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_); -create unique index ACT_UNIQ_RU_BUS_KEY on ACT_RU_EXECUTION (PROC_DEF_ID_, BUSINESS_KEY_) where BUSINESS_KEY_ is not null; create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_); create index ACT_IDX_EXECUTION_PROC on ACT_RU_EXECUTION(PROC_DEF_ID_); create index ACT_IDX_EXECUTION_PARENT on ACT_RU_EXECUTION(PARENT_ID_); @@ -180,9 +188,12 @@ create index ACT_IDX_VARIABLE_EXEC on ACT_RU_VARIABLE(EXECUTION_ID_); create index ACT_IDX_VARIABLE_PROCINST on ACT_RU_VARIABLE(PROC_INST_ID_); create index ACT_IDX_IDENT_LNK_TASK on ACT_RU_IDENTITYLINK(TASK_ID_); create index ACT_IDX_IDENT_LNK_PROCINST on ACT_RU_IDENTITYLINK(PROC_INST_ID_); -create index ACT_IDX_IDENT_LNK_PROCDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_); create index ACT_IDX_TASK_EXEC on ACT_RU_TASK(EXECUTION_ID_); create index ACT_IDX_TASK_PROCINST on ACT_RU_TASK(PROC_INST_ID_); +create index ACT_IDX_EXEC_PROC_INST_ID on ACT_RU_EXECUTION(PROC_INST_ID_); +create index ACT_IDX_TASK_PROC_DEF_ID on ACT_RU_TASK(PROC_DEF_ID_); +create index ACT_IDX_EVENT_SUBSCR_EXEC_ID on ACT_RU_EVENT_SUBSCR(EXECUTION_ID_); +create index ACT_IDX_JOB_EXCEPTION_STACK_ID on ACT_RU_JOB(EXCEPTION_STACK_ID_); alter table ACT_GE_BYTEARRAY add constraint ACT_FK_BYTEARR_DEPL @@ -191,7 +202,7 @@ alter table ACT_GE_BYTEARRAY alter table ACT_RE_PROCDEF add constraint ACT_UNIQ_PROCDEF - unique (KEY_,VERSION_); + unique (KEY_,VERSION_, TENANT_ID_); alter table ACT_RU_EXECUTION add constraint ACT_FK_EXE_PARENT @@ -276,4 +287,4 @@ alter table ACT_RE_MODEL alter table ACT_RE_MODEL add constraint ACT_FK_MODEL_DEPLOYMENT foreign key (DEPLOYMENT_ID_) - references ACT_RE_DEPLOYMENT (ID_); \ No newline at end of file + references ACT_RE_DEPLOYMENT (ID_); diff --git a/config/sql/activiti/activiti.mssql.create.history.sql b/config/sql/activiti/activiti.mssql.create.history.sql index a014e6348ac..2abd699e7bc 100644 --- a/config/sql/activiti/activiti.mssql.create.history.sql +++ b/config/sql/activiti/activiti.mssql.create.history.sql @@ -11,6 +11,7 @@ create table ACT_HI_PROCINST ( END_ACT_ID_ nvarchar(255), SUPER_PROCESS_INSTANCE_ID_ nvarchar(64), DELETE_REASON_ nvarchar(4000), + TENANT_ID_ nvarchar(255) default '', primary key (ID_), unique (PROC_INST_ID_) ); @@ -25,10 +26,11 @@ create table ACT_HI_ACTINST ( CALL_PROC_INST_ID_ nvarchar(64), ACT_NAME_ nvarchar(255), ACT_TYPE_ nvarchar(255) not null, - ASSIGNEE_ nvarchar(64), + ASSIGNEE_ nvarchar(255), START_TIME_ datetime not null, END_TIME_ datetime, DURATION_ numeric(19,0), + TENANT_ID_ nvarchar(255) default '', primary key (ID_) ); @@ -51,6 +53,8 @@ create table ACT_HI_TASKINST ( PRIORITY_ int, DUE_DATE_ datetime, FORM_KEY_ nvarchar(255), + CATEGORY_ nvarchar(255), + TENANT_ID_ nvarchar(255) default '', primary key (ID_) ); @@ -67,6 +71,8 @@ create table ACT_HI_VARINST ( LONG_ numeric(19,0), TEXT_ nvarchar(4000), TEXT2_ nvarchar(4000), + CREATE_TIME_ datetime, + LAST_UPDATED_TIME_ datetime, primary key (ID_) ); @@ -137,7 +143,6 @@ create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_); create index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL(TASK_ID_); create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_); create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_); -create unique index ACT_UNIQ_HI_BUS_KEY on ACT_HI_PROCINST (PROC_DEF_ID_, BUSINESS_KEY_) where BUSINESS_KEY_ is not null; create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_); create index ACT_IDX_HI_ACT_INST_EXEC on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_); create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); diff --git a/config/sql/activiti/activiti.mssql.drop.engine.sql b/config/sql/activiti/activiti.mssql.drop.engine.sql deleted file mode 100644 index 60279cbc061..00000000000 --- a/config/sql/activiti/activiti.mssql.drop.engine.sql +++ /dev/null @@ -1,39 +0,0 @@ -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_EXEC_BUSKEY') drop index ACT_RU_EXECUTION.ACT_IDX_EXEC_BUSKEY; -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_TASK_CREATE') drop index ACT_RU_TASK.ACT_IDX_TASK_CREATE; -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_IDENT_LNK_USER') drop index ACT_RU_IDENTITYLINK.ACT_IDX_IDENT_LNK_USER; -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_IDENT_LNK_GROUP') drop index ACT_RU_IDENTITYLINK.ACT_IDX_IDENT_LNK_GROUP; -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_VARIABLE_TASK_ID') drop index ACT_RU_VARIABLE.ACT_IDX_VARIABLE_TASK_ID; -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_EVENT_SUBSCR_CONFIG_') drop index ACT_RU_EVENT_SUBSCR.ACT_IDX_EVENT_SUBSCR_CONFIG_; - -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_GE_BYTEARRAY') alter table ACT_GE_BYTEARRAY drop constraint ACT_FK_BYTEARR_DEPL; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RE_PROCDEF') alter table ACT_RE_PROCDEF drop constraint ACT_UNIQ_PROCDEF; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RU_EXECUTION') alter table ACT_RU_EXECUTION drop constraint ACT_FK_EXE_PROCDEF; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RU_EXECUTION') alter table ACT_RU_EXECUTION drop constraint ACT_FK_EXE_PARENT; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RU_EXECUTION') alter table ACT_RU_EXECUTION drop constraint ACT_FK_EXE_SUPER; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RU_IDENTITYLINK') alter table ACT_RU_IDENTITYLINK drop constraint ACT_FK_TSKASS_TASK; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RU_IDENTITYLINK') alter table ACT_RU_IDENTITYLINK drop constraint ACT_FK_ATHRZ_PROCEDEF; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RU_TASK') alter table ACT_RU_TASK drop constraint ACT_FK_TASK_EXE; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RU_TASK') alter table ACT_RU_TASK drop constraint ACT_FK_TASK_PROCINST; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RU_TASK') alter table ACT_RU_TASK drop constraint ACT_FK_TASK_PROCDEF; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RU_VARIABLE') alter table ACT_RU_VARIABLE drop constraint ACT_FK_VAR_EXE; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RU_VARIABLE') alter table ACT_RU_VARIABLE drop constraint ACT_FK_VAR_PROCINST; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RU_VARIABLE') alter table ACT_RU_VARIABLE drop constraint ACT_FK_VAR_BYTEARRAY; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RU_JOB') alter table ACT_RU_JOB drop constraint ACT_FK_JOB_EXCEPTION; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RU_EVENT_SUBSCR') alter table ACT_RU_EVENT_SUBSCR drop constraint ACT_FK_EVENT_EXEC; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RE_MODEL') alter table ACT_RE_MODEL drop constraint ACT_FK_MODEL_SOURCE; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RE_MODEL') alter table ACT_RE_MODEL drop constraint ACT_FK_MODEL_SOURCE_EXTRA; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RE_MODEL') alter table ACT_RE_MODEL drop constraint ACT_FK_MODEL_DEPLOYMENT; - -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_ATHRZ_PROCEDEF') drop index ACT_RU_IDENTITYLINK.ACT_IDX_ATHRZ_PROCEDEF; - -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_GE_PROPERTY') drop table ACT_GE_PROPERTY; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_GE_BYTEARRAY') drop table ACT_GE_BYTEARRAY; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RE_PROCDEF') drop table ACT_RE_PROCDEF; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RE_DEPLOYMENT') drop table ACT_RE_DEPLOYMENT; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RE_MODEL') drop table ACT_RE_MODEL; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RU_IDENTITYLINK') drop table ACT_RU_IDENTITYLINK; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RU_TASK') drop table ACT_RU_TASK; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RU_VARIABLE') drop table ACT_RU_VARIABLE; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RU_EXECUTION') drop table ACT_RU_EXECUTION; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RU_EVENT_SUBSCR') drop table ACT_RU_EVENT_SUBSCR; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_RU_JOB') drop table ACT_RU_JOB; diff --git a/config/sql/activiti/activiti.mssql.drop.history.sql b/config/sql/activiti/activiti.mssql.drop.history.sql deleted file mode 100644 index 93bc00b444f..00000000000 --- a/config/sql/activiti/activiti.mssql.drop.history.sql +++ /dev/null @@ -1,24 +0,0 @@ -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_PRO_INST_END') drop index ACT_HI_PROCINST.ACT_IDX_HI_PRO_INST_END; -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_PRO_I_BUSKEY') drop index ACT_HI_PROCINST.ACT_IDX_HI_PRO_I_BUSKEY; -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_ACT_INST_START') drop index ACT_HI_ACTINST.ACT_IDX_HI_ACT_INST_START; -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_ACT_INST_END') drop index ACT_HI_ACTINST.ACT_IDX_HI_ACT_INST_END; -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_DETAIL_PROC_INST') drop index ACT_HI_DETAIL.ACT_IDX_HI_DETAIL_PROC_INST; -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_DETAIL_ACT_INST') drop index ACT_HI_DETAIL.ACT_IDX_HI_DETAIL_ACT_INST; -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_DETAIL_TIME') drop index ACT_HI_DETAIL.ACT_IDX_HI_DETAIL_TIME; -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_DETAIL_NAME') drop index ACT_HI_DETAIL.ACT_IDX_HI_DETAIL_NAME; -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_DETAIL_TASK_ID') drop index ACT_HI_DETAIL.ACT_IDX_HI_DETAIL_TASK_ID; -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_PROCVAR_PROC_INST') drop index ACT_HI_VARINST.ACT_IDX_HI_PROCVAR_PROC_INST; -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_PROCVAR_NAME_TYPE') drop index ACT_HI_VARINST.ACT_IDX_HI_PROCVAR_NAME_TYPE; -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_ACT_INST_PROCINST') drop index ACT_HI_ACTINST.ACT_IDX_HI_ACT_INST_PROCINST; -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_IDENT_LNK_USER') drop index ACT_HI_IDENTITYLINK.ACT_IDX_HI_IDENT_LNK_USER; -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_IDENT_LNK_TASK') drop index ACT_HI_IDENTITYLINK.ACT_IDX_HI_IDENT_LNK_TASK; -IF EXISTS (SELECT name FROM sysindexes WHERE name = 'ACT_IDX_HI_IDENT_LNK_PROCINST') drop index ACT_HI_IDENTITYLINK.ACT_IDX_HI_IDENT_LNK_PROCINST; - -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_HI_PROCINST') drop table ACT_HI_PROCINST; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_HI_ACTINST') drop table ACT_HI_ACTINST; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_HI_VARINST') drop table ACT_HI_VARINST; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_HI_TASKINST') drop table ACT_HI_TASKINST; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_HI_DETAIL') drop table ACT_HI_DETAIL; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_HI_COMMENT') drop table ACT_HI_COMMENT; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_HI_ATTACHMENT') drop table ACT_HI_ATTACHMENT; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_HI_IDENTITYLINK') drop table ACT_HI_IDENTITYLINK; diff --git a/config/sql/activiti/activiti.mssql.drop.identity.sql b/config/sql/activiti/activiti.mssql.drop.identity.sql deleted file mode 100644 index dc934ef233c..00000000000 --- a/config/sql/activiti/activiti.mssql.drop.identity.sql +++ /dev/null @@ -1,7 +0,0 @@ -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_ID_MEMBERSHIP') alter table ACT_ID_MEMBERSHIP drop constraint ACT_FK_MEMB_GROUP; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_ID_MEMBERSHIP') alter table ACT_ID_MEMBERSHIP drop constraint ACT_FK_MEMB_USER; - -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_ID_INFO') drop table ACT_ID_INFO; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_ID_MEMBERSHIP') drop table ACT_ID_MEMBERSHIP; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_ID_GROUP') drop table ACT_ID_GROUP; -if exists (select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'ACT_ID_USER') drop table ACT_ID_USER; diff --git a/config/sql/activiti/activiti.mysql.create.engine.sql b/config/sql/activiti/activiti.mysql.create.engine.sql index 0c0d493f35c..322eec1095a 100644 --- a/config/sql/activiti/activiti.mysql.create.engine.sql +++ b/config/sql/activiti/activiti.mysql.create.engine.sql @@ -6,10 +6,10 @@ create table ACT_GE_PROPERTY ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; insert into ACT_GE_PROPERTY -values ('schema.version', '5.13', 1); +values ('schema.version', '5.15.1', 1); insert into ACT_GE_PROPERTY -values ('schema.history', 'create(5.13)', 1); +values ('schema.history', 'create(5.15.1)', 1); insert into ACT_GE_PROPERTY values ('next.dbid', '1', 1); @@ -28,7 +28,8 @@ create table ACT_RE_DEPLOYMENT ( ID_ varchar(64), NAME_ varchar(255), CATEGORY_ varchar(255), - DEPLOY_TIME_ timestamp, + TENANT_ID_ varchar(255) default '', + DEPLOY_TIME_ timestamp(3), primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; @@ -38,13 +39,14 @@ create table ACT_RE_MODEL ( NAME_ varchar(255), KEY_ varchar(255), CATEGORY_ varchar(255), - CREATE_TIME_ timestamp null, - LAST_UPDATE_TIME_ timestamp null, + CREATE_TIME_ timestamp(3) null, + LAST_UPDATE_TIME_ timestamp(3) null, VERSION_ integer, META_INFO_ varchar(4000), DEPLOYMENT_ID_ varchar(64), EDITOR_SOURCE_VALUE_ID_ varchar(64), EDITOR_SOURCE_EXTRA_VALUE_ID_ varchar(64), + TENANT_ID_ varchar(255) default '', primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; @@ -63,15 +65,15 @@ create table ACT_RU_EXECUTION ( IS_EVENT_SCOPE_ TINYINT, SUSPENSION_STATE_ integer, CACHED_ENT_STATE_ integer, - primary key (ID_), - unique ACT_UNIQ_RU_BUS_KEY (PROC_DEF_ID_, BUSINESS_KEY_) + TENANT_ID_ varchar(255) default '', + primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; create table ACT_RU_JOB ( ID_ varchar(64) NOT NULL, REV_ integer, TYPE_ varchar(255) NOT NULL, - LOCK_EXP_TIME_ timestamp NULL, + LOCK_EXP_TIME_ timestamp(3) NULL, LOCK_OWNER_ varchar(255), EXCLUSIVE_ boolean, EXECUTION_ID_ varchar(64), @@ -80,10 +82,11 @@ create table ACT_RU_JOB ( RETRIES_ integer, EXCEPTION_STACK_ID_ varchar(64), EXCEPTION_MSG_ varchar(4000), - DUEDATE_ timestamp NULL, + DUEDATE_ timestamp(3) NULL, REPEAT_ varchar(255), HANDLER_TYPE_ varchar(255), HANDLER_CFG_ varchar(4000), + TENANT_ID_ varchar(255) default '', primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; @@ -100,6 +103,7 @@ create table ACT_RE_PROCDEF ( DESCRIPTION_ varchar(4000), HAS_START_FORM_KEY_ TINYINT, SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(255) default '', primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; @@ -117,9 +121,11 @@ create table ACT_RU_TASK ( ASSIGNEE_ varchar(255), DELEGATION_ varchar(64), PRIORITY_ integer, - CREATE_TIME_ timestamp, - DUE_DATE_ datetime, + CREATE_TIME_ timestamp(3), + DUE_DATE_ datetime(3), + CATEGORY_ varchar(255), SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(255) default '', primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; @@ -160,7 +166,9 @@ create table ACT_RU_EVENT_SUBSCR ( PROC_INST_ID_ varchar(64), ACTIVITY_ID_ varchar(64), CONFIGURATION_ varchar(255), - CREATED_ timestamp not null, + CREATED_ timestamp(3) not null DEFAULT CURRENT_TIMESTAMP(3), + PROC_DEF_ID_ varchar(64), + TENANT_ID_ varchar(255) default '', primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; @@ -179,7 +187,7 @@ alter table ACT_GE_BYTEARRAY alter table ACT_RE_PROCDEF add constraint ACT_UNIQ_PROCDEF - unique (KEY_,VERSION_); + unique (KEY_,VERSION_, TENANT_ID_); alter table ACT_RU_EXECUTION add constraint ACT_FK_EXE_PROCINST diff --git a/config/sql/activiti/activiti.mysql.create.history.sql b/config/sql/activiti/activiti.mysql.create.history.sql index 98e68967fa7..00d24a23d41 100644 --- a/config/sql/activiti/activiti.mysql.create.history.sql +++ b/config/sql/activiti/activiti.mysql.create.history.sql @@ -3,17 +3,17 @@ create table ACT_HI_PROCINST ( PROC_INST_ID_ varchar(64) not null, BUSINESS_KEY_ varchar(255), PROC_DEF_ID_ varchar(64) not null, - START_TIME_ datetime not null, - END_TIME_ datetime, + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), DURATION_ bigint, START_USER_ID_ varchar(255), START_ACT_ID_ varchar(255), END_ACT_ID_ varchar(255), SUPER_PROCESS_INSTANCE_ID_ varchar(64), DELETE_REASON_ varchar(4000), + TENANT_ID_ varchar(255) default '', primary key (ID_), - unique (PROC_INST_ID_), - unique ACT_UNIQ_HI_BUS_KEY (PROC_DEF_ID_, BUSINESS_KEY_) + unique (PROC_INST_ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; create table ACT_HI_ACTINST ( @@ -26,10 +26,11 @@ create table ACT_HI_ACTINST ( CALL_PROC_INST_ID_ varchar(64), ACT_NAME_ varchar(255), ACT_TYPE_ varchar(255) not null, - ASSIGNEE_ varchar(64), - START_TIME_ datetime not null, - END_TIME_ datetime, + ASSIGNEE_ varchar(255), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), DURATION_ bigint, + TENANT_ID_ varchar(255) default '', primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; @@ -44,14 +45,16 @@ create table ACT_HI_TASKINST ( DESCRIPTION_ varchar(4000), OWNER_ varchar(255), ASSIGNEE_ varchar(255), - START_TIME_ datetime not null, - CLAIM_TIME_ datetime, - END_TIME_ datetime, + START_TIME_ datetime(3) not null, + CLAIM_TIME_ datetime(3), + END_TIME_ datetime(3), DURATION_ bigint, DELETE_REASON_ varchar(4000), PRIORITY_ integer, - DUE_DATE_ datetime, + DUE_DATE_ datetime(3), FORM_KEY_ varchar(255), + CATEGORY_ varchar(255), + TENANT_ID_ varchar(255) default '', primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; @@ -68,6 +71,8 @@ create table ACT_HI_VARINST ( LONG_ bigint, TEXT_ varchar(4000), TEXT2_ varchar(4000), + CREATE_TIME_ datetime(3), + LAST_UPDATED_TIME_ datetime(3), primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; @@ -81,7 +86,7 @@ create table ACT_HI_DETAIL ( NAME_ varchar(255) not null, VAR_TYPE_ varchar(255), REV_ integer, - TIME_ datetime not null, + TIME_ datetime(3) not null, BYTEARRAY_ID_ varchar(64), DOUBLE_ double, LONG_ bigint, @@ -93,7 +98,7 @@ create table ACT_HI_DETAIL ( create table ACT_HI_COMMENT ( ID_ varchar(64) not null, TYPE_ varchar(255), - TIME_ datetime not null, + TIME_ datetime(3) not null, USER_ID_ varchar(255), TASK_ID_ varchar(64), PROC_INST_ID_ varchar(64), diff --git a/config/sql/activiti/activiti.mysql.drop.engine.sql b/config/sql/activiti/activiti.mysql.drop.engine.sql deleted file mode 100644 index 0b4c913aabc..00000000000 --- a/config/sql/activiti/activiti.mysql.drop.engine.sql +++ /dev/null @@ -1,74 +0,0 @@ -drop index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION; -drop index ACT_IDX_TASK_CREATE on ACT_RU_TASK; -drop index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK; -drop index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK; -drop index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE; - -alter table ACT_GE_BYTEARRAY - drop FOREIGN KEY ACT_FK_BYTEARR_DEPL; - -alter table ACT_RU_EXECUTION - drop FOREIGN KEY ACT_FK_EXE_PROCINST; - -alter table ACT_RU_EXECUTION - drop FOREIGN KEY ACT_FK_EXE_PARENT; - -alter table ACT_RU_EXECUTION - drop FOREIGN KEY ACT_FK_EXE_SUPER; - -alter table ACT_RU_EXECUTION - drop FOREIGN KEY ACT_FK_EXE_PROCDEF; - -alter table ACT_RU_IDENTITYLINK - drop FOREIGN KEY ACT_FK_TSKASS_TASK; - -alter table ACT_RU_IDENTITYLINK - drop FOREIGN KEY ACT_FK_ATHRZ_PROCEDEF; - -alter table ACT_RU_TASK - drop FOREIGN KEY ACT_FK_TASK_EXE; - -alter table ACT_RU_TASK - drop FOREIGN KEY ACT_FK_TASK_PROCINST; - -alter table ACT_RU_TASK - drop FOREIGN KEY ACT_FK_TASK_PROCDEF; - -alter table ACT_RU_VARIABLE - drop FOREIGN KEY ACT_FK_VAR_EXE; - -alter table ACT_RU_VARIABLE - drop FOREIGN KEY ACT_FK_VAR_PROCINST; - -alter table ACT_RU_VARIABLE - drop FOREIGN KEY ACT_FK_VAR_BYTEARRAY; - -alter table ACT_RU_JOB - drop FOREIGN KEY ACT_FK_JOB_EXCEPTION; - -alter table ACT_RU_EVENT_SUBSCR - drop FOREIGN KEY ACT_FK_EVENT_EXEC; - -alter table ACT_RE_MODEL - drop FOREIGN KEY ACT_FK_MODEL_SOURCE; - -alter table ACT_RE_MODEL - drop FOREIGN KEY ACT_FK_MODEL_SOURCE_EXTRA; - -alter table ACT_RE_MODEL - drop FOREIGN KEY ACT_FK_MODEL_DEPLOYMENT; - -drop index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK; -drop index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR; - -drop table if exists ACT_GE_PROPERTY; -drop table if exists ACT_RU_VARIABLE; -drop table if exists ACT_GE_BYTEARRAY; -drop table if exists ACT_RE_DEPLOYMENT; -drop table if exists ACT_RE_MODEL; -drop table if exists ACT_RU_IDENTITYLINK; -drop table if exists ACT_RU_TASK; -drop table if exists ACT_RE_PROCDEF; -drop table if exists ACT_RU_EXECUTION; -drop table if exists ACT_RU_JOB; -drop table if exists ACT_RU_EVENT_SUBSCR; \ No newline at end of file diff --git a/config/sql/activiti/activiti.mysql.drop.history.sql b/config/sql/activiti/activiti.mysql.drop.history.sql deleted file mode 100644 index 2d78a20a526..00000000000 --- a/config/sql/activiti/activiti.mysql.drop.history.sql +++ /dev/null @@ -1,25 +0,0 @@ -drop index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST; -drop index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST; -drop index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST; -drop index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST; -drop index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL; -drop index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL; -drop index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL; -drop index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL; -drop index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL; -drop index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST; -drop index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST; -drop index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST; -drop index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK; -drop index ACT_IDX_HI_IDENT_LNK_TASK on ACT_HI_IDENTITYLINK; -drop index ACT_IDX_HI_IDENT_LNK_PROCINST on ACT_HI_IDENTITYLINK; - -drop table if exists ACT_HI_PROCINST; -drop table if exists ACT_HI_ACTINST; -drop table if exists ACT_HI_VARINST; -drop table if exists ACT_HI_TASKINST; -drop table if exists ACT_HI_DETAIL; -drop table if exists ACT_HI_COMMENT; -drop table if exists ACT_HI_ATTACHMENT; -drop table if exists ACT_HI_IDENTITYLINK; - \ No newline at end of file diff --git a/config/sql/activiti/activiti.mysql.drop.identity.sql b/config/sql/activiti/activiti.mysql.drop.identity.sql deleted file mode 100644 index e663912a6fc..00000000000 --- a/config/sql/activiti/activiti.mysql.drop.identity.sql +++ /dev/null @@ -1,10 +0,0 @@ -alter table ACT_ID_MEMBERSHIP - drop FOREIGN KEY ACT_FK_MEMB_GROUP; - -alter table ACT_ID_MEMBERSHIP - drop FOREIGN KEY ACT_FK_MEMB_USER; - -drop table if exists ACT_ID_INFO; -drop table if exists ACT_ID_MEMBERSHIP; -drop table if exists ACT_ID_GROUP; -drop table if exists ACT_ID_USER; diff --git a/config/sql/activiti/activiti.db2.create.engine.sql b/config/sql/activiti/activiti.mysql55.create.engine.sql similarity index 76% rename from config/sql/activiti/activiti.db2.create.engine.sql rename to config/sql/activiti/activiti.mysql55.create.engine.sql index 27683b818d9..10fe2fff3c0 100644 --- a/config/sql/activiti/activiti.db2.create.engine.sql +++ b/config/sql/activiti/activiti.mysql55.create.engine.sql @@ -1,36 +1,37 @@ create table ACT_GE_PROPERTY ( - NAME_ varchar(64) not null, + NAME_ varchar(64), VALUE_ varchar(300), REV_ integer, primary key (NAME_) -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; insert into ACT_GE_PROPERTY -values ('schema.version', '5.13', 1); +values ('schema.version', '5.15.1', 1); insert into ACT_GE_PROPERTY -values ('schema.history', 'create(5.13)', 1); +values ('schema.history', 'create(5.15.1)', 1); insert into ACT_GE_PROPERTY values ('next.dbid', '1', 1); create table ACT_GE_BYTEARRAY ( - ID_ varchar(64) not null, + ID_ varchar(64), REV_ integer, NAME_ varchar(255), DEPLOYMENT_ID_ varchar(64), - BYTES_ BLOB, - GENERATED_ smallint check(GENERATED_ in (1,0)), + BYTES_ LONGBLOB, + GENERATED_ TINYINT, primary key (ID_) -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; create table ACT_RE_DEPLOYMENT ( - ID_ varchar(64) not null, + ID_ varchar(64), NAME_ varchar(255), CATEGORY_ varchar(255), + TENANT_ID_ varchar(255) default '', DEPLOY_TIME_ timestamp, primary key (ID_) -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; create table ACT_RE_MODEL ( ID_ varchar(64) not null, @@ -38,18 +39,19 @@ create table ACT_RE_MODEL ( NAME_ varchar(255), KEY_ varchar(255), CATEGORY_ varchar(255), - CREATE_TIME_ timestamp, - LAST_UPDATE_TIME_ timestamp, + CREATE_TIME_ timestamp null, + LAST_UPDATE_TIME_ timestamp null, VERSION_ integer, META_INFO_ varchar(4000), DEPLOYMENT_ID_ varchar(64), EDITOR_SOURCE_VALUE_ID_ varchar(64), EDITOR_SOURCE_EXTRA_VALUE_ID_ varchar(64), + TENANT_ID_ varchar(255) default '', primary key (ID_) -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; create table ACT_RU_EXECUTION ( - ID_ varchar(64) not null, + ID_ varchar(64), REV_ integer, PROC_INST_ID_ varchar(64), BUSINESS_KEY_ varchar(255), @@ -57,36 +59,36 @@ create table ACT_RU_EXECUTION ( PROC_DEF_ID_ varchar(64), SUPER_EXEC_ varchar(64), ACT_ID_ varchar(255), - IS_ACTIVE_ smallint check(IS_ACTIVE_ in (1,0)), - IS_CONCURRENT_ smallint check(IS_CONCURRENT_ in (1,0)), - IS_SCOPE_ smallint check(IS_SCOPE_ in (1,0)), - IS_EVENT_SCOPE_ smallint check(IS_EVENT_SCOPE_ in (1,0)), - UNI_BUSINESS_KEY varchar (255) not null generated always as (case when "BUSINESS_KEY_" is null then "ID_" else "BUSINESS_KEY_" end), - UNI_PROC_DEF_ID varchar (64) not null generated always as (case when "PROC_DEF_ID_" is null then "ID_" else "PROC_DEF_ID_" end), - SUSPENSION_STATE_ integer, - CACHED_ENT_STATE_ integer, + IS_ACTIVE_ TINYINT, + IS_CONCURRENT_ TINYINT, + IS_SCOPE_ TINYINT, + IS_EVENT_SCOPE_ TINYINT, + SUSPENSION_STATE_ integer, + CACHED_ENT_STATE_ integer, + TENANT_ID_ varchar(255) default '', primary key (ID_) -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; create table ACT_RU_JOB ( - ID_ varchar(64) not null, - REV_ integer, - TYPE_ varchar(255) not null, - LOCK_EXP_TIME_ timestamp, + ID_ varchar(64) NOT NULL, + REV_ integer, + TYPE_ varchar(255) NOT NULL, + LOCK_EXP_TIME_ timestamp NULL, LOCK_OWNER_ varchar(255), - EXCLUSIVE_ smallint check(EXCLUSIVE_ in (1,0)), + EXCLUSIVE_ boolean, EXECUTION_ID_ varchar(64), PROCESS_INSTANCE_ID_ varchar(64), PROC_DEF_ID_ varchar(64), RETRIES_ integer, EXCEPTION_STACK_ID_ varchar(64), EXCEPTION_MSG_ varchar(4000), - DUEDATE_ timestamp, + DUEDATE_ timestamp NULL, REPEAT_ varchar(255), HANDLER_TYPE_ varchar(255), HANDLER_CFG_ varchar(4000), + TENANT_ID_ varchar(255) default '', primary key (ID_) -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; create table ACT_RE_PROCDEF ( ID_ varchar(64) not null, @@ -99,13 +101,14 @@ create table ACT_RE_PROCDEF ( RESOURCE_NAME_ varchar(4000), DGRM_RESOURCE_NAME_ varchar(4000), DESCRIPTION_ varchar(4000), - HAS_START_FORM_KEY_ smallint check(HAS_START_FORM_KEY_ in (1,0)), + HAS_START_FORM_KEY_ TINYINT, SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(255) default '', primary key (ID_) -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; create table ACT_RU_TASK ( - ID_ varchar(64) not null, + ID_ varchar(64), REV_ integer, EXECUTION_ID_ varchar(64), PROC_INST_ID_ varchar(64), @@ -119,22 +122,24 @@ create table ACT_RU_TASK ( DELEGATION_ varchar(64), PRIORITY_ integer, CREATE_TIME_ timestamp, - DUE_DATE_ timestamp, + DUE_DATE_ datetime, + CATEGORY_ varchar(255), SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(255) default '', primary key (ID_) -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; create table ACT_RU_IDENTITYLINK ( - ID_ varchar(64) not null, + ID_ varchar(64), REV_ integer, GROUP_ID_ varchar(255), TYPE_ varchar(255), USER_ID_ varchar(255), TASK_ID_ varchar(64), PROC_INST_ID_ varchar(64), - PROC_DEF_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), primary key (ID_) -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; create table ACT_RU_VARIABLE ( ID_ varchar(64) not null, @@ -142,15 +147,15 @@ create table ACT_RU_VARIABLE ( TYPE_ varchar(255) not null, NAME_ varchar(255) not null, EXECUTION_ID_ varchar(64), - PROC_INST_ID_ varchar(64), + PROC_INST_ID_ varchar(64), TASK_ID_ varchar(64), BYTEARRAY_ID_ varchar(64), - DOUBLE_ double precision, + DOUBLE_ double, LONG_ bigint, TEXT_ varchar(4000), TEXT2_ varchar(4000), primary key (ID_) -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; create table ACT_RU_EVENT_SUBSCR ( ID_ varchar(64) not null, @@ -161,11 +166,12 @@ create table ACT_RU_EVENT_SUBSCR ( PROC_INST_ID_ varchar(64), ACTIVITY_ID_ varchar(64), CONFIGURATION_ varchar(255), - CREATED_ timestamp not null, + CREATED_ timestamp not null DEFAULT CURRENT_TIMESTAMP, + PROC_DEF_ID_ varchar(64), + TENANT_ID_ varchar(255) default '', primary key (ID_) -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; -create unique index ACT_UNIQ_RU_BUS_KEY on ACT_RU_EXECUTION(UNI_PROC_DEF_ID, UNI_BUSINESS_KEY); create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_); create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_); create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_); @@ -181,12 +187,12 @@ alter table ACT_GE_BYTEARRAY alter table ACT_RE_PROCDEF add constraint ACT_UNIQ_PROCDEF - unique (KEY_,VERSION_); + unique (KEY_,VERSION_, TENANT_ID_); alter table ACT_RU_EXECUTION add constraint ACT_FK_EXE_PROCINST foreign key (PROC_INST_ID_) - references ACT_RU_EXECUTION (ID_); + references ACT_RU_EXECUTION (ID_) on delete cascade on update cascade; alter table ACT_RU_EXECUTION add constraint ACT_FK_EXE_PARENT @@ -197,27 +203,27 @@ alter table ACT_RU_EXECUTION add constraint ACT_FK_EXE_SUPER foreign key (SUPER_EXEC_) references ACT_RU_EXECUTION (ID_); - + alter table ACT_RU_EXECUTION add constraint ACT_FK_EXE_PROCDEF foreign key (PROC_DEF_ID_) - references ACT_RE_PROCDEF (ID_); + references ACT_RE_PROCDEF (ID_); alter table ACT_RU_IDENTITYLINK add constraint ACT_FK_TSKASS_TASK foreign key (TASK_ID_) references ACT_RU_TASK (ID_); - + alter table ACT_RU_IDENTITYLINK add constraint ACT_FK_ATHRZ_PROCEDEF foreign key (PROC_DEF_ID_) - references ACT_RE_PROCDEF (ID_); + references ACT_RE_PROCDEF(ID_); alter table ACT_RU_IDENTITYLINK add constraint ACT_FK_IDL_PROCINST foreign key (PROC_INST_ID_) references ACT_RU_EXECUTION (ID_); - + alter table ACT_RU_TASK add constraint ACT_FK_TASK_EXE foreign key (EXECUTION_ID_) @@ -252,7 +258,7 @@ alter table ACT_RU_JOB add constraint ACT_FK_JOB_EXCEPTION foreign key (EXCEPTION_STACK_ID_) references ACT_GE_BYTEARRAY (ID_); - + alter table ACT_RU_EVENT_SUBSCR add constraint ACT_FK_EVENT_EXEC foreign key (EXECUTION_ID_) @@ -271,4 +277,4 @@ alter table ACT_RE_MODEL alter table ACT_RE_MODEL add constraint ACT_FK_MODEL_DEPLOYMENT foreign key (DEPLOYMENT_ID_) - references ACT_RE_DEPLOYMENT (ID_); + references ACT_RE_DEPLOYMENT (ID_); diff --git a/config/sql/activiti/activiti.db2.create.history.sql b/config/sql/activiti/activiti.mysql55.create.history.sql similarity index 77% rename from config/sql/activiti/activiti.db2.create.history.sql rename to config/sql/activiti/activiti.mysql55.create.history.sql index b16a65109a9..0f0e3dc78c5 100644 --- a/config/sql/activiti/activiti.db2.create.history.sql +++ b/config/sql/activiti/activiti.mysql55.create.history.sql @@ -3,20 +3,18 @@ create table ACT_HI_PROCINST ( PROC_INST_ID_ varchar(64) not null, BUSINESS_KEY_ varchar(255), PROC_DEF_ID_ varchar(64) not null, - START_TIME_ timestamp not null, - END_TIME_ timestamp, + START_TIME_ datetime not null, + END_TIME_ datetime, DURATION_ bigint, START_USER_ID_ varchar(255), START_ACT_ID_ varchar(255), END_ACT_ID_ varchar(255), SUPER_PROCESS_INSTANCE_ID_ varchar(64), - UNI_BUSINESS_KEY varchar (255) not null generated always as (case when "BUSINESS_KEY_" is null then "ID_" else "BUSINESS_KEY_" end), - UNI_PROC_DEF_ID varchar (64) not null generated always as (case when "PROC_DEF_ID_" is null then "ID_" else "PROC_DEF_ID_" end), DELETE_REASON_ varchar(4000), - primary key (ID_) -); - -alter table ACT_HI_PROCINST add constraint PROC_INST_ID_ unique(PROC_INST_ID_); + TENANT_ID_ varchar(255) default '', + primary key (ID_), + unique (PROC_INST_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; create table ACT_HI_ACTINST ( ID_ varchar(64) not null, @@ -28,13 +26,13 @@ create table ACT_HI_ACTINST ( CALL_PROC_INST_ID_ varchar(64), ACT_NAME_ varchar(255), ACT_TYPE_ varchar(255) not null, - OWNER_ varchar(64), - ASSIGNEE_ varchar(64), - START_TIME_ timestamp not null, - END_TIME_ timestamp, + ASSIGNEE_ varchar(255), + START_TIME_ datetime not null, + END_TIME_ datetime, DURATION_ bigint, + TENANT_ID_ varchar(255) default '', primary key (ID_) -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; create table ACT_HI_TASKINST ( ID_ varchar(64) not null, @@ -47,16 +45,18 @@ create table ACT_HI_TASKINST ( DESCRIPTION_ varchar(4000), OWNER_ varchar(255), ASSIGNEE_ varchar(255), - START_TIME_ timestamp not null, - CLAIM_TIME_ timestamp, - END_TIME_ timestamp, + START_TIME_ datetime not null, + CLAIM_TIME_ datetime, + END_TIME_ datetime, DURATION_ bigint, DELETE_REASON_ varchar(4000), PRIORITY_ integer, - DUE_DATE_ timestamp, + DUE_DATE_ datetime, FORM_KEY_ varchar(255), + CATEGORY_ varchar(255), + TENANT_ID_ varchar(255) default '', primary key (ID_) -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; create table ACT_HI_VARINST ( ID_ varchar(64) not null, @@ -67,12 +67,14 @@ create table ACT_HI_VARINST ( VAR_TYPE_ varchar(100), REV_ integer, BYTEARRAY_ID_ varchar(64), - DOUBLE_ double precision, + DOUBLE_ double, LONG_ bigint, TEXT_ varchar(4000), TEXT2_ varchar(4000), + CREATE_TIME_ datetime, + LAST_UPDATED_TIME_ datetime, primary key (ID_) -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; create table ACT_HI_DETAIL ( ID_ varchar(64) not null, @@ -84,27 +86,27 @@ create table ACT_HI_DETAIL ( NAME_ varchar(255) not null, VAR_TYPE_ varchar(255), REV_ integer, - TIME_ timestamp not null, + TIME_ datetime not null, BYTEARRAY_ID_ varchar(64), - DOUBLE_ double precision, + DOUBLE_ double, LONG_ bigint, TEXT_ varchar(4000), TEXT2_ varchar(4000), primary key (ID_) -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; create table ACT_HI_COMMENT ( ID_ varchar(64) not null, TYPE_ varchar(255), - TIME_ timestamp not null, + TIME_ datetime not null, USER_ID_ varchar(255), TASK_ID_ varchar(64), PROC_INST_ID_ varchar(64), ACTION_ varchar(255), MESSAGE_ varchar(4000), - FULL_MSG_ BLOB, + FULL_MSG_ LONGBLOB, primary key (ID_) -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; create table ACT_HI_ATTACHMENT ( ID_ varchar(64) not null, @@ -118,19 +120,18 @@ create table ACT_HI_ATTACHMENT ( URL_ varchar(4000), CONTENT_ID_ varchar(64), primary key (ID_) -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; create table ACT_HI_IDENTITYLINK ( - ID_ varchar(64) not null, + ID_ varchar(64), GROUP_ID_ varchar(255), TYPE_ varchar(255), USER_ID_ varchar(255), TASK_ID_ varchar(64), PROC_INST_ID_ varchar(64), primary key (ID_) -); +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; -create unique index ACT_UNIQ_HI_BUS_KEY on ACT_HI_PROCINST(UNI_PROC_DEF_ID, UNI_BUSINESS_KEY); create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_); create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_); create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_); @@ -146,4 +147,4 @@ create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_I create index ACT_IDX_HI_ACT_INST_EXEC on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_); create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); create index ACT_IDX_HI_IDENT_LNK_TASK on ACT_HI_IDENTITYLINK(TASK_ID_); -create index ACT_IDX_HI_IDENT_LNK_PROCINST on ACT_HI_IDENTITYLINK(PROC_INST_ID_); +create index ACT_IDX_HI_IDENT_LNK_PROCINST on ACT_HI_IDENTITYLINK(PROC_INST_ID_); \ No newline at end of file diff --git a/config/sql/activiti/activiti.oracle.create.engine.sql b/config/sql/activiti/activiti.oracle.create.engine.sql index 2569a7eddfd..44bfe555999 100644 --- a/config/sql/activiti/activiti.oracle.create.engine.sql +++ b/config/sql/activiti/activiti.oracle.create.engine.sql @@ -6,10 +6,10 @@ create table ACT_GE_PROPERTY ( ); insert into ACT_GE_PROPERTY -values ('schema.version', '5.13', 1); +values ('schema.version', '5.15.1', 1); insert into ACT_GE_PROPERTY -values ('schema.history', 'create(5.13)', 1); +values ('schema.history', 'create(5.15.1)', 1); insert into ACT_GE_PROPERTY values ('next.dbid', '1', 1); @@ -28,6 +28,7 @@ create table ACT_RE_DEPLOYMENT ( ID_ NVARCHAR2(64), NAME_ NVARCHAR2(255), CATEGORY_ NVARCHAR2(255), + TENANT_ID_ NVARCHAR2(255) DEFAULT '', DEPLOY_TIME_ TIMESTAMP(6), primary key (ID_) ); @@ -45,6 +46,7 @@ create table ACT_RE_MODEL ( DEPLOYMENT_ID_ NVARCHAR2(64), EDITOR_SOURCE_VALUE_ID_ NVARCHAR2(64), EDITOR_SOURCE_EXTRA_VALUE_ID_ NVARCHAR2(64), + TENANT_ID_ NVARCHAR2(255) DEFAULT '', primary key (ID_) ); @@ -63,6 +65,7 @@ create table ACT_RU_EXECUTION ( IS_EVENT_SCOPE_ NUMBER(1,0) CHECK (IS_EVENT_SCOPE_ IN (1,0)), SUSPENSION_STATE_ INTEGER, CACHED_ENT_STATE_ INTEGER, + TENANT_ID_ NVARCHAR2(255) DEFAULT '', primary key (ID_) ); @@ -83,6 +86,7 @@ create table ACT_RU_JOB ( REPEAT_ NVARCHAR2(255), HANDLER_TYPE_ NVARCHAR2(255), HANDLER_CFG_ NVARCHAR2(2000), + TENANT_ID_ NVARCHAR2(255) DEFAULT '', primary key (ID_) ); @@ -99,6 +103,7 @@ create table ACT_RE_PROCDEF ( DESCRIPTION_ NVARCHAR2(2000), HAS_START_FORM_KEY_ NUMBER(1,0) CHECK (HAS_START_FORM_KEY_ IN (1,0)), SUSPENSION_STATE_ INTEGER, + TENANT_ID_ NVARCHAR2(255) DEFAULT '', primary key (ID_) ); @@ -118,7 +123,9 @@ create table ACT_RU_TASK ( PRIORITY_ INTEGER, CREATE_TIME_ TIMESTAMP(6), DUE_DATE_ TIMESTAMP(6), + CATEGORY_ NVARCHAR2(255), SUSPENSION_STATE_ INTEGER, + TENANT_ID_ NVARCHAR2(255) DEFAULT '', primary key (ID_) ); @@ -160,6 +167,8 @@ create table ACT_RU_EVENT_SUBSCR ( ACTIVITY_ID_ NVARCHAR2(64), CONFIGURATION_ NVARCHAR2(255), CREATED_ TIMESTAMP(6) not null, + PROC_DEF_ID_ NVARCHAR2(64), + TENANT_ID_ NVARCHAR2(255) DEFAULT '', primary key (ID_) ); @@ -178,7 +187,7 @@ alter table ACT_GE_BYTEARRAY alter table ACT_RE_PROCDEF add constraint ACT_UNIQ_PROCDEF - unique (KEY_,VERSION_); + unique (KEY_,VERSION_, TENANT_ID_); create index ACT_IDX_EXE_PROCINST on ACT_RU_EXECUTION(PROC_INST_ID_); alter table ACT_RU_EXECUTION @@ -288,7 +297,3 @@ alter table ACT_RE_MODEL foreign key (DEPLOYMENT_ID_) references ACT_RE_DEPLOYMENT (ID_); --- see http://stackoverflow.com/questions/675398/how-can-i-constrain-multiple-columns-to-prevent-duplicates-but-ignore-null-value -create unique index ACT_UNIQ_RU_BUS_KEY on ACT_RU_EXECUTION - (case when BUSINESS_KEY_ is null then null else PROC_DEF_ID_ end, - case when BUSINESS_KEY_ is null then null else BUSINESS_KEY_ end); diff --git a/config/sql/activiti/activiti.oracle.create.history.sql b/config/sql/activiti/activiti.oracle.create.history.sql index a515423a600..d9771a0f4b7 100644 --- a/config/sql/activiti/activiti.oracle.create.history.sql +++ b/config/sql/activiti/activiti.oracle.create.history.sql @@ -11,6 +11,7 @@ create table ACT_HI_PROCINST ( END_ACT_ID_ NVARCHAR2(255), SUPER_PROCESS_INSTANCE_ID_ NVARCHAR2(64), DELETE_REASON_ NVARCHAR2(2000), + TENANT_ID_ NVARCHAR2(255) default '', primary key (ID_), unique (PROC_INST_ID_) ); @@ -25,10 +26,11 @@ create table ACT_HI_ACTINST ( CALL_PROC_INST_ID_ NVARCHAR2(64), ACT_NAME_ NVARCHAR2(255), ACT_TYPE_ NVARCHAR2(255) not null, - ASSIGNEE_ NVARCHAR2(64), + ASSIGNEE_ NVARCHAR2(255), START_TIME_ TIMESTAMP(6) not null, END_TIME_ TIMESTAMP(6), DURATION_ NUMBER(19,0), + TENANT_ID_ NVARCHAR2(255) default '', primary key (ID_) ); @@ -51,6 +53,8 @@ create table ACT_HI_TASKINST ( PRIORITY_ INTEGER, DUE_DATE_ TIMESTAMP(6), FORM_KEY_ NVARCHAR2(255), + CATEGORY_ NVARCHAR2(255), + TENANT_ID_ NVARCHAR2(255) default '', primary key (ID_) ); @@ -67,6 +71,8 @@ create table ACT_HI_VARINST ( LONG_ NUMBER(19,0), TEXT_ NVARCHAR2(2000), TEXT2_ NVARCHAR2(2000), + CREATE_TIME_ TIMESTAMP(6), + LAST_UPDATED_TIME_ TIMESTAMP(6), primary key (ID_) ); @@ -141,10 +147,5 @@ create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); create index ACT_IDX_HI_IDENT_LNK_TASK on ACT_HI_IDENTITYLINK(TASK_ID_); create index ACT_IDX_HI_IDENT_LNK_PROCINST on ACT_HI_IDENTITYLINK(PROC_INST_ID_); --- see http://stackoverflow.com/questions/675398/how-can-i-constrain-multiple-columns-to-prevent-duplicates-but-ignore-null-value -create unique index ACT_UNIQ_HI_BUS_KEY on ACT_HI_PROCINST - (case when BUSINESS_KEY_ is null then null else PROC_DEF_ID_ end, - case when BUSINESS_KEY_ is null then null else BUSINESS_KEY_ end); - create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_); create index ACT_IDX_HI_ACT_INST_EXEC on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_); diff --git a/config/sql/activiti/activiti.oracle.drop.engine.sql b/config/sql/activiti/activiti.oracle.drop.engine.sql deleted file mode 100644 index 7c3f958cb46..00000000000 --- a/config/sql/activiti/activiti.oracle.drop.engine.sql +++ /dev/null @@ -1,94 +0,0 @@ -drop index ACT_IDX_BYTEAR_DEPL; -drop index ACT_IDX_EXE_PROCINST; -drop index ACT_IDX_EXE_PARENT; -drop index ACT_IDX_EXE_SUPER; -drop index ACT_IDX_TSKASS_TASK; -drop index ACT_IDX_TASK_EXEC; -drop index ACT_IDX_TASK_PROCINST; -drop index ACT_IDX_TASK_PROCDEF; -drop index ACT_IDX_VAR_EXE; -drop index ACT_IDX_VAR_PROCINST; -drop index ACT_IDX_VAR_BYTEARRAY; -drop index ACT_IDX_JOB_EXCEPTION; -drop index ACT_IDX_MODEL_SOURCE; -drop index ACT_IDX_MODEL_SOURCE_EXTRA; -drop index ACT_IDX_MODEL_DEPLOYMENT; - -drop index ACT_IDX_EXEC_BUSKEY; -drop index ACT_IDX_TASK_CREATE; -drop index ACT_IDX_IDENT_LNK_USER; -drop index ACT_IDX_IDENT_LNK_GROUP; -drop index ACT_IDX_VARIABLE_TASK_ID; - -alter table ACT_GE_BYTEARRAY - drop CONSTRAINT ACT_FK_BYTEARR_DEPL; - -alter table ACT_RU_EXECUTION - drop CONSTRAINT ACT_FK_EXE_PROCINST; - -alter table ACT_RU_EXECUTION - drop CONSTRAINT ACT_FK_EXE_PARENT; - -alter table ACT_RU_EXECUTION - drop CONSTRAINT ACT_FK_EXE_SUPER; - -alter table ACT_RU_EXECUTION - drop CONSTRAINT ACT_FK_EXE_PROCDEF; - -alter table ACT_RU_IDENTITYLINK - drop CONSTRAINT ACT_FK_TSKASS_TASK; - -alter table ACT_RU_IDENTITYLINK - drop CONSTRAINT ACT_FK_ATHRZ_PROCEDEF; - -alter table ACT_RU_TASK - drop CONSTRAINT ACT_FK_TASK_EXE; - -alter table ACT_RU_TASK - drop CONSTRAINT ACT_FK_TASK_PROCINST; - -alter table ACT_RU_TASK - drop CONSTRAINT ACT_FK_TASK_PROCDEF; - -alter table ACT_RU_VARIABLE - drop CONSTRAINT ACT_FK_VAR_EXE; - -alter table ACT_RU_VARIABLE - drop CONSTRAINT ACT_FK_VAR_PROCINST; - -alter table ACT_RU_VARIABLE - drop CONSTRAINT ACT_FK_VAR_BYTEARRAY; - -alter table ACT_RU_JOB - drop CONSTRAINT ACT_FK_JOB_EXCEPTION; - -alter table ACT_RU_EVENT_SUBSCR - drop CONSTRAINT ACT_FK_EVENT_EXEC; - -alter table ACT_RE_PROCDEF - drop CONSTRAINT ACT_UNIQ_PROCDEF; - -alter table ACT_RE_MODEL - drop CONSTRAINT ACT_FK_MODEL_SOURCE; - -alter table ACT_RE_MODEL - drop CONSTRAINT ACT_FK_MODEL_SOURCE_EXTRA; - -alter table ACT_RE_MODEL - drop CONSTRAINT ACT_FK_MODEL_DEPLOYMENT; - -drop index ACT_IDX_EVENT_SUBSCR_CONFIG_; -drop index ACT_IDX_EVENT_SUBSCR; -drop index ACT_IDX_ATHRZ_PROCEDEF; - -drop table ACT_GE_PROPERTY; -drop table ACT_GE_BYTEARRAY; -drop table ACT_RE_DEPLOYMENT; -drop table ACT_RE_MODEL; -drop table ACT_RE_PROCDEF; -drop table ACT_RU_IDENTITYLINK; -drop table ACT_RU_VARIABLE; -drop table ACT_RU_TASK; -drop table ACT_RU_EXECUTION; -drop table ACT_RU_JOB; -drop table ACT_RU_EVENT_SUBSCR; diff --git a/config/sql/activiti/activiti.oracle.drop.history.sql b/config/sql/activiti/activiti.oracle.drop.history.sql deleted file mode 100644 index f07c8f50765..00000000000 --- a/config/sql/activiti/activiti.oracle.drop.history.sql +++ /dev/null @@ -1,24 +0,0 @@ -drop index ACT_IDX_HI_PRO_INST_END; -drop index ACT_IDX_HI_PRO_I_BUSKEY; -drop index ACT_IDX_HI_ACT_INST_START; -drop index ACT_IDX_HI_ACT_INST_END; -drop index ACT_IDX_HI_DETAIL_PROC_INST; -drop index ACT_IDX_HI_DETAIL_ACT_INST; -drop index ACT_IDX_HI_DETAIL_TIME; -drop index ACT_IDX_HI_DETAIL_NAME; -drop index ACT_IDX_HI_DETAIL_TASK_ID; -drop index ACT_IDX_HI_PROCVAR_PROC_INST; -drop index ACT_IDX_HI_PROCVAR_NAME_TYPE; -drop index ACT_IDX_HI_ACT_INST_PROCINST; -drop index ACT_IDX_HI_IDENT_LNK_USER; -drop index ACT_IDX_HI_IDENT_LNK_TASK; -drop index ACT_IDX_HI_IDENT_LNK_PROCINST; - -drop table ACT_HI_PROCINST; -drop table ACT_HI_ACTINST; -drop table ACT_HI_VARINST; -drop table ACT_HI_TASKINST; -drop table ACT_HI_DETAIL; -drop table ACT_HI_COMMENT; -drop table ACT_HI_ATTACHMENT; -drop table ACT_HI_IDENTITYLINK; \ No newline at end of file diff --git a/config/sql/activiti/activiti.oracle.drop.identity.sql b/config/sql/activiti/activiti.oracle.drop.identity.sql deleted file mode 100644 index 592e15d7c53..00000000000 --- a/config/sql/activiti/activiti.oracle.drop.identity.sql +++ /dev/null @@ -1,13 +0,0 @@ -alter table ACT_ID_MEMBERSHIP - drop CONSTRAINT ACT_FK_MEMB_GROUP; - -alter table ACT_ID_MEMBERSHIP - drop CONSTRAINT ACT_FK_MEMB_USER; - -drop index ACT_IDX_MEMB_GROUP; -drop index ACT_IDX_MEMB_USER; - -drop table ACT_ID_INFO; -drop table ACT_ID_MEMBERSHIP; -drop table ACT_ID_GROUP; -drop table ACT_ID_USER; diff --git a/config/sql/activiti/activiti.postgres.create.engine.sql b/config/sql/activiti/activiti.postgres.create.engine.sql index e6b0a3d3185..40cbc198d22 100644 --- a/config/sql/activiti/activiti.postgres.create.engine.sql +++ b/config/sql/activiti/activiti.postgres.create.engine.sql @@ -6,10 +6,10 @@ create table ACT_GE_PROPERTY ( ); insert into ACT_GE_PROPERTY -values ('schema.version', '5.13', 1); +values ('schema.version', '5.15.1', 1); insert into ACT_GE_PROPERTY -values ('schema.history', 'create(5.13)', 1); +values ('schema.history', 'create(5.15.1)', 1); insert into ACT_GE_PROPERTY values ('next.dbid', '1', 1); @@ -28,6 +28,7 @@ create table ACT_RE_DEPLOYMENT ( ID_ varchar(64), NAME_ varchar(255), CATEGORY_ varchar(255), + TENANT_ID_ varchar(255) default '', DEPLOY_TIME_ timestamp, primary key (ID_) ); @@ -45,6 +46,7 @@ create table ACT_RE_MODEL ( DEPLOYMENT_ID_ varchar(64), EDITOR_SOURCE_VALUE_ID_ varchar(64), EDITOR_SOURCE_EXTRA_VALUE_ID_ varchar(64), + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -60,11 +62,11 @@ create table ACT_RU_EXECUTION ( IS_ACTIVE_ boolean, IS_CONCURRENT_ boolean, IS_SCOPE_ boolean, - IS_EVENT_SCOPE_ boolean, - SUSPENSION_STATE_ integer, - CACHED_ENT_STATE_ integer, - primary key (ID_), - unique (PROC_DEF_ID_, BUSINESS_KEY_) + IS_EVENT_SCOPE_ boolean, + SUSPENSION_STATE_ integer, + CACHED_ENT_STATE_ integer, + TENANT_ID_ varchar(255) default '', + primary key (ID_) ); create table ACT_RU_JOB ( @@ -84,6 +86,7 @@ create table ACT_RU_JOB ( REPEAT_ varchar(255), HANDLER_TYPE_ varchar(255), HANDLER_CFG_ varchar(4000), + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -100,6 +103,7 @@ create table ACT_RE_PROCDEF ( DESCRIPTION_ varchar(4000), HAS_START_FORM_KEY_ boolean, SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -119,7 +123,9 @@ create table ACT_RU_TASK ( PRIORITY_ integer, CREATE_TIME_ timestamp, DUE_DATE_ timestamp, + CATEGORY_ varchar(255), SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -161,6 +167,8 @@ create table ACT_RU_EVENT_SUBSCR ( ACTIVITY_ID_ varchar(64), CONFIGURATION_ varchar(255), CREATED_ timestamp not null, + PROC_DEF_ID_ varchar(64), + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -179,7 +187,7 @@ alter table ACT_GE_BYTEARRAY alter table ACT_RE_PROCDEF add constraint ACT_UNIQ_PROCDEF - unique (KEY_,VERSION_); + unique (KEY_,VERSION_, TENANT_ID_); create index ACT_IDX_EXE_PROCINST on ACT_RU_EXECUTION(PROC_INST_ID_); alter table ACT_RU_EXECUTION diff --git a/config/sql/activiti/activiti.postgres.create.history.sql b/config/sql/activiti/activiti.postgres.create.history.sql index 0c0b0ba0a4c..b9a458db531 100644 --- a/config/sql/activiti/activiti.postgres.create.history.sql +++ b/config/sql/activiti/activiti.postgres.create.history.sql @@ -11,9 +11,9 @@ create table ACT_HI_PROCINST ( END_ACT_ID_ varchar(255), SUPER_PROCESS_INSTANCE_ID_ varchar(64), DELETE_REASON_ varchar(4000), + TENANT_ID_ varchar(255) default '', primary key (ID_), - unique (PROC_INST_ID_), - unique (PROC_DEF_ID_, BUSINESS_KEY_) + unique (PROC_INST_ID_) ); create table ACT_HI_ACTINST ( @@ -26,10 +26,11 @@ create table ACT_HI_ACTINST ( CALL_PROC_INST_ID_ varchar(64), ACT_NAME_ varchar(255), ACT_TYPE_ varchar(255) not null, - ASSIGNEE_ varchar(64), + ASSIGNEE_ varchar(255), START_TIME_ timestamp not null, END_TIME_ timestamp, DURATION_ bigint, + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -52,6 +53,8 @@ create table ACT_HI_TASKINST ( PRIORITY_ integer, DUE_DATE_ timestamp, FORM_KEY_ varchar(255), + CATEGORY_ varchar(255), + TENANT_ID_ varchar(255) default '', primary key (ID_) ); @@ -68,6 +71,8 @@ create table ACT_HI_VARINST ( LONG_ bigint, TEXT_ varchar(4000), TEXT2_ varchar(4000), + CREATE_TIME_ timestamp, + LAST_UPDATED_TIME_ timestamp, primary key (ID_) ); diff --git a/config/sql/activiti/activiti.postgres.drop.engine.sql b/config/sql/activiti/activiti.postgres.drop.engine.sql deleted file mode 100644 index f8451a3cdbb..00000000000 --- a/config/sql/activiti/activiti.postgres.drop.engine.sql +++ /dev/null @@ -1,11 +0,0 @@ -drop table if exists ACT_GE_PROPERTY cascade; -drop table if exists ACT_GE_BYTEARRAY cascade; -drop table if exists ACT_RE_DEPLOYMENT cascade; -drop table if exists ACT_RE_MODEL cascade; -drop table if exists ACT_RE_PROCDEF cascade; -drop table if exists ACT_RU_EXECUTION cascade; -drop table if exists ACT_RU_JOB cascade; -drop table if exists ACT_RU_TASK cascade; -drop table if exists ACT_RU_IDENTITYLINK cascade; -drop table if exists ACT_RU_VARIABLE cascade; -drop table if exists ACT_RU_EVENT_SUBSCR cascade; diff --git a/config/sql/activiti/activiti.postgres.drop.history.sql b/config/sql/activiti/activiti.postgres.drop.history.sql deleted file mode 100644 index 1b62c785dab..00000000000 --- a/config/sql/activiti/activiti.postgres.drop.history.sql +++ /dev/null @@ -1,8 +0,0 @@ -drop table if exists ACT_HI_PROCINST cascade; -drop table if exists ACT_HI_ACTINST cascade; -drop table if exists ACT_HI_VARINST cascade; -drop table if exists ACT_HI_TASKINST cascade; -drop table if exists ACT_HI_DETAIL cascade; -drop table if exists ACT_HI_COMMENT cascade; -drop table if exists ACT_HI_ATTACHMENT cascade; -drop table if exists ACT_HI_IDENTITYLINK cascade; diff --git a/config/sql/activiti/activiti.postgres.drop.identity.sql b/config/sql/activiti/activiti.postgres.drop.identity.sql deleted file mode 100644 index b52afaedfe1..00000000000 --- a/config/sql/activiti/activiti.postgres.drop.identity.sql +++ /dev/null @@ -1,4 +0,0 @@ -drop table if exists ACT_ID_INFO cascade; -drop table if exists ACT_ID_GROUP cascade; -drop table if exists ACT_ID_MEMBERSHIP cascade; -drop table if exists ACT_ID_USER cascade; \ No newline at end of file diff --git a/config/sql/midpoint/2.2/h2/h2-2.2.sql b/config/sql/midpoint/2.2/h2/h2-2.2.sql deleted file mode 100644 index aa22ce8d677..00000000000 --- a/config/sql/midpoint/2.2/h2/h2-2.2.sql +++ /dev/null @@ -1,964 +0,0 @@ -CREATE TABLE m_abstract_role ( - approvalExpression CLOB, - approvalProcess VARCHAR(255), - approvalSchema CLOB, - automaticallyApproved CLOB, - requestable BOOLEAN, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_account_shadow ( - accountType VARCHAR(255), - allowedIdmAdminGuiAccess BOOLEAN, - passwordXml CLOB, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_any ( - owner_id BIGINT NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - owner_type INTEGER NOT NULL, - PRIMARY KEY (owner_id, owner_oid, owner_type) -); - -CREATE TABLE m_any_clob ( - checksum VARCHAR(32) NOT NULL, - name_namespace VARCHAR(255) NOT NULL, - name_localPart VARCHAR(100) NOT NULL, - anyContainer_owner_id BIGINT NOT NULL, - anyContainer_owner_oid VARCHAR(36) NOT NULL, - anyContainer_owner_type INTEGER NOT NULL, - type_namespace VARCHAR(255) NOT NULL, - type_localPart VARCHAR(100) NOT NULL, - dynamicDef BOOLEAN, - clobValue CLOB, - valueType INTEGER, - PRIMARY KEY (checksum, name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart) -); - -CREATE TABLE m_any_date ( - name_namespace VARCHAR(255) NOT NULL, - name_localPart VARCHAR(100) NOT NULL, - anyContainer_owner_id BIGINT NOT NULL, - anyContainer_owner_oid VARCHAR(36) NOT NULL, - anyContainer_owner_type INTEGER NOT NULL, - type_namespace VARCHAR(255) NOT NULL, - type_localPart VARCHAR(100) NOT NULL, - dateValue TIMESTAMP NOT NULL, - dynamicDef BOOLEAN, - valueType INTEGER, - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, dateValue) -); - -CREATE TABLE m_any_long ( - name_namespace VARCHAR(255) NOT NULL, - name_localPart VARCHAR(100) NOT NULL, - anyContainer_owner_id BIGINT NOT NULL, - anyContainer_owner_oid VARCHAR(36) NOT NULL, - anyContainer_owner_type INTEGER NOT NULL, - type_namespace VARCHAR(255) NOT NULL, - type_localPart VARCHAR(100) NOT NULL, - longValue BIGINT NOT NULL, - dynamicDef BOOLEAN, - valueType INTEGER, - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, longValue) -); - -CREATE TABLE m_any_poly_string ( - name_namespace VARCHAR(255) NOT NULL, - name_localPart VARCHAR(100) NOT NULL, - anyContainer_owner_id BIGINT NOT NULL, - anyContainer_owner_oid VARCHAR(36) NOT NULL, - anyContainer_owner_type INTEGER NOT NULL, - type_namespace VARCHAR(255) NOT NULL, - type_localPart VARCHAR(100) NOT NULL, - orig VARCHAR(255) NOT NULL, - dynamicDef BOOLEAN, - norm VARCHAR(255), - valueType INTEGER, - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, orig) -); - -CREATE TABLE m_any_reference ( - name_namespace VARCHAR(255) NOT NULL, - name_localPart VARCHAR(100) NOT NULL, - anyContainer_owner_id BIGINT NOT NULL, - anyContainer_owner_oid VARCHAR(36) NOT NULL, - anyContainer_owner_type INTEGER NOT NULL, - type_namespace VARCHAR(255) NOT NULL, - type_localPart VARCHAR(100) NOT NULL, - targetoid VARCHAR(36) NOT NULL, - description CLOB, - dynamicDef BOOLEAN, - filter CLOB, - relation_namespace VARCHAR(255), - relation_localPart VARCHAR(100), - targetType INTEGER, - valueType INTEGER, - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, targetoid) -); - -CREATE TABLE m_any_string ( - name_namespace VARCHAR(255) NOT NULL, - name_localPart VARCHAR(100) NOT NULL, - anyContainer_owner_id BIGINT NOT NULL, - anyContainer_owner_oid VARCHAR(36) NOT NULL, - anyContainer_owner_type INTEGER NOT NULL, - type_namespace VARCHAR(255) NOT NULL, - type_localPart VARCHAR(100) NOT NULL, - stringValue VARCHAR(255) NOT NULL, - dynamicDef BOOLEAN, - valueType INTEGER, - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, stringValue) -); - -CREATE TABLE m_assignment ( - accountConstruction CLOB, - administrativeStatus INTEGER, - archiveTimestamp TIMESTAMP, - disableTimestamp TIMESTAMP, - effectiveStatus INTEGER, - enableTimestamp TIMESTAMP, - validFrom TIMESTAMP, - validTo TIMESTAMP, - validityChangeTimestamp TIMESTAMP, - validityStatus INTEGER, - assignmentOwner INTEGER, - construction CLOB, - description CLOB, - owner_id BIGINT NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - targetRef_description CLOB, - targetRef_filter CLOB, - targetRef_relationLocalPart VARCHAR(100), - targetRef_relationNamespace VARCHAR(255), - targetRef_targetOid VARCHAR(36), - targetRef_type INTEGER, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - extId BIGINT, - extOid VARCHAR(36), - extType INTEGER, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_audit_delta ( - checksum VARCHAR(32) NOT NULL, - record_id BIGINT NOT NULL, - delta CLOB, - deltaOid VARCHAR(36), - deltaType INTEGER, - details CLOB, - localizedMessage CLOB, - message CLOB, - messageCode VARCHAR(255), - operation CLOB, - params CLOB, - partialResults CLOB, - status INTEGER, - token BIGINT, - PRIMARY KEY (checksum, record_id) -); - -CREATE TABLE m_audit_event ( - id BIGINT NOT NULL, - channel VARCHAR(255), - eventIdentifier VARCHAR(255), - eventStage INTEGER, - eventType INTEGER, - hostIdentifier VARCHAR(255), - initiatorName VARCHAR(255), - initiatorOid VARCHAR(36), - message VARCHAR(1024), - outcome INTEGER, - parameter VARCHAR(255), - result VARCHAR(255), - sessionIdentifier VARCHAR(255), - targetName VARCHAR(255), - targetOid VARCHAR(36), - targetOwnerName VARCHAR(255), - targetOwnerOid VARCHAR(36), - targetType INTEGER, - taskIdentifier VARCHAR(255), - taskOID VARCHAR(255), - timestampValue TIMESTAMP, - PRIMARY KEY (id) -); - -CREATE TABLE m_authorization ( - decision INTEGER, - description CLOB, - owner_id BIGINT NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_authorization_action ( - role_id BIGINT NOT NULL, - role_oid VARCHAR(36) NOT NULL, - action VARCHAR(255) -); - -CREATE TABLE m_connector ( - connectorBundle VARCHAR(255), - connectorHostRef_description CLOB, - connectorHostRef_filter CLOB, - c16_relationLocalPart VARCHAR(100), - c16_relationNamespace VARCHAR(255), - connectorHostRef_targetOid VARCHAR(36), - connectorHostRef_type INTEGER, - connectorType VARCHAR(255), - connectorVersion VARCHAR(255), - framework VARCHAR(255), - name_norm VARCHAR(255), - name_orig VARCHAR(255), - namespace VARCHAR(255), - xmlSchema CLOB, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_connector_host ( - hostname VARCHAR(255), - name_norm VARCHAR(255), - name_orig VARCHAR(255), - port VARCHAR(255), - protectConnection BOOLEAN, - sharedSecret CLOB, - timeout INTEGER, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_connector_target_system ( - connector_id BIGINT NOT NULL, - connector_oid VARCHAR(36) NOT NULL, - targetSystemType VARCHAR(255) -); - -CREATE TABLE m_container ( - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_exclusion ( - description CLOB, - owner_id BIGINT NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - policy INTEGER, - targetRef_description CLOB, - targetRef_filter CLOB, - targetRef_relationLocalPart VARCHAR(100), - targetRef_relationNamespace VARCHAR(255), - targetRef_targetOid VARCHAR(36), - targetRef_type INTEGER, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_focus ( - administrativeStatus INTEGER, - archiveTimestamp TIMESTAMP, - disableTimestamp TIMESTAMP, - effectiveStatus INTEGER, - enableTimestamp TIMESTAMP, - validFrom TIMESTAMP, - validTo TIMESTAMP, - validityChangeTimestamp TIMESTAMP, - validityStatus INTEGER, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_generic_object ( - name_norm VARCHAR(255), - name_orig VARCHAR(255), - objectType VARCHAR(255), - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_metadata ( - owner_id BIGINT NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - createChannel VARCHAR(255), - createTimestamp TIMESTAMP, - creatorRef_description CLOB, - creatorRef_filter CLOB, - creatorRef_relationLocalPart VARCHAR(100), - creatorRef_relationNamespace VARCHAR(255), - creatorRef_targetOid VARCHAR(36), - creatorRef_type INTEGER, - modifierRef_description CLOB, - modifierRef_filter CLOB, - modifierRef_relationLocalPart VARCHAR(100), - modifierRef_relationNamespace VARCHAR(255), - modifierRef_targetOid VARCHAR(36), - modifierRef_type INTEGER, - modifyChannel VARCHAR(255), - modifyTimestamp TIMESTAMP, - PRIMARY KEY (owner_id, owner_oid) -); - -CREATE TABLE m_node ( - clusteredNode BOOLEAN, - hostname VARCHAR(255), - internalNodeIdentifier VARCHAR(255), - jmxPort INTEGER, - lastCheckInTime TIMESTAMP, - name_norm VARCHAR(255), - name_orig VARCHAR(255), - nodeIdentifier VARCHAR(255), - running BOOLEAN, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_object ( - description CLOB, - version BIGINT NOT NULL, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - extId BIGINT, - extOid VARCHAR(36), - extType INTEGER, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_object_template ( - accountConstruction CLOB, - mapping CLOB, - name_norm VARCHAR(255), - name_orig VARCHAR(255), - type INTEGER, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_operation_result ( - owner_oid VARCHAR(36) NOT NULL, - owner_id BIGINT NOT NULL, - details CLOB, - localizedMessage CLOB, - message CLOB, - messageCode VARCHAR(255), - operation CLOB, - params CLOB, - partialResults CLOB, - status INTEGER, - token BIGINT, - PRIMARY KEY (owner_oid, owner_id) -); - -CREATE TABLE m_org ( - costCenter VARCHAR(255), - displayName_norm VARCHAR(255), - displayName_orig VARCHAR(255), - identifier VARCHAR(255), - locality_norm VARCHAR(255), - locality_orig VARCHAR(255), - name_norm VARCHAR(255), - name_orig VARCHAR(255), - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_org_closure ( - id BIGINT NOT NULL, - ancestor_id BIGINT, - ancestor_oid VARCHAR(36), - depthValue INTEGER, - descendant_id BIGINT, - descendant_oid VARCHAR(36), - PRIMARY KEY (id) -); - -CREATE TABLE m_org_incorrect ( - descendant_oid VARCHAR(36) NOT NULL, - descendant_id BIGINT NOT NULL, - ancestor_oid VARCHAR(36) NOT NULL, - PRIMARY KEY (descendant_oid, descendant_id, ancestor_oid) -); - -CREATE TABLE m_org_org_type ( - org_id BIGINT NOT NULL, - org_oid VARCHAR(36) NOT NULL, - orgType VARCHAR(255) -); - -CREATE TABLE m_reference ( - reference_type INTEGER NOT NULL, - owner_id BIGINT NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - relLocalPart VARCHAR(100) NOT NULL, - relNamespace VARCHAR(255) NOT NULL, - targetOid VARCHAR(36) NOT NULL, - description CLOB, - filter CLOB, - containerType INTEGER, - PRIMARY KEY (owner_id, owner_oid, relLocalPart, relNamespace, targetOid) -); - -CREATE TABLE m_resource ( - administrativeState INTEGER, - capabilities_cachingMetadata CLOB, - capabilities_configured CLOB, - capabilities_native CLOB, - configuration CLOB, - connectorRef_description CLOB, - connectorRef_filter CLOB, - connectorRef_relationLocalPart VARCHAR(100), - connectorRef_relationNamespace VARCHAR(255), - connectorRef_targetOid VARCHAR(36), - connectorRef_type INTEGER, - consistency CLOB, - name_norm VARCHAR(255), - name_orig VARCHAR(255), - namespace VARCHAR(255), - o16_lastAvailabilityStatus INTEGER, - projection CLOB, - schemaHandling CLOB, - scripts CLOB, - synchronization CLOB, - xmlSchema CLOB, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_role ( - name_norm VARCHAR(255), - name_orig VARCHAR(255), - roleType VARCHAR(255), - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_shadow ( - administrativeStatus INTEGER, - archiveTimestamp TIMESTAMP, - disableTimestamp TIMESTAMP, - effectiveStatus INTEGER, - enableTimestamp TIMESTAMP, - validFrom TIMESTAMP, - validTo TIMESTAMP, - validityChangeTimestamp TIMESTAMP, - validityStatus INTEGER, - assigned BOOLEAN, - attemptNumber INTEGER, - dead BOOLEAN, - exist BOOLEAN, - failedOperationType INTEGER, - intent VARCHAR(255), - iteration INTEGER, - iterationToken VARCHAR(255), - kind INTEGER, - name_norm VARCHAR(255), - name_orig VARCHAR(255), - objectChange CLOB, - class_namespace VARCHAR(255), - class_localPart VARCHAR(100), - resourceRef_description CLOB, - resourceRef_filter CLOB, - resourceRef_relationLocalPart VARCHAR(100), - resourceRef_relationNamespace VARCHAR(255), - resourceRef_targetOid VARCHAR(36), - resourceRef_type INTEGER, - synchronizationSituation INTEGER, - synchronizationTimestamp TIMESTAMP, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - attrId BIGINT, - attrOid VARCHAR(36), - attrType INTEGER, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_sync_situation_description ( - checksum VARCHAR(32) NOT NULL, - shadow_id BIGINT NOT NULL, - shadow_oid VARCHAR(36) NOT NULL, - chanel VARCHAR(255), - situation INTEGER, - timestampValue TIMESTAMP, - PRIMARY KEY (checksum, shadow_id, shadow_oid) -); - -CREATE TABLE m_system_configuration ( - cleanupPolicy CLOB, - connectorFramework CLOB, - d22_description CLOB, - defaultUserTemplateRef_filter CLOB, - d22_relationLocalPart VARCHAR(100), - d22_relationNamespace VARCHAR(255), - d22_targetOid VARCHAR(36), - defaultUserTemplateRef_type INTEGER, - g36 CLOB, - g23_description CLOB, - globalPasswordPolicyRef_filter CLOB, - g23_relationLocalPart VARCHAR(100), - g23_relationNamespace VARCHAR(255), - g23_targetOid VARCHAR(36), - globalPasswordPolicyRef_type INTEGER, - logging CLOB, - modelHooks CLOB, - name_norm VARCHAR(255), - name_orig VARCHAR(255), - notificationConfiguration CLOB, - profilingConfiguration CLOB, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_task ( - binding INTEGER, - canRunOnNode VARCHAR(255), - category VARCHAR(255), - completionTimestamp TIMESTAMP, - executionStatus INTEGER, - handlerUri VARCHAR(255), - lastRunFinishTimestamp TIMESTAMP, - lastRunStartTimestamp TIMESTAMP, - name_norm VARCHAR(255), - name_orig VARCHAR(255), - node VARCHAR(255), - objectRef_description CLOB, - objectRef_filter CLOB, - objectRef_relationLocalPart VARCHAR(100), - objectRef_relationNamespace VARCHAR(255), - objectRef_targetOid VARCHAR(36), - objectRef_type INTEGER, - otherHandlersUriStack CLOB, - ownerRef_description CLOB, - ownerRef_filter CLOB, - ownerRef_relationLocalPart VARCHAR(100), - ownerRef_relationNamespace VARCHAR(255), - ownerRef_targetOid VARCHAR(36), - ownerRef_type INTEGER, - parent VARCHAR(255), - progress BIGINT, - recurrence INTEGER, - resultStatus INTEGER, - schedule CLOB, - taskIdentifier VARCHAR(255), - threadStopAction INTEGER, - waitingReason INTEGER, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_task_dependent ( - task_id BIGINT NOT NULL, - task_oid VARCHAR(36) NOT NULL, - dependent VARCHAR(255) -); - -CREATE TABLE m_trigger ( - handlerUri VARCHAR(255), - owner_id BIGINT NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - timestampValue TIMESTAMP, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_user ( - additionalName_norm VARCHAR(255), - additionalName_orig VARCHAR(255), - costCenter VARCHAR(255), - allowedIdmAdminGuiAccess BOOLEAN, - passwordXml CLOB, - emailAddress VARCHAR(255), - employeeNumber VARCHAR(255), - familyName_norm VARCHAR(255), - familyName_orig VARCHAR(255), - fullName_norm VARCHAR(255), - fullName_orig VARCHAR(255), - givenName_norm VARCHAR(255), - givenName_orig VARCHAR(255), - honorificPrefix_norm VARCHAR(255), - honorificPrefix_orig VARCHAR(255), - honorificSuffix_norm VARCHAR(255), - honorificSuffix_orig VARCHAR(255), - locale VARCHAR(255), - locality_norm VARCHAR(255), - locality_orig VARCHAR(255), - name_norm VARCHAR(255), - name_orig VARCHAR(255), - nickName_norm VARCHAR(255), - nickName_orig VARCHAR(255), - preferredLanguage VARCHAR(255), - telephoneNumber VARCHAR(255), - timezone VARCHAR(255), - title_norm VARCHAR(255), - title_orig VARCHAR(255), - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_user_employee_type ( - user_id BIGINT NOT NULL, - user_oid VARCHAR(36) NOT NULL, - employeeType VARCHAR(255) -); - -CREATE TABLE m_user_organization ( - user_id BIGINT NOT NULL, - user_oid VARCHAR(36) NOT NULL, - norm VARCHAR(255), - orig VARCHAR(255) -); - -CREATE TABLE m_user_organizational_unit ( - user_id BIGINT NOT NULL, - user_oid VARCHAR(36) NOT NULL, - norm VARCHAR(255), - orig VARCHAR(255) -); - -CREATE TABLE m_value_policy ( - lifetime CLOB, - name_norm VARCHAR(255), - name_orig VARCHAR(255), - stringPolicy CLOB, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE INDEX iRequestable ON m_abstract_role (requestable); - -ALTER TABLE m_abstract_role -ADD CONSTRAINT fk_abstract_role -FOREIGN KEY (id, oid) -REFERENCES m_focus; - -ALTER TABLE m_account_shadow -ADD CONSTRAINT fk_account_shadow -FOREIGN KEY (id, oid) -REFERENCES m_shadow; - -ALTER TABLE m_any_clob -ADD CONSTRAINT fk_any_clob -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iDate ON m_any_date (dateValue); - -ALTER TABLE m_any_date -ADD CONSTRAINT fk_any_date -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iLong ON m_any_long (longValue); - -ALTER TABLE m_any_long -ADD CONSTRAINT fk_any_long -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iPolyString ON m_any_poly_string (orig); - -ALTER TABLE m_any_poly_string -ADD CONSTRAINT fk_any_poly_string -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iTargetOid ON m_any_reference (targetoid); - -ALTER TABLE m_any_reference -ADD CONSTRAINT fk_any_reference -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iString ON m_any_string (stringValue); - -ALTER TABLE m_any_string -ADD CONSTRAINT fk_any_string -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus); - -CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus); - -ALTER TABLE m_assignment -ADD CONSTRAINT fk_assignment -FOREIGN KEY (id, oid) -REFERENCES m_container; - -ALTER TABLE m_assignment -ADD CONSTRAINT fk_assignment_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object; - -ALTER TABLE m_audit_delta -ADD CONSTRAINT fk_audit_delta -FOREIGN KEY (record_id) -REFERENCES m_audit_event; - -ALTER TABLE m_authorization -ADD CONSTRAINT fk_authorization -FOREIGN KEY (id, oid) -REFERENCES m_container; - -ALTER TABLE m_authorization -ADD CONSTRAINT fk_authorization_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object; - -ALTER TABLE m_authorization_action -ADD CONSTRAINT fk_authorization_action -FOREIGN KEY (role_id, role_oid) -REFERENCES m_authorization; - -CREATE INDEX iConnectorNameNorm ON m_connector (name_norm); - -CREATE INDEX iConnectorNameOrig ON m_connector (name_orig); - -ALTER TABLE m_connector -ADD CONSTRAINT fk_connector -FOREIGN KEY (id, oid) -REFERENCES m_object; - -CREATE INDEX iConnectorHostName ON m_connector_host (name_orig); - -ALTER TABLE m_connector_host -ADD CONSTRAINT fk_connector_host -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_connector_target_system -ADD CONSTRAINT fk_connector_target_system -FOREIGN KEY (connector_id, connector_oid) -REFERENCES m_connector; - -ALTER TABLE m_exclusion -ADD CONSTRAINT fk_exclusion -FOREIGN KEY (id, oid) -REFERENCES m_container; - -ALTER TABLE m_exclusion -ADD CONSTRAINT fk_exclusion_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object; - -CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus); - -CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); - -ALTER TABLE m_focus -ADD CONSTRAINT fk_focus -FOREIGN KEY (id, oid) -REFERENCES m_object; - -CREATE INDEX iGenericObjectName ON m_generic_object (name_orig); - -ALTER TABLE m_generic_object -ADD CONSTRAINT fk_generic_object -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_metadata -ADD CONSTRAINT fk_metadata_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_container; - -CREATE INDEX iNodeName ON m_node (name_orig); - -ALTER TABLE m_node -ADD CONSTRAINT fk_node -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_object -ADD CONSTRAINT fk_object -FOREIGN KEY (id, oid) -REFERENCES m_container; - -CREATE INDEX iObjectTemplate ON m_object_template (name_orig); - -ALTER TABLE m_object_template -ADD CONSTRAINT fk_object_template -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_operation_result -ADD CONSTRAINT fk_result_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object; - -CREATE INDEX iOrgName ON m_org (name_orig); - -ALTER TABLE m_org -ADD CONSTRAINT fk_org -FOREIGN KEY (id, oid) -REFERENCES m_abstract_role; - -ALTER TABLE m_org_closure -ADD CONSTRAINT fk_descendant -FOREIGN KEY (descendant_id, descendant_oid) -REFERENCES m_object; - -ALTER TABLE m_org_closure -ADD CONSTRAINT fk_ancestor -FOREIGN KEY (ancestor_id, ancestor_oid) -REFERENCES m_object; - -ALTER TABLE m_org_org_type -ADD CONSTRAINT fk_org_org_type -FOREIGN KEY (org_id, org_oid) -REFERENCES m_org; - -CREATE INDEX iReferenceTargetOid ON m_reference (targetOid); - -ALTER TABLE m_reference -ADD CONSTRAINT fk_reference_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_container; - -CREATE INDEX iResourceName ON m_resource (name_orig); - -ALTER TABLE m_resource -ADD CONSTRAINT fk_resource -FOREIGN KEY (id, oid) -REFERENCES m_object; - -CREATE INDEX iRoleName ON m_role (name_orig); - -ALTER TABLE m_role -ADD CONSTRAINT fk_role -FOREIGN KEY (id, oid) -REFERENCES m_abstract_role; - -CREATE INDEX iShadowNameOrig ON m_shadow (name_orig); - -CREATE INDEX iShadowDead ON m_shadow (dead); - -CREATE INDEX iShadowNameNorm ON m_shadow (name_norm); - -CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid); - -CREATE INDEX iShadowAdministrative ON m_shadow (administrativeStatus); - -CREATE INDEX iShadowEffective ON m_shadow (effectiveStatus); - -ALTER TABLE m_shadow -ADD CONSTRAINT fk_shadow -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_sync_situation_description -ADD CONSTRAINT fk_shadow_sync_situation -FOREIGN KEY (shadow_id, shadow_oid) -REFERENCES m_shadow; - -CREATE INDEX iSystemConfigurationName ON m_system_configuration (name_orig); - -ALTER TABLE m_system_configuration -ADD CONSTRAINT fk_system_configuration -FOREIGN KEY (id, oid) -REFERENCES m_object; - -CREATE INDEX iTaskNameNameNorm ON m_task (name_norm); - -CREATE INDEX iTaskNameOrig ON m_task (name_orig); - -ALTER TABLE m_task -ADD CONSTRAINT fk_task -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_task_dependent -ADD CONSTRAINT fk_task_dependent -FOREIGN KEY (task_id, task_oid) -REFERENCES m_task; - -CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue); - -ALTER TABLE m_trigger -ADD CONSTRAINT fk_trigger -FOREIGN KEY (id, oid) -REFERENCES m_container; - -ALTER TABLE m_trigger -ADD CONSTRAINT fk_trigger_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object; - -CREATE INDEX iFullName ON m_user (fullName_orig); - -CREATE INDEX iLocality ON m_user (locality_orig); - -CREATE INDEX iHonorificSuffix ON m_user (honorificSuffix_orig); - -CREATE INDEX iEmployeeNumber ON m_user (employeeNumber); - -CREATE INDEX iGivenName ON m_user (givenName_orig); - -CREATE INDEX iFamilyName ON m_user (familyName_orig); - -CREATE INDEX iAdditionalName ON m_user (additionalName_orig); - -CREATE INDEX iHonorificPrefix ON m_user (honorificPrefix_orig); - -CREATE INDEX iUserName ON m_user (name_orig); - -ALTER TABLE m_user -ADD CONSTRAINT fk_user -FOREIGN KEY (id, oid) -REFERENCES m_focus; - -ALTER TABLE m_user_employee_type -ADD CONSTRAINT fk_user_employee_type -FOREIGN KEY (user_id, user_oid) -REFERENCES m_user; - -ALTER TABLE m_user_organization -ADD CONSTRAINT fk_user_organization -FOREIGN KEY (user_id, user_oid) -REFERENCES m_user; - -ALTER TABLE m_user_organizational_unit -ADD CONSTRAINT fk_user_org_unit -FOREIGN KEY (user_id, user_oid) -REFERENCES m_user; - -CREATE INDEX iValuePolicy ON m_value_policy (name_orig); - -ALTER TABLE m_value_policy -ADD CONSTRAINT fk_value_policy -FOREIGN KEY (id, oid) -REFERENCES m_object; - -CREATE SEQUENCE hibernate_sequence START WITH 1 INCREMENT BY 1; \ No newline at end of file diff --git a/config/sql/midpoint/2.2/h2/h2-upgrade-2.2-to-2.2.1.sql b/config/sql/midpoint/2.2/h2/h2-upgrade-2.2-to-2.2.1.sql deleted file mode 100644 index 62453b0eaf8..00000000000 --- a/config/sql/midpoint/2.2/h2/h2-upgrade-2.2-to-2.2.1.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE INDEX iParent ON m_task (parent); - -ALTER TABLE m_sync_situation_description ADD fullFlag BOOLEAN; -ALTER TABLE m_shadow ADD fullSynchronizationTimestamp TIMESTAMP; -ALTER TABLE m_task ADD expectedTotal BIGINT; -ALTER TABLE m_assignment ADD disableReason VARCHAR(255); -ALTER TABLE m_focus ADD disableReason VARCHAR(255); -ALTER TABLE m_shadow ADD disableReason VARCHAR(255); -ALTER TABLE m_audit_delta ADD context CLOB; -ALTER TABLE m_audit_delta ADD returns CLOB; -ALTER TABLE m_operation_result ADD context CLOB; -ALTER TABLE m_operation_result ADD returns CLOB; - -CREATE INDEX iAncestorDepth ON m_org_closure (ancestor_id, ancestor_oid, depthValue); \ No newline at end of file diff --git a/config/sql/midpoint/2.2/mysql/mysql-2.2.sql b/config/sql/midpoint/2.2/mysql/mysql-2.2.sql deleted file mode 100644 index f87603ecd4d..00000000000 --- a/config/sql/midpoint/2.2/mysql/mysql-2.2.sql +++ /dev/null @@ -1,1145 +0,0 @@ -CREATE TABLE m_abstract_role ( - approvalExpression LONGTEXT, - approvalProcess VARCHAR(255), - approvalSchema LONGTEXT, - automaticallyApproved LONGTEXT, - requestable BIT, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_account_shadow ( - accountType VARCHAR(255), - allowedIdmAdminGuiAccess BIT, - passwordXml LONGTEXT, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_any ( - owner_id BIGINT NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - owner_type INTEGER NOT NULL, - PRIMARY KEY (owner_id, owner_oid, owner_type) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_any_clob ( - checksum VARCHAR(32) NOT NULL, - name_namespace VARCHAR(255) NOT NULL, - name_localPart VARCHAR(100) NOT NULL, - anyContainer_owner_id BIGINT NOT NULL, - anyContainer_owner_oid VARCHAR(36) NOT NULL, - anyContainer_owner_type INTEGER NOT NULL, - type_namespace VARCHAR(255) NOT NULL, - type_localPart VARCHAR(100) NOT NULL, - dynamicDef BIT, - clobValue LONGTEXT, - valueType INTEGER, - PRIMARY KEY (checksum, name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_any_date ( - name_namespace VARCHAR(255) NOT NULL, - name_localPart VARCHAR(100) NOT NULL, - anyContainer_owner_id BIGINT NOT NULL, - anyContainer_owner_oid VARCHAR(36) NOT NULL, - anyContainer_owner_type INTEGER NOT NULL, - type_namespace VARCHAR(255) NOT NULL, - type_localPart VARCHAR(100) NOT NULL, - dateValue DATETIME(6) NOT NULL, - dynamicDef BIT, - valueType INTEGER, - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, dateValue) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_any_long ( - name_namespace VARCHAR(255) NOT NULL, - name_localPart VARCHAR(100) NOT NULL, - anyContainer_owner_id BIGINT NOT NULL, - anyContainer_owner_oid VARCHAR(36) NOT NULL, - anyContainer_owner_type INTEGER NOT NULL, - type_namespace VARCHAR(255) NOT NULL, - type_localPart VARCHAR(100) NOT NULL, - longValue BIGINT NOT NULL, - dynamicDef BIT, - valueType INTEGER, - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, longValue) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_any_poly_string ( - name_namespace VARCHAR(255) NOT NULL, - name_localPart VARCHAR(100) NOT NULL, - anyContainer_owner_id BIGINT NOT NULL, - anyContainer_owner_oid VARCHAR(36) NOT NULL, - anyContainer_owner_type INTEGER NOT NULL, - type_namespace VARCHAR(255) NOT NULL, - type_localPart VARCHAR(100) NOT NULL, - orig VARCHAR(255) NOT NULL, - dynamicDef BIT, - norm VARCHAR(255), - valueType INTEGER, - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, orig) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_any_reference ( - name_namespace VARCHAR(255) NOT NULL, - name_localPart VARCHAR(100) NOT NULL, - anyContainer_owner_id BIGINT NOT NULL, - anyContainer_owner_oid VARCHAR(36) NOT NULL, - anyContainer_owner_type INTEGER NOT NULL, - type_namespace VARCHAR(255) NOT NULL, - type_localPart VARCHAR(100) NOT NULL, - targetoid VARCHAR(36) NOT NULL, - description LONGTEXT, - dynamicDef BIT, - filter LONGTEXT, - relation_namespace VARCHAR(255), - relation_localPart VARCHAR(100), - targetType INTEGER, - valueType INTEGER, - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, targetoid) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_any_string ( - name_namespace VARCHAR(255) NOT NULL, - name_localPart VARCHAR(100) NOT NULL, - anyContainer_owner_id BIGINT NOT NULL, - anyContainer_owner_oid VARCHAR(36) NOT NULL, - anyContainer_owner_type INTEGER NOT NULL, - type_namespace VARCHAR(255) NOT NULL, - type_localPart VARCHAR(100) NOT NULL, - stringValue VARCHAR(255) NOT NULL, - dynamicDef BIT, - valueType INTEGER, - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, stringValue) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_assignment ( - accountConstruction LONGTEXT, - administrativeStatus INTEGER, - archiveTimestamp DATETIME(6), - disableTimestamp DATETIME(6), - effectiveStatus INTEGER, - enableTimestamp DATETIME(6), - validFrom DATETIME(6), - validTo DATETIME(6), - validityChangeTimestamp DATETIME(6), - validityStatus INTEGER, - assignmentOwner INTEGER, - construction LONGTEXT, - description LONGTEXT, - owner_id BIGINT NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - targetRef_description LONGTEXT, - targetRef_filter LONGTEXT, - targetRef_relationLocalPart VARCHAR(100), - targetRef_relationNamespace VARCHAR(255), - targetRef_targetOid VARCHAR(36), - targetRef_type INTEGER, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - extId BIGINT, - extOid VARCHAR(36), - extType INTEGER, - PRIMARY KEY (id, oid) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_audit_delta ( - checksum VARCHAR(32) NOT NULL, - record_id BIGINT NOT NULL, - delta LONGTEXT, - deltaOid VARCHAR(36), - deltaType INTEGER, - details LONGTEXT, - localizedMessage LONGTEXT, - message LONGTEXT, - messageCode VARCHAR(255), - operation LONGTEXT, - params LONGTEXT, - partialResults LONGTEXT, - status INTEGER, - token BIGINT, - PRIMARY KEY (checksum, record_id) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_audit_event ( - id BIGINT NOT NULL, - channel VARCHAR(255), - eventIdentifier VARCHAR(255), - eventStage INTEGER, - eventType INTEGER, - hostIdentifier VARCHAR(255), - initiatorName VARCHAR(255), - initiatorOid VARCHAR(36), - message VARCHAR(1024), - outcome INTEGER, - parameter VARCHAR(255), - result VARCHAR(255), - sessionIdentifier VARCHAR(255), - targetName VARCHAR(255), - targetOid VARCHAR(36), - targetOwnerName VARCHAR(255), - targetOwnerOid VARCHAR(36), - targetType INTEGER, - taskIdentifier VARCHAR(255), - taskOID VARCHAR(255), - timestampValue DATETIME(6), - PRIMARY KEY (id) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_authorization ( - decision INTEGER, - description LONGTEXT, - owner_id BIGINT NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_authorization_action ( - role_id BIGINT NOT NULL, - role_oid VARCHAR(36) NOT NULL, - action VARCHAR(255) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_connector ( - connectorBundle VARCHAR(255), - connectorHostRef_description LONGTEXT, - connectorHostRef_filter LONGTEXT, - c16_relationLocalPart VARCHAR(100), - c16_relationNamespace VARCHAR(255), - connectorHostRef_targetOid VARCHAR(36), - connectorHostRef_type INTEGER, - connectorType VARCHAR(255), - connectorVersion VARCHAR(255), - framework VARCHAR(255), - name_norm VARCHAR(255), - name_orig VARCHAR(255), - namespace VARCHAR(255), - xmlSchema LONGTEXT, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_connector_host ( - hostname VARCHAR(255), - name_norm VARCHAR(255), - name_orig VARCHAR(255), - port VARCHAR(255), - protectConnection BIT, - sharedSecret LONGTEXT, - timeout INTEGER, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_connector_target_system ( - connector_id BIGINT NOT NULL, - connector_oid VARCHAR(36) NOT NULL, - targetSystemType VARCHAR(255) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_container ( - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_exclusion ( - description LONGTEXT, - owner_id BIGINT NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - policy INTEGER, - targetRef_description LONGTEXT, - targetRef_filter LONGTEXT, - targetRef_relationLocalPart VARCHAR(100), - targetRef_relationNamespace VARCHAR(255), - targetRef_targetOid VARCHAR(36), - targetRef_type INTEGER, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_focus ( - administrativeStatus INTEGER, - archiveTimestamp DATETIME(6), - disableTimestamp DATETIME(6), - effectiveStatus INTEGER, - enableTimestamp DATETIME(6), - validFrom DATETIME(6), - validTo DATETIME(6), - validityChangeTimestamp DATETIME(6), - validityStatus INTEGER, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_generic_object ( - name_norm VARCHAR(255), - name_orig VARCHAR(255), - objectType VARCHAR(255), - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_metadata ( - owner_id BIGINT NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - createChannel VARCHAR(255), - createTimestamp DATETIME(6), - creatorRef_description LONGTEXT, - creatorRef_filter LONGTEXT, - creatorRef_relationLocalPart VARCHAR(100), - creatorRef_relationNamespace VARCHAR(255), - creatorRef_targetOid VARCHAR(36), - creatorRef_type INTEGER, - modifierRef_description LONGTEXT, - modifierRef_filter LONGTEXT, - modifierRef_relationLocalPart VARCHAR(100), - modifierRef_relationNamespace VARCHAR(255), - modifierRef_targetOid VARCHAR(36), - modifierRef_type INTEGER, - modifyChannel VARCHAR(255), - modifyTimestamp DATETIME(6), - PRIMARY KEY (owner_id, owner_oid) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_node ( - clusteredNode BIT, - hostname VARCHAR(255), - internalNodeIdentifier VARCHAR(255), - jmxPort INTEGER, - lastCheckInTime DATETIME(6), - name_norm VARCHAR(255), - name_orig VARCHAR(255), - nodeIdentifier VARCHAR(255), - running BIT, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_object ( - description LONGTEXT, - version BIGINT NOT NULL, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - extId BIGINT, - extOid VARCHAR(36), - extType INTEGER, - PRIMARY KEY (id, oid) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_object_template ( - accountConstruction LONGTEXT, - mapping LONGTEXT, - name_norm VARCHAR(255), - name_orig VARCHAR(255), - type INTEGER, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_operation_result ( - owner_oid VARCHAR(36) NOT NULL, - owner_id BIGINT NOT NULL, - details LONGTEXT, - localizedMessage LONGTEXT, - message LONGTEXT, - messageCode VARCHAR(255), - operation LONGTEXT, - params LONGTEXT, - partialResults LONGTEXT, - status INTEGER, - token BIGINT, - PRIMARY KEY (owner_oid, owner_id) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_org ( - costCenter VARCHAR(255), - displayName_norm VARCHAR(255), - displayName_orig VARCHAR(255), - identifier VARCHAR(255), - locality_norm VARCHAR(255), - locality_orig VARCHAR(255), - name_norm VARCHAR(255), - name_orig VARCHAR(255), - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_org_closure ( - id BIGINT NOT NULL, - ancestor_id BIGINT, - ancestor_oid VARCHAR(36), - depthValue INTEGER, - descendant_id BIGINT, - descendant_oid VARCHAR(36), - PRIMARY KEY (id) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_org_incorrect ( - descendant_oid VARCHAR(36) NOT NULL, - descendant_id BIGINT NOT NULL, - ancestor_oid VARCHAR(36) NOT NULL, - PRIMARY KEY (descendant_oid, descendant_id, ancestor_oid) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_org_org_type ( - org_id BIGINT NOT NULL, - org_oid VARCHAR(36) NOT NULL, - orgType VARCHAR(255) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_reference ( - reference_type INTEGER NOT NULL, - owner_id BIGINT NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - relLocalPart VARCHAR(100) NOT NULL, - relNamespace VARCHAR(255) NOT NULL, - targetOid VARCHAR(36) NOT NULL, - description LONGTEXT, - filter LONGTEXT, - containerType INTEGER, - PRIMARY KEY (owner_id, owner_oid, relLocalPart, relNamespace, targetOid) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_resource ( - administrativeState INTEGER, - capabilities_cachingMetadata LONGTEXT, - capabilities_configured LONGTEXT, - capabilities_native LONGTEXT, - configuration LONGTEXT, - connectorRef_description LONGTEXT, - connectorRef_filter LONGTEXT, - connectorRef_relationLocalPart VARCHAR(100), - connectorRef_relationNamespace VARCHAR(255), - connectorRef_targetOid VARCHAR(36), - connectorRef_type INTEGER, - consistency LONGTEXT, - name_norm VARCHAR(255), - name_orig VARCHAR(255), - namespace VARCHAR(255), - o16_lastAvailabilityStatus INTEGER, - projection LONGTEXT, - schemaHandling LONGTEXT, - scripts LONGTEXT, - synchronization LONGTEXT, - xmlSchema LONGTEXT, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_role ( - name_norm VARCHAR(255), - name_orig VARCHAR(255), - roleType VARCHAR(255), - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_shadow ( - administrativeStatus INTEGER, - archiveTimestamp DATETIME(6), - disableTimestamp DATETIME(6), - effectiveStatus INTEGER, - enableTimestamp DATETIME(6), - validFrom DATETIME(6), - validTo DATETIME(6), - validityChangeTimestamp DATETIME(6), - validityStatus INTEGER, - assigned BIT, - attemptNumber INTEGER, - dead BIT, - exist BIT, - failedOperationType INTEGER, - intent VARCHAR(255), - iteration INTEGER, - iterationToken VARCHAR(255), - kind INTEGER, - name_norm VARCHAR(255), - name_orig VARCHAR(255), - objectChange LONGTEXT, - class_namespace VARCHAR(255), - class_localPart VARCHAR(100), - resourceRef_description LONGTEXT, - resourceRef_filter LONGTEXT, - resourceRef_relationLocalPart VARCHAR(100), - resourceRef_relationNamespace VARCHAR(255), - resourceRef_targetOid VARCHAR(36), - resourceRef_type INTEGER, - synchronizationSituation INTEGER, - synchronizationTimestamp DATETIME(6), - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - attrId BIGINT, - attrOid VARCHAR(36), - attrType INTEGER, - PRIMARY KEY (id, oid) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_sync_situation_description ( - checksum VARCHAR(32) NOT NULL, - shadow_id BIGINT NOT NULL, - shadow_oid VARCHAR(36) NOT NULL, - chanel VARCHAR(255), - situation INTEGER, - timestampValue DATETIME(6), - PRIMARY KEY (checksum, shadow_id, shadow_oid) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_system_configuration ( - cleanupPolicy LONGTEXT, - connectorFramework LONGTEXT, - d22_description LONGTEXT, - defaultUserTemplateRef_filter LONGTEXT, - d22_relationLocalPart VARCHAR(100), - d22_relationNamespace VARCHAR(255), - d22_targetOid VARCHAR(36), - defaultUserTemplateRef_type INTEGER, - g36 LONGTEXT, - g23_description LONGTEXT, - globalPasswordPolicyRef_filter LONGTEXT, - g23_relationLocalPart VARCHAR(100), - g23_relationNamespace VARCHAR(255), - g23_targetOid VARCHAR(36), - globalPasswordPolicyRef_type INTEGER, - logging LONGTEXT, - modelHooks LONGTEXT, - name_norm VARCHAR(255), - name_orig VARCHAR(255), - notificationConfiguration LONGTEXT, - profilingConfiguration LONGTEXT, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_task ( - binding INTEGER, - canRunOnNode VARCHAR(255), - category VARCHAR(255), - completionTimestamp DATETIME(6), - executionStatus INTEGER, - handlerUri VARCHAR(255), - lastRunFinishTimestamp DATETIME(6), - lastRunStartTimestamp DATETIME(6), - name_norm VARCHAR(255), - name_orig VARCHAR(255), - node VARCHAR(255), - objectRef_description LONGTEXT, - objectRef_filter LONGTEXT, - objectRef_relationLocalPart VARCHAR(100), - objectRef_relationNamespace VARCHAR(255), - objectRef_targetOid VARCHAR(36), - objectRef_type INTEGER, - otherHandlersUriStack LONGTEXT, - ownerRef_description LONGTEXT, - ownerRef_filter LONGTEXT, - ownerRef_relationLocalPart VARCHAR(100), - ownerRef_relationNamespace VARCHAR(255), - ownerRef_targetOid VARCHAR(36), - ownerRef_type INTEGER, - parent VARCHAR(255), - progress BIGINT, - recurrence INTEGER, - resultStatus INTEGER, - schedule LONGTEXT, - taskIdentifier VARCHAR(255), - threadStopAction INTEGER, - waitingReason INTEGER, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_task_dependent ( - task_id BIGINT NOT NULL, - task_oid VARCHAR(36) NOT NULL, - dependent VARCHAR(255) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_trigger ( - handlerUri VARCHAR(255), - owner_id BIGINT NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - timestampValue DATETIME(6), - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_user ( - additionalName_norm VARCHAR(255), - additionalName_orig VARCHAR(255), - costCenter VARCHAR(255), - allowedIdmAdminGuiAccess BIT, - passwordXml LONGTEXT, - emailAddress VARCHAR(255), - employeeNumber VARCHAR(255), - familyName_norm VARCHAR(255), - familyName_orig VARCHAR(255), - fullName_norm VARCHAR(255), - fullName_orig VARCHAR(255), - givenName_norm VARCHAR(255), - givenName_orig VARCHAR(255), - honorificPrefix_norm VARCHAR(255), - honorificPrefix_orig VARCHAR(255), - honorificSuffix_norm VARCHAR(255), - honorificSuffix_orig VARCHAR(255), - locale VARCHAR(255), - locality_norm VARCHAR(255), - locality_orig VARCHAR(255), - name_norm VARCHAR(255), - name_orig VARCHAR(255), - nickName_norm VARCHAR(255), - nickName_orig VARCHAR(255), - preferredLanguage VARCHAR(255), - telephoneNumber VARCHAR(255), - timezone VARCHAR(255), - title_norm VARCHAR(255), - title_orig VARCHAR(255), - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_user_employee_type ( - user_id BIGINT NOT NULL, - user_oid VARCHAR(36) NOT NULL, - employeeType VARCHAR(255) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_user_organization ( - user_id BIGINT NOT NULL, - user_oid VARCHAR(36) NOT NULL, - norm VARCHAR(255), - orig VARCHAR(255) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_user_organizational_unit ( - user_id BIGINT NOT NULL, - user_oid VARCHAR(36) NOT NULL, - norm VARCHAR(255), - orig VARCHAR(255) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE TABLE m_value_policy ( - lifetime LONGTEXT, - name_norm VARCHAR(255), - name_orig VARCHAR(255), - stringPolicy LONGTEXT, - id BIGINT NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE =InnoDB; - -CREATE INDEX iRequestable ON m_abstract_role (requestable); - -ALTER TABLE m_abstract_role -ADD INDEX fk_abstract_role (id, oid), -ADD CONSTRAINT fk_abstract_role -FOREIGN KEY (id, oid) -REFERENCES m_focus (id, oid); - -ALTER TABLE m_account_shadow -ADD INDEX fk_account_shadow (id, oid), -ADD CONSTRAINT fk_account_shadow -FOREIGN KEY (id, oid) -REFERENCES m_shadow (id, oid); - -ALTER TABLE m_any_clob -ADD INDEX fk_any_clob (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type), -ADD CONSTRAINT fk_any_clob -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any (owner_id, owner_oid, owner_type); - -CREATE INDEX iDate ON m_any_date (dateValue); - -ALTER TABLE m_any_date -ADD INDEX fk_any_date (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type), -ADD CONSTRAINT fk_any_date -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any (owner_id, owner_oid, owner_type); - -CREATE INDEX iLong ON m_any_long (longValue); - -ALTER TABLE m_any_long -ADD INDEX fk_any_long (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type), -ADD CONSTRAINT fk_any_long -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any (owner_id, owner_oid, owner_type); - -CREATE INDEX iPolyString ON m_any_poly_string (orig); - -ALTER TABLE m_any_poly_string -ADD INDEX fk_any_poly_string (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type), -ADD CONSTRAINT fk_any_poly_string -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any (owner_id, owner_oid, owner_type); - -CREATE INDEX iTargetOid ON m_any_reference (targetoid); - -ALTER TABLE m_any_reference -ADD INDEX fk_any_reference (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type), -ADD CONSTRAINT fk_any_reference -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any (owner_id, owner_oid, owner_type); - -CREATE INDEX iString ON m_any_string (stringValue); - -ALTER TABLE m_any_string -ADD INDEX fk_any_string (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type), -ADD CONSTRAINT fk_any_string -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any (owner_id, owner_oid, owner_type); - -CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus); - -CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus); - -ALTER TABLE m_assignment -ADD INDEX fk_assignment (id, oid), -ADD CONSTRAINT fk_assignment -FOREIGN KEY (id, oid) -REFERENCES m_container (id, oid); - -ALTER TABLE m_assignment -ADD INDEX fk_assignment_owner (owner_id, owner_oid), -ADD CONSTRAINT fk_assignment_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object (id, oid); - -ALTER TABLE m_audit_delta -ADD INDEX fk_audit_delta (record_id), -ADD CONSTRAINT fk_audit_delta -FOREIGN KEY (record_id) -REFERENCES m_audit_event (id); - -ALTER TABLE m_authorization -ADD INDEX fk_authorization (id, oid), -ADD CONSTRAINT fk_authorization -FOREIGN KEY (id, oid) -REFERENCES m_container (id, oid); - -ALTER TABLE m_authorization -ADD INDEX fk_authorization_owner (owner_id, owner_oid), -ADD CONSTRAINT fk_authorization_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object (id, oid); - -ALTER TABLE m_authorization_action -ADD INDEX fk_authorization_action (role_id, role_oid), -ADD CONSTRAINT fk_authorization_action -FOREIGN KEY (role_id, role_oid) -REFERENCES m_authorization (id, oid); - -CREATE INDEX iConnectorNameNorm ON m_connector (name_norm); - -CREATE INDEX iConnectorNameOrig ON m_connector (name_orig); - -ALTER TABLE m_connector -ADD INDEX fk_connector (id, oid), -ADD CONSTRAINT fk_connector -FOREIGN KEY (id, oid) -REFERENCES m_object (id, oid); - -CREATE INDEX iConnectorHostName ON m_connector_host (name_orig); - -ALTER TABLE m_connector_host -ADD INDEX fk_connector_host (id, oid), -ADD CONSTRAINT fk_connector_host -FOREIGN KEY (id, oid) -REFERENCES m_object (id, oid); - -ALTER TABLE m_connector_target_system -ADD INDEX fk_connector_target_system (connector_id, connector_oid), -ADD CONSTRAINT fk_connector_target_system -FOREIGN KEY (connector_id, connector_oid) -REFERENCES m_connector (id, oid); - -ALTER TABLE m_exclusion -ADD INDEX fk_exclusion (id, oid), -ADD CONSTRAINT fk_exclusion -FOREIGN KEY (id, oid) -REFERENCES m_container (id, oid); - -ALTER TABLE m_exclusion -ADD INDEX fk_exclusion_owner (owner_id, owner_oid), -ADD CONSTRAINT fk_exclusion_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object (id, oid); - -CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus); - -CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); - -ALTER TABLE m_focus -ADD INDEX fk_focus (id, oid), -ADD CONSTRAINT fk_focus -FOREIGN KEY (id, oid) -REFERENCES m_object (id, oid); - -CREATE INDEX iGenericObjectName ON m_generic_object (name_orig); - -ALTER TABLE m_generic_object -ADD INDEX fk_generic_object (id, oid), -ADD CONSTRAINT fk_generic_object -FOREIGN KEY (id, oid) -REFERENCES m_object (id, oid); - -ALTER TABLE m_metadata -ADD INDEX fk_metadata_owner (owner_id, owner_oid), -ADD CONSTRAINT fk_metadata_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_container (id, oid); - -CREATE INDEX iNodeName ON m_node (name_orig); - -ALTER TABLE m_node -ADD INDEX fk_node (id, oid), -ADD CONSTRAINT fk_node -FOREIGN KEY (id, oid) -REFERENCES m_object (id, oid); - -ALTER TABLE m_object -ADD INDEX fk_object (id, oid), -ADD CONSTRAINT fk_object -FOREIGN KEY (id, oid) -REFERENCES m_container (id, oid); - -CREATE INDEX iObjectTemplate ON m_object_template (name_orig); - -ALTER TABLE m_object_template -ADD INDEX fk_object_template (id, oid), -ADD CONSTRAINT fk_object_template -FOREIGN KEY (id, oid) -REFERENCES m_object (id, oid); - -ALTER TABLE m_operation_result -ADD INDEX fk_result_owner (owner_id, owner_oid), -ADD CONSTRAINT fk_result_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object (id, oid); - -CREATE INDEX iOrgName ON m_org (name_orig); - -ALTER TABLE m_org -ADD INDEX fk_org (id, oid), -ADD CONSTRAINT fk_org -FOREIGN KEY (id, oid) -REFERENCES m_abstract_role (id, oid); - -ALTER TABLE m_org_closure -ADD INDEX fk_descendant (descendant_id, descendant_oid), -ADD CONSTRAINT fk_descendant -FOREIGN KEY (descendant_id, descendant_oid) -REFERENCES m_object (id, oid); - -ALTER TABLE m_org_closure -ADD INDEX fk_ancestor (ancestor_id, ancestor_oid), -ADD CONSTRAINT fk_ancestor -FOREIGN KEY (ancestor_id, ancestor_oid) -REFERENCES m_object (id, oid); - -ALTER TABLE m_org_org_type -ADD INDEX fk_org_org_type (org_id, org_oid), -ADD CONSTRAINT fk_org_org_type -FOREIGN KEY (org_id, org_oid) -REFERENCES m_org (id, oid); - -CREATE INDEX iReferenceTargetOid ON m_reference (targetOid); - -ALTER TABLE m_reference -ADD INDEX fk_reference_owner (owner_id, owner_oid), -ADD CONSTRAINT fk_reference_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_container (id, oid); - -CREATE INDEX iResourceName ON m_resource (name_orig); - -ALTER TABLE m_resource -ADD INDEX fk_resource (id, oid), -ADD CONSTRAINT fk_resource -FOREIGN KEY (id, oid) -REFERENCES m_object (id, oid); - -CREATE INDEX iRoleName ON m_role (name_orig); - -ALTER TABLE m_role -ADD INDEX fk_role (id, oid), -ADD CONSTRAINT fk_role -FOREIGN KEY (id, oid) -REFERENCES m_abstract_role (id, oid); - -CREATE INDEX iShadowNameOrig ON m_shadow (name_orig); - -CREATE INDEX iShadowDead ON m_shadow (dead); - -CREATE INDEX iShadowNameNorm ON m_shadow (name_norm); - -CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid); - -CREATE INDEX iShadowAdministrative ON m_shadow (administrativeStatus); - -CREATE INDEX iShadowEffective ON m_shadow (effectiveStatus); - -ALTER TABLE m_shadow -ADD INDEX fk_shadow (id, oid), -ADD CONSTRAINT fk_shadow -FOREIGN KEY (id, oid) -REFERENCES m_object (id, oid); - -ALTER TABLE m_sync_situation_description -ADD INDEX fk_shadow_sync_situation (shadow_id, shadow_oid), -ADD CONSTRAINT fk_shadow_sync_situation -FOREIGN KEY (shadow_id, shadow_oid) -REFERENCES m_shadow (id, oid); - -CREATE INDEX iSystemConfigurationName ON m_system_configuration (name_orig); - -ALTER TABLE m_system_configuration -ADD INDEX fk_system_configuration (id, oid), -ADD CONSTRAINT fk_system_configuration -FOREIGN KEY (id, oid) -REFERENCES m_object (id, oid); - -CREATE INDEX iTaskNameNameNorm ON m_task (name_norm); - -CREATE INDEX iTaskNameOrig ON m_task (name_orig); - -ALTER TABLE m_task -ADD INDEX fk_task (id, oid), -ADD CONSTRAINT fk_task -FOREIGN KEY (id, oid) -REFERENCES m_object (id, oid); - -ALTER TABLE m_task_dependent -ADD INDEX fk_task_dependent (task_id, task_oid), -ADD CONSTRAINT fk_task_dependent -FOREIGN KEY (task_id, task_oid) -REFERENCES m_task (id, oid); - -CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue); - -ALTER TABLE m_trigger -ADD INDEX fk_trigger (id, oid), -ADD CONSTRAINT fk_trigger -FOREIGN KEY (id, oid) -REFERENCES m_container (id, oid); - -ALTER TABLE m_trigger -ADD INDEX fk_trigger_owner (owner_id, owner_oid), -ADD CONSTRAINT fk_trigger_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object (id, oid); - -CREATE INDEX iFullName ON m_user (fullName_orig); - -CREATE INDEX iLocality ON m_user (locality_orig); - -CREATE INDEX iHonorificSuffix ON m_user (honorificSuffix_orig); - -CREATE INDEX iEmployeeNumber ON m_user (employeeNumber); - -CREATE INDEX iGivenName ON m_user (givenName_orig); - -CREATE INDEX iFamilyName ON m_user (familyName_orig); - -CREATE INDEX iAdditionalName ON m_user (additionalName_orig); - -CREATE INDEX iHonorificPrefix ON m_user (honorificPrefix_orig); - -CREATE INDEX iUserName ON m_user (name_orig); - -ALTER TABLE m_user -ADD INDEX fk_user (id, oid), -ADD CONSTRAINT fk_user -FOREIGN KEY (id, oid) -REFERENCES m_focus (id, oid); - -ALTER TABLE m_user_employee_type -ADD INDEX fk_user_employee_type (user_id, user_oid), -ADD CONSTRAINT fk_user_employee_type -FOREIGN KEY (user_id, user_oid) -REFERENCES m_user (id, oid); - -ALTER TABLE m_user_organization -ADD INDEX fk_user_organization (user_id, user_oid), -ADD CONSTRAINT fk_user_organization -FOREIGN KEY (user_id, user_oid) -REFERENCES m_user (id, oid); - -ALTER TABLE m_user_organizational_unit -ADD INDEX fk_user_org_unit (user_id, user_oid), -ADD CONSTRAINT fk_user_org_unit -FOREIGN KEY (user_id, user_oid) -REFERENCES m_user (id, oid); - -CREATE INDEX iValuePolicy ON m_value_policy (name_orig); - -ALTER TABLE m_value_policy -ADD INDEX fk_value_policy (id, oid), -ADD CONSTRAINT fk_value_policy -FOREIGN KEY (id, oid) -REFERENCES m_object (id, oid); - -CREATE TABLE hibernate_sequence ( - next_val BIGINT -); - -INSERT INTO hibernate_sequence VALUES (1); \ No newline at end of file diff --git a/config/sql/midpoint/2.2/mysql/mysql-upgrade-2.2-to-2.2.1.sql b/config/sql/midpoint/2.2/mysql/mysql-upgrade-2.2-to-2.2.1.sql deleted file mode 100644 index 6d38872a661..00000000000 --- a/config/sql/midpoint/2.2/mysql/mysql-upgrade-2.2-to-2.2.1.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE INDEX iParent ON m_task (parent); - -ALTER TABLE m_sync_situation_description ADD fullFlag BIT; -ALTER TABLE m_shadow ADD fullSynchronizationTimestamp DATETIME(6); -ALTER TABLE m_task ADD expectedTotal BIGINT; -ALTER TABLE m_assignment ADD disableReason VARCHAR(255); -ALTER TABLE m_focus ADD disableReason VARCHAR(255); -ALTER TABLE m_shadow ADD disableReason VARCHAR(255); -ALTER TABLE m_audit_delta ADD context LONGTEXT; -ALTER TABLE m_audit_delta ADD returns LONGTEXT; -ALTER TABLE m_operation_result ADD context LONGTEXT; -ALTER TABLE m_operation_result ADD returns LONGTEXT; - - -CREATE INDEX iAncestorDepth ON m_org_closure (ancestor_id, ancestor_oid, depthValue); \ No newline at end of file diff --git a/config/sql/midpoint/2.2/oracle/oracle-2.2.sql b/config/sql/midpoint/2.2/oracle/oracle-2.2.sql deleted file mode 100644 index 142395aa313..00000000000 --- a/config/sql/midpoint/2.2/oracle/oracle-2.2.sql +++ /dev/null @@ -1,964 +0,0 @@ -CREATE TABLE m_abstract_role ( - approvalExpression CLOB, - approvalProcess VARCHAR2(255 CHAR), - approvalSchema CLOB, - automaticallyApproved CLOB, - requestable NUMBER(1, 0), - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (id, oid) -) INITRANS 30; - -CREATE TABLE m_account_shadow ( - accountType VARCHAR2(255 CHAR), - allowedIdmAdminGuiAccess NUMBER(1, 0), - passwordXml CLOB, - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (id, oid) -) INITRANS 30; - -CREATE TABLE m_any ( - owner_id NUMBER(19, 0) NOT NULL, - owner_oid VARCHAR2(36 CHAR) NOT NULL, - owner_type NUMBER(10, 0) NOT NULL, - PRIMARY KEY (owner_id, owner_oid, owner_type) -) INITRANS 30; - -CREATE TABLE m_any_clob ( - checksum VARCHAR2(32 CHAR) NOT NULL, - name_namespace VARCHAR2(255 CHAR) NOT NULL, - name_localPart VARCHAR2(100 CHAR) NOT NULL, - anyContainer_owner_id NUMBER(19, 0) NOT NULL, - anyContainer_owner_oid VARCHAR2(36 CHAR) NOT NULL, - anyContainer_owner_type NUMBER(10, 0) NOT NULL, - type_namespace VARCHAR2(255 CHAR) NOT NULL, - type_localPart VARCHAR2(100 CHAR) NOT NULL, - dynamicDef NUMBER(1, 0), - clobValue CLOB, - valueType NUMBER(10, 0), - PRIMARY KEY (checksum, name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart) -) INITRANS 30; - -CREATE TABLE m_any_date ( - name_namespace VARCHAR2(255 CHAR) NOT NULL, - name_localPart VARCHAR2(100 CHAR) NOT NULL, - anyContainer_owner_id NUMBER(19, 0) NOT NULL, - anyContainer_owner_oid VARCHAR2(36 CHAR) NOT NULL, - anyContainer_owner_type NUMBER(10, 0) NOT NULL, - type_namespace VARCHAR2(255 CHAR) NOT NULL, - type_localPart VARCHAR2(100 CHAR) NOT NULL, - dateValue TIMESTAMP NOT NULL, - dynamicDef NUMBER(1, 0), - valueType NUMBER(10, 0), - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, dateValue) -) INITRANS 30; - -CREATE TABLE m_any_long ( - name_namespace VARCHAR2(255 CHAR) NOT NULL, - name_localPart VARCHAR2(100 CHAR) NOT NULL, - anyContainer_owner_id NUMBER(19, 0) NOT NULL, - anyContainer_owner_oid VARCHAR2(36 CHAR) NOT NULL, - anyContainer_owner_type NUMBER(10, 0) NOT NULL, - type_namespace VARCHAR2(255 CHAR) NOT NULL, - type_localPart VARCHAR2(100 CHAR) NOT NULL, - longValue NUMBER(19, 0) NOT NULL, - dynamicDef NUMBER(1, 0), - valueType NUMBER(10, 0), - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, longValue) -) INITRANS 30; - -CREATE TABLE m_any_poly_string ( - name_namespace VARCHAR2(255 CHAR) NOT NULL, - name_localPart VARCHAR2(100 CHAR) NOT NULL, - anyContainer_owner_id NUMBER(19, 0) NOT NULL, - anyContainer_owner_oid VARCHAR2(36 CHAR) NOT NULL, - anyContainer_owner_type NUMBER(10, 0) NOT NULL, - type_namespace VARCHAR2(255 CHAR) NOT NULL, - type_localPart VARCHAR2(100 CHAR) NOT NULL, - orig VARCHAR2(255 CHAR) NOT NULL, - dynamicDef NUMBER(1, 0), - norm VARCHAR2(255 CHAR), - valueType NUMBER(10, 0), - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, orig) -) INITRANS 30; - -CREATE TABLE m_any_reference ( - name_namespace VARCHAR2(255 CHAR) NOT NULL, - name_localPart VARCHAR2(100 CHAR) NOT NULL, - anyContainer_owner_id NUMBER(19, 0) NOT NULL, - anyContainer_owner_oid VARCHAR2(36 CHAR) NOT NULL, - anyContainer_owner_type NUMBER(10, 0) NOT NULL, - type_namespace VARCHAR2(255 CHAR) NOT NULL, - type_localPart VARCHAR2(100 CHAR) NOT NULL, - targetoid VARCHAR2(36 CHAR) NOT NULL, - description CLOB, - dynamicDef NUMBER(1, 0), - filter CLOB, - relation_namespace VARCHAR2(255 CHAR), - relation_localPart VARCHAR2(100 CHAR), - targetType NUMBER(10, 0), - valueType NUMBER(10, 0), - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, targetoid) -) INITRANS 30; - -CREATE TABLE m_any_string ( - name_namespace VARCHAR2(255 CHAR) NOT NULL, - name_localPart VARCHAR2(100 CHAR) NOT NULL, - anyContainer_owner_id NUMBER(19, 0) NOT NULL, - anyContainer_owner_oid VARCHAR2(36 CHAR) NOT NULL, - anyContainer_owner_type NUMBER(10, 0) NOT NULL, - type_namespace VARCHAR2(255 CHAR) NOT NULL, - type_localPart VARCHAR2(100 CHAR) NOT NULL, - stringValue VARCHAR2(255 CHAR) NOT NULL, - dynamicDef NUMBER(1, 0), - valueType NUMBER(10, 0), - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, stringValue) -) INITRANS 30; - -CREATE TABLE m_assignment ( - accountConstruction CLOB, - administrativeStatus NUMBER(10, 0), - archiveTimestamp TIMESTAMP, - disableTimestamp TIMESTAMP, - effectiveStatus NUMBER(10, 0), - enableTimestamp TIMESTAMP, - validFrom TIMESTAMP, - validTo TIMESTAMP, - validityChangeTimestamp TIMESTAMP, - validityStatus NUMBER(10, 0), - assignmentOwner NUMBER(10, 0), - construction CLOB, - description CLOB, - owner_id NUMBER(19, 0) NOT NULL, - owner_oid VARCHAR2(36 CHAR) NOT NULL, - targetRef_description CLOB, - targetRef_filter CLOB, - targetRef_relationLocalPart VARCHAR2(100 CHAR), - targetRef_relationNamespace VARCHAR2(255 CHAR), - targetRef_targetOid VARCHAR2(36 CHAR), - targetRef_type NUMBER(10, 0), - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - extId NUMBER(19, 0), - extOid VARCHAR2(36 CHAR), - extType NUMBER(10, 0), - PRIMARY KEY (id, oid) -) INITRANS 30; - -CREATE TABLE m_audit_delta ( - checksum VARCHAR2(32 CHAR) NOT NULL, - record_id NUMBER(19, 0) NOT NULL, - delta CLOB, - deltaOid VARCHAR2(36 CHAR), - deltaType NUMBER(10, 0), - details CLOB, - localizedMessage CLOB, - message CLOB, - messageCode VARCHAR2(255 CHAR), - operation CLOB, - params CLOB, - partialResults CLOB, - status NUMBER(10, 0), - token NUMBER(19, 0), - PRIMARY KEY (checksum, record_id) -) INITRANS 30; - -CREATE TABLE m_audit_event ( - id NUMBER(19, 0) NOT NULL, - channel VARCHAR2(255 CHAR), - eventIdentifier VARCHAR2(255 CHAR), - eventStage NUMBER(10, 0), - eventType NUMBER(10, 0), - hostIdentifier VARCHAR2(255 CHAR), - initiatorName VARCHAR2(255 CHAR), - initiatorOid VARCHAR2(36 CHAR), - message VARCHAR2(1024 CHAR), - outcome NUMBER(10, 0), - parameter VARCHAR2(255 CHAR), - result VARCHAR2(255 CHAR), - sessionIdentifier VARCHAR2(255 CHAR), - targetName VARCHAR2(255 CHAR), - targetOid VARCHAR2(36 CHAR), - targetOwnerName VARCHAR2(255 CHAR), - targetOwnerOid VARCHAR2(36 CHAR), - targetType NUMBER(10, 0), - taskIdentifier VARCHAR2(255 CHAR), - taskOID VARCHAR2(255 CHAR), - timestampValue TIMESTAMP, - PRIMARY KEY (id) -) INITRANS 30; - -CREATE TABLE m_authorization ( - decision NUMBER(10, 0), - description CLOB, - owner_id NUMBER(19, 0) NOT NULL, - owner_oid VARCHAR2(36 CHAR) NOT NULL, - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (id, oid) -) INITRANS 30; - -CREATE TABLE m_authorization_action ( - role_id NUMBER(19, 0) NOT NULL, - role_oid VARCHAR2(36 CHAR) NOT NULL, - action VARCHAR2(255 CHAR) -) INITRANS 30; - -CREATE TABLE m_connector ( - connectorBundle VARCHAR2(255 CHAR), - connectorHostRef_description CLOB, - connectorHostRef_filter CLOB, - c16_relationLocalPart VARCHAR2(100 CHAR), - c16_relationNamespace VARCHAR2(255 CHAR), - connectorHostRef_targetOid VARCHAR2(36 CHAR), - connectorHostRef_type NUMBER(10, 0), - connectorType VARCHAR2(255 CHAR), - connectorVersion VARCHAR2(255 CHAR), - framework VARCHAR2(255 CHAR), - name_norm VARCHAR2(255 CHAR), - name_orig VARCHAR2(255 CHAR), - namespace VARCHAR2(255 CHAR), - xmlSchema CLOB, - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (id, oid) -) INITRANS 30; - -CREATE TABLE m_connector_host ( - hostname VARCHAR2(255 CHAR), - name_norm VARCHAR2(255 CHAR), - name_orig VARCHAR2(255 CHAR), - port VARCHAR2(255 CHAR), - protectConnection NUMBER(1, 0), - sharedSecret CLOB, - timeout NUMBER(10, 0), - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -) INITRANS 30; - -CREATE TABLE m_connector_target_system ( - connector_id NUMBER(19, 0) NOT NULL, - connector_oid VARCHAR2(36 CHAR) NOT NULL, - targetSystemType VARCHAR2(255 CHAR) -) INITRANS 30; - -CREATE TABLE m_container ( - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (id, oid) -) INITRANS 30; - -CREATE TABLE m_exclusion ( - description CLOB, - owner_id NUMBER(19, 0) NOT NULL, - owner_oid VARCHAR2(36 CHAR) NOT NULL, - policy NUMBER(10, 0), - targetRef_description CLOB, - targetRef_filter CLOB, - targetRef_relationLocalPart VARCHAR2(100 CHAR), - targetRef_relationNamespace VARCHAR2(255 CHAR), - targetRef_targetOid VARCHAR2(36 CHAR), - targetRef_type NUMBER(10, 0), - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (id, oid) -) INITRANS 30; - -CREATE TABLE m_focus ( - administrativeStatus NUMBER(10, 0), - archiveTimestamp TIMESTAMP, - disableTimestamp TIMESTAMP, - effectiveStatus NUMBER(10, 0), - enableTimestamp TIMESTAMP, - validFrom TIMESTAMP, - validTo TIMESTAMP, - validityChangeTimestamp TIMESTAMP, - validityStatus NUMBER(10, 0), - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (id, oid) -) INITRANS 30; - -CREATE TABLE m_generic_object ( - name_norm VARCHAR2(255 CHAR), - name_orig VARCHAR2(255 CHAR), - objectType VARCHAR2(255 CHAR), - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -) INITRANS 30; - -CREATE TABLE m_metadata ( - owner_id NUMBER(19, 0) NOT NULL, - owner_oid VARCHAR2(36 CHAR) NOT NULL, - createChannel VARCHAR2(255 CHAR), - createTimestamp TIMESTAMP, - creatorRef_description CLOB, - creatorRef_filter CLOB, - creatorRef_relationLocalPart VARCHAR2(100 CHAR), - creatorRef_relationNamespace VARCHAR2(255 CHAR), - creatorRef_targetOid VARCHAR2(36 CHAR), - creatorRef_type NUMBER(10, 0), - modifierRef_description CLOB, - modifierRef_filter CLOB, - modifierRef_relationLocalPart VARCHAR2(100 CHAR), - modifierRef_relationNamespace VARCHAR2(255 CHAR), - modifierRef_targetOid VARCHAR2(36 CHAR), - modifierRef_type NUMBER(10, 0), - modifyChannel VARCHAR2(255 CHAR), - modifyTimestamp TIMESTAMP, - PRIMARY KEY (owner_id, owner_oid) -) INITRANS 30; - -CREATE TABLE m_node ( - clusteredNode NUMBER(1, 0), - hostname VARCHAR2(255 CHAR), - internalNodeIdentifier VARCHAR2(255 CHAR), - jmxPort NUMBER(10, 0), - lastCheckInTime TIMESTAMP, - name_norm VARCHAR2(255 CHAR), - name_orig VARCHAR2(255 CHAR), - nodeIdentifier VARCHAR2(255 CHAR), - running NUMBER(1, 0), - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -) INITRANS 30; - -CREATE TABLE m_object ( - description CLOB, - version NUMBER(19, 0) NOT NULL, - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - extId NUMBER(19, 0), - extOid VARCHAR2(36 CHAR), - extType NUMBER(10, 0), - PRIMARY KEY (id, oid) -) INITRANS 30; - -CREATE TABLE m_object_template ( - accountConstruction CLOB, - mapping CLOB, - name_norm VARCHAR2(255 CHAR), - name_orig VARCHAR2(255 CHAR), - type NUMBER(10, 0), - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -) INITRANS 30; - -CREATE TABLE m_operation_result ( - owner_oid VARCHAR2(36 CHAR) NOT NULL, - owner_id NUMBER(19, 0) NOT NULL, - details CLOB, - localizedMessage CLOB, - message CLOB, - messageCode VARCHAR2(255 CHAR), - operation CLOB, - params CLOB, - partialResults CLOB, - status NUMBER(10, 0), - token NUMBER(19, 0), - PRIMARY KEY (owner_oid, owner_id) -) INITRANS 30; - -CREATE TABLE m_org ( - costCenter VARCHAR2(255 CHAR), - displayName_norm VARCHAR2(255 CHAR), - displayName_orig VARCHAR2(255 CHAR), - identifier VARCHAR2(255 CHAR), - locality_norm VARCHAR2(255 CHAR), - locality_orig VARCHAR2(255 CHAR), - name_norm VARCHAR2(255 CHAR), - name_orig VARCHAR2(255 CHAR), - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -) INITRANS 30; - -CREATE TABLE m_org_closure ( - id NUMBER(19, 0) NOT NULL, - ancestor_id NUMBER(19, 0), - ancestor_oid VARCHAR2(36 CHAR), - depthValue NUMBER(10, 0), - descendant_id NUMBER(19, 0), - descendant_oid VARCHAR2(36 CHAR), - PRIMARY KEY (id) -) INITRANS 30; - -CREATE TABLE m_org_incorrect ( - descendant_oid VARCHAR2(36 CHAR) NOT NULL, - descendant_id NUMBER(19, 0) NOT NULL, - ancestor_oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (descendant_oid, descendant_id, ancestor_oid) -) INITRANS 30; - -CREATE TABLE m_org_org_type ( - org_id NUMBER(19, 0) NOT NULL, - org_oid VARCHAR2(36 CHAR) NOT NULL, - orgType VARCHAR2(255 CHAR) -) INITRANS 30; - -CREATE TABLE m_reference ( - reference_type NUMBER(10, 0) NOT NULL, - owner_id NUMBER(19, 0) NOT NULL, - owner_oid VARCHAR2(36 CHAR) NOT NULL, - relLocalPart VARCHAR2(100 CHAR) NOT NULL, - relNamespace VARCHAR2(255 CHAR) NOT NULL, - targetOid VARCHAR2(36 CHAR) NOT NULL, - description CLOB, - filter CLOB, - containerType NUMBER(10, 0), - PRIMARY KEY (owner_id, owner_oid, relLocalPart, relNamespace, targetOid) -) INITRANS 30; - -CREATE TABLE m_resource ( - administrativeState NUMBER(10, 0), - capabilities_cachingMetadata CLOB, - capabilities_configured CLOB, - capabilities_native CLOB, - configuration CLOB, - connectorRef_description CLOB, - connectorRef_filter CLOB, - connectorRef_relationLocalPart VARCHAR2(100 CHAR), - connectorRef_relationNamespace VARCHAR2(255 CHAR), - connectorRef_targetOid VARCHAR2(36 CHAR), - connectorRef_type NUMBER(10, 0), - consistency CLOB, - name_norm VARCHAR2(255 CHAR), - name_orig VARCHAR2(255 CHAR), - namespace VARCHAR2(255 CHAR), - o16_lastAvailabilityStatus NUMBER(10, 0), - projection CLOB, - schemaHandling CLOB, - scripts CLOB, - synchronization CLOB, - xmlSchema CLOB, - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -) INITRANS 30; - -CREATE TABLE m_role ( - name_norm VARCHAR2(255 CHAR), - name_orig VARCHAR2(255 CHAR), - roleType VARCHAR2(255 CHAR), - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -) INITRANS 30; - -CREATE TABLE m_shadow ( - administrativeStatus NUMBER(10, 0), - archiveTimestamp TIMESTAMP, - disableTimestamp TIMESTAMP, - effectiveStatus NUMBER(10, 0), - enableTimestamp TIMESTAMP, - validFrom TIMESTAMP, - validTo TIMESTAMP, - validityChangeTimestamp TIMESTAMP, - validityStatus NUMBER(10, 0), - assigned NUMBER(1, 0), - attemptNumber NUMBER(10, 0), - dead NUMBER(1, 0), - exist NUMBER(1, 0), - failedOperationType NUMBER(10, 0), - intent VARCHAR2(255 CHAR), - iteration NUMBER(10, 0), - iterationToken VARCHAR2(255 CHAR), - kind NUMBER(10, 0), - name_norm VARCHAR2(255 CHAR), - name_orig VARCHAR2(255 CHAR), - objectChange CLOB, - class_namespace VARCHAR2(255 CHAR), - class_localPart VARCHAR2(100 CHAR), - resourceRef_description CLOB, - resourceRef_filter CLOB, - resourceRef_relationLocalPart VARCHAR2(100 CHAR), - resourceRef_relationNamespace VARCHAR2(255 CHAR), - resourceRef_targetOid VARCHAR2(36 CHAR), - resourceRef_type NUMBER(10, 0), - synchronizationSituation NUMBER(10, 0), - synchronizationTimestamp TIMESTAMP, - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - attrId NUMBER(19, 0), - attrOid VARCHAR2(36 CHAR), - attrType NUMBER(10, 0), - PRIMARY KEY (id, oid) -) INITRANS 30; - -CREATE TABLE m_sync_situation_description ( - checksum VARCHAR2(32 CHAR) NOT NULL, - shadow_id NUMBER(19, 0) NOT NULL, - shadow_oid VARCHAR2(36 CHAR) NOT NULL, - chanel VARCHAR2(255 CHAR), - situation NUMBER(10, 0), - timestampValue TIMESTAMP, - PRIMARY KEY (checksum, shadow_id, shadow_oid) -) INITRANS 30; - -CREATE TABLE m_system_configuration ( - cleanupPolicy CLOB, - connectorFramework CLOB, - d22_description CLOB, - defaultUserTemplateRef_filter CLOB, - d22_relationLocalPart VARCHAR2(100 CHAR), - d22_relationNamespace VARCHAR2(255 CHAR), - d22_targetOid VARCHAR2(36 CHAR), - defaultUserTemplateRef_type NUMBER(10, 0), - g36 CLOB, - g23_description CLOB, - globalPasswordPolicyRef_filter CLOB, - g23_relationLocalPart VARCHAR2(100 CHAR), - g23_relationNamespace VARCHAR2(255 CHAR), - g23_targetOid VARCHAR2(36 CHAR), - globalPasswordPolicyRef_type NUMBER(10, 0), - logging CLOB, - modelHooks CLOB, - name_norm VARCHAR2(255 CHAR), - name_orig VARCHAR2(255 CHAR), - notificationConfiguration CLOB, - profilingConfiguration CLOB, - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -) INITRANS 30; - -CREATE TABLE m_task ( - binding NUMBER(10, 0), - canRunOnNode VARCHAR2(255 CHAR), - category VARCHAR2(255 CHAR), - completionTimestamp TIMESTAMP, - executionStatus NUMBER(10, 0), - handlerUri VARCHAR2(255 CHAR), - lastRunFinishTimestamp TIMESTAMP, - lastRunStartTimestamp TIMESTAMP, - name_norm VARCHAR2(255 CHAR), - name_orig VARCHAR2(255 CHAR), - node VARCHAR2(255 CHAR), - objectRef_description CLOB, - objectRef_filter CLOB, - objectRef_relationLocalPart VARCHAR2(100 CHAR), - objectRef_relationNamespace VARCHAR2(255 CHAR), - objectRef_targetOid VARCHAR2(36 CHAR), - objectRef_type NUMBER(10, 0), - otherHandlersUriStack CLOB, - ownerRef_description CLOB, - ownerRef_filter CLOB, - ownerRef_relationLocalPart VARCHAR2(100 CHAR), - ownerRef_relationNamespace VARCHAR2(255 CHAR), - ownerRef_targetOid VARCHAR2(36 CHAR), - ownerRef_type NUMBER(10, 0), - parent VARCHAR2(255 CHAR), - progress NUMBER(19, 0), - recurrence NUMBER(10, 0), - resultStatus NUMBER(10, 0), - schedule CLOB, - taskIdentifier VARCHAR2(255 CHAR), - threadStopAction NUMBER(10, 0), - waitingReason NUMBER(10, 0), - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (id, oid) -) INITRANS 30; - -CREATE TABLE m_task_dependent ( - task_id NUMBER(19, 0) NOT NULL, - task_oid VARCHAR2(36 CHAR) NOT NULL, - dependent VARCHAR2(255 CHAR) -) INITRANS 30; - -CREATE TABLE m_trigger ( - handlerUri VARCHAR2(255 CHAR), - owner_id NUMBER(19, 0) NOT NULL, - owner_oid VARCHAR2(36 CHAR) NOT NULL, - timestampValue TIMESTAMP, - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (id, oid) -) INITRANS 30; - -CREATE TABLE m_user ( - additionalName_norm VARCHAR2(255 CHAR), - additionalName_orig VARCHAR2(255 CHAR), - costCenter VARCHAR2(255 CHAR), - allowedIdmAdminGuiAccess NUMBER(1, 0), - passwordXml CLOB, - emailAddress VARCHAR2(255 CHAR), - employeeNumber VARCHAR2(255 CHAR), - familyName_norm VARCHAR2(255 CHAR), - familyName_orig VARCHAR2(255 CHAR), - fullName_norm VARCHAR2(255 CHAR), - fullName_orig VARCHAR2(255 CHAR), - givenName_norm VARCHAR2(255 CHAR), - givenName_orig VARCHAR2(255 CHAR), - honorificPrefix_norm VARCHAR2(255 CHAR), - honorificPrefix_orig VARCHAR2(255 CHAR), - honorificSuffix_norm VARCHAR2(255 CHAR), - honorificSuffix_orig VARCHAR2(255 CHAR), - locale VARCHAR2(255 CHAR), - locality_norm VARCHAR2(255 CHAR), - locality_orig VARCHAR2(255 CHAR), - name_norm VARCHAR2(255 CHAR), - name_orig VARCHAR2(255 CHAR), - nickName_norm VARCHAR2(255 CHAR), - nickName_orig VARCHAR2(255 CHAR), - preferredLanguage VARCHAR2(255 CHAR), - telephoneNumber VARCHAR2(255 CHAR), - timezone VARCHAR2(255 CHAR), - title_norm VARCHAR2(255 CHAR), - title_orig VARCHAR2(255 CHAR), - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -) INITRANS 30; - -CREATE TABLE m_user_employee_type ( - user_id NUMBER(19, 0) NOT NULL, - user_oid VARCHAR2(36 CHAR) NOT NULL, - employeeType VARCHAR2(255 CHAR) -) INITRANS 30; - -CREATE TABLE m_user_organization ( - user_id NUMBER(19, 0) NOT NULL, - user_oid VARCHAR2(36 CHAR) NOT NULL, - norm VARCHAR2(255 CHAR), - orig VARCHAR2(255 CHAR) -) INITRANS 30; - -CREATE TABLE m_user_organizational_unit ( - user_id NUMBER(19, 0) NOT NULL, - user_oid VARCHAR2(36 CHAR) NOT NULL, - norm VARCHAR2(255 CHAR), - orig VARCHAR2(255 CHAR) -) INITRANS 30; - -CREATE TABLE m_value_policy ( - lifetime CLOB, - name_norm VARCHAR2(255 CHAR), - name_orig VARCHAR2(255 CHAR), - stringPolicy CLOB, - id NUMBER(19, 0) NOT NULL, - oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -) INITRANS 30; - -CREATE INDEX iRequestable ON m_abstract_role (requestable) INITRANS 30; - -ALTER TABLE m_abstract_role -ADD CONSTRAINT fk_abstract_role -FOREIGN KEY (id, oid) -REFERENCES m_focus; - -ALTER TABLE m_account_shadow -ADD CONSTRAINT fk_account_shadow -FOREIGN KEY (id, oid) -REFERENCES m_shadow; - -ALTER TABLE m_any_clob -ADD CONSTRAINT fk_any_clob -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iDate ON m_any_date (dateValue) INITRANS 30; - -ALTER TABLE m_any_date -ADD CONSTRAINT fk_any_date -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iLong ON m_any_long (longValue) INITRANS 30; - -ALTER TABLE m_any_long -ADD CONSTRAINT fk_any_long -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iPolyString ON m_any_poly_string (orig) INITRANS 30; - -ALTER TABLE m_any_poly_string -ADD CONSTRAINT fk_any_poly_string -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iTargetOid ON m_any_reference (targetoid) INITRANS 30; - -ALTER TABLE m_any_reference -ADD CONSTRAINT fk_any_reference -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iString ON m_any_string (stringValue) INITRANS 30; - -ALTER TABLE m_any_string -ADD CONSTRAINT fk_any_string -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus) INITRANS 30; - -CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus) INITRANS 30; - -ALTER TABLE m_assignment -ADD CONSTRAINT fk_assignment -FOREIGN KEY (id, oid) -REFERENCES m_container; - -ALTER TABLE m_assignment -ADD CONSTRAINT fk_assignment_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object; - -ALTER TABLE m_audit_delta -ADD CONSTRAINT fk_audit_delta -FOREIGN KEY (record_id) -REFERENCES m_audit_event; - -ALTER TABLE m_authorization -ADD CONSTRAINT fk_authorization -FOREIGN KEY (id, oid) -REFERENCES m_container; - -ALTER TABLE m_authorization -ADD CONSTRAINT fk_authorization_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object; - -ALTER TABLE m_authorization_action -ADD CONSTRAINT fk_authorization_action -FOREIGN KEY (role_id, role_oid) -REFERENCES m_authorization; - -CREATE INDEX iConnectorNameNorm ON m_connector (name_norm) INITRANS 30; - -CREATE INDEX iConnectorNameOrig ON m_connector (name_orig) INITRANS 30; - -ALTER TABLE m_connector -ADD CONSTRAINT fk_connector -FOREIGN KEY (id, oid) -REFERENCES m_object; - -CREATE INDEX iConnectorHostName ON m_connector_host (name_orig) INITRANS 30; - -ALTER TABLE m_connector_host -ADD CONSTRAINT fk_connector_host -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_connector_target_system -ADD CONSTRAINT fk_connector_target_system -FOREIGN KEY (connector_id, connector_oid) -REFERENCES m_connector; - -ALTER TABLE m_exclusion -ADD CONSTRAINT fk_exclusion -FOREIGN KEY (id, oid) -REFERENCES m_container; - -ALTER TABLE m_exclusion -ADD CONSTRAINT fk_exclusion_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object; - -CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus) INITRANS 30; - -CREATE INDEX iFocusEffective ON m_focus (effectiveStatus) INITRANS 30; - -ALTER TABLE m_focus -ADD CONSTRAINT fk_focus -FOREIGN KEY (id, oid) -REFERENCES m_object; - -CREATE INDEX iGenericObjectName ON m_generic_object (name_orig) INITRANS 30; - -ALTER TABLE m_generic_object -ADD CONSTRAINT fk_generic_object -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_metadata -ADD CONSTRAINT fk_metadata_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_container; - -CREATE INDEX iNodeName ON m_node (name_orig) INITRANS 30; - -ALTER TABLE m_node -ADD CONSTRAINT fk_node -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_object -ADD CONSTRAINT fk_object -FOREIGN KEY (id, oid) -REFERENCES m_container; - -CREATE INDEX iObjectTemplate ON m_object_template (name_orig) INITRANS 30; - -ALTER TABLE m_object_template -ADD CONSTRAINT fk_object_template -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_operation_result -ADD CONSTRAINT fk_result_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object; - -CREATE INDEX iOrgName ON m_org (name_orig) INITRANS 30; - -ALTER TABLE m_org -ADD CONSTRAINT fk_org -FOREIGN KEY (id, oid) -REFERENCES m_abstract_role; - -ALTER TABLE m_org_closure -ADD CONSTRAINT fk_descendant -FOREIGN KEY (descendant_id, descendant_oid) -REFERENCES m_object; - -ALTER TABLE m_org_closure -ADD CONSTRAINT fk_ancestor -FOREIGN KEY (ancestor_id, ancestor_oid) -REFERENCES m_object; - -ALTER TABLE m_org_org_type -ADD CONSTRAINT fk_org_org_type -FOREIGN KEY (org_id, org_oid) -REFERENCES m_org; - -CREATE INDEX iReferenceTargetOid ON m_reference (targetOid) INITRANS 30; - -ALTER TABLE m_reference -ADD CONSTRAINT fk_reference_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_container; - -CREATE INDEX iResourceName ON m_resource (name_orig) INITRANS 30; - -ALTER TABLE m_resource -ADD CONSTRAINT fk_resource -FOREIGN KEY (id, oid) -REFERENCES m_object; - -CREATE INDEX iRoleName ON m_role (name_orig) INITRANS 30; - -ALTER TABLE m_role -ADD CONSTRAINT fk_role -FOREIGN KEY (id, oid) -REFERENCES m_abstract_role; - -CREATE INDEX iShadowNameOrig ON m_shadow (name_orig) INITRANS 30; - -CREATE INDEX iShadowDead ON m_shadow (dead) INITRANS 30; - -CREATE INDEX iShadowNameNorm ON m_shadow (name_norm) INITRANS 30; - -CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid) INITRANS 30; - -CREATE INDEX iShadowAdministrative ON m_shadow (administrativeStatus) INITRANS 30; - -CREATE INDEX iShadowEffective ON m_shadow (effectiveStatus) INITRANS 30; - -ALTER TABLE m_shadow -ADD CONSTRAINT fk_shadow -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_sync_situation_description -ADD CONSTRAINT fk_shadow_sync_situation -FOREIGN KEY (shadow_id, shadow_oid) -REFERENCES m_shadow; - -CREATE INDEX iSystemConfigurationName ON m_system_configuration (name_orig) INITRANS 30; - -ALTER TABLE m_system_configuration -ADD CONSTRAINT fk_system_configuration -FOREIGN KEY (id, oid) -REFERENCES m_object; - -CREATE INDEX iTaskNameNameNorm ON m_task (name_norm) INITRANS 30; - -CREATE INDEX iTaskNameOrig ON m_task (name_orig) INITRANS 30; - -ALTER TABLE m_task -ADD CONSTRAINT fk_task -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_task_dependent -ADD CONSTRAINT fk_task_dependent -FOREIGN KEY (task_id, task_oid) -REFERENCES m_task; - -CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue) INITRANS 30; - -ALTER TABLE m_trigger -ADD CONSTRAINT fk_trigger -FOREIGN KEY (id, oid) -REFERENCES m_container; - -ALTER TABLE m_trigger -ADD CONSTRAINT fk_trigger_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object; - -CREATE INDEX iFullName ON m_user (fullName_orig) INITRANS 30; - -CREATE INDEX iLocality ON m_user (locality_orig) INITRANS 30; - -CREATE INDEX iHonorificSuffix ON m_user (honorificSuffix_orig) INITRANS 30; - -CREATE INDEX iEmployeeNumber ON m_user (employeeNumber) INITRANS 30; - -CREATE INDEX iGivenName ON m_user (givenName_orig) INITRANS 30; - -CREATE INDEX iFamilyName ON m_user (familyName_orig) INITRANS 30; - -CREATE INDEX iAdditionalName ON m_user (additionalName_orig) INITRANS 30; - -CREATE INDEX iHonorificPrefix ON m_user (honorificPrefix_orig) INITRANS 30; - -CREATE INDEX iUserName ON m_user (name_orig) INITRANS 30; - -ALTER TABLE m_user -ADD CONSTRAINT fk_user -FOREIGN KEY (id, oid) -REFERENCES m_focus; - -ALTER TABLE m_user_employee_type -ADD CONSTRAINT fk_user_employee_type -FOREIGN KEY (user_id, user_oid) -REFERENCES m_user; - -ALTER TABLE m_user_organization -ADD CONSTRAINT fk_user_organization -FOREIGN KEY (user_id, user_oid) -REFERENCES m_user; - -ALTER TABLE m_user_organizational_unit -ADD CONSTRAINT fk_user_org_unit -FOREIGN KEY (user_id, user_oid) -REFERENCES m_user; - -CREATE INDEX iValuePolicy ON m_value_policy (name_orig) INITRANS 30; - -ALTER TABLE m_value_policy -ADD CONSTRAINT fk_value_policy -FOREIGN KEY (id, oid) -REFERENCES m_object; - -CREATE SEQUENCE hibernate_sequence START WITH 1 INCREMENT BY 1; \ No newline at end of file diff --git a/config/sql/midpoint/2.2/oracle/oracle-upgrade-2.2-to-2.2.1.sql b/config/sql/midpoint/2.2/oracle/oracle-upgrade-2.2-to-2.2.1.sql deleted file mode 100644 index b8bbbf5065f..00000000000 --- a/config/sql/midpoint/2.2/oracle/oracle-upgrade-2.2-to-2.2.1.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE INDEX iParent ON m_task (parent) INITRANS 30; - -ALTER TABLE m_sync_situation_description ADD fullFlag NUMBER(1, 0); -ALTER TABLE m_shadow ADD fullSynchronizationTimestamp TIMESTAMP; -ALTER TABLE m_task ADD expectedTotal NUMBER(19, 0); -ALTER TABLE m_assignment ADD disableReason VARCHAR2(255 CHAR); -ALTER TABLE m_focus ADD disableReason VARCHAR2(255 CHAR); -ALTER TABLE m_shadow ADD disableReason VARCHAR2(255 CHAR); -ALTER TABLE m_audit_delta ADD context CLOB; -ALTER TABLE m_audit_delta ADD returns CLOB; -ALTER TABLE m_operation_result ADD context CLOB; -ALTER TABLE m_operation_result ADD returns CLOB; - -CREATE INDEX iAncestorDepth ON m_org_closure (ancestor_id, ancestor_oid, depthValue) INITRANS 30; diff --git a/config/sql/midpoint/2.2/postgresql/postgresql-2.2.sql b/config/sql/midpoint/2.2/postgresql/postgresql-2.2.sql deleted file mode 100644 index 8eac994a4c6..00000000000 --- a/config/sql/midpoint/2.2/postgresql/postgresql-2.2.sql +++ /dev/null @@ -1,964 +0,0 @@ -CREATE TABLE m_abstract_role ( - approvalExpression TEXT, - approvalProcess VARCHAR(255), - approvalSchema TEXT, - automaticallyApproved TEXT, - requestable BOOLEAN, - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_account_shadow ( - accountType VARCHAR(255), - allowedIdmAdminGuiAccess BOOLEAN, - passwordXml TEXT, - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_any ( - owner_id INT8 NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - owner_type INT4 NOT NULL, - PRIMARY KEY (owner_id, owner_oid, owner_type) -); - -CREATE TABLE m_any_clob ( - checksum VARCHAR(32) NOT NULL, - name_namespace VARCHAR(255) NOT NULL, - name_localPart VARCHAR(100) NOT NULL, - anyContainer_owner_id INT8 NOT NULL, - anyContainer_owner_oid VARCHAR(36) NOT NULL, - anyContainer_owner_type INT4 NOT NULL, - type_namespace VARCHAR(255) NOT NULL, - type_localPart VARCHAR(100) NOT NULL, - dynamicDef BOOLEAN, - clobValue TEXT, - valueType INT4, - PRIMARY KEY (checksum, name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart) -); - -CREATE TABLE m_any_date ( - name_namespace VARCHAR(255) NOT NULL, - name_localPart VARCHAR(100) NOT NULL, - anyContainer_owner_id INT8 NOT NULL, - anyContainer_owner_oid VARCHAR(36) NOT NULL, - anyContainer_owner_type INT4 NOT NULL, - type_namespace VARCHAR(255) NOT NULL, - type_localPart VARCHAR(100) NOT NULL, - dateValue TIMESTAMP NOT NULL, - dynamicDef BOOLEAN, - valueType INT4, - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, dateValue) -); - -CREATE TABLE m_any_long ( - name_namespace VARCHAR(255) NOT NULL, - name_localPart VARCHAR(100) NOT NULL, - anyContainer_owner_id INT8 NOT NULL, - anyContainer_owner_oid VARCHAR(36) NOT NULL, - anyContainer_owner_type INT4 NOT NULL, - type_namespace VARCHAR(255) NOT NULL, - type_localPart VARCHAR(100) NOT NULL, - longValue INT8 NOT NULL, - dynamicDef BOOLEAN, - valueType INT4, - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, longValue) -); - -CREATE TABLE m_any_poly_string ( - name_namespace VARCHAR(255) NOT NULL, - name_localPart VARCHAR(100) NOT NULL, - anyContainer_owner_id INT8 NOT NULL, - anyContainer_owner_oid VARCHAR(36) NOT NULL, - anyContainer_owner_type INT4 NOT NULL, - type_namespace VARCHAR(255) NOT NULL, - type_localPart VARCHAR(100) NOT NULL, - orig VARCHAR(255) NOT NULL, - dynamicDef BOOLEAN, - norm VARCHAR(255), - valueType INT4, - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, orig) -); - -CREATE TABLE m_any_reference ( - name_namespace VARCHAR(255) NOT NULL, - name_localPart VARCHAR(100) NOT NULL, - anyContainer_owner_id INT8 NOT NULL, - anyContainer_owner_oid VARCHAR(36) NOT NULL, - anyContainer_owner_type INT4 NOT NULL, - type_namespace VARCHAR(255) NOT NULL, - type_localPart VARCHAR(100) NOT NULL, - targetoid VARCHAR(36) NOT NULL, - description TEXT, - dynamicDef BOOLEAN, - filter TEXT, - relation_namespace VARCHAR(255), - relation_localPart VARCHAR(100), - targetType INT4, - valueType INT4, - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, targetoid) -); - -CREATE TABLE m_any_string ( - name_namespace VARCHAR(255) NOT NULL, - name_localPart VARCHAR(100) NOT NULL, - anyContainer_owner_id INT8 NOT NULL, - anyContainer_owner_oid VARCHAR(36) NOT NULL, - anyContainer_owner_type INT4 NOT NULL, - type_namespace VARCHAR(255) NOT NULL, - type_localPart VARCHAR(100) NOT NULL, - stringValue VARCHAR(255) NOT NULL, - dynamicDef BOOLEAN, - valueType INT4, - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, stringValue) -); - -CREATE TABLE m_assignment ( - accountConstruction TEXT, - administrativeStatus INT4, - archiveTimestamp TIMESTAMP, - disableTimestamp TIMESTAMP, - effectiveStatus INT4, - enableTimestamp TIMESTAMP, - validFrom TIMESTAMP, - validTo TIMESTAMP, - validityChangeTimestamp TIMESTAMP, - validityStatus INT4, - assignmentOwner INT4, - construction TEXT, - description TEXT, - owner_id INT8 NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - targetRef_description TEXT, - targetRef_filter TEXT, - targetRef_relationLocalPart VARCHAR(100), - targetRef_relationNamespace VARCHAR(255), - targetRef_targetOid VARCHAR(36), - targetRef_type INT4, - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - extId INT8, - extOid VARCHAR(36), - extType INT4, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_audit_delta ( - checksum VARCHAR(32) NOT NULL, - record_id INT8 NOT NULL, - delta TEXT, - deltaOid VARCHAR(36), - deltaType INT4, - details TEXT, - localizedMessage TEXT, - message TEXT, - messageCode VARCHAR(255), - operation TEXT, - params TEXT, - partialResults TEXT, - status INT4, - token INT8, - PRIMARY KEY (checksum, record_id) -); - -CREATE TABLE m_audit_event ( - id INT8 NOT NULL, - channel VARCHAR(255), - eventIdentifier VARCHAR(255), - eventStage INT4, - eventType INT4, - hostIdentifier VARCHAR(255), - initiatorName VARCHAR(255), - initiatorOid VARCHAR(36), - message VARCHAR(1024), - outcome INT4, - parameter VARCHAR(255), - result VARCHAR(255), - sessionIdentifier VARCHAR(255), - targetName VARCHAR(255), - targetOid VARCHAR(36), - targetOwnerName VARCHAR(255), - targetOwnerOid VARCHAR(36), - targetType INT4, - taskIdentifier VARCHAR(255), - taskOID VARCHAR(255), - timestampValue TIMESTAMP, - PRIMARY KEY (id) -); - -CREATE TABLE m_authorization ( - decision INT4, - description TEXT, - owner_id INT8 NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_authorization_action ( - role_id INT8 NOT NULL, - role_oid VARCHAR(36) NOT NULL, - action VARCHAR(255) -); - -CREATE TABLE m_connector ( - connectorBundle VARCHAR(255), - connectorHostRef_description TEXT, - connectorHostRef_filter TEXT, - c16_relationLocalPart VARCHAR(100), - c16_relationNamespace VARCHAR(255), - connectorHostRef_targetOid VARCHAR(36), - connectorHostRef_type INT4, - connectorType VARCHAR(255), - connectorVersion VARCHAR(255), - framework VARCHAR(255), - name_norm VARCHAR(255), - name_orig VARCHAR(255), - namespace VARCHAR(255), - xmlSchema TEXT, - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_connector_host ( - hostname VARCHAR(255), - name_norm VARCHAR(255), - name_orig VARCHAR(255), - port VARCHAR(255), - protectConnection BOOLEAN, - sharedSecret TEXT, - timeout INT4, - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_connector_target_system ( - connector_id INT8 NOT NULL, - connector_oid VARCHAR(36) NOT NULL, - targetSystemType VARCHAR(255) -); - -CREATE TABLE m_container ( - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_exclusion ( - description TEXT, - owner_id INT8 NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - policy INT4, - targetRef_description TEXT, - targetRef_filter TEXT, - targetRef_relationLocalPart VARCHAR(100), - targetRef_relationNamespace VARCHAR(255), - targetRef_targetOid VARCHAR(36), - targetRef_type INT4, - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_focus ( - administrativeStatus INT4, - archiveTimestamp TIMESTAMP, - disableTimestamp TIMESTAMP, - effectiveStatus INT4, - enableTimestamp TIMESTAMP, - validFrom TIMESTAMP, - validTo TIMESTAMP, - validityChangeTimestamp TIMESTAMP, - validityStatus INT4, - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_generic_object ( - name_norm VARCHAR(255), - name_orig VARCHAR(255), - objectType VARCHAR(255), - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_metadata ( - owner_id INT8 NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - createChannel VARCHAR(255), - createTimestamp TIMESTAMP, - creatorRef_description TEXT, - creatorRef_filter TEXT, - creatorRef_relationLocalPart VARCHAR(100), - creatorRef_relationNamespace VARCHAR(255), - creatorRef_targetOid VARCHAR(36), - creatorRef_type INT4, - modifierRef_description TEXT, - modifierRef_filter TEXT, - modifierRef_relationLocalPart VARCHAR(100), - modifierRef_relationNamespace VARCHAR(255), - modifierRef_targetOid VARCHAR(36), - modifierRef_type INT4, - modifyChannel VARCHAR(255), - modifyTimestamp TIMESTAMP, - PRIMARY KEY (owner_id, owner_oid) -); - -CREATE TABLE m_node ( - clusteredNode BOOLEAN, - hostname VARCHAR(255), - internalNodeIdentifier VARCHAR(255), - jmxPort INT4, - lastCheckInTime TIMESTAMP, - name_norm VARCHAR(255), - name_orig VARCHAR(255), - nodeIdentifier VARCHAR(255), - running BOOLEAN, - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_object ( - description TEXT, - version INT8 NOT NULL, - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - extId INT8, - extOid VARCHAR(36), - extType INT4, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_object_template ( - accountConstruction TEXT, - mapping TEXT, - name_norm VARCHAR(255), - name_orig VARCHAR(255), - type INT4, - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_operation_result ( - owner_oid VARCHAR(36) NOT NULL, - owner_id INT8 NOT NULL, - details TEXT, - localizedMessage TEXT, - message TEXT, - messageCode VARCHAR(255), - operation TEXT, - params TEXT, - partialResults TEXT, - status INT4, - token INT8, - PRIMARY KEY (owner_oid, owner_id) -); - -CREATE TABLE m_org ( - costCenter VARCHAR(255), - displayName_norm VARCHAR(255), - displayName_orig VARCHAR(255), - identifier VARCHAR(255), - locality_norm VARCHAR(255), - locality_orig VARCHAR(255), - name_norm VARCHAR(255), - name_orig VARCHAR(255), - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_org_closure ( - id INT8 NOT NULL, - ancestor_id INT8, - ancestor_oid VARCHAR(36), - depthValue INT4, - descendant_id INT8, - descendant_oid VARCHAR(36), - PRIMARY KEY (id) -); - -CREATE TABLE m_org_incorrect ( - descendant_oid VARCHAR(36) NOT NULL, - descendant_id INT8 NOT NULL, - ancestor_oid VARCHAR(36) NOT NULL, - PRIMARY KEY (descendant_oid, descendant_id, ancestor_oid) -); - -CREATE TABLE m_org_org_type ( - org_id INT8 NOT NULL, - org_oid VARCHAR(36) NOT NULL, - orgType VARCHAR(255) -); - -CREATE TABLE m_reference ( - reference_type INT4 NOT NULL, - owner_id INT8 NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - relLocalPart VARCHAR(100) NOT NULL, - relNamespace VARCHAR(255) NOT NULL, - targetOid VARCHAR(36) NOT NULL, - description TEXT, - filter TEXT, - containerType INT4, - PRIMARY KEY (owner_id, owner_oid, relLocalPart, relNamespace, targetOid) -); - -CREATE TABLE m_resource ( - administrativeState INT4, - capabilities_cachingMetadata TEXT, - capabilities_configured TEXT, - capabilities_native TEXT, - configuration TEXT, - connectorRef_description TEXT, - connectorRef_filter TEXT, - connectorRef_relationLocalPart VARCHAR(100), - connectorRef_relationNamespace VARCHAR(255), - connectorRef_targetOid VARCHAR(36), - connectorRef_type INT4, - consistency TEXT, - name_norm VARCHAR(255), - name_orig VARCHAR(255), - namespace VARCHAR(255), - o16_lastAvailabilityStatus INT4, - projection TEXT, - schemaHandling TEXT, - scripts TEXT, - synchronization TEXT, - xmlSchema TEXT, - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_role ( - name_norm VARCHAR(255), - name_orig VARCHAR(255), - roleType VARCHAR(255), - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_shadow ( - administrativeStatus INT4, - archiveTimestamp TIMESTAMP, - disableTimestamp TIMESTAMP, - effectiveStatus INT4, - enableTimestamp TIMESTAMP, - validFrom TIMESTAMP, - validTo TIMESTAMP, - validityChangeTimestamp TIMESTAMP, - validityStatus INT4, - assigned BOOLEAN, - attemptNumber INT4, - dead BOOLEAN, - exist BOOLEAN, - failedOperationType INT4, - intent VARCHAR(255), - iteration INT4, - iterationToken VARCHAR(255), - kind INT4, - name_norm VARCHAR(255), - name_orig VARCHAR(255), - objectChange TEXT, - class_namespace VARCHAR(255), - class_localPart VARCHAR(100), - resourceRef_description TEXT, - resourceRef_filter TEXT, - resourceRef_relationLocalPart VARCHAR(100), - resourceRef_relationNamespace VARCHAR(255), - resourceRef_targetOid VARCHAR(36), - resourceRef_type INT4, - synchronizationSituation INT4, - synchronizationTimestamp TIMESTAMP, - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - attrId INT8, - attrOid VARCHAR(36), - attrType INT4, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_sync_situation_description ( - checksum VARCHAR(32) NOT NULL, - shadow_id INT8 NOT NULL, - shadow_oid VARCHAR(36) NOT NULL, - chanel VARCHAR(255), - situation INT4, - timestampValue TIMESTAMP, - PRIMARY KEY (checksum, shadow_id, shadow_oid) -); - -CREATE TABLE m_system_configuration ( - cleanupPolicy TEXT, - connectorFramework TEXT, - d22_description TEXT, - defaultUserTemplateRef_filter TEXT, - d22_relationLocalPart VARCHAR(100), - d22_relationNamespace VARCHAR(255), - d22_targetOid VARCHAR(36), - defaultUserTemplateRef_type INT4, - g36 TEXT, - g23_description TEXT, - globalPasswordPolicyRef_filter TEXT, - g23_relationLocalPart VARCHAR(100), - g23_relationNamespace VARCHAR(255), - g23_targetOid VARCHAR(36), - globalPasswordPolicyRef_type INT4, - logging TEXT, - modelHooks TEXT, - name_norm VARCHAR(255), - name_orig VARCHAR(255), - notificationConfiguration TEXT, - profilingConfiguration TEXT, - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_task ( - binding INT4, - canRunOnNode VARCHAR(255), - category VARCHAR(255), - completionTimestamp TIMESTAMP, - executionStatus INT4, - handlerUri VARCHAR(255), - lastRunFinishTimestamp TIMESTAMP, - lastRunStartTimestamp TIMESTAMP, - name_norm VARCHAR(255), - name_orig VARCHAR(255), - node VARCHAR(255), - objectRef_description TEXT, - objectRef_filter TEXT, - objectRef_relationLocalPart VARCHAR(100), - objectRef_relationNamespace VARCHAR(255), - objectRef_targetOid VARCHAR(36), - objectRef_type INT4, - otherHandlersUriStack TEXT, - ownerRef_description TEXT, - ownerRef_filter TEXT, - ownerRef_relationLocalPart VARCHAR(100), - ownerRef_relationNamespace VARCHAR(255), - ownerRef_targetOid VARCHAR(36), - ownerRef_type INT4, - parent VARCHAR(255), - progress INT8, - recurrence INT4, - resultStatus INT4, - schedule TEXT, - taskIdentifier VARCHAR(255), - threadStopAction INT4, - waitingReason INT4, - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_task_dependent ( - task_id INT8 NOT NULL, - task_oid VARCHAR(36) NOT NULL, - dependent VARCHAR(255) -); - -CREATE TABLE m_trigger ( - handlerUri VARCHAR(255), - owner_id INT8 NOT NULL, - owner_oid VARCHAR(36) NOT NULL, - timestampValue TIMESTAMP, - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_user ( - additionalName_norm VARCHAR(255), - additionalName_orig VARCHAR(255), - costCenter VARCHAR(255), - allowedIdmAdminGuiAccess BOOLEAN, - passwordXml TEXT, - emailAddress VARCHAR(255), - employeeNumber VARCHAR(255), - familyName_norm VARCHAR(255), - familyName_orig VARCHAR(255), - fullName_norm VARCHAR(255), - fullName_orig VARCHAR(255), - givenName_norm VARCHAR(255), - givenName_orig VARCHAR(255), - honorificPrefix_norm VARCHAR(255), - honorificPrefix_orig VARCHAR(255), - honorificSuffix_norm VARCHAR(255), - honorificSuffix_orig VARCHAR(255), - locale VARCHAR(255), - locality_norm VARCHAR(255), - locality_orig VARCHAR(255), - name_norm VARCHAR(255), - name_orig VARCHAR(255), - nickName_norm VARCHAR(255), - nickName_orig VARCHAR(255), - preferredLanguage VARCHAR(255), - telephoneNumber VARCHAR(255), - timezone VARCHAR(255), - title_norm VARCHAR(255), - title_orig VARCHAR(255), - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_user_employee_type ( - user_id INT8 NOT NULL, - user_oid VARCHAR(36) NOT NULL, - employeeType VARCHAR(255) -); - -CREATE TABLE m_user_organization ( - user_id INT8 NOT NULL, - user_oid VARCHAR(36) NOT NULL, - norm VARCHAR(255), - orig VARCHAR(255) -); - -CREATE TABLE m_user_organizational_unit ( - user_id INT8 NOT NULL, - user_oid VARCHAR(36) NOT NULL, - norm VARCHAR(255), - orig VARCHAR(255) -); - -CREATE TABLE m_value_policy ( - lifetime TEXT, - name_norm VARCHAR(255), - name_orig VARCHAR(255), - stringPolicy TEXT, - id INT8 NOT NULL, - oid VARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE INDEX iRequestable ON m_abstract_role (requestable); - -ALTER TABLE m_abstract_role -ADD CONSTRAINT fk_abstract_role -FOREIGN KEY (id, oid) -REFERENCES m_focus; - -ALTER TABLE m_account_shadow -ADD CONSTRAINT fk_account_shadow -FOREIGN KEY (id, oid) -REFERENCES m_shadow; - -ALTER TABLE m_any_clob -ADD CONSTRAINT fk_any_clob -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iDate ON m_any_date (dateValue); - -ALTER TABLE m_any_date -ADD CONSTRAINT fk_any_date -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iLong ON m_any_long (longValue); - -ALTER TABLE m_any_long -ADD CONSTRAINT fk_any_long -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iPolyString ON m_any_poly_string (orig); - -ALTER TABLE m_any_poly_string -ADD CONSTRAINT fk_any_poly_string -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iTargetOid ON m_any_reference (targetoid); - -ALTER TABLE m_any_reference -ADD CONSTRAINT fk_any_reference -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iString ON m_any_string (stringValue); - -ALTER TABLE m_any_string -ADD CONSTRAINT fk_any_string -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus); - -CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus); - -ALTER TABLE m_assignment -ADD CONSTRAINT fk_assignment -FOREIGN KEY (id, oid) -REFERENCES m_container; - -ALTER TABLE m_assignment -ADD CONSTRAINT fk_assignment_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object; - -ALTER TABLE m_audit_delta -ADD CONSTRAINT fk_audit_delta -FOREIGN KEY (record_id) -REFERENCES m_audit_event; - -ALTER TABLE m_authorization -ADD CONSTRAINT fk_authorization -FOREIGN KEY (id, oid) -REFERENCES m_container; - -ALTER TABLE m_authorization -ADD CONSTRAINT fk_authorization_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object; - -ALTER TABLE m_authorization_action -ADD CONSTRAINT fk_authorization_action -FOREIGN KEY (role_id, role_oid) -REFERENCES m_authorization; - -CREATE INDEX iConnectorNameNorm ON m_connector (name_norm); - -CREATE INDEX iConnectorNameOrig ON m_connector (name_orig); - -ALTER TABLE m_connector -ADD CONSTRAINT fk_connector -FOREIGN KEY (id, oid) -REFERENCES m_object; - -CREATE INDEX iConnectorHostName ON m_connector_host (name_orig); - -ALTER TABLE m_connector_host -ADD CONSTRAINT fk_connector_host -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_connector_target_system -ADD CONSTRAINT fk_connector_target_system -FOREIGN KEY (connector_id, connector_oid) -REFERENCES m_connector; - -ALTER TABLE m_exclusion -ADD CONSTRAINT fk_exclusion -FOREIGN KEY (id, oid) -REFERENCES m_container; - -ALTER TABLE m_exclusion -ADD CONSTRAINT fk_exclusion_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object; - -CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus); - -CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); - -ALTER TABLE m_focus -ADD CONSTRAINT fk_focus -FOREIGN KEY (id, oid) -REFERENCES m_object; - -CREATE INDEX iGenericObjectName ON m_generic_object (name_orig); - -ALTER TABLE m_generic_object -ADD CONSTRAINT fk_generic_object -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_metadata -ADD CONSTRAINT fk_metadata_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_container; - -CREATE INDEX iNodeName ON m_node (name_orig); - -ALTER TABLE m_node -ADD CONSTRAINT fk_node -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_object -ADD CONSTRAINT fk_object -FOREIGN KEY (id, oid) -REFERENCES m_container; - -CREATE INDEX iObjectTemplate ON m_object_template (name_orig); - -ALTER TABLE m_object_template -ADD CONSTRAINT fk_object_template -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_operation_result -ADD CONSTRAINT fk_result_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object; - -CREATE INDEX iOrgName ON m_org (name_orig); - -ALTER TABLE m_org -ADD CONSTRAINT fk_org -FOREIGN KEY (id, oid) -REFERENCES m_abstract_role; - -ALTER TABLE m_org_closure -ADD CONSTRAINT fk_descendant -FOREIGN KEY (descendant_id, descendant_oid) -REFERENCES m_object; - -ALTER TABLE m_org_closure -ADD CONSTRAINT fk_ancestor -FOREIGN KEY (ancestor_id, ancestor_oid) -REFERENCES m_object; - -ALTER TABLE m_org_org_type -ADD CONSTRAINT fk_org_org_type -FOREIGN KEY (org_id, org_oid) -REFERENCES m_org; - -CREATE INDEX iReferenceTargetOid ON m_reference (targetOid); - -ALTER TABLE m_reference -ADD CONSTRAINT fk_reference_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_container; - -CREATE INDEX iResourceName ON m_resource (name_orig); - -ALTER TABLE m_resource -ADD CONSTRAINT fk_resource -FOREIGN KEY (id, oid) -REFERENCES m_object; - -CREATE INDEX iRoleName ON m_role (name_orig); - -ALTER TABLE m_role -ADD CONSTRAINT fk_role -FOREIGN KEY (id, oid) -REFERENCES m_abstract_role; - -CREATE INDEX iShadowNameOrig ON m_shadow (name_orig); - -CREATE INDEX iShadowDead ON m_shadow (dead); - -CREATE INDEX iShadowNameNorm ON m_shadow (name_norm); - -CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid); - -CREATE INDEX iShadowAdministrative ON m_shadow (administrativeStatus); - -CREATE INDEX iShadowEffective ON m_shadow (effectiveStatus); - -ALTER TABLE m_shadow -ADD CONSTRAINT fk_shadow -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_sync_situation_description -ADD CONSTRAINT fk_shadow_sync_situation -FOREIGN KEY (shadow_id, shadow_oid) -REFERENCES m_shadow; - -CREATE INDEX iSystemConfigurationName ON m_system_configuration (name_orig); - -ALTER TABLE m_system_configuration -ADD CONSTRAINT fk_system_configuration -FOREIGN KEY (id, oid) -REFERENCES m_object; - -CREATE INDEX iTaskNameNameNorm ON m_task (name_norm); - -CREATE INDEX iTaskNameOrig ON m_task (name_orig); - -ALTER TABLE m_task -ADD CONSTRAINT fk_task -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_task_dependent -ADD CONSTRAINT fk_task_dependent -FOREIGN KEY (task_id, task_oid) -REFERENCES m_task; - -CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue); - -ALTER TABLE m_trigger -ADD CONSTRAINT fk_trigger -FOREIGN KEY (id, oid) -REFERENCES m_container; - -ALTER TABLE m_trigger -ADD CONSTRAINT fk_trigger_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object; - -CREATE INDEX iFullName ON m_user (fullName_orig); - -CREATE INDEX iLocality ON m_user (locality_orig); - -CREATE INDEX iHonorificSuffix ON m_user (honorificSuffix_orig); - -CREATE INDEX iEmployeeNumber ON m_user (employeeNumber); - -CREATE INDEX iGivenName ON m_user (givenName_orig); - -CREATE INDEX iFamilyName ON m_user (familyName_orig); - -CREATE INDEX iAdditionalName ON m_user (additionalName_orig); - -CREATE INDEX iHonorificPrefix ON m_user (honorificPrefix_orig); - -CREATE INDEX iUserName ON m_user (name_orig); - -ALTER TABLE m_user -ADD CONSTRAINT fk_user -FOREIGN KEY (id, oid) -REFERENCES m_focus; - -ALTER TABLE m_user_employee_type -ADD CONSTRAINT fk_user_employee_type -FOREIGN KEY (user_id, user_oid) -REFERENCES m_user; - -ALTER TABLE m_user_organization -ADD CONSTRAINT fk_user_organization -FOREIGN KEY (user_id, user_oid) -REFERENCES m_user; - -ALTER TABLE m_user_organizational_unit -ADD CONSTRAINT fk_user_org_unit -FOREIGN KEY (user_id, user_oid) -REFERENCES m_user; - -CREATE INDEX iValuePolicy ON m_value_policy (name_orig); - -ALTER TABLE m_value_policy -ADD CONSTRAINT fk_value_policy -FOREIGN KEY (id, oid) -REFERENCES m_object; - -CREATE SEQUENCE hibernate_sequence START 1 INCREMENT 1; \ No newline at end of file diff --git a/config/sql/midpoint/2.2/postgresql/postgresql-upgrade-2.2-to-2.2.1.sql b/config/sql/midpoint/2.2/postgresql/postgresql-upgrade-2.2-to-2.2.1.sql deleted file mode 100644 index 9b488369ec0..00000000000 --- a/config/sql/midpoint/2.2/postgresql/postgresql-upgrade-2.2-to-2.2.1.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE INDEX iParent ON m_task (parent); - -ALTER TABLE m_sync_situation_description ADD COLUMN fullFlag BOOLEAN; -ALTER TABLE m_shadow ADD COLUMN fullSynchronizationTimestamp TIMESTAMP; -ALTER TABLE m_task ADD COLUMN expectedTotal INT8; -ALTER TABLE m_assignment ADD disableReason VARCHAR(255); -ALTER TABLE m_focus ADD disableReason VARCHAR(255); -ALTER TABLE m_shadow ADD disableReason VARCHAR(255); -ALTER TABLE m_audit_delta ADD context TEXT; -ALTER TABLE m_audit_delta ADD returns TEXT; -ALTER TABLE m_operation_result ADD context TEXT; -ALTER TABLE m_operation_result ADD returns TEXT; - -CREATE INDEX iAncestorDepth ON m_org_closure (ancestor_id, ancestor_oid, depthValue); diff --git a/config/sql/midpoint/2.2/sqlserver/sqlserver-2.2.sql b/config/sql/midpoint/2.2/sqlserver/sqlserver-2.2.sql deleted file mode 100644 index 0f520996ece..00000000000 --- a/config/sql/midpoint/2.2/sqlserver/sqlserver-2.2.sql +++ /dev/null @@ -1,968 +0,0 @@ -CREATE TABLE m_abstract_role ( - approvalExpression NVARCHAR(MAX), - approvalProcess NVARCHAR(255), - approvalSchema NVARCHAR(MAX), - automaticallyApproved NVARCHAR(MAX), - requestable BIT, - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_account_shadow ( - accountType NVARCHAR(255), - allowedIdmAdminGuiAccess BIT, - passwordXml NVARCHAR(MAX), - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_any ( - owner_id BIGINT NOT NULL, - owner_oid NVARCHAR(36) NOT NULL, - owner_type INT NOT NULL, - PRIMARY KEY (owner_id, owner_oid, owner_type) -); - -CREATE TABLE m_any_clob ( - checksum NVARCHAR(32) NOT NULL, - name_namespace NVARCHAR(255) NOT NULL, - name_localPart NVARCHAR(100) NOT NULL, - anyContainer_owner_id BIGINT NOT NULL, - anyContainer_owner_oid NVARCHAR(36) NOT NULL, - anyContainer_owner_type INT NOT NULL, - type_namespace NVARCHAR(255) NOT NULL, - type_localPart NVARCHAR(100) NOT NULL, - dynamicDef BIT, - clobValue NVARCHAR(MAX), - valueType INT, - PRIMARY KEY (checksum, name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart) -); - -CREATE TABLE m_any_date ( - name_namespace NVARCHAR(255) NOT NULL, - name_localPart NVARCHAR(100) NOT NULL, - anyContainer_owner_id BIGINT NOT NULL, - anyContainer_owner_oid NVARCHAR(36) NOT NULL, - anyContainer_owner_type INT NOT NULL, - type_namespace NVARCHAR(255) NOT NULL, - type_localPart NVARCHAR(100) NOT NULL, - dateValue DATETIME2 NOT NULL, - dynamicDef BIT, - valueType INT, - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, dateValue) -); - -CREATE TABLE m_any_long ( - name_namespace NVARCHAR(255) NOT NULL, - name_localPart NVARCHAR(100) NOT NULL, - anyContainer_owner_id BIGINT NOT NULL, - anyContainer_owner_oid NVARCHAR(36) NOT NULL, - anyContainer_owner_type INT NOT NULL, - type_namespace NVARCHAR(255) NOT NULL, - type_localPart NVARCHAR(100) NOT NULL, - longValue BIGINT NOT NULL, - dynamicDef BIT, - valueType INT, - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, longValue) -); - -CREATE TABLE m_any_poly_string ( - name_namespace NVARCHAR(255) NOT NULL, - name_localPart NVARCHAR(100) NOT NULL, - anyContainer_owner_id BIGINT NOT NULL, - anyContainer_owner_oid NVARCHAR(36) NOT NULL, - anyContainer_owner_type INT NOT NULL, - type_namespace NVARCHAR(255) NOT NULL, - type_localPart NVARCHAR(100) NOT NULL, - orig NVARCHAR(255) NOT NULL, - dynamicDef BIT, - norm NVARCHAR(255), - valueType INT, - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, orig) -); - -CREATE TABLE m_any_reference ( - name_namespace NVARCHAR(255) NOT NULL, - name_localPart NVARCHAR(100) NOT NULL, - anyContainer_owner_id BIGINT NOT NULL, - anyContainer_owner_oid NVARCHAR(36) NOT NULL, - anyContainer_owner_type INT NOT NULL, - type_namespace NVARCHAR(255) NOT NULL, - type_localPart NVARCHAR(100) NOT NULL, - targetoid NVARCHAR(36) NOT NULL, - description NVARCHAR(MAX), - dynamicDef BIT, - filter NVARCHAR(MAX), - relation_namespace NVARCHAR(255), - relation_localPart NVARCHAR(100), - targetType INT, - valueType INT, - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, targetoid) -); - -CREATE TABLE m_any_string ( - name_namespace NVARCHAR(255) NOT NULL, - name_localPart NVARCHAR(100) NOT NULL, - anyContainer_owner_id BIGINT NOT NULL, - anyContainer_owner_oid NVARCHAR(36) NOT NULL, - anyContainer_owner_type INT NOT NULL, - type_namespace NVARCHAR(255) NOT NULL, - type_localPart NVARCHAR(100) NOT NULL, - stringValue NVARCHAR(255) NOT NULL, - dynamicDef BIT, - valueType INT, - PRIMARY KEY (name_namespace, name_localPart, anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type, type_namespace, type_localPart, stringValue) -); - -CREATE TABLE m_assignment ( - accountConstruction NVARCHAR(MAX), - administrativeStatus INT, - archiveTimestamp DATETIME2, - disableTimestamp DATETIME2, - effectiveStatus INT, - enableTimestamp DATETIME2, - validFrom DATETIME2, - validTo DATETIME2, - validityChangeTimestamp DATETIME2, - validityStatus INT, - assignmentOwner INT, - construction NVARCHAR(MAX), - description NVARCHAR(MAX), - owner_id BIGINT NOT NULL, - owner_oid NVARCHAR(36) NOT NULL, - targetRef_description NVARCHAR(MAX), - targetRef_filter NVARCHAR(MAX), - targetRef_relationLocalPart NVARCHAR(100), - targetRef_relationNamespace NVARCHAR(255), - targetRef_targetOid NVARCHAR(36), - targetRef_type INT, - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - extId BIGINT, - extOid NVARCHAR(36), - extType INT, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_audit_delta ( - checksum NVARCHAR(32) NOT NULL, - record_id BIGINT NOT NULL, - delta NVARCHAR(MAX), - deltaOid NVARCHAR(36), - deltaType INT, - details NVARCHAR(MAX), - localizedMessage NVARCHAR(MAX), - message NVARCHAR(MAX), - messageCode NVARCHAR(255), - operation NVARCHAR(MAX), - params NVARCHAR(MAX), - partialResults NVARCHAR(MAX), - status INT, - token BIGINT, - PRIMARY KEY (checksum, record_id) -); - -CREATE TABLE m_audit_event ( - id BIGINT NOT NULL, - channel NVARCHAR(255), - eventIdentifier NVARCHAR(255), - eventStage INT, - eventType INT, - hostIdentifier NVARCHAR(255), - initiatorName NVARCHAR(255), - initiatorOid NVARCHAR(36), - message NVARCHAR(1024), - outcome INT, - parameter NVARCHAR(255), - result NVARCHAR(255), - sessionIdentifier NVARCHAR(255), - targetName NVARCHAR(255), - targetOid NVARCHAR(36), - targetOwnerName NVARCHAR(255), - targetOwnerOid NVARCHAR(36), - targetType INT, - taskIdentifier NVARCHAR(255), - taskOID NVARCHAR(255), - timestampValue DATETIME2, - PRIMARY KEY (id) -); - -CREATE TABLE m_authorization ( - decision INT, - description NVARCHAR(MAX), - owner_id BIGINT NOT NULL, - owner_oid NVARCHAR(36) NOT NULL, - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_authorization_action ( - role_id BIGINT NOT NULL, - role_oid NVARCHAR(36) NOT NULL, - action NVARCHAR(255) -); - -CREATE TABLE m_connector ( - connectorBundle NVARCHAR(255), - connectorHostRef_description NVARCHAR(MAX), - connectorHostRef_filter NVARCHAR(MAX), - c16_relationLocalPart NVARCHAR(100), - c16_relationNamespace NVARCHAR(255), - connectorHostRef_targetOid NVARCHAR(36), - connectorHostRef_type INT, - connectorType NVARCHAR(255), - connectorVersion NVARCHAR(255), - framework NVARCHAR(255), - name_norm NVARCHAR(255), - name_orig NVARCHAR(255), - namespace NVARCHAR(255), - xmlSchema NVARCHAR(MAX), - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_connector_host ( - hostname NVARCHAR(255), - name_norm NVARCHAR(255), - name_orig NVARCHAR(255), - port NVARCHAR(255), - protectConnection BIT, - sharedSecret NVARCHAR(MAX), - timeout INT, - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_connector_target_system ( - connector_id BIGINT NOT NULL, - connector_oid NVARCHAR(36) NOT NULL, - targetSystemType NVARCHAR(255) -); - -CREATE TABLE m_container ( - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_exclusion ( - description NVARCHAR(MAX), - owner_id BIGINT NOT NULL, - owner_oid NVARCHAR(36) NOT NULL, - policy INT, - targetRef_description NVARCHAR(MAX), - targetRef_filter NVARCHAR(MAX), - targetRef_relationLocalPart NVARCHAR(100), - targetRef_relationNamespace NVARCHAR(255), - targetRef_targetOid NVARCHAR(36), - targetRef_type INT, - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_focus ( - administrativeStatus INT, - archiveTimestamp DATETIME2, - disableTimestamp DATETIME2, - effectiveStatus INT, - enableTimestamp DATETIME2, - validFrom DATETIME2, - validTo DATETIME2, - validityChangeTimestamp DATETIME2, - validityStatus INT, - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_generic_object ( - name_norm NVARCHAR(255), - name_orig NVARCHAR(255), - objectType NVARCHAR(255), - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_metadata ( - owner_id BIGINT NOT NULL, - owner_oid NVARCHAR(36) NOT NULL, - createChannel NVARCHAR(255), - createTimestamp DATETIME2, - creatorRef_description NVARCHAR(MAX), - creatorRef_filter NVARCHAR(MAX), - creatorRef_relationLocalPart NVARCHAR(100), - creatorRef_relationNamespace NVARCHAR(255), - creatorRef_targetOid NVARCHAR(36), - creatorRef_type INT, - modifierRef_description NVARCHAR(MAX), - modifierRef_filter NVARCHAR(MAX), - modifierRef_relationLocalPart NVARCHAR(100), - modifierRef_relationNamespace NVARCHAR(255), - modifierRef_targetOid NVARCHAR(36), - modifierRef_type INT, - modifyChannel NVARCHAR(255), - modifyTimestamp DATETIME2, - PRIMARY KEY (owner_id, owner_oid) -); - -CREATE TABLE m_node ( - clusteredNode BIT, - hostname NVARCHAR(255), - internalNodeIdentifier NVARCHAR(255), - jmxPort INT, - lastCheckInTime DATETIME2, - name_norm NVARCHAR(255), - name_orig NVARCHAR(255), - nodeIdentifier NVARCHAR(255), - running BIT, - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_object ( - description NVARCHAR(MAX), - version BIGINT NOT NULL, - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - extId BIGINT, - extOid NVARCHAR(36), - extType INT, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_object_template ( - accountConstruction NVARCHAR(MAX), - mapping NVARCHAR(MAX), - name_norm NVARCHAR(255), - name_orig NVARCHAR(255), - type INT, - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_operation_result ( - owner_oid NVARCHAR(36) NOT NULL, - owner_id BIGINT NOT NULL, - details NVARCHAR(MAX), - localizedMessage NVARCHAR(MAX), - message NVARCHAR(MAX), - messageCode NVARCHAR(255), - operation NVARCHAR(MAX), - params NVARCHAR(MAX), - partialResults NVARCHAR(MAX), - status INT, - token BIGINT, - PRIMARY KEY (owner_oid, owner_id) -); - -CREATE TABLE m_org ( - costCenter NVARCHAR(255), - displayName_norm NVARCHAR(255), - displayName_orig NVARCHAR(255), - identifier NVARCHAR(255), - locality_norm NVARCHAR(255), - locality_orig NVARCHAR(255), - name_norm NVARCHAR(255), - name_orig NVARCHAR(255), - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_org_closure ( - id BIGINT NOT NULL, - ancestor_id BIGINT, - ancestor_oid NVARCHAR(36), - depthValue INT, - descendant_id BIGINT, - descendant_oid NVARCHAR(36), - PRIMARY KEY (id) -); - -CREATE TABLE m_org_incorrect ( - descendant_oid NVARCHAR(36) NOT NULL, - descendant_id BIGINT NOT NULL, - ancestor_oid NVARCHAR(36) NOT NULL, - PRIMARY KEY (descendant_oid, descendant_id, ancestor_oid) -); - -CREATE TABLE m_org_org_type ( - org_id BIGINT NOT NULL, - org_oid NVARCHAR(36) NOT NULL, - orgType NVARCHAR(255) -); - -CREATE TABLE m_reference ( - reference_type INT NOT NULL, - owner_id BIGINT NOT NULL, - owner_oid NVARCHAR(36) NOT NULL, - relLocalPart NVARCHAR(100) NOT NULL, - relNamespace NVARCHAR(255) NOT NULL, - targetOid NVARCHAR(36) NOT NULL, - description NVARCHAR(MAX), - filter NVARCHAR(MAX), - containerType INT, - PRIMARY KEY (owner_id, owner_oid, relLocalPart, relNamespace, targetOid) -); - -CREATE TABLE m_resource ( - administrativeState INT, - capabilities_cachingMetadata NVARCHAR(MAX), - capabilities_configured NVARCHAR(MAX), - capabilities_native NVARCHAR(MAX), - configuration NVARCHAR(MAX), - connectorRef_description NVARCHAR(MAX), - connectorRef_filter NVARCHAR(MAX), - connectorRef_relationLocalPart NVARCHAR(100), - connectorRef_relationNamespace NVARCHAR(255), - connectorRef_targetOid NVARCHAR(36), - connectorRef_type INT, - consistency NVARCHAR(MAX), - name_norm NVARCHAR(255), - name_orig NVARCHAR(255), - namespace NVARCHAR(255), - o16_lastAvailabilityStatus INT, - projection NVARCHAR(MAX), - schemaHandling NVARCHAR(MAX), - scripts NVARCHAR(MAX), - synchronization NVARCHAR(MAX), - xmlSchema NVARCHAR(MAX), - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_role ( - name_norm NVARCHAR(255), - name_orig NVARCHAR(255), - roleType NVARCHAR(255), - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_shadow ( - administrativeStatus INT, - archiveTimestamp DATETIME2, - disableTimestamp DATETIME2, - effectiveStatus INT, - enableTimestamp DATETIME2, - validFrom DATETIME2, - validTo DATETIME2, - validityChangeTimestamp DATETIME2, - validityStatus INT, - assigned BIT, - attemptNumber INT, - dead BIT, - exist BIT, - failedOperationType INT, - intent NVARCHAR(255), - iteration INT, - iterationToken NVARCHAR(255), - kind INT, - name_norm NVARCHAR(255), - name_orig NVARCHAR(255), - objectChange NVARCHAR(MAX), - class_namespace NVARCHAR(255), - class_localPart NVARCHAR(100), - resourceRef_description NVARCHAR(MAX), - resourceRef_filter NVARCHAR(MAX), - resourceRef_relationLocalPart NVARCHAR(100), - resourceRef_relationNamespace NVARCHAR(255), - resourceRef_targetOid NVARCHAR(36), - resourceRef_type INT, - synchronizationSituation INT, - synchronizationTimestamp DATETIME2, - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - attrId BIGINT, - attrOid NVARCHAR(36), - attrType INT, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_sync_situation_description ( - checksum NVARCHAR(32) NOT NULL, - shadow_id BIGINT NOT NULL, - shadow_oid NVARCHAR(36) NOT NULL, - chanel NVARCHAR(255), - situation INT, - timestampValue DATETIME2, - PRIMARY KEY (checksum, shadow_id, shadow_oid) -); - -CREATE TABLE m_system_configuration ( - cleanupPolicy NVARCHAR(MAX), - connectorFramework NVARCHAR(MAX), - d22_description NVARCHAR(MAX), - defaultUserTemplateRef_filter NVARCHAR(MAX), - d22_relationLocalPart NVARCHAR(100), - d22_relationNamespace NVARCHAR(255), - d22_targetOid NVARCHAR(36), - defaultUserTemplateRef_type INT, - g36 NVARCHAR(MAX), - g23_description NVARCHAR(MAX), - globalPasswordPolicyRef_filter NVARCHAR(MAX), - g23_relationLocalPart NVARCHAR(100), - g23_relationNamespace NVARCHAR(255), - g23_targetOid NVARCHAR(36), - globalPasswordPolicyRef_type INT, - logging NVARCHAR(MAX), - modelHooks NVARCHAR(MAX), - name_norm NVARCHAR(255), - name_orig NVARCHAR(255), - notificationConfiguration NVARCHAR(MAX), - profilingConfiguration NVARCHAR(MAX), - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_task ( - binding INT, - canRunOnNode NVARCHAR(255), - category NVARCHAR(255), - completionTimestamp DATETIME2, - executionStatus INT, - handlerUri NVARCHAR(255), - lastRunFinishTimestamp DATETIME2, - lastRunStartTimestamp DATETIME2, - name_norm NVARCHAR(255), - name_orig NVARCHAR(255), - node NVARCHAR(255), - objectRef_description NVARCHAR(MAX), - objectRef_filter NVARCHAR(MAX), - objectRef_relationLocalPart NVARCHAR(100), - objectRef_relationNamespace NVARCHAR(255), - objectRef_targetOid NVARCHAR(36), - objectRef_type INT, - otherHandlersUriStack NVARCHAR(MAX), - ownerRef_description NVARCHAR(MAX), - ownerRef_filter NVARCHAR(MAX), - ownerRef_relationLocalPart NVARCHAR(100), - ownerRef_relationNamespace NVARCHAR(255), - ownerRef_targetOid NVARCHAR(36), - ownerRef_type INT, - parent NVARCHAR(255), - progress BIGINT, - recurrence INT, - resultStatus INT, - schedule NVARCHAR(MAX), - taskIdentifier NVARCHAR(255), - threadStopAction INT, - waitingReason INT, - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_task_dependent ( - task_id BIGINT NOT NULL, - task_oid NVARCHAR(36) NOT NULL, - dependent NVARCHAR(255) -); - -CREATE TABLE m_trigger ( - handlerUri NVARCHAR(255), - owner_id BIGINT NOT NULL, - owner_oid NVARCHAR(36) NOT NULL, - timestampValue DATETIME2, - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid) -); - -CREATE TABLE m_user ( - additionalName_norm NVARCHAR(255), - additionalName_orig NVARCHAR(255), - costCenter NVARCHAR(255), - allowedIdmAdminGuiAccess BIT, - passwordXml NVARCHAR(MAX), - emailAddress NVARCHAR(255), - employeeNumber NVARCHAR(255), - familyName_norm NVARCHAR(255), - familyName_orig NVARCHAR(255), - fullName_norm NVARCHAR(255), - fullName_orig NVARCHAR(255), - givenName_norm NVARCHAR(255), - givenName_orig NVARCHAR(255), - honorificPrefix_norm NVARCHAR(255), - honorificPrefix_orig NVARCHAR(255), - honorificSuffix_norm NVARCHAR(255), - honorificSuffix_orig NVARCHAR(255), - locale NVARCHAR(255), - locality_norm NVARCHAR(255), - locality_orig NVARCHAR(255), - name_norm NVARCHAR(255), - name_orig NVARCHAR(255), - nickName_norm NVARCHAR(255), - nickName_orig NVARCHAR(255), - preferredLanguage NVARCHAR(255), - telephoneNumber NVARCHAR(255), - timezone NVARCHAR(255), - title_norm NVARCHAR(255), - title_orig NVARCHAR(255), - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE TABLE m_user_employee_type ( - user_id BIGINT NOT NULL, - user_oid NVARCHAR(36) NOT NULL, - employeeType NVARCHAR(255) -); - -CREATE TABLE m_user_organization ( - user_id BIGINT NOT NULL, - user_oid NVARCHAR(36) NOT NULL, - norm NVARCHAR(255), - orig NVARCHAR(255) -); - -CREATE TABLE m_user_organizational_unit ( - user_id BIGINT NOT NULL, - user_oid NVARCHAR(36) NOT NULL, - norm NVARCHAR(255), - orig NVARCHAR(255) -); - -CREATE TABLE m_value_policy ( - lifetime NVARCHAR(MAX), - name_norm NVARCHAR(255), - name_orig NVARCHAR(255), - stringPolicy NVARCHAR(MAX), - id BIGINT NOT NULL, - oid NVARCHAR(36) NOT NULL, - PRIMARY KEY (id, oid), - UNIQUE (name_norm) -); - -CREATE INDEX iRequestable ON m_abstract_role (requestable); - -ALTER TABLE m_abstract_role -ADD CONSTRAINT fk_abstract_role -FOREIGN KEY (id, oid) -REFERENCES m_focus; - -ALTER TABLE m_account_shadow -ADD CONSTRAINT fk_account_shadow -FOREIGN KEY (id, oid) -REFERENCES m_shadow; - -ALTER TABLE m_any_clob -ADD CONSTRAINT fk_any_clob -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iDate ON m_any_date (dateValue); - -ALTER TABLE m_any_date -ADD CONSTRAINT fk_any_date -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iLong ON m_any_long (longValue); - -ALTER TABLE m_any_long -ADD CONSTRAINT fk_any_long -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iPolyString ON m_any_poly_string (orig); - -ALTER TABLE m_any_poly_string -ADD CONSTRAINT fk_any_poly_string -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iTargetOid ON m_any_reference (targetoid); - -ALTER TABLE m_any_reference -ADD CONSTRAINT fk_any_reference -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iString ON m_any_string (stringValue); - -ALTER TABLE m_any_string -ADD CONSTRAINT fk_any_string -FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_oid, anyContainer_owner_type) -REFERENCES m_any; - -CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus); - -CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus); - -ALTER TABLE m_assignment -ADD CONSTRAINT fk_assignment -FOREIGN KEY (id, oid) -REFERENCES m_container; - -ALTER TABLE m_assignment -ADD CONSTRAINT fk_assignment_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object; - -ALTER TABLE m_audit_delta -ADD CONSTRAINT fk_audit_delta -FOREIGN KEY (record_id) -REFERENCES m_audit_event; - -ALTER TABLE m_authorization -ADD CONSTRAINT fk_authorization -FOREIGN KEY (id, oid) -REFERENCES m_container; - -ALTER TABLE m_authorization -ADD CONSTRAINT fk_authorization_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object; - -ALTER TABLE m_authorization_action -ADD CONSTRAINT fk_authorization_action -FOREIGN KEY (role_id, role_oid) -REFERENCES m_authorization; - -CREATE INDEX iConnectorNameNorm ON m_connector (name_norm); - -CREATE INDEX iConnectorNameOrig ON m_connector (name_orig); - -ALTER TABLE m_connector -ADD CONSTRAINT fk_connector -FOREIGN KEY (id, oid) -REFERENCES m_object; - -CREATE INDEX iConnectorHostName ON m_connector_host (name_orig); - -ALTER TABLE m_connector_host -ADD CONSTRAINT fk_connector_host -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_connector_target_system -ADD CONSTRAINT fk_connector_target_system -FOREIGN KEY (connector_id, connector_oid) -REFERENCES m_connector; - -ALTER TABLE m_exclusion -ADD CONSTRAINT fk_exclusion -FOREIGN KEY (id, oid) -REFERENCES m_container; - -ALTER TABLE m_exclusion -ADD CONSTRAINT fk_exclusion_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object; - -CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus); - -CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); - -ALTER TABLE m_focus -ADD CONSTRAINT fk_focus -FOREIGN KEY (id, oid) -REFERENCES m_object; - -CREATE INDEX iGenericObjectName ON m_generic_object (name_orig); - -ALTER TABLE m_generic_object -ADD CONSTRAINT fk_generic_object -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_metadata -ADD CONSTRAINT fk_metadata_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_container; - -CREATE INDEX iNodeName ON m_node (name_orig); - -ALTER TABLE m_node -ADD CONSTRAINT fk_node -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_object -ADD CONSTRAINT fk_object -FOREIGN KEY (id, oid) -REFERENCES m_container; - -CREATE INDEX iObjectTemplate ON m_object_template (name_orig); - -ALTER TABLE m_object_template -ADD CONSTRAINT fk_object_template -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_operation_result -ADD CONSTRAINT fk_result_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object; - -CREATE INDEX iOrgName ON m_org (name_orig); - -ALTER TABLE m_org -ADD CONSTRAINT fk_org -FOREIGN KEY (id, oid) -REFERENCES m_abstract_role; - -ALTER TABLE m_org_closure -ADD CONSTRAINT fk_descendant -FOREIGN KEY (descendant_id, descendant_oid) -REFERENCES m_object; - -ALTER TABLE m_org_closure -ADD CONSTRAINT fk_ancestor -FOREIGN KEY (ancestor_id, ancestor_oid) -REFERENCES m_object; - -ALTER TABLE m_org_org_type -ADD CONSTRAINT fk_org_org_type -FOREIGN KEY (org_id, org_oid) -REFERENCES m_org; - -CREATE INDEX iReferenceTargetOid ON m_reference (targetOid); - -ALTER TABLE m_reference -ADD CONSTRAINT fk_reference_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_container; - -CREATE INDEX iResourceName ON m_resource (name_orig); - -ALTER TABLE m_resource -ADD CONSTRAINT fk_resource -FOREIGN KEY (id, oid) -REFERENCES m_object; - -CREATE INDEX iRoleName ON m_role (name_orig); - -ALTER TABLE m_role -ADD CONSTRAINT fk_role -FOREIGN KEY (id, oid) -REFERENCES m_abstract_role; - -CREATE INDEX iShadowNameOrig ON m_shadow (name_orig); - -CREATE INDEX iShadowDead ON m_shadow (dead); - -CREATE INDEX iShadowNameNorm ON m_shadow (name_norm); - -CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid); - -CREATE INDEX iShadowAdministrative ON m_shadow (administrativeStatus); - -CREATE INDEX iShadowEffective ON m_shadow (effectiveStatus); - -ALTER TABLE m_shadow -ADD CONSTRAINT fk_shadow -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_sync_situation_description -ADD CONSTRAINT fk_shadow_sync_situation -FOREIGN KEY (shadow_id, shadow_oid) -REFERENCES m_shadow; - -CREATE INDEX iSystemConfigurationName ON m_system_configuration (name_orig); - -ALTER TABLE m_system_configuration -ADD CONSTRAINT fk_system_configuration -FOREIGN KEY (id, oid) -REFERENCES m_object; - -CREATE INDEX iTaskNameNameNorm ON m_task (name_norm); - -CREATE INDEX iTaskNameOrig ON m_task (name_orig); - -ALTER TABLE m_task -ADD CONSTRAINT fk_task -FOREIGN KEY (id, oid) -REFERENCES m_object; - -ALTER TABLE m_task_dependent -ADD CONSTRAINT fk_task_dependent -FOREIGN KEY (task_id, task_oid) -REFERENCES m_task; - -CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue); - -ALTER TABLE m_trigger -ADD CONSTRAINT fk_trigger -FOREIGN KEY (id, oid) -REFERENCES m_container; - -ALTER TABLE m_trigger -ADD CONSTRAINT fk_trigger_owner -FOREIGN KEY (owner_id, owner_oid) -REFERENCES m_object; - -CREATE INDEX iFullName ON m_user (fullName_orig); - -CREATE INDEX iLocality ON m_user (locality_orig); - -CREATE INDEX iHonorificSuffix ON m_user (honorificSuffix_orig); - -CREATE INDEX iEmployeeNumber ON m_user (employeeNumber); - -CREATE INDEX iGivenName ON m_user (givenName_orig); - -CREATE INDEX iFamilyName ON m_user (familyName_orig); - -CREATE INDEX iAdditionalName ON m_user (additionalName_orig); - -CREATE INDEX iHonorificPrefix ON m_user (honorificPrefix_orig); - -CREATE INDEX iUserName ON m_user (name_orig); - -ALTER TABLE m_user -ADD CONSTRAINT fk_user -FOREIGN KEY (id, oid) -REFERENCES m_focus; - -ALTER TABLE m_user_employee_type -ADD CONSTRAINT fk_user_employee_type -FOREIGN KEY (user_id, user_oid) -REFERENCES m_user; - -ALTER TABLE m_user_organization -ADD CONSTRAINT fk_user_organization -FOREIGN KEY (user_id, user_oid) -REFERENCES m_user; - -ALTER TABLE m_user_organizational_unit -ADD CONSTRAINT fk_user_org_unit -FOREIGN KEY (user_id, user_oid) -REFERENCES m_user; - -CREATE INDEX iValuePolicy ON m_value_policy (name_orig); - -ALTER TABLE m_value_policy -ADD CONSTRAINT fk_value_policy -FOREIGN KEY (id, oid) -REFERENCES m_object; - -CREATE TABLE hibernate_sequence ( - next_val BIGINT -); - -INSERT INTO hibernate_sequence VALUES (1); \ No newline at end of file diff --git a/config/sql/midpoint/2.2/sqlserver/sqlserver-upgrade-2.2-to-2.2.1.sql b/config/sql/midpoint/2.2/sqlserver/sqlserver-upgrade-2.2-to-2.2.1.sql deleted file mode 100644 index 5d4dfa1e53c..00000000000 --- a/config/sql/midpoint/2.2/sqlserver/sqlserver-upgrade-2.2-to-2.2.1.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE INDEX iParent ON m_task (parent); - -ALTER TABLE m_sync_situation_description ADD fullFlag BIT; -ALTER TABLE m_shadow ADD fullSynchronizationTimestamp DATETIME2; -ALTER TABLE m_task ADD expectedTotal BIGINT; -ALTER TABLE m_assignment ADD disableReason NVARCHAR(255); -ALTER TABLE m_focus ADD disableReason NVARCHAR(255); -ALTER TABLE m_shadow ADD disableReason NVARCHAR(255); -ALTER TABLE m_audit_delta ADD context NVARCHAR(MAX); -ALTER TABLE m_audit_delta ADD returns NVARCHAR(MAX); -ALTER TABLE m_operation_result ADD context NVARCHAR(MAX); -ALTER TABLE m_operation_result ADD returns NVARCHAR(MAX); - - -CREATE INDEX iAncestorDepth ON m_org_closure (ancestor_id, ancestor_oid, depthValue); diff --git a/config/sql/midpoint/3.0/h2/h2-3.0-closure-upgrade.sql b/config/sql/midpoint/3.1/h2/h2-3.1-closure-upgrade.sql similarity index 100% rename from config/sql/midpoint/3.0/h2/h2-3.0-closure-upgrade.sql rename to config/sql/midpoint/3.1/h2/h2-3.1-closure-upgrade.sql diff --git a/config/sql/midpoint/3.0/h2/h2-3.0.sql b/config/sql/midpoint/3.1/h2/h2-3.1.sql similarity index 100% rename from config/sql/midpoint/3.0/h2/h2-3.0.sql rename to config/sql/midpoint/3.1/h2/h2-3.1.sql diff --git a/config/sql/midpoint/3.0/mysql/mysql-3.0-closure-upgrade.sql b/config/sql/midpoint/3.1/mysql/mysql-3.1-closure-upgrade.sql similarity index 100% rename from config/sql/midpoint/3.0/mysql/mysql-3.0-closure-upgrade.sql rename to config/sql/midpoint/3.1/mysql/mysql-3.1-closure-upgrade.sql diff --git a/config/sql/midpoint/3.0/mysql/mysql-3.0.sql b/config/sql/midpoint/3.1/mysql/mysql-3.1.sql similarity index 100% rename from config/sql/midpoint/3.0/mysql/mysql-3.0.sql rename to config/sql/midpoint/3.1/mysql/mysql-3.1.sql diff --git a/config/sql/midpoint/3.0/oracle/oracle-3.0-closure-upgrade.sql b/config/sql/midpoint/3.1/oracle/oracle-3.1-closure-upgrade.sql similarity index 100% rename from config/sql/midpoint/3.0/oracle/oracle-3.0-closure-upgrade.sql rename to config/sql/midpoint/3.1/oracle/oracle-3.1-closure-upgrade.sql diff --git a/config/sql/midpoint/3.0/oracle/oracle-3.0.sql b/config/sql/midpoint/3.1/oracle/oracle-3.1.sql similarity index 100% rename from config/sql/midpoint/3.0/oracle/oracle-3.0.sql rename to config/sql/midpoint/3.1/oracle/oracle-3.1.sql diff --git a/config/sql/midpoint/3.0/postgresql/postgresql-3.0-closure-upgrade.sql b/config/sql/midpoint/3.1/postgresql/postgresql-3.1-closure-upgrade.sql similarity index 100% rename from config/sql/midpoint/3.0/postgresql/postgresql-3.0-closure-upgrade.sql rename to config/sql/midpoint/3.1/postgresql/postgresql-3.1-closure-upgrade.sql diff --git a/config/sql/midpoint/3.0/postgresql/postgresql-3.0.sql b/config/sql/midpoint/3.1/postgresql/postgresql-3.1.sql similarity index 100% rename from config/sql/midpoint/3.0/postgresql/postgresql-3.0.sql rename to config/sql/midpoint/3.1/postgresql/postgresql-3.1.sql diff --git a/config/sql/midpoint/3.0/sqlserver/sqlserver-3.0-closure-upgrade.sql b/config/sql/midpoint/3.1/sqlserver/sqlserver-3.1-closure-upgrade.sql similarity index 100% rename from config/sql/midpoint/3.0/sqlserver/sqlserver-3.0-closure-upgrade.sql rename to config/sql/midpoint/3.1/sqlserver/sqlserver-3.1-closure-upgrade.sql diff --git a/config/sql/midpoint/3.0/sqlserver/sqlserver-3.0.sql b/config/sql/midpoint/3.1/sqlserver/sqlserver-3.1.sql similarity index 100% rename from config/sql/midpoint/3.0/sqlserver/sqlserver-3.0.sql rename to config/sql/midpoint/3.1/sqlserver/sqlserver-3.1.sql From 3b748674cfe579c21b085400118f703ee8c2bfa1 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Fri, 30 Jan 2015 14:49:58 +0100 Subject: [PATCH 081/215] fix for MID-2189 - issue 2. --- .../ResourceAssociationEditor.java | 9 ++----- .../ResourceAttributeEditor.java | 5 +--- .../modal/MappingEditorDialog.java | 13 +++++++--- .../wizard/resource/dto/MappingTypeDto.java | 25 +++++++++++++++---- 4 files changed, 33 insertions(+), 19 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java index ad06897d6e1..95f00440d06 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java @@ -51,7 +51,6 @@ import javax.xml.namespace.QName; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; /** @@ -411,18 +410,14 @@ private List loadObjectReferences(boolean restrictObjectClass){ for(ObjectClassComplexTypeDefinition def: schema.getObjectClassDefinitions()){ if(restrictObjectClass){ if(objectType != null && def.getTypeName().equals(objectType.getObjectClass())){ - Iterator it = def.getAttributeDefinitions().iterator(); - while(it.hasNext()){ - ResourceAttributeDefinition attributeDefinition = (ResourceAttributeDefinition)it.next(); + for(ResourceAttributeDefinition attributeDefinition : def.getAttributeDefinitions()) { references.add(attributeDefinition.getName()); } } } else { - Iterator it = def.getAttributeDefinitions().iterator(); - while(it.hasNext()){ - ResourceAttributeDefinition attributeDefinition = (ResourceAttributeDefinition)it.next(); + for(ResourceAttributeDefinition attributeDefinition : def.getAttributeDefinitions()) { references.add(attributeDefinition.getName()); } } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java index 4d677e0a3e8..2c03c665464 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java @@ -53,7 +53,6 @@ import javax.xml.namespace.QName; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; /** @@ -377,10 +376,8 @@ private List loadObjectReferences(){ for(ObjectClassComplexTypeDefinition def: schema.getObjectClassDefinitions()){ if(objectType != null && def.getTypeName().equals(objectType.getObjectClass())){ - Iterator it = def.getAttributeDefinitions().iterator(); - while(it.hasNext()){ - ResourceAttributeDefinition attributeDefinition = (ResourceAttributeDefinition)it.next(); + for (ResourceAttributeDefinition attributeDefinition : def.getAttributeDefinitions()) { references.add(attributeDefinition.getName()); } } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/modal/MappingEditorDialog.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/modal/MappingEditorDialog.java index e7fda3727ce..daf5c897176 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/modal/MappingEditorDialog.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/modal/MappingEditorDialog.java @@ -573,6 +573,12 @@ private List createPasswordPolicyList(){ } private void cancelPerformed(AjaxRequestTarget target){ + if(inputModel != null && model.getObject() != null){ + model.getObject().cancelChanges(); + } + + updateComponents(target); + target.add(getPageBase().getFeedbackPanel()); close(target); } @@ -595,7 +601,8 @@ private void savePerformed(AjaxRequestTarget target){ close(target); } - public void updateComponents(AjaxRequestTarget target){ - //Override this if update of component(s) holding this modal window is needed - } + /** + * Override this if update of component(s) holding this modal window is needed + * */ + public void updateComponents(AjaxRequestTarget target){} } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/dto/MappingTypeDto.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/dto/MappingTypeDto.java index 0117d253fb9..63f18294365 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/dto/MappingTypeDto.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/dto/MappingTypeDto.java @@ -53,6 +53,7 @@ public class MappingTypeDto implements Serializable { private static MappingStrengthType DEFAULT_MAPPING_STRENGTH = MappingStrengthType.NORMAL; private MappingType mappingObject; + private MappingType oldMappingObject; private String expression; private String condition; private String target; @@ -80,6 +81,8 @@ public MappingTypeDto(MappingType mapping, PrismContext prismContext){ mappingObject = mapping; } + oldMappingObject = mappingObject.clone(); + for(MappingSourceDeclarationType mappingSource: mappingObject.getSource()){ if(mappingSource.getPath() != null && mappingSource.getPath().getItemPath() != null){ source.add(mappingSource.getPath().getItemPath().toString()); @@ -141,6 +144,18 @@ private JAXBElement deserializeExpression(PrismContext prismContext, String x return prismContext.parseAnyValueAsJAXBElement(xmlCode, PrismContext.LANG_XML); } + public void cancelChanges(){ + mappingObject.setName(oldMappingObject.getName()); + mappingObject.setDescription(oldMappingObject.getDescription()); + mappingObject.setAuthoritative(oldMappingObject.isAuthoritative()); + mappingObject.setExclusive(oldMappingObject.isExclusive()); + mappingObject.setStrength(oldMappingObject.getStrength()); + mappingObject.getChannel().clear(); + mappingObject.getChannel().addAll(oldMappingObject.getChannel()); + mappingObject.getExceptChannel().clear(); + mappingObject.getExceptChannel().addAll(oldMappingObject.getExceptChannel()); + } + public MappingType prepareDtoToSave(PrismContext prismContext) throws SchemaException{ if(mappingObject == null){ @@ -301,7 +316,7 @@ public void setConditionPolicyRef(ObjectReferenceType conditionPolicyRef) { @Override public boolean equals(Object o) { if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (!(o instanceof MappingTypeDto)) return false; MappingTypeDto that = (MappingTypeDto) o; @@ -317,6 +332,8 @@ public boolean equals(Object o) { if (expressionType != that.expressionType) return false; if (mappingObject != null ? !mappingObject.equals(that.mappingObject) : that.mappingObject != null) return false; + if (oldMappingObject != null ? !oldMappingObject.equals(that.oldMappingObject) : that.oldMappingObject != null) + return false; if (source != null ? !source.equals(that.source) : that.source != null) return false; if (target != null ? !target.equals(that.target) : that.target != null) return false; @@ -326,6 +343,7 @@ public boolean equals(Object o) { @Override public int hashCode() { int result = mappingObject != null ? mappingObject.hashCode() : 0; + result = 31 * result + (oldMappingObject != null ? oldMappingObject.hashCode() : 0); result = 31 * result + (expression != null ? expression.hashCode() : 0); result = 31 * result + (condition != null ? condition.hashCode() : 0); result = 31 * result + (target != null ? target.hashCode() : 0); @@ -339,9 +357,6 @@ public int hashCode() { return result; } - /** - * TODO - find a better place for this method, it probably shouldn't be here - * */ public static String createMappingLabel(MappingType mapping, Trace LOGGER, PrismContext context, String placeholder, String nameNotSpecified ){ if(mapping == null){ @@ -363,4 +378,4 @@ public static String createMappingLabel(MappingType mapping, Trace LOGGER, Prism return sb.toString(); } -} +} \ No newline at end of file From 1eeba6bdea54f29b402e4ae9c282a4a68bcaf897 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Fri, 30 Jan 2015 15:03:48 +0100 Subject: [PATCH 082/215] MID-2189 - issue 3 improvement. --- .../SynchronizationReactionEditor.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/synchronization/SynchronizationReactionEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/synchronization/SynchronizationReactionEditor.java index 8109b8ef505..69a07394d9c 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/synchronization/SynchronizationReactionEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/synchronization/SynchronizationReactionEditor.java @@ -188,11 +188,21 @@ protected IModel createTextModel(final IModel public String getObject() { SynchronizationActionType action = model.getObject(); - if(action != null){ - return action.getName() != null ? action.getName() : " - "; - } else { + if(action == null){ return null; } + + StringBuilder sb = new StringBuilder(); + sb.append(action.getName() != null ? action.getName() : " - "); + + if(action.getHandlerUri() != null){ + String[] handlerUriSplit = action.getHandlerUri().split("#"); + sb.append("("); + sb.append(handlerUriSplit[handlerUriSplit.length - 1]); + sb.append(")"); + } + + return sb.toString(); } }; } From b5bb35882ed0782da1dd76ea163d3d44732e8014 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Sat, 31 Jan 2015 17:01:50 +0100 Subject: [PATCH 083/215] fix for MID-2189 - issue 1 - reload achema operation on Schema Step. --- .../component/wizard/resource/SchemaStep.java | 50 +++++++++++++++++-- .../wizard/resource/SchemaStep.properties | 2 + 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaStep.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaStep.java index 726dd0f3d47..66508449686 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaStep.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaStep.java @@ -20,14 +20,21 @@ import com.evolveum.midpoint.prism.PrismContext; import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.schema.SchemaConstantsGenerated; +import com.evolveum.midpoint.schema.result.OperationResult; +import com.evolveum.midpoint.util.exception.SchemaException; +import com.evolveum.midpoint.util.logging.Trace; +import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.web.component.AjaxButton; import com.evolveum.midpoint.web.component.TabbedPanel; import com.evolveum.midpoint.web.component.wizard.WizardStep; import com.evolveum.midpoint.web.component.wizard.resource.component.SchemaListPanel; import com.evolveum.midpoint.web.component.wizard.resource.component.XmlEditorPanel; import com.evolveum.midpoint.web.page.PageBase; +import com.evolveum.midpoint.web.util.WebMiscUtil; +import com.evolveum.midpoint.web.util.WebModelUtils; import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.XmlSchemaType; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.extensions.markup.html.tabs.AbstractTab; import org.apache.wicket.extensions.markup.html.tabs.ITab; @@ -43,12 +50,17 @@ */ public class SchemaStep extends WizardStep { - private static final String ID_TABPANEL = "tabPanel"; + private static final Trace LOGGER = TraceManager.getTrace(SchemaStep.class); + private static final String DOT_CLASS = SchemaStep.class.getName() + "."; + private static final String OPERATION_RELOAD_RESOURCE_SCHEMA = DOT_CLASS + "reloadResourceSchema"; + + private static final String ID_TAB_PANEL = "tabPanel"; private static final String ID_RELOAD = "reload"; private IModel> model; public SchemaStep(IModel> model) { this.model = model; + setOutputMarkupId(true); initLayout(); } @@ -58,9 +70,9 @@ private void initLayout() { tabs.add(createSimpleSchemaView()); tabs.add(createSchemaEditor()); - TabbedPanel tabpanel = new TabbedPanel(ID_TABPANEL, tabs); - tabpanel.setOutputMarkupId(true); - add(tabpanel); + TabbedPanel tabPanel = new TabbedPanel(ID_TAB_PANEL, tabs); + tabPanel.setOutputMarkupId(true); + add(tabPanel); AjaxButton reload = new AjaxButton(ID_RELOAD, createStringModel("SchemaStep.button.reload")) { @@ -121,7 +133,35 @@ public void detach() { } private void reloadPerformed(AjaxRequestTarget target) { - //todo implement + if(model == null || model.getObject() == null){ + return; + } + + PrismObject resource = model.getObject(); + resource.asObjectable().setSchema(new XmlSchemaType()); + OperationResult result = new OperationResult(OPERATION_RELOAD_RESOURCE_SCHEMA); + + try { + resource = WebModelUtils.loadObject(ResourceType.class, resource.getOid(), result, getPageBase()); + getPageBase().getPrismContext().adopt(resource); + + model.getObject().asObjectable().setSchema(resource.asObjectable().getSchema()); + } catch (SchemaException e) { + LOGGER.error(getString("SchemaStep.message.reload.fail", WebMiscUtil.getName(resource))); + result.recordFatalError(getString("SchemaStep.message.reload.fail", WebMiscUtil.getName(resource))); + } + + result.computeStatusIfUnknown(); + if(result.isSuccess()){ + LOGGER.info(getString("SchemaStep.message.reload.ok", WebMiscUtil.getName(resource))); + result.recordSuccess(); + } else { + LOGGER.error(getString("SchemaStep.message.reload.fail", WebMiscUtil.getName(resource))); + result.recordFatalError(getString("SchemaStep.message.reload.fail", WebMiscUtil.getName(resource))); + } + + getPageBase().showResult(result); + target.add(getPageBase().getFeedbackPanel(), this); } private ITab createSchemaEditor() { diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaStep.properties b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaStep.properties index ce9d8a6b2a1..0bfdb274eba 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaStep.properties +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaStep.properties @@ -17,4 +17,6 @@ WizardStep.title=Schema SchemaStep.xml=Xml SchemaStep.schema=Schema SchemaStep.button.reload=Reload +SchemaStep.message.reload.ok=Schema for resource '{0}' was reloaded successfully. +SchemaStep.message.reload.fail=Schema for resource '{0}' was not reloaded. From 2786f698609c6d4c591029b2b45a2afe26b78c6e Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Sun, 1 Feb 2015 13:10:02 +0100 Subject: [PATCH 084/215] fix for resource wizard - handling outbounds/inbounds in attribute, association and credentials editor. --- .../ResourceAssociationEditor.html | 3 +- .../ResourceAssociationEditor.java | 28 ++++++++++++------- .../ResourceAttributeEditor.html | 3 +- .../ResourceAttributeEditor.java | 27 ++++++++++++------ .../ResourceCredentialsEditor.html | 3 +- .../ResourceCredentialsEditor.java | 27 ++++++++++++------ 6 files changed, 60 insertions(+), 31 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.html index db165e1b0a3..3776e36832e 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.html @@ -18,7 +18,8 @@
-
+
+

diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java index 95f00440d06..08785dc0795 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java @@ -82,8 +82,8 @@ public class ResourceAssociationEditor extends SimplePanel>(getModel(), "limitations")); add(limitationsEditor); - ModalWindow mappingEditor = new MappingEditorDialog(ID_MODAL_MAPPING, null){ + ModalWindow inboundEditor = new MappingEditorDialog(ID_MODAL_INBOUND, null){ @Override public void updateComponents(AjaxRequestTarget target){ - target.add(ResourceAssociationEditor.this.get(ID_INBOUND), ResourceAssociationEditor.this.get(ID_OUTBOUND_LABEL), - ResourceAssociationEditor.this.get(ID_BUTTON_OUTBOUND)); + target.add(ResourceAssociationEditor.this.get(ID_INBOUND)); } }; - add(mappingEditor); + add(inboundEditor); + + ModalWindow outboundEditor = new MappingEditorDialog(ID_MODAL_OUTBOUND, null){ + + @Override + public void updateComponents(AjaxRequestTarget target) { + target.add(ResourceAssociationEditor.this.get(ID_OUTBOUND_LABEL), ResourceAssociationEditor.this.get(ID_BUTTON_OUTBOUND)); + } + }; + add(outboundEditor); } private List loadObjectReferences(boolean restrictObjectClass){ @@ -469,13 +477,13 @@ private void limitationsEditPerformed(AjaxRequestTarget target){ } private void outboundEditPerformed(AjaxRequestTarget target){ - MappingEditorDialog window = (MappingEditorDialog) get(ID_MODAL_MAPPING); + MappingEditorDialog window = (MappingEditorDialog) get(ID_MODAL_OUTBOUND); window.updateModel(target, new PropertyModel(getModel(), "outbound")); window.show(target); } - private void mappingEditPerformed(AjaxRequestTarget target, MappingType mapping){ - MappingEditorDialog window = (MappingEditorDialog) get(ID_MODAL_MAPPING); + private void inboundEditPerformed(AjaxRequestTarget target, MappingType mapping){ + MappingEditorDialog window = (MappingEditorDialog) get(ID_MODAL_INBOUND); window.updateModel(target, mapping); window.show(target); } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.html index ba9ac4f914c..e2e2fbbbc02 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.html @@ -17,7 +17,8 @@
-
+
+

diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java index 2c03c665464..6084d3fdc60 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java @@ -80,7 +80,8 @@ public class ResourceAttributeEditor extends SimplePanel>(getModel(), "limitations")); add(limitationsEditor); - ModalWindow mappingEditor = new MappingEditorDialog(ID_MODAL_MAPPING, null){ + ModalWindow inboundEditor = new MappingEditorDialog(ID_MODAL_INBOUND, null){ @Override public void updateComponents(AjaxRequestTarget target) { - target.add(ResourceAttributeEditor.this.get(ID_INBOUND), ResourceAttributeEditor.this.get(ID_OUTBOUND_LABEL), - ResourceAttributeEditor.this.get(ID_BUTTON_OUTBOUND)); + target.add(ResourceAttributeEditor.this.get(ID_INBOUND)); } }; - add(mappingEditor); + add(inboundEditor); + + ModalWindow outboundEditor = new MappingEditorDialog(ID_MODAL_OUTBOUND, null){ + + @Override + public void updateComponents(AjaxRequestTarget target) { + target.add(ResourceAttributeEditor.this.get(ID_OUTBOUND_LABEL), ResourceAttributeEditor.this.get(ID_BUTTON_OUTBOUND)); + } + }; + add(outboundEditor); } private List loadObjectReferences(){ @@ -429,13 +438,13 @@ private void limitationsEditPerformed(AjaxRequestTarget target){ } private void outboundEditPerformed(AjaxRequestTarget target){ - MappingEditorDialog window = (MappingEditorDialog) get(ID_MODAL_MAPPING); + MappingEditorDialog window = (MappingEditorDialog) get(ID_MODAL_OUTBOUND); window.updateModel(target, new PropertyModel(getModel(), "outbound")); window.show(target); } - private void mappingEditPerformed(AjaxRequestTarget target, MappingType mapping){ - MappingEditorDialog window = (MappingEditorDialog) get(ID_MODAL_MAPPING); + private void inboundEditPerformed(AjaxRequestTarget target, MappingType mapping){ + MappingEditorDialog window = (MappingEditorDialog) get(ID_MODAL_INBOUND); window.updateModel(target, mapping); window.show(target); } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceCredentialsEditor.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceCredentialsEditor.html index 59231f5191f..08a1da425e5 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceCredentialsEditor.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceCredentialsEditor.html @@ -17,7 +17,8 @@ -
+
+

diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceCredentialsEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceCredentialsEditor.java index f36bc472482..5eb1f5668b4 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceCredentialsEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceCredentialsEditor.java @@ -61,7 +61,8 @@ public class ResourceCredentialsEditor extends SimplePanel createPasswordPolicyList(){ @@ -241,13 +250,13 @@ private List createPasswordPolicyList(){ } private void outboundEditPerformed(AjaxRequestTarget target){ - MappingEditorDialog window = (MappingEditorDialog) get(ID_MODAL_MAPPING); + MappingEditorDialog window = (MappingEditorDialog) get(ID_MODAL_OUTBOUND); window.updateModel(target, new PropertyModel(getModel(), "password.outbound")); window.show(target); } - private void mappingEditPerformed(AjaxRequestTarget target, MappingType mapping){ - MappingEditorDialog window = (MappingEditorDialog) get(ID_MODAL_MAPPING); + private void inboundEditPerformed(AjaxRequestTarget target, MappingType mapping){ + MappingEditorDialog window = (MappingEditorDialog) get(ID_MODAL_INBOUND); window.updateModel(target, mapping); window.show(target); } From 0c047c98686f2256203218d33989d0f3625b3485 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Sun, 1 Feb 2015 13:35:49 +0100 Subject: [PATCH 085/215] updated mysql scripts --- .../3.1/mysql/mysql-3.1-closure-upgrade.sql | 14 +- config/sql/midpoint/3.1/mysql/mysql-3.1.sql | 367 +++++++++--------- 2 files changed, 185 insertions(+), 196 deletions(-) diff --git a/config/sql/midpoint/3.1/mysql/mysql-3.1-closure-upgrade.sql b/config/sql/midpoint/3.1/mysql/mysql-3.1-closure-upgrade.sql index c31a5ace6c8..75227bbc1ae 100644 --- a/config/sql/midpoint/3.1/mysql/mysql-3.1-closure-upgrade.sql +++ b/config/sql/midpoint/3.1/mysql/mysql-3.1-closure-upgrade.sql @@ -11,23 +11,23 @@ drop table if exists m_org_incorrect; -- CREATE TABLE m_org_closure ( + ancestor_oid VARCHAR(36) NOT NULL, descendant_oid VARCHAR(36) NOT NULL, - ancestor_oid VARCHAR(36) NOT NULL , - val INTEGER NOT NULL , - PRIMARY KEY (descendant_oid, ancestor_oid) + val INTEGER, + PRIMARY KEY (ancestor_oid, descendant_oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; + +CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid); ALTER TABLE m_org_closure -ADD INDEX fk_ancestor (ancestor_oid), ADD CONSTRAINT fk_ancestor FOREIGN KEY (ancestor_oid) REFERENCES m_object (oid); ALTER TABLE m_org_closure -ADD INDEX fk_descendant (descendant_oid), ADD CONSTRAINT fk_descendant FOREIGN KEY (descendant_oid) -REFERENCES m_object (oid); +REFERENCES m_object (oid); \ No newline at end of file diff --git a/config/sql/midpoint/3.1/mysql/mysql-3.1.sql b/config/sql/midpoint/3.1/mysql/mysql-3.1.sql index d96c9c878b5..e8640162a14 100644 --- a/config/sql/midpoint/3.1/mysql/mysql-3.1.sql +++ b/config/sql/midpoint/3.1/mysql/mysql-3.1.sql @@ -19,7 +19,7 @@ CREATE TABLE m_abstract_role ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_assignment ( id SMALLINT NOT NULL, @@ -58,13 +58,13 @@ CREATE TABLE m_assignment ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_assignment_ext_date ( eName VARCHAR(157) NOT NULL, anyContainer_owner_id SMALLINT NOT NULL, anyContainer_owner_owner_oid VARCHAR(36) NOT NULL, - dateValue DATETIME(6) NOT NULL, + dateValue DATETIME(6) NOT NULL, extensionType INTEGER, dynamicDef BIT, eType VARCHAR(157), @@ -73,7 +73,7 @@ CREATE TABLE m_assignment_ext_date ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_assignment_ext_long ( eName VARCHAR(157) NOT NULL, @@ -88,7 +88,7 @@ CREATE TABLE m_assignment_ext_long ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_assignment_ext_poly ( eName VARCHAR(157) NOT NULL, @@ -104,7 +104,7 @@ CREATE TABLE m_assignment_ext_poly ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_assignment_ext_reference ( eName VARCHAR(157) NOT NULL, @@ -121,7 +121,7 @@ CREATE TABLE m_assignment_ext_reference ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_assignment_ext_string ( eName VARCHAR(157) NOT NULL, @@ -136,7 +136,7 @@ CREATE TABLE m_assignment_ext_string ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_assignment_extension ( owner_id SMALLINT NOT NULL, @@ -150,7 +150,7 @@ CREATE TABLE m_assignment_extension ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_assignment_reference ( reference_type INTEGER NOT NULL, @@ -163,7 +163,7 @@ CREATE TABLE m_assignment_reference ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_audit_delta ( checksum VARCHAR(32) NOT NULL, @@ -177,7 +177,7 @@ CREATE TABLE m_audit_delta ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_audit_event ( id BIGINT NOT NULL, @@ -205,7 +205,7 @@ CREATE TABLE m_audit_event ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_connector ( connectorBundle VARCHAR(255), @@ -222,7 +222,7 @@ CREATE TABLE m_connector ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_connector_host ( hostname VARCHAR(255), @@ -230,12 +230,11 @@ CREATE TABLE m_connector_host ( name_orig VARCHAR(255), port VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_connector_target_system ( connector_oid VARCHAR(36) NOT NULL, @@ -243,7 +242,7 @@ CREATE TABLE m_connector_target_system ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_exclusion ( id SMALLINT NOT NULL, @@ -256,7 +255,7 @@ CREATE TABLE m_exclusion ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_focus ( administrativeStatus INTEGER, @@ -274,31 +273,29 @@ CREATE TABLE m_focus ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_generic_object ( name_norm VARCHAR(255), name_orig VARCHAR(255), objectType VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_node ( name_norm VARCHAR(255), name_orig VARCHAR(255), nodeIdentifier VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_object ( oid VARCHAR(36) NOT NULL, @@ -329,13 +326,13 @@ CREATE TABLE m_object ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_object_ext_date ( eName VARCHAR(157) NOT NULL, owner_oid VARCHAR(36) NOT NULL, ownerType INTEGER NOT NULL, - dateValue DATETIME(6) NOT NULL, + dateValue DATETIME(6) NOT NULL, dynamicDef BIT, eType VARCHAR(157), valueType INTEGER, @@ -343,7 +340,7 @@ CREATE TABLE m_object_ext_date ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_object_ext_long ( eName VARCHAR(157) NOT NULL, @@ -357,7 +354,7 @@ CREATE TABLE m_object_ext_long ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_object_ext_poly ( eName VARCHAR(157) NOT NULL, @@ -372,7 +369,7 @@ CREATE TABLE m_object_ext_poly ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_object_ext_reference ( eName VARCHAR(157) NOT NULL, @@ -388,7 +385,7 @@ CREATE TABLE m_object_ext_reference ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_object_ext_string ( eName VARCHAR(157) NOT NULL, @@ -402,19 +399,18 @@ CREATE TABLE m_object_ext_string ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_object_template ( name_norm VARCHAR(255), name_orig VARCHAR(255), type INTEGER, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_org ( costCenter VARCHAR(255), @@ -428,22 +424,21 @@ CREATE TABLE m_org ( name_orig VARCHAR(255), tenant BIT, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_org_closure ( + ancestor_oid VARCHAR(36) NOT NULL, descendant_oid VARCHAR(36) NOT NULL, - ancestor_oid VARCHAR(36) NOT NULL , - val INTEGER NOT NULL , - PRIMARY KEY (descendant_oid, ancestor_oid) + val INTEGER, + PRIMARY KEY (ancestor_oid, descendant_oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_org_org_type ( org_oid VARCHAR(36) NOT NULL, @@ -451,7 +446,7 @@ CREATE TABLE m_org_org_type ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_reference ( reference_type INTEGER NOT NULL, @@ -463,7 +458,7 @@ CREATE TABLE m_reference ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_report ( export INTEGER, @@ -473,12 +468,11 @@ CREATE TABLE m_report ( parent BIT, useHibernateSession BIT, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_report_output ( name_norm VARCHAR(255), @@ -491,7 +485,7 @@ CREATE TABLE m_report_output ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_resource ( administrativeState INTEGER, @@ -502,35 +496,32 @@ CREATE TABLE m_resource ( name_orig VARCHAR(255), o16_lastAvailabilityStatus INTEGER, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_role ( name_norm VARCHAR(255), name_orig VARCHAR(255), roleType VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_security_policy ( name_norm VARCHAR(255), name_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_shadow ( attemptNumber INTEGER, @@ -554,18 +545,17 @@ CREATE TABLE m_shadow ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_system_configuration ( name_norm VARCHAR(255), name_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_task ( binding INTEGER, @@ -596,7 +586,7 @@ CREATE TABLE m_task ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_task_dependent ( task_oid VARCHAR(36) NOT NULL, @@ -604,7 +594,7 @@ CREATE TABLE m_task_dependent ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_trigger ( id SMALLINT NOT NULL, @@ -615,7 +605,7 @@ CREATE TABLE m_trigger ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_user ( additionalName_norm VARCHAR(255), @@ -648,12 +638,11 @@ CREATE TABLE m_user ( title_norm VARCHAR(255), title_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_user_employee_type ( user_oid VARCHAR(36) NOT NULL, @@ -661,7 +650,7 @@ CREATE TABLE m_user_employee_type ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_user_organization ( user_oid VARCHAR(36) NOT NULL, @@ -670,7 +659,7 @@ CREATE TABLE m_user_organization ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_user_organizational_unit ( user_oid VARCHAR(36) NOT NULL, @@ -679,7 +668,7 @@ CREATE TABLE m_user_organizational_unit ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_user_photo ( owner_oid VARCHAR(36) NOT NULL, @@ -688,347 +677,347 @@ CREATE TABLE m_user_photo ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_value_policy ( name_norm VARCHAR(255), name_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE INDEX iRequestable ON m_abstract_role (requestable); +CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus); + +CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus); + +CREATE INDEX iAExtensionDate ON m_assignment_ext_date (extensionType, eName, dateValue); + +CREATE INDEX iAExtensionLong ON m_assignment_ext_long (extensionType, eName, longValue); + +CREATE INDEX iAExtensionPolyString ON m_assignment_ext_poly (extensionType, eName, orig); + +CREATE INDEX iAExtensionReference ON m_assignment_ext_reference (extensionType, eName, targetoid); + +CREATE INDEX iAExtensionString ON m_assignment_ext_string (extensionType, eName, stringValue); + +CREATE INDEX iAssignmentReferenceTargetOid ON m_assignment_reference (targetOid); + +ALTER TABLE m_connector_host +ADD CONSTRAINT uc_connector_host_name UNIQUE (name_norm); + +CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus); + +CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); + +ALTER TABLE m_generic_object +ADD CONSTRAINT uc_generic_object_name UNIQUE (name_norm); + +ALTER TABLE m_node +ADD CONSTRAINT uc_node_name UNIQUE (name_norm); + +CREATE INDEX iObjectNameOrig ON m_object (name_orig); + +CREATE INDEX iObjectNameNorm ON m_object (name_norm); + +CREATE INDEX iObjectTypeClass ON m_object (objectTypeClass); + +CREATE INDEX iObjectCreateTimestamp ON m_object (createTimestamp); + +CREATE INDEX iExtensionDate ON m_object_ext_date (ownerType, eName, dateValue); + +CREATE INDEX iExtensionDateDef ON m_object_ext_date (owner_oid, ownerType); + +CREATE INDEX iExtensionLong ON m_object_ext_long (ownerType, eName, longValue); + +CREATE INDEX iExtensionLongDef ON m_object_ext_long (owner_oid, ownerType); + +CREATE INDEX iExtensionPolyString ON m_object_ext_poly (ownerType, eName, orig); + +CREATE INDEX iExtensionPolyStringDef ON m_object_ext_poly (owner_oid, ownerType); + +CREATE INDEX iExtensionReference ON m_object_ext_reference (ownerType, eName, targetoid); + +CREATE INDEX iExtensionReferenceDef ON m_object_ext_reference (owner_oid, ownerType); + +CREATE INDEX iExtensionString ON m_object_ext_string (ownerType, eName, stringValue); + +CREATE INDEX iExtensionStringDef ON m_object_ext_string (owner_oid, ownerType); + +ALTER TABLE m_object_template +ADD CONSTRAINT uc_object_template_name UNIQUE (name_norm); + +ALTER TABLE m_org +ADD CONSTRAINT uc_org_name UNIQUE (name_norm); + +CREATE INDEX iDisplayOrder ON m_org (displayOrder); + +-- Not needed [FK already creates this index] +-- CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); + +-- Not needed [FK already creates this index] +-- CREATE INDEX iDescendant ON m_org_closure (descendant_oid); + +CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid); + +CREATE INDEX iReferenceTargetOid ON m_reference (targetOid); + +ALTER TABLE m_report +ADD CONSTRAINT uc_report_name UNIQUE (name_norm); + +CREATE INDEX iReportParent ON m_report (parent); + +ALTER TABLE m_resource +ADD CONSTRAINT uc_resource_name UNIQUE (name_norm); + +ALTER TABLE m_role +ADD CONSTRAINT uc_role_name UNIQUE (name_norm); + +ALTER TABLE m_security_policy +ADD CONSTRAINT uc_security_policy_name UNIQUE (name_norm); + +CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid); + +CREATE INDEX iShadowDead ON m_shadow (dead); + +ALTER TABLE m_system_configuration +ADD CONSTRAINT uc_system_configuration_name UNIQUE (name_norm); + +CREATE INDEX iParent ON m_task (parent); + +CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue); + +ALTER TABLE m_user +ADD CONSTRAINT uc_user_name UNIQUE (name_norm); + +CREATE INDEX iEmployeeNumber ON m_user (employeeNumber); + +CREATE INDEX iFullName ON m_user (fullName_orig); + +CREATE INDEX iFamilyName ON m_user (familyName_orig); + +CREATE INDEX iGivenName ON m_user (givenName_orig); + +CREATE INDEX iLocality ON m_user (locality_orig); + +ALTER TABLE m_value_policy +ADD CONSTRAINT uc_value_policy_name UNIQUE (name_norm); + ALTER TABLE m_abstract_role -ADD INDEX fk_abstract_role (oid), ADD CONSTRAINT fk_abstract_role FOREIGN KEY (oid) REFERENCES m_focus (oid); -CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus); - -CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus); - ALTER TABLE m_assignment -ADD INDEX fk_assignment_owner (owner_oid), ADD CONSTRAINT fk_assignment_owner FOREIGN KEY (owner_oid) REFERENCES m_object (oid); -CREATE INDEX iAExtensionDate ON m_assignment_ext_date (extensionType, eName, dateValue); - ALTER TABLE m_assignment_ext_date -ADD INDEX fk_assignment_ext_date (anyContainer_owner_id, anyContainer_owner_owner_oid), ADD CONSTRAINT fk_assignment_ext_date FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension (owner_id, owner_owner_oid); -CREATE INDEX iAExtensionLong ON m_assignment_ext_long (extensionType, eName, longValue); - ALTER TABLE m_assignment_ext_long -ADD INDEX fk_assignment_ext_long (anyContainer_owner_id, anyContainer_owner_owner_oid), ADD CONSTRAINT fk_assignment_ext_long FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension (owner_id, owner_owner_oid); -CREATE INDEX iAExtensionPolyString ON m_assignment_ext_poly (extensionType, eName, orig); - ALTER TABLE m_assignment_ext_poly -ADD INDEX fk_assignment_ext_poly (anyContainer_owner_id, anyContainer_owner_owner_oid), ADD CONSTRAINT fk_assignment_ext_poly FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension (owner_id, owner_owner_oid); -CREATE INDEX iAExtensionReference ON m_assignment_ext_reference (extensionType, eName, targetoid); - ALTER TABLE m_assignment_ext_reference -ADD INDEX fk_assignment_ext_reference (anyContainer_owner_id, anyContainer_owner_owner_oid), ADD CONSTRAINT fk_assignment_ext_reference FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension (owner_id, owner_owner_oid); -CREATE INDEX iAExtensionString ON m_assignment_ext_string (extensionType, eName, stringValue); - ALTER TABLE m_assignment_ext_string -ADD INDEX fk_assignment_ext_string (anyContainer_owner_id, anyContainer_owner_owner_oid), ADD CONSTRAINT fk_assignment_ext_string FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension (owner_id, owner_owner_oid); -CREATE INDEX iAssignmentReferenceTargetOid ON m_assignment_reference (targetOid); - ALTER TABLE m_assignment_reference -ADD INDEX fk_assignment_reference (owner_id, owner_owner_oid), ADD CONSTRAINT fk_assignment_reference FOREIGN KEY (owner_id, owner_owner_oid) REFERENCES m_assignment (id, owner_oid); ALTER TABLE m_audit_delta -ADD INDEX fk_audit_delta (record_id), ADD CONSTRAINT fk_audit_delta FOREIGN KEY (record_id) REFERENCES m_audit_event (id); ALTER TABLE m_connector -ADD INDEX fk_connector (oid), ADD CONSTRAINT fk_connector FOREIGN KEY (oid) REFERENCES m_object (oid); ALTER TABLE m_connector_host -ADD INDEX fk_connector_host (oid), ADD CONSTRAINT fk_connector_host FOREIGN KEY (oid) REFERENCES m_object (oid); ALTER TABLE m_connector_target_system -ADD INDEX fk_connector_target_system (connector_oid), ADD CONSTRAINT fk_connector_target_system FOREIGN KEY (connector_oid) REFERENCES m_connector (oid); ALTER TABLE m_exclusion -ADD INDEX fk_exclusion_owner (owner_oid), ADD CONSTRAINT fk_exclusion_owner FOREIGN KEY (owner_oid) REFERENCES m_object (oid); -CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus); - -CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); - ALTER TABLE m_focus -ADD INDEX fk_focus (oid), ADD CONSTRAINT fk_focus FOREIGN KEY (oid) REFERENCES m_object (oid); ALTER TABLE m_generic_object -ADD INDEX fk_generic_object (oid), ADD CONSTRAINT fk_generic_object FOREIGN KEY (oid) REFERENCES m_object (oid); ALTER TABLE m_node -ADD INDEX fk_node (oid), ADD CONSTRAINT fk_node FOREIGN KEY (oid) REFERENCES m_object (oid); -CREATE INDEX iObjectCreateTimestamp ON m_object (createTimestamp); - -CREATE INDEX iObjectTypeClass ON m_object (objectTypeClass); - -CREATE INDEX iObjectNameOrig ON m_object (name_orig); - -CREATE INDEX iObjectNameNorm ON m_object (name_norm); - -CREATE INDEX iExtensionDate ON m_object_ext_date (ownerType, eName, dateValue); - -CREATE INDEX iExtensionDateDef ON m_object_ext_date (owner_oid, ownerType); - ALTER TABLE m_object_ext_date -ADD INDEX fk_object_ext_date (owner_oid), ADD CONSTRAINT fk_object_ext_date FOREIGN KEY (owner_oid) REFERENCES m_object (oid); -CREATE INDEX iExtensionLong ON m_object_ext_long (ownerType, eName, longValue); - -CREATE INDEX iExtensionLongDef ON m_object_ext_long (owner_oid, ownerType); - ALTER TABLE m_object_ext_long -ADD INDEX fk_object_ext_long (owner_oid), ADD CONSTRAINT fk_object_ext_long FOREIGN KEY (owner_oid) REFERENCES m_object (oid); -CREATE INDEX iExtensionPolyString ON m_object_ext_poly (ownerType, eName, orig); - -CREATE INDEX iExtensionPolyStringDef ON m_object_ext_poly (owner_oid, ownerType); - ALTER TABLE m_object_ext_poly -ADD INDEX fk_object_ext_poly (owner_oid), ADD CONSTRAINT fk_object_ext_poly FOREIGN KEY (owner_oid) REFERENCES m_object (oid); -CREATE INDEX iExtensionReference ON m_object_ext_reference (ownerType, eName, targetoid); - -CREATE INDEX iExtensionReferenceDef ON m_object_ext_reference (owner_oid, ownerType); - ALTER TABLE m_object_ext_reference -ADD INDEX fk_object_ext_reference (owner_oid), ADD CONSTRAINT fk_object_ext_reference FOREIGN KEY (owner_oid) REFERENCES m_object (oid); -CREATE INDEX iExtensionString ON m_object_ext_string (ownerType, eName, stringValue); - -CREATE INDEX iExtensionStringDef ON m_object_ext_string (owner_oid, ownerType); - ALTER TABLE m_object_ext_string -ADD INDEX fk_object_ext_string (owner_oid), ADD CONSTRAINT fk_object_ext_string FOREIGN KEY (owner_oid) REFERENCES m_object (oid); ALTER TABLE m_object_template -ADD INDEX fk_object_template (oid), ADD CONSTRAINT fk_object_template FOREIGN KEY (oid) REFERENCES m_object (oid); -CREATE INDEX iDisplayOrder ON m_org (displayOrder); - ALTER TABLE m_org -ADD INDEX fk_org (oid), ADD CONSTRAINT fk_org FOREIGN KEY (oid) REFERENCES m_abstract_role (oid); ALTER TABLE m_org_closure -ADD INDEX fk_ancestor (ancestor_oid), ADD CONSTRAINT fk_ancestor FOREIGN KEY (ancestor_oid) REFERENCES m_object (oid); ALTER TABLE m_org_closure -ADD INDEX fk_descendant (descendant_oid), ADD CONSTRAINT fk_descendant FOREIGN KEY (descendant_oid) REFERENCES m_object (oid); ALTER TABLE m_org_org_type -ADD INDEX fk_org_org_type (org_oid), ADD CONSTRAINT fk_org_org_type FOREIGN KEY (org_oid) REFERENCES m_org (oid); -CREATE INDEX iReferenceTargetOid ON m_reference (targetOid); - ALTER TABLE m_reference -ADD INDEX fk_reference_owner (owner_oid), ADD CONSTRAINT fk_reference_owner FOREIGN KEY (owner_oid) REFERENCES m_object (oid); -CREATE INDEX iReportParent ON m_report (parent); - ALTER TABLE m_report -ADD INDEX fk_report (oid), ADD CONSTRAINT fk_report FOREIGN KEY (oid) REFERENCES m_object (oid); ALTER TABLE m_report_output -ADD INDEX fk_report_output (oid), ADD CONSTRAINT fk_report_output FOREIGN KEY (oid) REFERENCES m_object (oid); ALTER TABLE m_resource -ADD INDEX fk_resource (oid), ADD CONSTRAINT fk_resource FOREIGN KEY (oid) REFERENCES m_object (oid); ALTER TABLE m_role -ADD INDEX fk_role (oid), ADD CONSTRAINT fk_role FOREIGN KEY (oid) REFERENCES m_abstract_role (oid); ALTER TABLE m_security_policy -ADD INDEX fk_security_policy (oid), ADD CONSTRAINT fk_security_policy FOREIGN KEY (oid) REFERENCES m_object (oid); -CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid); - -CREATE INDEX iShadowDead ON m_shadow (dead); - ALTER TABLE m_shadow -ADD INDEX fk_shadow (oid), ADD CONSTRAINT fk_shadow FOREIGN KEY (oid) REFERENCES m_object (oid); ALTER TABLE m_system_configuration -ADD INDEX fk_system_configuration (oid), ADD CONSTRAINT fk_system_configuration FOREIGN KEY (oid) REFERENCES m_object (oid); -CREATE INDEX iParent ON m_task (parent); - ALTER TABLE m_task -ADD INDEX fk_task (oid), ADD CONSTRAINT fk_task FOREIGN KEY (oid) REFERENCES m_object (oid); ALTER TABLE m_task_dependent -ADD INDEX fk_task_dependent (task_oid), ADD CONSTRAINT fk_task_dependent FOREIGN KEY (task_oid) REFERENCES m_task (oid); -CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue); - ALTER TABLE m_trigger -ADD INDEX fk_trigger_owner (owner_oid), ADD CONSTRAINT fk_trigger_owner FOREIGN KEY (owner_oid) REFERENCES m_object (oid); -CREATE INDEX iEmployeeNumber ON m_user (employeeNumber); - -CREATE INDEX iFullName ON m_user (fullName_orig); - -CREATE INDEX iFamilyName ON m_user (familyName_orig); - -CREATE INDEX iGivenName ON m_user (givenName_orig); - -CREATE INDEX iLocality ON m_user (locality_orig); - ALTER TABLE m_user -ADD INDEX fk_user (oid), ADD CONSTRAINT fk_user FOREIGN KEY (oid) REFERENCES m_focus (oid); ALTER TABLE m_user_employee_type -ADD INDEX fk_user_employee_type (user_oid), ADD CONSTRAINT fk_user_employee_type FOREIGN KEY (user_oid) REFERENCES m_user (oid); ALTER TABLE m_user_organization -ADD INDEX fk_user_organization (user_oid), ADD CONSTRAINT fk_user_organization FOREIGN KEY (user_oid) REFERENCES m_user (oid); ALTER TABLE m_user_organizational_unit -ADD INDEX fk_user_org_unit (user_oid), ADD CONSTRAINT fk_user_org_unit FOREIGN KEY (user_oid) REFERENCES m_user (oid); ALTER TABLE m_user_photo -ADD INDEX fk_user_photo (owner_oid), ADD CONSTRAINT fk_user_photo FOREIGN KEY (owner_oid) REFERENCES m_user (oid); ALTER TABLE m_value_policy -ADD INDEX fk_value_policy (oid), ADD CONSTRAINT fk_value_policy FOREIGN KEY (oid) REFERENCES m_object (oid); From d12a08c91cd20176dbadee8daf7346f37b3b9ab0 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Sun, 1 Feb 2015 14:04:04 +0100 Subject: [PATCH 086/215] updated oracle scripts --- .../3.1/oracle/oracle-3.1-closure-upgrade.sql | 8 +- config/sql/midpoint/3.1/oracle/oracle-3.1.sql | 232 ++++++++++-------- 2 files changed, 134 insertions(+), 106 deletions(-) diff --git a/config/sql/midpoint/3.1/oracle/oracle-3.1-closure-upgrade.sql b/config/sql/midpoint/3.1/oracle/oracle-3.1-closure-upgrade.sql index aec67791ee4..62d0ce2f59c 100644 --- a/config/sql/midpoint/3.1/oracle/oracle-3.1-closure-upgrade.sql +++ b/config/sql/midpoint/3.1/oracle/oracle-3.1-closure-upgrade.sql @@ -10,10 +10,10 @@ BEGIN END; CREATE TABLE m_org_closure ( - descendant_oid VARCHAR2(36 CHAR) NOT NULL, ancestor_oid VARCHAR2(36 CHAR) NOT NULL, - val NUMBER(10, 0) NOT NULL, - PRIMARY KEY (descendant_oid, ancestor_oid) + descendant_oid VARCHAR2(36 CHAR) NOT NULL, + val NUMBER(10, 0), + PRIMARY KEY (ancestor_oid, descendant_oid) ) INITRANS 30; BEGIN @@ -36,6 +36,8 @@ CREATE INDEX iAncestor ON m_org_closure (ancestor_oid) INITRANS 30; CREATE INDEX iDescendant ON m_org_closure (descendant_oid) INITRANS 30; +CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid) INITRANS 30; + ALTER TABLE m_org_closure ADD CONSTRAINT fk_ancestor FOREIGN KEY (ancestor_oid) diff --git a/config/sql/midpoint/3.1/oracle/oracle-3.1.sql b/config/sql/midpoint/3.1/oracle/oracle-3.1.sql index 0d68de44555..c789958e7fa 100644 --- a/config/sql/midpoint/3.1/oracle/oracle-3.1.sql +++ b/config/sql/midpoint/3.1/oracle/oracle-3.1.sql @@ -184,8 +184,7 @@ CREATE TABLE m_connector_host ( name_orig VARCHAR2(255 CHAR), port VARCHAR2(255 CHAR), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_connector_target_system ( @@ -223,8 +222,7 @@ CREATE TABLE m_generic_object ( name_orig VARCHAR2(255 CHAR), objectType VARCHAR2(255 CHAR), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_node ( @@ -232,8 +230,7 @@ CREATE TABLE m_node ( name_orig VARCHAR2(255 CHAR), nodeIdentifier VARCHAR2(255 CHAR), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_object ( @@ -327,8 +324,7 @@ CREATE TABLE m_object_template ( name_orig VARCHAR2(255 CHAR), type NUMBER(10, 0), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_org ( @@ -343,15 +339,14 @@ CREATE TABLE m_org ( name_orig VARCHAR2(255 CHAR), tenant NUMBER(1, 0), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_org_closure ( - descendant_oid VARCHAR2(36 CHAR) NOT NULL, ancestor_oid VARCHAR2(36 CHAR) NOT NULL, - val NUMBER(10, 0) NOT NULL, - PRIMARY KEY (descendant_oid, ancestor_oid) + descendant_oid VARCHAR2(36 CHAR) NOT NULL, + val NUMBER(10, 0), + PRIMARY KEY (ancestor_oid, descendant_oid) ) INITRANS 30; CREATE GLOBAL TEMPORARY TABLE m_org_closure_temp_delta ( @@ -383,8 +378,7 @@ CREATE TABLE m_report ( parent NUMBER(1, 0), useHibernateSession NUMBER(1, 0), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_report_output ( @@ -406,8 +400,7 @@ CREATE TABLE m_resource ( name_orig VARCHAR2(255 CHAR), o16_lastAvailabilityStatus NUMBER(10, 0), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_role ( @@ -415,16 +408,14 @@ CREATE TABLE m_role ( name_orig VARCHAR2(255 CHAR), roleType VARCHAR2(255 CHAR), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_security_policy ( name_norm VARCHAR2(255 CHAR), name_orig VARCHAR2(255 CHAR), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_shadow ( @@ -452,8 +443,7 @@ CREATE TABLE m_system_configuration ( name_norm VARCHAR2(255 CHAR), name_orig VARCHAR2(255 CHAR), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_task ( @@ -528,8 +518,7 @@ CREATE TABLE m_user ( title_norm VARCHAR2(255 CHAR), title_orig VARCHAR2(255 CHAR), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_user_employee_type ( @@ -559,63 +548,160 @@ CREATE TABLE m_value_policy ( name_norm VARCHAR2(255 CHAR), name_orig VARCHAR2(255 CHAR), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE INDEX iRequestable ON m_abstract_role (requestable) INITRANS 30; +CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus) INITRANS 30; + +CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus) INITRANS 30; + +CREATE INDEX iAExtensionDate ON m_assignment_ext_date (extensionType, eName, dateValue) INITRANS 30; + +CREATE INDEX iAExtensionLong ON m_assignment_ext_long (extensionType, eName, longValue) INITRANS 30; + +CREATE INDEX iAExtensionPolyString ON m_assignment_ext_poly (extensionType, eName, orig) INITRANS 30; + +CREATE INDEX iAExtensionReference ON m_assignment_ext_reference (extensionType, eName, targetoid) INITRANS 30; + +CREATE INDEX iAExtensionString ON m_assignment_ext_string (extensionType, eName, stringValue) INITRANS 30; + +CREATE INDEX iAssignmentReferenceTargetOid ON m_assignment_reference (targetOid) INITRANS 30; + +ALTER TABLE m_connector_host +ADD CONSTRAINT uc_connector_host_name UNIQUE (name_norm) INITRANS 30; + +CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus) INITRANS 30; + +CREATE INDEX iFocusEffective ON m_focus (effectiveStatus) INITRANS 30; + +ALTER TABLE m_generic_object +ADD CONSTRAINT uc_generic_object_name UNIQUE (name_norm) INITRANS 30; + +ALTER TABLE m_node +ADD CONSTRAINT uc_node_name UNIQUE (name_norm) INITRANS 30; + +CREATE INDEX iObjectNameOrig ON m_object (name_orig) INITRANS 30; + +CREATE INDEX iObjectNameNorm ON m_object (name_norm) INITRANS 30; + +CREATE INDEX iObjectTypeClass ON m_object (objectTypeClass) INITRANS 30; + +CREATE INDEX iObjectCreateTimestamp ON m_object (createTimestamp) INITRANS 30; + +CREATE INDEX iExtensionDate ON m_object_ext_date (ownerType, eName, dateValue) INITRANS 30; + +CREATE INDEX iExtensionDateDef ON m_object_ext_date (owner_oid, ownerType) INITRANS 30; + +CREATE INDEX iExtensionLong ON m_object_ext_long (ownerType, eName, longValue) INITRANS 30; + +CREATE INDEX iExtensionLongDef ON m_object_ext_long (owner_oid, ownerType) INITRANS 30; + +CREATE INDEX iExtensionPolyString ON m_object_ext_poly (ownerType, eName, orig) INITRANS 30; + +CREATE INDEX iExtensionPolyStringDef ON m_object_ext_poly (owner_oid, ownerType) INITRANS 30; + +CREATE INDEX iExtensionReference ON m_object_ext_reference (ownerType, eName, targetoid) INITRANS 30; + +CREATE INDEX iExtensionReferenceDef ON m_object_ext_reference (owner_oid, ownerType) INITRANS 30; + +CREATE INDEX iExtensionString ON m_object_ext_string (ownerType, eName, stringValue) INITRANS 30; + +CREATE INDEX iExtensionStringDef ON m_object_ext_string (owner_oid, ownerType) INITRANS 30; + +ALTER TABLE m_object_template +ADD CONSTRAINT uc_object_template_name UNIQUE (name_norm) INITRANS 30; + +ALTER TABLE m_org +ADD CONSTRAINT uc_org_name UNIQUE (name_norm) INITRANS 30; + +CREATE INDEX iDisplayOrder ON m_org (displayOrder) INITRANS 30; + +CREATE INDEX iAncestor ON m_org_closure (ancestor_oid) INITRANS 30; + +CREATE INDEX iDescendant ON m_org_closure (descendant_oid) INITRANS 30; + +CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid) INITRANS 30; + +CREATE INDEX iReferenceTargetOid ON m_reference (targetOid) INITRANS 30; + +ALTER TABLE m_report +ADD CONSTRAINT uc_report_name UNIQUE (name_norm) INITRANS 30; + +CREATE INDEX iReportParent ON m_report (parent) INITRANS 30; + +ALTER TABLE m_resource +ADD CONSTRAINT uc_resource_name UNIQUE (name_norm) INITRANS 30; + +ALTER TABLE m_role +ADD CONSTRAINT uc_role_name UNIQUE (name_norm) INITRANS 30; + +ALTER TABLE m_security_policy +ADD CONSTRAINT uc_security_policy_name UNIQUE (name_norm) INITRANS 30; + +CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid) INITRANS 30; + +CREATE INDEX iShadowDead ON m_shadow (dead) INITRANS 30; + +ALTER TABLE m_system_configuration +ADD CONSTRAINT uc_system_configuration_name UNIQUE (name_norm) INITRANS 30; + +CREATE INDEX iParent ON m_task (parent) INITRANS 30; + +CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue) INITRANS 30; + +ALTER TABLE m_user +ADD CONSTRAINT uc_user_name UNIQUE (name_norm) INITRANS 30; + +CREATE INDEX iEmployeeNumber ON m_user (employeeNumber) INITRANS 30; + +CREATE INDEX iFullName ON m_user (fullName_orig) INITRANS 30; + +CREATE INDEX iFamilyName ON m_user (familyName_orig) INITRANS 30; + +CREATE INDEX iGivenName ON m_user (givenName_orig) INITRANS 30; + +CREATE INDEX iLocality ON m_user (locality_orig) INITRANS 30; + +ALTER TABLE m_value_policy +ADD CONSTRAINT uc_value_policy_name UNIQUE (name_norm) INITRANS 30; + ALTER TABLE m_abstract_role ADD CONSTRAINT fk_abstract_role FOREIGN KEY (oid) REFERENCES m_focus; -CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus) INITRANS 30; - -CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus) INITRANS 30; - ALTER TABLE m_assignment ADD CONSTRAINT fk_assignment_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iAExtensionDate ON m_assignment_ext_date (extensionType, eName, dateValue) INITRANS 30; - ALTER TABLE m_assignment_ext_date ADD CONSTRAINT fk_assignment_ext_date FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionLong ON m_assignment_ext_long (extensionType, eName, longValue) INITRANS 30; - ALTER TABLE m_assignment_ext_long ADD CONSTRAINT fk_assignment_ext_long FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionPolyString ON m_assignment_ext_poly (extensionType, eName, orig) INITRANS 30; - ALTER TABLE m_assignment_ext_poly ADD CONSTRAINT fk_assignment_ext_poly FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionReference ON m_assignment_ext_reference (extensionType, eName, targetoid) INITRANS 30; - ALTER TABLE m_assignment_ext_reference ADD CONSTRAINT fk_assignment_ext_reference FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionString ON m_assignment_ext_string (extensionType, eName, stringValue) INITRANS 30; - ALTER TABLE m_assignment_ext_string ADD CONSTRAINT fk_assignment_ext_string FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAssignmentReferenceTargetOid ON m_assignment_reference (targetOid) INITRANS 30; - ALTER TABLE m_assignment_reference ADD CONSTRAINT fk_assignment_reference FOREIGN KEY (owner_id, owner_owner_oid) @@ -646,10 +732,6 @@ ADD CONSTRAINT fk_exclusion_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus) INITRANS 30; - -CREATE INDEX iFocusEffective ON m_focus (effectiveStatus) INITRANS 30; - ALTER TABLE m_focus ADD CONSTRAINT fk_focus FOREIGN KEY (oid) @@ -665,54 +747,26 @@ ADD CONSTRAINT fk_node FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iObjectCreateTimestamp ON m_object (createTimestamp) INITRANS 30; - -CREATE INDEX iObjectTypeClass ON m_object (objectTypeClass) INITRANS 30; - -CREATE INDEX iObjectNameOrig ON m_object (name_orig) INITRANS 30; - -CREATE INDEX iObjectNameNorm ON m_object (name_norm) INITRANS 30; - -CREATE INDEX iExtensionDate ON m_object_ext_date (ownerType, eName, dateValue) INITRANS 30; - -CREATE INDEX iExtensionDateDef ON m_object_ext_date (owner_oid, ownerType) INITRANS 30; - ALTER TABLE m_object_ext_date ADD CONSTRAINT fk_object_ext_date FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionLong ON m_object_ext_long (ownerType, eName, longValue) INITRANS 30; - -CREATE INDEX iExtensionLongDef ON m_object_ext_long (owner_oid, ownerType) INITRANS 30; - ALTER TABLE m_object_ext_long ADD CONSTRAINT fk_object_ext_long FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionPolyString ON m_object_ext_poly (ownerType, eName, orig) INITRANS 30; - -CREATE INDEX iExtensionPolyStringDef ON m_object_ext_poly (owner_oid, ownerType) INITRANS 30; - ALTER TABLE m_object_ext_poly ADD CONSTRAINT fk_object_ext_poly FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionReference ON m_object_ext_reference (ownerType, eName, targetoid) INITRANS 30; - -CREATE INDEX iExtensionReferenceDef ON m_object_ext_reference (owner_oid, ownerType) INITRANS 30; - ALTER TABLE m_object_ext_reference ADD CONSTRAINT fk_object_ext_reference FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionString ON m_object_ext_string (ownerType, eName, stringValue) INITRANS 30; - -CREATE INDEX iExtensionStringDef ON m_object_ext_string (owner_oid, ownerType) INITRANS 30; - ALTER TABLE m_object_ext_string ADD CONSTRAINT fk_object_ext_string FOREIGN KEY (owner_oid) @@ -723,17 +777,11 @@ ADD CONSTRAINT fk_object_template FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iDisplayOrder ON m_org (displayOrder) INITRANS 30; - ALTER TABLE m_org ADD CONSTRAINT fk_org FOREIGN KEY (oid) REFERENCES m_abstract_role; -CREATE INDEX iAncestor ON m_org_closure (ancestor_oid) INITRANS 30; - -CREATE INDEX iDescendant ON m_org_closure (descendant_oid) INITRANS 30; - ALTER TABLE m_org_closure ADD CONSTRAINT fk_ancestor FOREIGN KEY (ancestor_oid) @@ -749,15 +797,11 @@ ADD CONSTRAINT fk_org_org_type FOREIGN KEY (org_oid) REFERENCES m_org; -CREATE INDEX iReferenceTargetOid ON m_reference (targetOid) INITRANS 30; - ALTER TABLE m_reference ADD CONSTRAINT fk_reference_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iReportParent ON m_report (parent) INITRANS 30; - ALTER TABLE m_report ADD CONSTRAINT fk_report FOREIGN KEY (oid) @@ -783,10 +827,6 @@ ADD CONSTRAINT fk_security_policy FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid) INITRANS 30; - -CREATE INDEX iShadowDead ON m_shadow (dead) INITRANS 30; - ALTER TABLE m_shadow ADD CONSTRAINT fk_shadow FOREIGN KEY (oid) @@ -797,8 +837,6 @@ ADD CONSTRAINT fk_system_configuration FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iParent ON m_task (parent) INITRANS 30; - ALTER TABLE m_task ADD CONSTRAINT fk_task FOREIGN KEY (oid) @@ -809,23 +847,11 @@ ADD CONSTRAINT fk_task_dependent FOREIGN KEY (task_oid) REFERENCES m_task; -CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue) INITRANS 30; - ALTER TABLE m_trigger ADD CONSTRAINT fk_trigger_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iEmployeeNumber ON m_user (employeeNumber) INITRANS 30; - -CREATE INDEX iFullName ON m_user (fullName_orig) INITRANS 30; - -CREATE INDEX iFamilyName ON m_user (familyName_orig) INITRANS 30; - -CREATE INDEX iGivenName ON m_user (givenName_orig) INITRANS 30; - -CREATE INDEX iLocality ON m_user (locality_orig) INITRANS 30; - ALTER TABLE m_user ADD CONSTRAINT fk_user FOREIGN KEY (oid) From e87ef335a38c71ddcd68a93a475a3dcab793b1e6 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Sun, 1 Feb 2015 14:12:51 +0100 Subject: [PATCH 087/215] updated postgresql scripts --- .../postgresql-3.1-closure-upgrade.sql | 8 +- .../3.1/postgresql/postgresql-3.1.sql | 232 ++++++++++-------- 2 files changed, 134 insertions(+), 106 deletions(-) diff --git a/config/sql/midpoint/3.1/postgresql/postgresql-3.1-closure-upgrade.sql b/config/sql/midpoint/3.1/postgresql/postgresql-3.1-closure-upgrade.sql index 940b2714c2d..e68c1f4d670 100644 --- a/config/sql/midpoint/3.1/postgresql/postgresql-3.1-closure-upgrade.sql +++ b/config/sql/midpoint/3.1/postgresql/postgresql-3.1-closure-upgrade.sql @@ -3,16 +3,18 @@ DROP TABLE m_org_closure; DROP TABLE IF EXISTS m_org_incorrect; CREATE TABLE m_org_closure ( - descendant_oid VARCHAR(36) NOT NULL, ancestor_oid VARCHAR(36) NOT NULL, - val INT4 NOT NULL, - PRIMARY KEY (descendant_oid, ancestor_oid) + descendant_oid VARCHAR(36) NOT NULL, + val INT4, + PRIMARY KEY (ancestor_oid, descendant_oid) ); CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); CREATE INDEX iDescendant ON m_org_closure (descendant_oid); +CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid); + ALTER TABLE m_org_closure ADD CONSTRAINT fk_ancestor FOREIGN KEY (ancestor_oid) diff --git a/config/sql/midpoint/3.1/postgresql/postgresql-3.1.sql b/config/sql/midpoint/3.1/postgresql/postgresql-3.1.sql index 45e3715aa77..691dfe140b0 100644 --- a/config/sql/midpoint/3.1/postgresql/postgresql-3.1.sql +++ b/config/sql/midpoint/3.1/postgresql/postgresql-3.1.sql @@ -181,8 +181,7 @@ CREATE TABLE m_connector_host ( name_orig VARCHAR(255), port VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_connector_target_system ( @@ -220,8 +219,7 @@ CREATE TABLE m_generic_object ( name_orig VARCHAR(255), objectType VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_node ( @@ -229,8 +227,7 @@ CREATE TABLE m_node ( name_orig VARCHAR(255), nodeIdentifier VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_object ( @@ -324,8 +321,7 @@ CREATE TABLE m_object_template ( name_orig VARCHAR(255), type INT4, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_org ( @@ -340,15 +336,14 @@ CREATE TABLE m_org ( name_orig VARCHAR(255), tenant BOOLEAN, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_org_closure ( - descendant_oid VARCHAR(36) NOT NULL, ancestor_oid VARCHAR(36) NOT NULL, - val INT4 NOT NULL, - PRIMARY KEY (descendant_oid, ancestor_oid) + descendant_oid VARCHAR(36) NOT NULL, + val INT4, + PRIMARY KEY (ancestor_oid, descendant_oid) ); CREATE TABLE m_org_org_type ( @@ -373,8 +368,7 @@ CREATE TABLE m_report ( parent BOOLEAN, useHibernateSession BOOLEAN, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_report_output ( @@ -396,8 +390,7 @@ CREATE TABLE m_resource ( name_orig VARCHAR(255), o16_lastAvailabilityStatus INT4, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_role ( @@ -405,16 +398,14 @@ CREATE TABLE m_role ( name_orig VARCHAR(255), roleType VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_security_policy ( name_norm VARCHAR(255), name_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_shadow ( @@ -442,8 +433,7 @@ CREATE TABLE m_system_configuration ( name_norm VARCHAR(255), name_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_task ( @@ -518,8 +508,7 @@ CREATE TABLE m_user ( title_norm VARCHAR(255), title_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_user_employee_type ( @@ -549,63 +538,160 @@ CREATE TABLE m_value_policy ( name_norm VARCHAR(255), name_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE INDEX iRequestable ON m_abstract_role (requestable); +CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus); + +CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus); + +CREATE INDEX iAExtensionDate ON m_assignment_ext_date (extensionType, eName, dateValue); + +CREATE INDEX iAExtensionLong ON m_assignment_ext_long (extensionType, eName, longValue); + +CREATE INDEX iAExtensionPolyString ON m_assignment_ext_poly (extensionType, eName, orig); + +CREATE INDEX iAExtensionReference ON m_assignment_ext_reference (extensionType, eName, targetoid); + +CREATE INDEX iAExtensionString ON m_assignment_ext_string (extensionType, eName, stringValue); + +CREATE INDEX iAssignmentReferenceTargetOid ON m_assignment_reference (targetOid); + +ALTER TABLE m_connector_host +ADD CONSTRAINT uc_connector_host_name UNIQUE (name_norm); + +CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus); + +CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); + +ALTER TABLE m_generic_object +ADD CONSTRAINT uc_generic_object_name UNIQUE (name_norm); + +ALTER TABLE m_node +ADD CONSTRAINT uc_node_name UNIQUE (name_norm); + +CREATE INDEX iObjectNameOrig ON m_object (name_orig); + +CREATE INDEX iObjectNameNorm ON m_object (name_norm); + +CREATE INDEX iObjectTypeClass ON m_object (objectTypeClass); + +CREATE INDEX iObjectCreateTimestamp ON m_object (createTimestamp); + +CREATE INDEX iExtensionDate ON m_object_ext_date (ownerType, eName, dateValue); + +CREATE INDEX iExtensionDateDef ON m_object_ext_date (owner_oid, ownerType); + +CREATE INDEX iExtensionLong ON m_object_ext_long (ownerType, eName, longValue); + +CREATE INDEX iExtensionLongDef ON m_object_ext_long (owner_oid, ownerType); + +CREATE INDEX iExtensionPolyString ON m_object_ext_poly (ownerType, eName, orig); + +CREATE INDEX iExtensionPolyStringDef ON m_object_ext_poly (owner_oid, ownerType); + +CREATE INDEX iExtensionReference ON m_object_ext_reference (ownerType, eName, targetoid); + +CREATE INDEX iExtensionReferenceDef ON m_object_ext_reference (owner_oid, ownerType); + +CREATE INDEX iExtensionString ON m_object_ext_string (ownerType, eName, stringValue); + +CREATE INDEX iExtensionStringDef ON m_object_ext_string (owner_oid, ownerType); + +ALTER TABLE m_object_template +ADD CONSTRAINT uc_object_template_name UNIQUE (name_norm); + +ALTER TABLE m_org +ADD CONSTRAINT uc_org_name UNIQUE (name_norm); + +CREATE INDEX iDisplayOrder ON m_org (displayOrder); + +CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); + +CREATE INDEX iDescendant ON m_org_closure (descendant_oid); + +CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid); + +CREATE INDEX iReferenceTargetOid ON m_reference (targetOid); + +ALTER TABLE m_report +ADD CONSTRAINT uc_report_name UNIQUE (name_norm); + +CREATE INDEX iReportParent ON m_report (parent); + +ALTER TABLE m_resource +ADD CONSTRAINT uc_resource_name UNIQUE (name_norm); + +ALTER TABLE m_role +ADD CONSTRAINT uc_role_name UNIQUE (name_norm); + +ALTER TABLE m_security_policy +ADD CONSTRAINT uc_security_policy_name UNIQUE (name_norm); + +CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid); + +CREATE INDEX iShadowDead ON m_shadow (dead); + +ALTER TABLE m_system_configuration +ADD CONSTRAINT uc_system_configuration_name UNIQUE (name_norm); + +CREATE INDEX iParent ON m_task (parent); + +CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue); + +ALTER TABLE m_user +ADD CONSTRAINT uc_user_name UNIQUE (name_norm); + +CREATE INDEX iEmployeeNumber ON m_user (employeeNumber); + +CREATE INDEX iFullName ON m_user (fullName_orig); + +CREATE INDEX iFamilyName ON m_user (familyName_orig); + +CREATE INDEX iGivenName ON m_user (givenName_orig); + +CREATE INDEX iLocality ON m_user (locality_orig); + +ALTER TABLE m_value_policy +ADD CONSTRAINT uc_value_policy_name UNIQUE (name_norm); + ALTER TABLE m_abstract_role ADD CONSTRAINT fk_abstract_role FOREIGN KEY (oid) REFERENCES m_focus; -CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus); - -CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus); - ALTER TABLE m_assignment ADD CONSTRAINT fk_assignment_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iAExtensionDate ON m_assignment_ext_date (extensionType, eName, dateValue); - ALTER TABLE m_assignment_ext_date ADD CONSTRAINT fk_assignment_ext_date FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionLong ON m_assignment_ext_long (extensionType, eName, longValue); - ALTER TABLE m_assignment_ext_long ADD CONSTRAINT fk_assignment_ext_long FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionPolyString ON m_assignment_ext_poly (extensionType, eName, orig); - ALTER TABLE m_assignment_ext_poly ADD CONSTRAINT fk_assignment_ext_poly FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionReference ON m_assignment_ext_reference (extensionType, eName, targetoid); - ALTER TABLE m_assignment_ext_reference ADD CONSTRAINT fk_assignment_ext_reference FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionString ON m_assignment_ext_string (extensionType, eName, stringValue); - ALTER TABLE m_assignment_ext_string ADD CONSTRAINT fk_assignment_ext_string FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAssignmentReferenceTargetOid ON m_assignment_reference (targetOid); - ALTER TABLE m_assignment_reference ADD CONSTRAINT fk_assignment_reference FOREIGN KEY (owner_id, owner_owner_oid) @@ -636,10 +722,6 @@ ADD CONSTRAINT fk_exclusion_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus); - -CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); - ALTER TABLE m_focus ADD CONSTRAINT fk_focus FOREIGN KEY (oid) @@ -655,54 +737,26 @@ ADD CONSTRAINT fk_node FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iObjectCreateTimestamp ON m_object (createTimestamp); - -CREATE INDEX iObjectTypeClass ON m_object (objectTypeClass); - -CREATE INDEX iObjectNameOrig ON m_object (name_orig); - -CREATE INDEX iObjectNameNorm ON m_object (name_norm); - -CREATE INDEX iExtensionDate ON m_object_ext_date (ownerType, eName, dateValue); - -CREATE INDEX iExtensionDateDef ON m_object_ext_date (owner_oid, ownerType); - ALTER TABLE m_object_ext_date ADD CONSTRAINT fk_object_ext_date FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionLong ON m_object_ext_long (ownerType, eName, longValue); - -CREATE INDEX iExtensionLongDef ON m_object_ext_long (owner_oid, ownerType); - ALTER TABLE m_object_ext_long ADD CONSTRAINT fk_object_ext_long FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionPolyString ON m_object_ext_poly (ownerType, eName, orig); - -CREATE INDEX iExtensionPolyStringDef ON m_object_ext_poly (owner_oid, ownerType); - ALTER TABLE m_object_ext_poly ADD CONSTRAINT fk_object_ext_poly FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionReference ON m_object_ext_reference (ownerType, eName, targetoid); - -CREATE INDEX iExtensionReferenceDef ON m_object_ext_reference (owner_oid, ownerType); - ALTER TABLE m_object_ext_reference ADD CONSTRAINT fk_object_ext_reference FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionString ON m_object_ext_string (ownerType, eName, stringValue); - -CREATE INDEX iExtensionStringDef ON m_object_ext_string (owner_oid, ownerType); - ALTER TABLE m_object_ext_string ADD CONSTRAINT fk_object_ext_string FOREIGN KEY (owner_oid) @@ -713,17 +767,11 @@ ADD CONSTRAINT fk_object_template FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iDisplayOrder ON m_org (displayOrder); - ALTER TABLE m_org ADD CONSTRAINT fk_org FOREIGN KEY (oid) REFERENCES m_abstract_role; -CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); - -CREATE INDEX iDescendant ON m_org_closure (descendant_oid); - ALTER TABLE m_org_closure ADD CONSTRAINT fk_ancestor FOREIGN KEY (ancestor_oid) @@ -739,15 +787,11 @@ ADD CONSTRAINT fk_org_org_type FOREIGN KEY (org_oid) REFERENCES m_org; -CREATE INDEX iReferenceTargetOid ON m_reference (targetOid); - ALTER TABLE m_reference ADD CONSTRAINT fk_reference_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iReportParent ON m_report (parent); - ALTER TABLE m_report ADD CONSTRAINT fk_report FOREIGN KEY (oid) @@ -773,10 +817,6 @@ ADD CONSTRAINT fk_security_policy FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid); - -CREATE INDEX iShadowDead ON m_shadow (dead); - ALTER TABLE m_shadow ADD CONSTRAINT fk_shadow FOREIGN KEY (oid) @@ -787,8 +827,6 @@ ADD CONSTRAINT fk_system_configuration FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iParent ON m_task (parent); - ALTER TABLE m_task ADD CONSTRAINT fk_task FOREIGN KEY (oid) @@ -799,23 +837,11 @@ ADD CONSTRAINT fk_task_dependent FOREIGN KEY (task_oid) REFERENCES m_task; -CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue); - ALTER TABLE m_trigger ADD CONSTRAINT fk_trigger_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iEmployeeNumber ON m_user (employeeNumber); - -CREATE INDEX iFullName ON m_user (fullName_orig); - -CREATE INDEX iFamilyName ON m_user (familyName_orig); - -CREATE INDEX iGivenName ON m_user (givenName_orig); - -CREATE INDEX iLocality ON m_user (locality_orig); - ALTER TABLE m_user ADD CONSTRAINT fk_user FOREIGN KEY (oid) From 71294d3f0cdf277e2a6ff7309add433a4416fa30 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Sun, 1 Feb 2015 14:32:07 +0100 Subject: [PATCH 088/215] updated sql server scripts --- .../sqlserver-3.1-closure-upgrade.sql | 8 +- .../midpoint/3.1/sqlserver/sqlserver-3.1.sql | 232 ++++++++++-------- 2 files changed, 134 insertions(+), 106 deletions(-) diff --git a/config/sql/midpoint/3.1/sqlserver/sqlserver-3.1-closure-upgrade.sql b/config/sql/midpoint/3.1/sqlserver/sqlserver-3.1-closure-upgrade.sql index 0045099a7d0..da15003e1fc 100644 --- a/config/sql/midpoint/3.1/sqlserver/sqlserver-3.1-closure-upgrade.sql +++ b/config/sql/midpoint/3.1/sqlserver/sqlserver-3.1-closure-upgrade.sql @@ -4,16 +4,18 @@ IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'm_org_inc DROP TABLE m_org_incorrect; CREATE TABLE m_org_closure ( - descendant_oid NVARCHAR(36) COLLATE database_default NOT NULL, ancestor_oid NVARCHAR(36) COLLATE database_default NOT NULL, - val INT NOT NULL, - PRIMARY KEY (descendant_oid, ancestor_oid) + descendant_oid NVARCHAR(36) COLLATE database_default NOT NULL, + val INT, + PRIMARY KEY (ancestor_oid, descendant_oid) ); CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); CREATE INDEX iDescendant ON m_org_closure (descendant_oid); +CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid); + ALTER TABLE m_org_closure ADD CONSTRAINT fk_ancestor FOREIGN KEY (ancestor_oid) diff --git a/config/sql/midpoint/3.1/sqlserver/sqlserver-3.1.sql b/config/sql/midpoint/3.1/sqlserver/sqlserver-3.1.sql index ade06cdd7fa..a0d68c86fb5 100644 --- a/config/sql/midpoint/3.1/sqlserver/sqlserver-3.1.sql +++ b/config/sql/midpoint/3.1/sqlserver/sqlserver-3.1.sql @@ -181,8 +181,7 @@ CREATE TABLE m_connector_host ( name_orig NVARCHAR(255) COLLATE database_default, port NVARCHAR(255) COLLATE database_default, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_connector_target_system ( @@ -220,8 +219,7 @@ CREATE TABLE m_generic_object ( name_orig NVARCHAR(255) COLLATE database_default, objectType NVARCHAR(255) COLLATE database_default, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_node ( @@ -229,8 +227,7 @@ CREATE TABLE m_node ( name_orig NVARCHAR(255) COLLATE database_default, nodeIdentifier NVARCHAR(255) COLLATE database_default, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_object ( @@ -324,8 +321,7 @@ CREATE TABLE m_object_template ( name_orig NVARCHAR(255) COLLATE database_default, type INT, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_org ( @@ -340,15 +336,14 @@ CREATE TABLE m_org ( name_orig NVARCHAR(255) COLLATE database_default, tenant BIT, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_org_closure ( - descendant_oid NVARCHAR(36) COLLATE database_default NOT NULL, ancestor_oid NVARCHAR(36) COLLATE database_default NOT NULL, - val INT NOT NULL, - PRIMARY KEY (descendant_oid, ancestor_oid) + descendant_oid NVARCHAR(36) COLLATE database_default NOT NULL, + val INT, + PRIMARY KEY (ancestor_oid, descendant_oid) ); CREATE TABLE m_org_org_type ( @@ -373,8 +368,7 @@ CREATE TABLE m_report ( parent BIT, useHibernateSession BIT, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_report_output ( @@ -396,8 +390,7 @@ CREATE TABLE m_resource ( name_orig NVARCHAR(255) COLLATE database_default, o16_lastAvailabilityStatus INT, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_role ( @@ -405,16 +398,14 @@ CREATE TABLE m_role ( name_orig NVARCHAR(255) COLLATE database_default, roleType NVARCHAR(255) COLLATE database_default, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_security_policy ( name_norm NVARCHAR(255) COLLATE database_default, name_orig NVARCHAR(255) COLLATE database_default, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_shadow ( @@ -442,8 +433,7 @@ CREATE TABLE m_system_configuration ( name_norm NVARCHAR(255) COLLATE database_default, name_orig NVARCHAR(255) COLLATE database_default, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_task ( @@ -518,8 +508,7 @@ CREATE TABLE m_user ( title_norm NVARCHAR(255) COLLATE database_default, title_orig NVARCHAR(255) COLLATE database_default, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_user_employee_type ( @@ -549,63 +538,160 @@ CREATE TABLE m_value_policy ( name_norm NVARCHAR(255) COLLATE database_default, name_orig NVARCHAR(255) COLLATE database_default, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE INDEX iRequestable ON m_abstract_role (requestable); +CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus); + +CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus); + +CREATE INDEX iAExtensionDate ON m_assignment_ext_date (extensionType, eName, dateValue); + +CREATE INDEX iAExtensionLong ON m_assignment_ext_long (extensionType, eName, longValue); + +CREATE INDEX iAExtensionPolyString ON m_assignment_ext_poly (extensionType, eName, orig); + +CREATE INDEX iAExtensionReference ON m_assignment_ext_reference (extensionType, eName, targetoid); + +CREATE INDEX iAExtensionString ON m_assignment_ext_string (extensionType, eName, stringValue); + +CREATE INDEX iAssignmentReferenceTargetOid ON m_assignment_reference (targetOid); + +ALTER TABLE m_connector_host +ADD CONSTRAINT uc_connector_host_name UNIQUE (name_norm); + +CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus); + +CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); + +ALTER TABLE m_generic_object +ADD CONSTRAINT uc_generic_object_name UNIQUE (name_norm); + +ALTER TABLE m_node +ADD CONSTRAINT uc_node_name UNIQUE (name_norm); + +CREATE INDEX iObjectNameOrig ON m_object (name_orig); + +CREATE INDEX iObjectNameNorm ON m_object (name_norm); + +CREATE INDEX iObjectTypeClass ON m_object (objectTypeClass); + +CREATE INDEX iObjectCreateTimestamp ON m_object (createTimestamp); + +CREATE INDEX iExtensionDate ON m_object_ext_date (ownerType, eName, dateValue); + +CREATE INDEX iExtensionDateDef ON m_object_ext_date (owner_oid, ownerType); + +CREATE INDEX iExtensionLong ON m_object_ext_long (ownerType, eName, longValue); + +CREATE INDEX iExtensionLongDef ON m_object_ext_long (owner_oid, ownerType); + +CREATE INDEX iExtensionPolyString ON m_object_ext_poly (ownerType, eName, orig); + +CREATE INDEX iExtensionPolyStringDef ON m_object_ext_poly (owner_oid, ownerType); + +CREATE INDEX iExtensionReference ON m_object_ext_reference (ownerType, eName, targetoid); + +CREATE INDEX iExtensionReferenceDef ON m_object_ext_reference (owner_oid, ownerType); + +CREATE INDEX iExtensionString ON m_object_ext_string (ownerType, eName, stringValue); + +CREATE INDEX iExtensionStringDef ON m_object_ext_string (owner_oid, ownerType); + +ALTER TABLE m_object_template +ADD CONSTRAINT uc_object_template_name UNIQUE (name_norm); + +ALTER TABLE m_org +ADD CONSTRAINT uc_org_name UNIQUE (name_norm); + +CREATE INDEX iDisplayOrder ON m_org (displayOrder); + +CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); + +CREATE INDEX iDescendant ON m_org_closure (descendant_oid); + +CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid); + +CREATE INDEX iReferenceTargetOid ON m_reference (targetOid); + +ALTER TABLE m_report +ADD CONSTRAINT uc_report_name UNIQUE (name_norm); + +CREATE INDEX iReportParent ON m_report (parent); + +ALTER TABLE m_resource +ADD CONSTRAINT uc_resource_name UNIQUE (name_norm); + +ALTER TABLE m_role +ADD CONSTRAINT uc_role_name UNIQUE (name_norm); + +ALTER TABLE m_security_policy +ADD CONSTRAINT uc_security_policy_name UNIQUE (name_norm); + +CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid); + +CREATE INDEX iShadowDead ON m_shadow (dead); + +ALTER TABLE m_system_configuration +ADD CONSTRAINT uc_system_configuration_name UNIQUE (name_norm); + +CREATE INDEX iParent ON m_task (parent); + +CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue); + +ALTER TABLE m_user +ADD CONSTRAINT uc_user_name UNIQUE (name_norm); + +CREATE INDEX iEmployeeNumber ON m_user (employeeNumber); + +CREATE INDEX iFullName ON m_user (fullName_orig); + +CREATE INDEX iFamilyName ON m_user (familyName_orig); + +CREATE INDEX iGivenName ON m_user (givenName_orig); + +CREATE INDEX iLocality ON m_user (locality_orig); + +ALTER TABLE m_value_policy +ADD CONSTRAINT uc_value_policy_name UNIQUE (name_norm); + ALTER TABLE m_abstract_role ADD CONSTRAINT fk_abstract_role FOREIGN KEY (oid) REFERENCES m_focus; -CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus); - -CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus); - ALTER TABLE m_assignment ADD CONSTRAINT fk_assignment_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iAExtensionDate ON m_assignment_ext_date (extensionType, eName, dateValue); - ALTER TABLE m_assignment_ext_date ADD CONSTRAINT fk_assignment_ext_date FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionLong ON m_assignment_ext_long (extensionType, eName, longValue); - ALTER TABLE m_assignment_ext_long ADD CONSTRAINT fk_assignment_ext_long FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionPolyString ON m_assignment_ext_poly (extensionType, eName, orig); - ALTER TABLE m_assignment_ext_poly ADD CONSTRAINT fk_assignment_ext_poly FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionReference ON m_assignment_ext_reference (extensionType, eName, targetoid); - ALTER TABLE m_assignment_ext_reference ADD CONSTRAINT fk_assignment_ext_reference FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionString ON m_assignment_ext_string (extensionType, eName, stringValue); - ALTER TABLE m_assignment_ext_string ADD CONSTRAINT fk_assignment_ext_string FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAssignmentReferenceTargetOid ON m_assignment_reference (targetOid); - ALTER TABLE m_assignment_reference ADD CONSTRAINT fk_assignment_reference FOREIGN KEY (owner_id, owner_owner_oid) @@ -636,10 +722,6 @@ ADD CONSTRAINT fk_exclusion_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus); - -CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); - ALTER TABLE m_focus ADD CONSTRAINT fk_focus FOREIGN KEY (oid) @@ -655,54 +737,26 @@ ADD CONSTRAINT fk_node FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iObjectCreateTimestamp ON m_object (createTimestamp); - -CREATE INDEX iObjectTypeClass ON m_object (objectTypeClass); - -CREATE INDEX iObjectNameOrig ON m_object (name_orig); - -CREATE INDEX iObjectNameNorm ON m_object (name_norm); - -CREATE INDEX iExtensionDate ON m_object_ext_date (ownerType, eName, dateValue); - -CREATE INDEX iExtensionDateDef ON m_object_ext_date (owner_oid, ownerType); - ALTER TABLE m_object_ext_date ADD CONSTRAINT fk_object_ext_date FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionLong ON m_object_ext_long (ownerType, eName, longValue); - -CREATE INDEX iExtensionLongDef ON m_object_ext_long (owner_oid, ownerType); - ALTER TABLE m_object_ext_long ADD CONSTRAINT fk_object_ext_long FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionPolyString ON m_object_ext_poly (ownerType, eName, orig); - -CREATE INDEX iExtensionPolyStringDef ON m_object_ext_poly (owner_oid, ownerType); - ALTER TABLE m_object_ext_poly ADD CONSTRAINT fk_object_ext_poly FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionReference ON m_object_ext_reference (ownerType, eName, targetoid); - -CREATE INDEX iExtensionReferenceDef ON m_object_ext_reference (owner_oid, ownerType); - ALTER TABLE m_object_ext_reference ADD CONSTRAINT fk_object_ext_reference FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionString ON m_object_ext_string (ownerType, eName, stringValue); - -CREATE INDEX iExtensionStringDef ON m_object_ext_string (owner_oid, ownerType); - ALTER TABLE m_object_ext_string ADD CONSTRAINT fk_object_ext_string FOREIGN KEY (owner_oid) @@ -713,17 +767,11 @@ ADD CONSTRAINT fk_object_template FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iDisplayOrder ON m_org (displayOrder); - ALTER TABLE m_org ADD CONSTRAINT fk_org FOREIGN KEY (oid) REFERENCES m_abstract_role; -CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); - -CREATE INDEX iDescendant ON m_org_closure (descendant_oid); - ALTER TABLE m_org_closure ADD CONSTRAINT fk_ancestor FOREIGN KEY (ancestor_oid) @@ -739,15 +787,11 @@ ADD CONSTRAINT fk_org_org_type FOREIGN KEY (org_oid) REFERENCES m_org; -CREATE INDEX iReferenceTargetOid ON m_reference (targetOid); - ALTER TABLE m_reference ADD CONSTRAINT fk_reference_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iReportParent ON m_report (parent); - ALTER TABLE m_report ADD CONSTRAINT fk_report FOREIGN KEY (oid) @@ -773,10 +817,6 @@ ADD CONSTRAINT fk_security_policy FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid); - -CREATE INDEX iShadowDead ON m_shadow (dead); - ALTER TABLE m_shadow ADD CONSTRAINT fk_shadow FOREIGN KEY (oid) @@ -787,8 +827,6 @@ ADD CONSTRAINT fk_system_configuration FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iParent ON m_task (parent); - ALTER TABLE m_task ADD CONSTRAINT fk_task FOREIGN KEY (oid) @@ -799,23 +837,11 @@ ADD CONSTRAINT fk_task_dependent FOREIGN KEY (task_oid) REFERENCES m_task; -CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue); - ALTER TABLE m_trigger ADD CONSTRAINT fk_trigger_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iEmployeeNumber ON m_user (employeeNumber); - -CREATE INDEX iFullName ON m_user (fullName_orig); - -CREATE INDEX iFamilyName ON m_user (familyName_orig); - -CREATE INDEX iGivenName ON m_user (givenName_orig); - -CREATE INDEX iLocality ON m_user (locality_orig); - ALTER TABLE m_user ADD CONSTRAINT fk_user FOREIGN KEY (oid) From 5e2ea853237a73bfef5a2e5bd50ab0f08a24418c Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Sun, 1 Feb 2015 14:36:37 +0100 Subject: [PATCH 089/215] updated h2 scripts. --- .../3.1/h2/h2-3.1-closure-upgrade.sql | 10 +- config/sql/midpoint/3.1/h2/h2-3.1.sql | 232 ++++++++++-------- 2 files changed, 135 insertions(+), 107 deletions(-) diff --git a/config/sql/midpoint/3.1/h2/h2-3.1-closure-upgrade.sql b/config/sql/midpoint/3.1/h2/h2-3.1-closure-upgrade.sql index db6f756e478..9dbf6cc43ec 100644 --- a/config/sql/midpoint/3.1/h2/h2-3.1-closure-upgrade.sql +++ b/config/sql/midpoint/3.1/h2/h2-3.1-closure-upgrade.sql @@ -3,15 +3,17 @@ DROP TABLE m_org_closure; DROP TABLE IF EXISTS m_org_incorrect; CREATE TABLE m_org_closure ( - descendant_oid VARCHAR(36) NOT NULL, ancestor_oid VARCHAR(36) NOT NULL, - val INTEGER NOT NULL, - PRIMARY KEY (descendant_oid, ancestor_oid) + descendant_oid VARCHAR(36) NOT NULL, + val INTEGER, + PRIMARY KEY (ancestor_oid, descendant_oid) ); +CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); + CREATE INDEX iDescendant ON m_org_closure (descendant_oid); -CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); +CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid); ALTER TABLE m_org_closure ADD CONSTRAINT fk_ancestor diff --git a/config/sql/midpoint/3.1/h2/h2-3.1.sql b/config/sql/midpoint/3.1/h2/h2-3.1.sql index 43f8b3e0f90..83f26b4623b 100644 --- a/config/sql/midpoint/3.1/h2/h2-3.1.sql +++ b/config/sql/midpoint/3.1/h2/h2-3.1.sql @@ -181,8 +181,7 @@ CREATE TABLE m_connector_host ( name_orig VARCHAR(255), port VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_connector_target_system ( @@ -220,8 +219,7 @@ CREATE TABLE m_generic_object ( name_orig VARCHAR(255), objectType VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_node ( @@ -229,8 +227,7 @@ CREATE TABLE m_node ( name_orig VARCHAR(255), nodeIdentifier VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_object ( @@ -324,8 +321,7 @@ CREATE TABLE m_object_template ( name_orig VARCHAR(255), type INTEGER, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_org ( @@ -340,15 +336,14 @@ CREATE TABLE m_org ( name_orig VARCHAR(255), tenant BOOLEAN, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_org_closure ( - descendant_oid VARCHAR(36) NOT NULL, ancestor_oid VARCHAR(36) NOT NULL, - val INTEGER NOT NULL, - PRIMARY KEY (descendant_oid, ancestor_oid) + descendant_oid VARCHAR(36) NOT NULL, + val INTEGER, + PRIMARY KEY (ancestor_oid, descendant_oid) ); CREATE TABLE m_org_org_type ( @@ -373,8 +368,7 @@ CREATE TABLE m_report ( parent BOOLEAN, useHibernateSession BOOLEAN, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_report_output ( @@ -396,8 +390,7 @@ CREATE TABLE m_resource ( name_orig VARCHAR(255), o16_lastAvailabilityStatus INTEGER, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_role ( @@ -405,16 +398,14 @@ CREATE TABLE m_role ( name_orig VARCHAR(255), roleType VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_security_policy ( name_norm VARCHAR(255), name_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_shadow ( @@ -442,8 +433,7 @@ CREATE TABLE m_system_configuration ( name_norm VARCHAR(255), name_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_task ( @@ -518,8 +508,7 @@ CREATE TABLE m_user ( title_norm VARCHAR(255), title_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_user_employee_type ( @@ -549,63 +538,160 @@ CREATE TABLE m_value_policy ( name_norm VARCHAR(255), name_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE INDEX iRequestable ON m_abstract_role (requestable); +CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus); + +CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus); + +CREATE INDEX iAExtensionDate ON m_assignment_ext_date (extensionType, eName, dateValue); + +CREATE INDEX iAExtensionLong ON m_assignment_ext_long (extensionType, eName, longValue); + +CREATE INDEX iAExtensionPolyString ON m_assignment_ext_poly (extensionType, eName, orig); + +CREATE INDEX iAExtensionReference ON m_assignment_ext_reference (extensionType, eName, targetoid); + +CREATE INDEX iAExtensionString ON m_assignment_ext_string (extensionType, eName, stringValue); + +CREATE INDEX iAssignmentReferenceTargetOid ON m_assignment_reference (targetOid); + +ALTER TABLE m_connector_host +ADD CONSTRAINT uc_connector_host_name UNIQUE (name_norm); + +CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus); + +CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); + +ALTER TABLE m_generic_object +ADD CONSTRAINT uc_generic_object_name UNIQUE (name_norm); + +ALTER TABLE m_node +ADD CONSTRAINT uc_node_name UNIQUE (name_norm); + +CREATE INDEX iObjectNameOrig ON m_object (name_orig); + +CREATE INDEX iObjectNameNorm ON m_object (name_norm); + +CREATE INDEX iObjectTypeClass ON m_object (objectTypeClass); + +CREATE INDEX iObjectCreateTimestamp ON m_object (createTimestamp); + +CREATE INDEX iExtensionDate ON m_object_ext_date (ownerType, eName, dateValue); + +CREATE INDEX iExtensionDateDef ON m_object_ext_date (owner_oid, ownerType); + +CREATE INDEX iExtensionLong ON m_object_ext_long (ownerType, eName, longValue); + +CREATE INDEX iExtensionLongDef ON m_object_ext_long (owner_oid, ownerType); + +CREATE INDEX iExtensionPolyString ON m_object_ext_poly (ownerType, eName, orig); + +CREATE INDEX iExtensionPolyStringDef ON m_object_ext_poly (owner_oid, ownerType); + +CREATE INDEX iExtensionReference ON m_object_ext_reference (ownerType, eName, targetoid); + +CREATE INDEX iExtensionReferenceDef ON m_object_ext_reference (owner_oid, ownerType); + +CREATE INDEX iExtensionString ON m_object_ext_string (ownerType, eName, stringValue); + +CREATE INDEX iExtensionStringDef ON m_object_ext_string (owner_oid, ownerType); + +ALTER TABLE m_object_template +ADD CONSTRAINT uc_object_template_name UNIQUE (name_norm); + +ALTER TABLE m_org +ADD CONSTRAINT uc_org_name UNIQUE (name_norm); + +CREATE INDEX iDisplayOrder ON m_org (displayOrder); + +CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); + +CREATE INDEX iDescendant ON m_org_closure (descendant_oid); + +CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid); + +CREATE INDEX iReferenceTargetOid ON m_reference (targetOid); + +ALTER TABLE m_report +ADD CONSTRAINT uc_report_name UNIQUE (name_norm); + +CREATE INDEX iReportParent ON m_report (parent); + +ALTER TABLE m_resource +ADD CONSTRAINT uc_resource_name UNIQUE (name_norm); + +ALTER TABLE m_role +ADD CONSTRAINT uc_role_name UNIQUE (name_norm); + +ALTER TABLE m_security_policy +ADD CONSTRAINT uc_security_policy_name UNIQUE (name_norm); + +CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid); + +CREATE INDEX iShadowDead ON m_shadow (dead); + +ALTER TABLE m_system_configuration +ADD CONSTRAINT uc_system_configuration_name UNIQUE (name_norm); + +CREATE INDEX iParent ON m_task (parent); + +CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue); + +ALTER TABLE m_user +ADD CONSTRAINT uc_user_name UNIQUE (name_norm); + +CREATE INDEX iEmployeeNumber ON m_user (employeeNumber); + +CREATE INDEX iFullName ON m_user (fullName_orig); + +CREATE INDEX iFamilyName ON m_user (familyName_orig); + +CREATE INDEX iGivenName ON m_user (givenName_orig); + +CREATE INDEX iLocality ON m_user (locality_orig); + +ALTER TABLE m_value_policy +ADD CONSTRAINT uc_value_policy_name UNIQUE (name_norm); + ALTER TABLE m_abstract_role ADD CONSTRAINT fk_abstract_role FOREIGN KEY (oid) REFERENCES m_focus; -CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus); - -CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus); - ALTER TABLE m_assignment ADD CONSTRAINT fk_assignment_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iAExtensionDate ON m_assignment_ext_date (extensionType, eName, dateValue); - ALTER TABLE m_assignment_ext_date ADD CONSTRAINT fk_assignment_ext_date FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionLong ON m_assignment_ext_long (extensionType, eName, longValue); - ALTER TABLE m_assignment_ext_long ADD CONSTRAINT fk_assignment_ext_long FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionPolyString ON m_assignment_ext_poly (extensionType, eName, orig); - ALTER TABLE m_assignment_ext_poly ADD CONSTRAINT fk_assignment_ext_poly FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionReference ON m_assignment_ext_reference (extensionType, eName, targetoid); - ALTER TABLE m_assignment_ext_reference ADD CONSTRAINT fk_assignment_ext_reference FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionString ON m_assignment_ext_string (extensionType, eName, stringValue); - ALTER TABLE m_assignment_ext_string ADD CONSTRAINT fk_assignment_ext_string FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAssignmentReferenceTargetOid ON m_assignment_reference (targetOid); - ALTER TABLE m_assignment_reference ADD CONSTRAINT fk_assignment_reference FOREIGN KEY (owner_id, owner_owner_oid) @@ -636,10 +722,6 @@ ADD CONSTRAINT fk_exclusion_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus); - -CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); - ALTER TABLE m_focus ADD CONSTRAINT fk_focus FOREIGN KEY (oid) @@ -655,54 +737,26 @@ ADD CONSTRAINT fk_node FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iObjectCreateTimestamp ON m_object (createTimestamp); - -CREATE INDEX iObjectTypeClass ON m_object (objectTypeClass); - -CREATE INDEX iObjectNameOrig ON m_object (name_orig); - -CREATE INDEX iObjectNameNorm ON m_object (name_norm); - -CREATE INDEX iExtensionDate ON m_object_ext_date (ownerType, eName, dateValue); - -CREATE INDEX iExtensionDateDef ON m_object_ext_date (owner_oid, ownerType); - ALTER TABLE m_object_ext_date ADD CONSTRAINT fk_object_ext_date FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionLong ON m_object_ext_long (ownerType, eName, longValue); - -CREATE INDEX iExtensionLongDef ON m_object_ext_long (owner_oid, ownerType); - ALTER TABLE m_object_ext_long ADD CONSTRAINT fk_object_ext_long FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionPolyString ON m_object_ext_poly (ownerType, eName, orig); - -CREATE INDEX iExtensionPolyStringDef ON m_object_ext_poly (owner_oid, ownerType); - ALTER TABLE m_object_ext_poly ADD CONSTRAINT fk_object_ext_poly FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionReference ON m_object_ext_reference (ownerType, eName, targetoid); - -CREATE INDEX iExtensionReferenceDef ON m_object_ext_reference (owner_oid, ownerType); - ALTER TABLE m_object_ext_reference ADD CONSTRAINT fk_object_ext_reference FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionString ON m_object_ext_string (ownerType, eName, stringValue); - -CREATE INDEX iExtensionStringDef ON m_object_ext_string (owner_oid, ownerType); - ALTER TABLE m_object_ext_string ADD CONSTRAINT fk_object_ext_string FOREIGN KEY (owner_oid) @@ -713,17 +767,11 @@ ADD CONSTRAINT fk_object_template FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iDisplayOrder ON m_org (displayOrder); - ALTER TABLE m_org ADD CONSTRAINT fk_org FOREIGN KEY (oid) REFERENCES m_abstract_role; -CREATE INDEX iDescendant ON m_org_closure (descendant_oid); - -CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); - ALTER TABLE m_org_closure ADD CONSTRAINT fk_ancestor FOREIGN KEY (ancestor_oid) @@ -739,15 +787,11 @@ ADD CONSTRAINT fk_org_org_type FOREIGN KEY (org_oid) REFERENCES m_org; -CREATE INDEX iReferenceTargetOid ON m_reference (targetOid); - ALTER TABLE m_reference ADD CONSTRAINT fk_reference_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iReportParent ON m_report (parent); - ALTER TABLE m_report ADD CONSTRAINT fk_report FOREIGN KEY (oid) @@ -773,10 +817,6 @@ ADD CONSTRAINT fk_security_policy FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid); - -CREATE INDEX iShadowDead ON m_shadow (dead); - ALTER TABLE m_shadow ADD CONSTRAINT fk_shadow FOREIGN KEY (oid) @@ -787,8 +827,6 @@ ADD CONSTRAINT fk_system_configuration FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iParent ON m_task (parent); - ALTER TABLE m_task ADD CONSTRAINT fk_task FOREIGN KEY (oid) @@ -799,23 +837,11 @@ ADD CONSTRAINT fk_task_dependent FOREIGN KEY (task_oid) REFERENCES m_task; -CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue); - ALTER TABLE m_trigger ADD CONSTRAINT fk_trigger_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iEmployeeNumber ON m_user (employeeNumber); - -CREATE INDEX iFullName ON m_user (fullName_orig); - -CREATE INDEX iFamilyName ON m_user (familyName_orig); - -CREATE INDEX iGivenName ON m_user (givenName_orig); - -CREATE INDEX iLocality ON m_user (locality_orig); - ALTER TABLE m_user ADD CONSTRAINT fk_user FOREIGN KEY (oid) From 3ae71b38c7dfc13693495e9ddef24f79d99c188f Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Mon, 2 Feb 2015 09:45:37 +0100 Subject: [PATCH 090/215] updated all sql scripts. --- config/sql/_all/h2-3.1-all.sql | 232 +++++++++------- config/sql/_all/mysql-3.1-all.sql | 371 ++++++++++++------------- config/sql/_all/oracle-3.1-all.sql | 232 +++++++++------- config/sql/_all/postgresql-3.1-all.sql | 232 +++++++++------- config/sql/_all/sqlserver-3.1-all.sql | 232 +++++++++------- 5 files changed, 694 insertions(+), 605 deletions(-) diff --git a/config/sql/_all/h2-3.1-all.sql b/config/sql/_all/h2-3.1-all.sql index f23241952b9..7aa0c059fb9 100644 --- a/config/sql/_all/h2-3.1-all.sql +++ b/config/sql/_all/h2-3.1-all.sql @@ -181,8 +181,7 @@ CREATE TABLE m_connector_host ( name_orig VARCHAR(255), port VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_connector_target_system ( @@ -220,8 +219,7 @@ CREATE TABLE m_generic_object ( name_orig VARCHAR(255), objectType VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_node ( @@ -229,8 +227,7 @@ CREATE TABLE m_node ( name_orig VARCHAR(255), nodeIdentifier VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_object ( @@ -324,8 +321,7 @@ CREATE TABLE m_object_template ( name_orig VARCHAR(255), type INTEGER, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_org ( @@ -340,15 +336,14 @@ CREATE TABLE m_org ( name_orig VARCHAR(255), tenant BOOLEAN, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_org_closure ( - descendant_oid VARCHAR(36) NOT NULL, ancestor_oid VARCHAR(36) NOT NULL, - val INTEGER NOT NULL, - PRIMARY KEY (descendant_oid, ancestor_oid) + descendant_oid VARCHAR(36) NOT NULL, + val INTEGER, + PRIMARY KEY (ancestor_oid, descendant_oid) ); CREATE TABLE m_org_org_type ( @@ -373,8 +368,7 @@ CREATE TABLE m_report ( parent BOOLEAN, useHibernateSession BOOLEAN, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_report_output ( @@ -396,8 +390,7 @@ CREATE TABLE m_resource ( name_orig VARCHAR(255), o16_lastAvailabilityStatus INTEGER, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_role ( @@ -405,16 +398,14 @@ CREATE TABLE m_role ( name_orig VARCHAR(255), roleType VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_security_policy ( name_norm VARCHAR(255), name_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_shadow ( @@ -442,8 +433,7 @@ CREATE TABLE m_system_configuration ( name_norm VARCHAR(255), name_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_task ( @@ -518,8 +508,7 @@ CREATE TABLE m_user ( title_norm VARCHAR(255), title_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_user_employee_type ( @@ -549,63 +538,160 @@ CREATE TABLE m_value_policy ( name_norm VARCHAR(255), name_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE INDEX iRequestable ON m_abstract_role (requestable); +CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus); + +CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus); + +CREATE INDEX iAExtensionDate ON m_assignment_ext_date (extensionType, eName, dateValue); + +CREATE INDEX iAExtensionLong ON m_assignment_ext_long (extensionType, eName, longValue); + +CREATE INDEX iAExtensionPolyString ON m_assignment_ext_poly (extensionType, eName, orig); + +CREATE INDEX iAExtensionReference ON m_assignment_ext_reference (extensionType, eName, targetoid); + +CREATE INDEX iAExtensionString ON m_assignment_ext_string (extensionType, eName, stringValue); + +CREATE INDEX iAssignmentReferenceTargetOid ON m_assignment_reference (targetOid); + +ALTER TABLE m_connector_host +ADD CONSTRAINT uc_connector_host_name UNIQUE (name_norm); + +CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus); + +CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); + +ALTER TABLE m_generic_object +ADD CONSTRAINT uc_generic_object_name UNIQUE (name_norm); + +ALTER TABLE m_node +ADD CONSTRAINT uc_node_name UNIQUE (name_norm); + +CREATE INDEX iObjectNameOrig ON m_object (name_orig); + +CREATE INDEX iObjectNameNorm ON m_object (name_norm); + +CREATE INDEX iObjectTypeClass ON m_object (objectTypeClass); + +CREATE INDEX iObjectCreateTimestamp ON m_object (createTimestamp); + +CREATE INDEX iExtensionDate ON m_object_ext_date (ownerType, eName, dateValue); + +CREATE INDEX iExtensionDateDef ON m_object_ext_date (owner_oid, ownerType); + +CREATE INDEX iExtensionLong ON m_object_ext_long (ownerType, eName, longValue); + +CREATE INDEX iExtensionLongDef ON m_object_ext_long (owner_oid, ownerType); + +CREATE INDEX iExtensionPolyString ON m_object_ext_poly (ownerType, eName, orig); + +CREATE INDEX iExtensionPolyStringDef ON m_object_ext_poly (owner_oid, ownerType); + +CREATE INDEX iExtensionReference ON m_object_ext_reference (ownerType, eName, targetoid); + +CREATE INDEX iExtensionReferenceDef ON m_object_ext_reference (owner_oid, ownerType); + +CREATE INDEX iExtensionString ON m_object_ext_string (ownerType, eName, stringValue); + +CREATE INDEX iExtensionStringDef ON m_object_ext_string (owner_oid, ownerType); + +ALTER TABLE m_object_template +ADD CONSTRAINT uc_object_template_name UNIQUE (name_norm); + +ALTER TABLE m_org +ADD CONSTRAINT uc_org_name UNIQUE (name_norm); + +CREATE INDEX iDisplayOrder ON m_org (displayOrder); + +CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); + +CREATE INDEX iDescendant ON m_org_closure (descendant_oid); + +CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid); + +CREATE INDEX iReferenceTargetOid ON m_reference (targetOid); + +ALTER TABLE m_report +ADD CONSTRAINT uc_report_name UNIQUE (name_norm); + +CREATE INDEX iReportParent ON m_report (parent); + +ALTER TABLE m_resource +ADD CONSTRAINT uc_resource_name UNIQUE (name_norm); + +ALTER TABLE m_role +ADD CONSTRAINT uc_role_name UNIQUE (name_norm); + +ALTER TABLE m_security_policy +ADD CONSTRAINT uc_security_policy_name UNIQUE (name_norm); + +CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid); + +CREATE INDEX iShadowDead ON m_shadow (dead); + +ALTER TABLE m_system_configuration +ADD CONSTRAINT uc_system_configuration_name UNIQUE (name_norm); + +CREATE INDEX iParent ON m_task (parent); + +CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue); + +ALTER TABLE m_user +ADD CONSTRAINT uc_user_name UNIQUE (name_norm); + +CREATE INDEX iEmployeeNumber ON m_user (employeeNumber); + +CREATE INDEX iFullName ON m_user (fullName_orig); + +CREATE INDEX iFamilyName ON m_user (familyName_orig); + +CREATE INDEX iGivenName ON m_user (givenName_orig); + +CREATE INDEX iLocality ON m_user (locality_orig); + +ALTER TABLE m_value_policy +ADD CONSTRAINT uc_value_policy_name UNIQUE (name_norm); + ALTER TABLE m_abstract_role ADD CONSTRAINT fk_abstract_role FOREIGN KEY (oid) REFERENCES m_focus; -CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus); - -CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus); - ALTER TABLE m_assignment ADD CONSTRAINT fk_assignment_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iAExtensionDate ON m_assignment_ext_date (extensionType, eName, dateValue); - ALTER TABLE m_assignment_ext_date ADD CONSTRAINT fk_assignment_ext_date FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionLong ON m_assignment_ext_long (extensionType, eName, longValue); - ALTER TABLE m_assignment_ext_long ADD CONSTRAINT fk_assignment_ext_long FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionPolyString ON m_assignment_ext_poly (extensionType, eName, orig); - ALTER TABLE m_assignment_ext_poly ADD CONSTRAINT fk_assignment_ext_poly FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionReference ON m_assignment_ext_reference (extensionType, eName, targetoid); - ALTER TABLE m_assignment_ext_reference ADD CONSTRAINT fk_assignment_ext_reference FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionString ON m_assignment_ext_string (extensionType, eName, stringValue); - ALTER TABLE m_assignment_ext_string ADD CONSTRAINT fk_assignment_ext_string FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAssignmentReferenceTargetOid ON m_assignment_reference (targetOid); - ALTER TABLE m_assignment_reference ADD CONSTRAINT fk_assignment_reference FOREIGN KEY (owner_id, owner_owner_oid) @@ -636,10 +722,6 @@ ADD CONSTRAINT fk_exclusion_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus); - -CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); - ALTER TABLE m_focus ADD CONSTRAINT fk_focus FOREIGN KEY (oid) @@ -655,54 +737,26 @@ ADD CONSTRAINT fk_node FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iObjectCreateTimestamp ON m_object (createTimestamp); - -CREATE INDEX iObjectTypeClass ON m_object (objectTypeClass); - -CREATE INDEX iObjectNameOrig ON m_object (name_orig); - -CREATE INDEX iObjectNameNorm ON m_object (name_norm); - -CREATE INDEX iExtensionDate ON m_object_ext_date (ownerType, eName, dateValue); - -CREATE INDEX iExtensionDateDef ON m_object_ext_date (owner_oid, ownerType); - ALTER TABLE m_object_ext_date ADD CONSTRAINT fk_object_ext_date FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionLong ON m_object_ext_long (ownerType, eName, longValue); - -CREATE INDEX iExtensionLongDef ON m_object_ext_long (owner_oid, ownerType); - ALTER TABLE m_object_ext_long ADD CONSTRAINT fk_object_ext_long FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionPolyString ON m_object_ext_poly (ownerType, eName, orig); - -CREATE INDEX iExtensionPolyStringDef ON m_object_ext_poly (owner_oid, ownerType); - ALTER TABLE m_object_ext_poly ADD CONSTRAINT fk_object_ext_poly FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionReference ON m_object_ext_reference (ownerType, eName, targetoid); - -CREATE INDEX iExtensionReferenceDef ON m_object_ext_reference (owner_oid, ownerType); - ALTER TABLE m_object_ext_reference ADD CONSTRAINT fk_object_ext_reference FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionString ON m_object_ext_string (ownerType, eName, stringValue); - -CREATE INDEX iExtensionStringDef ON m_object_ext_string (owner_oid, ownerType); - ALTER TABLE m_object_ext_string ADD CONSTRAINT fk_object_ext_string FOREIGN KEY (owner_oid) @@ -713,17 +767,11 @@ ADD CONSTRAINT fk_object_template FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iDisplayOrder ON m_org (displayOrder); - ALTER TABLE m_org ADD CONSTRAINT fk_org FOREIGN KEY (oid) REFERENCES m_abstract_role; -CREATE INDEX iDescendant ON m_org_closure (descendant_oid); - -CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); - ALTER TABLE m_org_closure ADD CONSTRAINT fk_ancestor FOREIGN KEY (ancestor_oid) @@ -739,15 +787,11 @@ ADD CONSTRAINT fk_org_org_type FOREIGN KEY (org_oid) REFERENCES m_org; -CREATE INDEX iReferenceTargetOid ON m_reference (targetOid); - ALTER TABLE m_reference ADD CONSTRAINT fk_reference_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iReportParent ON m_report (parent); - ALTER TABLE m_report ADD CONSTRAINT fk_report FOREIGN KEY (oid) @@ -773,10 +817,6 @@ ADD CONSTRAINT fk_security_policy FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid); - -CREATE INDEX iShadowDead ON m_shadow (dead); - ALTER TABLE m_shadow ADD CONSTRAINT fk_shadow FOREIGN KEY (oid) @@ -787,8 +827,6 @@ ADD CONSTRAINT fk_system_configuration FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iParent ON m_task (parent); - ALTER TABLE m_task ADD CONSTRAINT fk_task FOREIGN KEY (oid) @@ -799,23 +837,11 @@ ADD CONSTRAINT fk_task_dependent FOREIGN KEY (task_oid) REFERENCES m_task; -CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue); - ALTER TABLE m_trigger ADD CONSTRAINT fk_trigger_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iEmployeeNumber ON m_user (employeeNumber); - -CREATE INDEX iFullName ON m_user (fullName_orig); - -CREATE INDEX iFamilyName ON m_user (familyName_orig); - -CREATE INDEX iGivenName ON m_user (givenName_orig); - -CREATE INDEX iLocality ON m_user (locality_orig); - ALTER TABLE m_user ADD CONSTRAINT fk_user FOREIGN KEY (oid) diff --git a/config/sql/_all/mysql-3.1-all.sql b/config/sql/_all/mysql-3.1-all.sql index 43f2f6f277f..266798a8d3e 100644 --- a/config/sql/_all/mysql-3.1-all.sql +++ b/config/sql/_all/mysql-3.1-all.sql @@ -1,7 +1,3 @@ -# Activiti scripts are for MySQL 5.6.4+ -# see http://jira.codehaus.org/browse/ACT-1867 for more information -#------------------------------ - # use for db create # CREATE DATABASE # CHARACTER SET utf8 @@ -23,7 +19,7 @@ CREATE TABLE m_abstract_role ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_assignment ( id SMALLINT NOT NULL, @@ -62,13 +58,13 @@ CREATE TABLE m_assignment ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_assignment_ext_date ( eName VARCHAR(157) NOT NULL, anyContainer_owner_id SMALLINT NOT NULL, anyContainer_owner_owner_oid VARCHAR(36) NOT NULL, - dateValue DATETIME(6) NOT NULL, + dateValue DATETIME(6) NOT NULL, extensionType INTEGER, dynamicDef BIT, eType VARCHAR(157), @@ -77,7 +73,7 @@ CREATE TABLE m_assignment_ext_date ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_assignment_ext_long ( eName VARCHAR(157) NOT NULL, @@ -92,7 +88,7 @@ CREATE TABLE m_assignment_ext_long ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_assignment_ext_poly ( eName VARCHAR(157) NOT NULL, @@ -108,7 +104,7 @@ CREATE TABLE m_assignment_ext_poly ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_assignment_ext_reference ( eName VARCHAR(157) NOT NULL, @@ -125,7 +121,7 @@ CREATE TABLE m_assignment_ext_reference ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_assignment_ext_string ( eName VARCHAR(157) NOT NULL, @@ -140,7 +136,7 @@ CREATE TABLE m_assignment_ext_string ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_assignment_extension ( owner_id SMALLINT NOT NULL, @@ -154,7 +150,7 @@ CREATE TABLE m_assignment_extension ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_assignment_reference ( reference_type INTEGER NOT NULL, @@ -167,7 +163,7 @@ CREATE TABLE m_assignment_reference ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_audit_delta ( checksum VARCHAR(32) NOT NULL, @@ -181,7 +177,7 @@ CREATE TABLE m_audit_delta ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_audit_event ( id BIGINT NOT NULL, @@ -209,7 +205,7 @@ CREATE TABLE m_audit_event ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_connector ( connectorBundle VARCHAR(255), @@ -226,7 +222,7 @@ CREATE TABLE m_connector ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_connector_host ( hostname VARCHAR(255), @@ -234,12 +230,11 @@ CREATE TABLE m_connector_host ( name_orig VARCHAR(255), port VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_connector_target_system ( connector_oid VARCHAR(36) NOT NULL, @@ -247,7 +242,7 @@ CREATE TABLE m_connector_target_system ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_exclusion ( id SMALLINT NOT NULL, @@ -260,7 +255,7 @@ CREATE TABLE m_exclusion ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_focus ( administrativeStatus INTEGER, @@ -278,31 +273,29 @@ CREATE TABLE m_focus ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_generic_object ( name_norm VARCHAR(255), name_orig VARCHAR(255), objectType VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_node ( name_norm VARCHAR(255), name_orig VARCHAR(255), nodeIdentifier VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_object ( oid VARCHAR(36) NOT NULL, @@ -333,13 +326,13 @@ CREATE TABLE m_object ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_object_ext_date ( eName VARCHAR(157) NOT NULL, owner_oid VARCHAR(36) NOT NULL, ownerType INTEGER NOT NULL, - dateValue DATETIME(6) NOT NULL, + dateValue DATETIME(6) NOT NULL, dynamicDef BIT, eType VARCHAR(157), valueType INTEGER, @@ -347,7 +340,7 @@ CREATE TABLE m_object_ext_date ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_object_ext_long ( eName VARCHAR(157) NOT NULL, @@ -361,7 +354,7 @@ CREATE TABLE m_object_ext_long ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_object_ext_poly ( eName VARCHAR(157) NOT NULL, @@ -376,7 +369,7 @@ CREATE TABLE m_object_ext_poly ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_object_ext_reference ( eName VARCHAR(157) NOT NULL, @@ -392,7 +385,7 @@ CREATE TABLE m_object_ext_reference ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_object_ext_string ( eName VARCHAR(157) NOT NULL, @@ -406,19 +399,18 @@ CREATE TABLE m_object_ext_string ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_object_template ( name_norm VARCHAR(255), name_orig VARCHAR(255), type INTEGER, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_org ( costCenter VARCHAR(255), @@ -432,22 +424,21 @@ CREATE TABLE m_org ( name_orig VARCHAR(255), tenant BIT, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_org_closure ( + ancestor_oid VARCHAR(36) NOT NULL, descendant_oid VARCHAR(36) NOT NULL, - ancestor_oid VARCHAR(36) NOT NULL , - val INTEGER NOT NULL , - PRIMARY KEY (descendant_oid, ancestor_oid) + val INTEGER, + PRIMARY KEY (ancestor_oid, descendant_oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_org_org_type ( org_oid VARCHAR(36) NOT NULL, @@ -455,7 +446,7 @@ CREATE TABLE m_org_org_type ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_reference ( reference_type INTEGER NOT NULL, @@ -467,7 +458,7 @@ CREATE TABLE m_reference ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_report ( export INTEGER, @@ -477,12 +468,11 @@ CREATE TABLE m_report ( parent BIT, useHibernateSession BIT, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_report_output ( name_norm VARCHAR(255), @@ -495,7 +485,7 @@ CREATE TABLE m_report_output ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_resource ( administrativeState INTEGER, @@ -506,35 +496,32 @@ CREATE TABLE m_resource ( name_orig VARCHAR(255), o16_lastAvailabilityStatus INTEGER, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_role ( name_norm VARCHAR(255), name_orig VARCHAR(255), roleType VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_security_policy ( name_norm VARCHAR(255), name_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_shadow ( attemptNumber INTEGER, @@ -558,18 +545,17 @@ CREATE TABLE m_shadow ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_system_configuration ( name_norm VARCHAR(255), name_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_task ( binding INTEGER, @@ -600,7 +586,7 @@ CREATE TABLE m_task ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_task_dependent ( task_oid VARCHAR(36) NOT NULL, @@ -608,7 +594,7 @@ CREATE TABLE m_task_dependent ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_trigger ( id SMALLINT NOT NULL, @@ -619,7 +605,7 @@ CREATE TABLE m_trigger ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_user ( additionalName_norm VARCHAR(255), @@ -652,12 +638,11 @@ CREATE TABLE m_user ( title_norm VARCHAR(255), title_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_user_employee_type ( user_oid VARCHAR(36) NOT NULL, @@ -665,7 +650,7 @@ CREATE TABLE m_user_employee_type ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_user_organization ( user_oid VARCHAR(36) NOT NULL, @@ -674,7 +659,7 @@ CREATE TABLE m_user_organization ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_user_organizational_unit ( user_oid VARCHAR(36) NOT NULL, @@ -683,7 +668,7 @@ CREATE TABLE m_user_organizational_unit ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_user_photo ( owner_oid VARCHAR(36) NOT NULL, @@ -692,347 +677,347 @@ CREATE TABLE m_user_photo ( ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE TABLE m_value_policy ( name_norm VARCHAR(255), name_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) DEFAULT CHARACTER SET utf8 COLLATE utf8_bin - ENGINE =InnoDB; + ENGINE = InnoDB; CREATE INDEX iRequestable ON m_abstract_role (requestable); +CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus); + +CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus); + +CREATE INDEX iAExtensionDate ON m_assignment_ext_date (extensionType, eName, dateValue); + +CREATE INDEX iAExtensionLong ON m_assignment_ext_long (extensionType, eName, longValue); + +CREATE INDEX iAExtensionPolyString ON m_assignment_ext_poly (extensionType, eName, orig); + +CREATE INDEX iAExtensionReference ON m_assignment_ext_reference (extensionType, eName, targetoid); + +CREATE INDEX iAExtensionString ON m_assignment_ext_string (extensionType, eName, stringValue); + +CREATE INDEX iAssignmentReferenceTargetOid ON m_assignment_reference (targetOid); + +ALTER TABLE m_connector_host +ADD CONSTRAINT uc_connector_host_name UNIQUE (name_norm); + +CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus); + +CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); + +ALTER TABLE m_generic_object +ADD CONSTRAINT uc_generic_object_name UNIQUE (name_norm); + +ALTER TABLE m_node +ADD CONSTRAINT uc_node_name UNIQUE (name_norm); + +CREATE INDEX iObjectNameOrig ON m_object (name_orig); + +CREATE INDEX iObjectNameNorm ON m_object (name_norm); + +CREATE INDEX iObjectTypeClass ON m_object (objectTypeClass); + +CREATE INDEX iObjectCreateTimestamp ON m_object (createTimestamp); + +CREATE INDEX iExtensionDate ON m_object_ext_date (ownerType, eName, dateValue); + +CREATE INDEX iExtensionDateDef ON m_object_ext_date (owner_oid, ownerType); + +CREATE INDEX iExtensionLong ON m_object_ext_long (ownerType, eName, longValue); + +CREATE INDEX iExtensionLongDef ON m_object_ext_long (owner_oid, ownerType); + +CREATE INDEX iExtensionPolyString ON m_object_ext_poly (ownerType, eName, orig); + +CREATE INDEX iExtensionPolyStringDef ON m_object_ext_poly (owner_oid, ownerType); + +CREATE INDEX iExtensionReference ON m_object_ext_reference (ownerType, eName, targetoid); + +CREATE INDEX iExtensionReferenceDef ON m_object_ext_reference (owner_oid, ownerType); + +CREATE INDEX iExtensionString ON m_object_ext_string (ownerType, eName, stringValue); + +CREATE INDEX iExtensionStringDef ON m_object_ext_string (owner_oid, ownerType); + +ALTER TABLE m_object_template +ADD CONSTRAINT uc_object_template_name UNIQUE (name_norm); + +ALTER TABLE m_org +ADD CONSTRAINT uc_org_name UNIQUE (name_norm); + +CREATE INDEX iDisplayOrder ON m_org (displayOrder); + +-- Not needed [FK already creates this index] +-- CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); + +-- Not needed [FK already creates this index] +-- CREATE INDEX iDescendant ON m_org_closure (descendant_oid); + +CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid); + +CREATE INDEX iReferenceTargetOid ON m_reference (targetOid); + +ALTER TABLE m_report +ADD CONSTRAINT uc_report_name UNIQUE (name_norm); + +CREATE INDEX iReportParent ON m_report (parent); + +ALTER TABLE m_resource +ADD CONSTRAINT uc_resource_name UNIQUE (name_norm); + +ALTER TABLE m_role +ADD CONSTRAINT uc_role_name UNIQUE (name_norm); + +ALTER TABLE m_security_policy +ADD CONSTRAINT uc_security_policy_name UNIQUE (name_norm); + +CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid); + +CREATE INDEX iShadowDead ON m_shadow (dead); + +ALTER TABLE m_system_configuration +ADD CONSTRAINT uc_system_configuration_name UNIQUE (name_norm); + +CREATE INDEX iParent ON m_task (parent); + +CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue); + +ALTER TABLE m_user +ADD CONSTRAINT uc_user_name UNIQUE (name_norm); + +CREATE INDEX iEmployeeNumber ON m_user (employeeNumber); + +CREATE INDEX iFullName ON m_user (fullName_orig); + +CREATE INDEX iFamilyName ON m_user (familyName_orig); + +CREATE INDEX iGivenName ON m_user (givenName_orig); + +CREATE INDEX iLocality ON m_user (locality_orig); + +ALTER TABLE m_value_policy +ADD CONSTRAINT uc_value_policy_name UNIQUE (name_norm); + ALTER TABLE m_abstract_role -ADD INDEX fk_abstract_role (oid), ADD CONSTRAINT fk_abstract_role FOREIGN KEY (oid) REFERENCES m_focus (oid); -CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus); - -CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus); - ALTER TABLE m_assignment -ADD INDEX fk_assignment_owner (owner_oid), ADD CONSTRAINT fk_assignment_owner FOREIGN KEY (owner_oid) REFERENCES m_object (oid); -CREATE INDEX iAExtensionDate ON m_assignment_ext_date (extensionType, eName, dateValue); - ALTER TABLE m_assignment_ext_date -ADD INDEX fk_assignment_ext_date (anyContainer_owner_id, anyContainer_owner_owner_oid), ADD CONSTRAINT fk_assignment_ext_date FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension (owner_id, owner_owner_oid); -CREATE INDEX iAExtensionLong ON m_assignment_ext_long (extensionType, eName, longValue); - ALTER TABLE m_assignment_ext_long -ADD INDEX fk_assignment_ext_long (anyContainer_owner_id, anyContainer_owner_owner_oid), ADD CONSTRAINT fk_assignment_ext_long FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension (owner_id, owner_owner_oid); -CREATE INDEX iAExtensionPolyString ON m_assignment_ext_poly (extensionType, eName, orig); - ALTER TABLE m_assignment_ext_poly -ADD INDEX fk_assignment_ext_poly (anyContainer_owner_id, anyContainer_owner_owner_oid), ADD CONSTRAINT fk_assignment_ext_poly FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension (owner_id, owner_owner_oid); -CREATE INDEX iAExtensionReference ON m_assignment_ext_reference (extensionType, eName, targetoid); - ALTER TABLE m_assignment_ext_reference -ADD INDEX fk_assignment_ext_reference (anyContainer_owner_id, anyContainer_owner_owner_oid), ADD CONSTRAINT fk_assignment_ext_reference FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension (owner_id, owner_owner_oid); -CREATE INDEX iAExtensionString ON m_assignment_ext_string (extensionType, eName, stringValue); - ALTER TABLE m_assignment_ext_string -ADD INDEX fk_assignment_ext_string (anyContainer_owner_id, anyContainer_owner_owner_oid), ADD CONSTRAINT fk_assignment_ext_string FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension (owner_id, owner_owner_oid); -CREATE INDEX iAssignmentReferenceTargetOid ON m_assignment_reference (targetOid); - ALTER TABLE m_assignment_reference -ADD INDEX fk_assignment_reference (owner_id, owner_owner_oid), ADD CONSTRAINT fk_assignment_reference FOREIGN KEY (owner_id, owner_owner_oid) REFERENCES m_assignment (id, owner_oid); ALTER TABLE m_audit_delta -ADD INDEX fk_audit_delta (record_id), ADD CONSTRAINT fk_audit_delta FOREIGN KEY (record_id) REFERENCES m_audit_event (id); ALTER TABLE m_connector -ADD INDEX fk_connector (oid), ADD CONSTRAINT fk_connector FOREIGN KEY (oid) REFERENCES m_object (oid); ALTER TABLE m_connector_host -ADD INDEX fk_connector_host (oid), ADD CONSTRAINT fk_connector_host FOREIGN KEY (oid) REFERENCES m_object (oid); ALTER TABLE m_connector_target_system -ADD INDEX fk_connector_target_system (connector_oid), ADD CONSTRAINT fk_connector_target_system FOREIGN KEY (connector_oid) REFERENCES m_connector (oid); ALTER TABLE m_exclusion -ADD INDEX fk_exclusion_owner (owner_oid), ADD CONSTRAINT fk_exclusion_owner FOREIGN KEY (owner_oid) REFERENCES m_object (oid); -CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus); - -CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); - ALTER TABLE m_focus -ADD INDEX fk_focus (oid), ADD CONSTRAINT fk_focus FOREIGN KEY (oid) REFERENCES m_object (oid); ALTER TABLE m_generic_object -ADD INDEX fk_generic_object (oid), ADD CONSTRAINT fk_generic_object FOREIGN KEY (oid) REFERENCES m_object (oid); ALTER TABLE m_node -ADD INDEX fk_node (oid), ADD CONSTRAINT fk_node FOREIGN KEY (oid) REFERENCES m_object (oid); -CREATE INDEX iObjectCreateTimestamp ON m_object (createTimestamp); - -CREATE INDEX iObjectTypeClass ON m_object (objectTypeClass); - -CREATE INDEX iObjectNameOrig ON m_object (name_orig); - -CREATE INDEX iObjectNameNorm ON m_object (name_norm); - -CREATE INDEX iExtensionDate ON m_object_ext_date (ownerType, eName, dateValue); - -CREATE INDEX iExtensionDateDef ON m_object_ext_date (owner_oid, ownerType); - ALTER TABLE m_object_ext_date -ADD INDEX fk_object_ext_date (owner_oid), ADD CONSTRAINT fk_object_ext_date FOREIGN KEY (owner_oid) REFERENCES m_object (oid); -CREATE INDEX iExtensionLong ON m_object_ext_long (ownerType, eName, longValue); - -CREATE INDEX iExtensionLongDef ON m_object_ext_long (owner_oid, ownerType); - ALTER TABLE m_object_ext_long -ADD INDEX fk_object_ext_long (owner_oid), ADD CONSTRAINT fk_object_ext_long FOREIGN KEY (owner_oid) REFERENCES m_object (oid); -CREATE INDEX iExtensionPolyString ON m_object_ext_poly (ownerType, eName, orig); - -CREATE INDEX iExtensionPolyStringDef ON m_object_ext_poly (owner_oid, ownerType); - ALTER TABLE m_object_ext_poly -ADD INDEX fk_object_ext_poly (owner_oid), ADD CONSTRAINT fk_object_ext_poly FOREIGN KEY (owner_oid) REFERENCES m_object (oid); -CREATE INDEX iExtensionReference ON m_object_ext_reference (ownerType, eName, targetoid); - -CREATE INDEX iExtensionReferenceDef ON m_object_ext_reference (owner_oid, ownerType); - ALTER TABLE m_object_ext_reference -ADD INDEX fk_object_ext_reference (owner_oid), ADD CONSTRAINT fk_object_ext_reference FOREIGN KEY (owner_oid) REFERENCES m_object (oid); -CREATE INDEX iExtensionString ON m_object_ext_string (ownerType, eName, stringValue); - -CREATE INDEX iExtensionStringDef ON m_object_ext_string (owner_oid, ownerType); - ALTER TABLE m_object_ext_string -ADD INDEX fk_object_ext_string (owner_oid), ADD CONSTRAINT fk_object_ext_string FOREIGN KEY (owner_oid) REFERENCES m_object (oid); ALTER TABLE m_object_template -ADD INDEX fk_object_template (oid), ADD CONSTRAINT fk_object_template FOREIGN KEY (oid) REFERENCES m_object (oid); -CREATE INDEX iDisplayOrder ON m_org (displayOrder); - ALTER TABLE m_org -ADD INDEX fk_org (oid), ADD CONSTRAINT fk_org FOREIGN KEY (oid) REFERENCES m_abstract_role (oid); ALTER TABLE m_org_closure -ADD INDEX fk_ancestor (ancestor_oid), ADD CONSTRAINT fk_ancestor FOREIGN KEY (ancestor_oid) REFERENCES m_object (oid); ALTER TABLE m_org_closure -ADD INDEX fk_descendant (descendant_oid), ADD CONSTRAINT fk_descendant FOREIGN KEY (descendant_oid) REFERENCES m_object (oid); ALTER TABLE m_org_org_type -ADD INDEX fk_org_org_type (org_oid), ADD CONSTRAINT fk_org_org_type FOREIGN KEY (org_oid) REFERENCES m_org (oid); -CREATE INDEX iReferenceTargetOid ON m_reference (targetOid); - ALTER TABLE m_reference -ADD INDEX fk_reference_owner (owner_oid), ADD CONSTRAINT fk_reference_owner FOREIGN KEY (owner_oid) REFERENCES m_object (oid); -CREATE INDEX iReportParent ON m_report (parent); - ALTER TABLE m_report -ADD INDEX fk_report (oid), ADD CONSTRAINT fk_report FOREIGN KEY (oid) REFERENCES m_object (oid); ALTER TABLE m_report_output -ADD INDEX fk_report_output (oid), ADD CONSTRAINT fk_report_output FOREIGN KEY (oid) REFERENCES m_object (oid); ALTER TABLE m_resource -ADD INDEX fk_resource (oid), ADD CONSTRAINT fk_resource FOREIGN KEY (oid) REFERENCES m_object (oid); ALTER TABLE m_role -ADD INDEX fk_role (oid), ADD CONSTRAINT fk_role FOREIGN KEY (oid) REFERENCES m_abstract_role (oid); ALTER TABLE m_security_policy -ADD INDEX fk_security_policy (oid), ADD CONSTRAINT fk_security_policy FOREIGN KEY (oid) REFERENCES m_object (oid); -CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid); - -CREATE INDEX iShadowDead ON m_shadow (dead); - ALTER TABLE m_shadow -ADD INDEX fk_shadow (oid), ADD CONSTRAINT fk_shadow FOREIGN KEY (oid) REFERENCES m_object (oid); ALTER TABLE m_system_configuration -ADD INDEX fk_system_configuration (oid), ADD CONSTRAINT fk_system_configuration FOREIGN KEY (oid) REFERENCES m_object (oid); -CREATE INDEX iParent ON m_task (parent); - ALTER TABLE m_task -ADD INDEX fk_task (oid), ADD CONSTRAINT fk_task FOREIGN KEY (oid) REFERENCES m_object (oid); ALTER TABLE m_task_dependent -ADD INDEX fk_task_dependent (task_oid), ADD CONSTRAINT fk_task_dependent FOREIGN KEY (task_oid) REFERENCES m_task (oid); -CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue); - ALTER TABLE m_trigger -ADD INDEX fk_trigger_owner (owner_oid), ADD CONSTRAINT fk_trigger_owner FOREIGN KEY (owner_oid) REFERENCES m_object (oid); -CREATE INDEX iEmployeeNumber ON m_user (employeeNumber); - -CREATE INDEX iFullName ON m_user (fullName_orig); - -CREATE INDEX iFamilyName ON m_user (familyName_orig); - -CREATE INDEX iGivenName ON m_user (givenName_orig); - -CREATE INDEX iLocality ON m_user (locality_orig); - ALTER TABLE m_user -ADD INDEX fk_user (oid), ADD CONSTRAINT fk_user FOREIGN KEY (oid) REFERENCES m_focus (oid); ALTER TABLE m_user_employee_type -ADD INDEX fk_user_employee_type (user_oid), ADD CONSTRAINT fk_user_employee_type FOREIGN KEY (user_oid) REFERENCES m_user (oid); ALTER TABLE m_user_organization -ADD INDEX fk_user_organization (user_oid), ADD CONSTRAINT fk_user_organization FOREIGN KEY (user_oid) REFERENCES m_user (oid); ALTER TABLE m_user_organizational_unit -ADD INDEX fk_user_org_unit (user_oid), ADD CONSTRAINT fk_user_org_unit FOREIGN KEY (user_oid) REFERENCES m_user (oid); ALTER TABLE m_user_photo -ADD INDEX fk_user_photo (owner_oid), ADD CONSTRAINT fk_user_photo FOREIGN KEY (owner_oid) REFERENCES m_user (oid); ALTER TABLE m_value_policy -ADD INDEX fk_value_policy (oid), ADD CONSTRAINT fk_value_policy FOREIGN KEY (oid) REFERENCES m_object (oid); diff --git a/config/sql/_all/oracle-3.1-all.sql b/config/sql/_all/oracle-3.1-all.sql index 5f52568c4d2..2c5a847f696 100644 --- a/config/sql/_all/oracle-3.1-all.sql +++ b/config/sql/_all/oracle-3.1-all.sql @@ -184,8 +184,7 @@ CREATE TABLE m_connector_host ( name_orig VARCHAR2(255 CHAR), port VARCHAR2(255 CHAR), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_connector_target_system ( @@ -223,8 +222,7 @@ CREATE TABLE m_generic_object ( name_orig VARCHAR2(255 CHAR), objectType VARCHAR2(255 CHAR), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_node ( @@ -232,8 +230,7 @@ CREATE TABLE m_node ( name_orig VARCHAR2(255 CHAR), nodeIdentifier VARCHAR2(255 CHAR), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_object ( @@ -327,8 +324,7 @@ CREATE TABLE m_object_template ( name_orig VARCHAR2(255 CHAR), type NUMBER(10, 0), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_org ( @@ -343,15 +339,14 @@ CREATE TABLE m_org ( name_orig VARCHAR2(255 CHAR), tenant NUMBER(1, 0), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_org_closure ( - descendant_oid VARCHAR2(36 CHAR) NOT NULL, ancestor_oid VARCHAR2(36 CHAR) NOT NULL, - val NUMBER(10, 0) NOT NULL, - PRIMARY KEY (descendant_oid, ancestor_oid) + descendant_oid VARCHAR2(36 CHAR) NOT NULL, + val NUMBER(10, 0), + PRIMARY KEY (ancestor_oid, descendant_oid) ) INITRANS 30; CREATE GLOBAL TEMPORARY TABLE m_org_closure_temp_delta ( @@ -383,8 +378,7 @@ CREATE TABLE m_report ( parent NUMBER(1, 0), useHibernateSession NUMBER(1, 0), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_report_output ( @@ -406,8 +400,7 @@ CREATE TABLE m_resource ( name_orig VARCHAR2(255 CHAR), o16_lastAvailabilityStatus NUMBER(10, 0), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_role ( @@ -415,16 +408,14 @@ CREATE TABLE m_role ( name_orig VARCHAR2(255 CHAR), roleType VARCHAR2(255 CHAR), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_security_policy ( name_norm VARCHAR2(255 CHAR), name_orig VARCHAR2(255 CHAR), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_shadow ( @@ -452,8 +443,7 @@ CREATE TABLE m_system_configuration ( name_norm VARCHAR2(255 CHAR), name_orig VARCHAR2(255 CHAR), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_task ( @@ -528,8 +518,7 @@ CREATE TABLE m_user ( title_norm VARCHAR2(255 CHAR), title_orig VARCHAR2(255 CHAR), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE TABLE m_user_employee_type ( @@ -559,63 +548,160 @@ CREATE TABLE m_value_policy ( name_norm VARCHAR2(255 CHAR), name_orig VARCHAR2(255 CHAR), oid VARCHAR2(36 CHAR) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ) INITRANS 30; CREATE INDEX iRequestable ON m_abstract_role (requestable) INITRANS 30; +CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus) INITRANS 30; + +CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus) INITRANS 30; + +CREATE INDEX iAExtensionDate ON m_assignment_ext_date (extensionType, eName, dateValue) INITRANS 30; + +CREATE INDEX iAExtensionLong ON m_assignment_ext_long (extensionType, eName, longValue) INITRANS 30; + +CREATE INDEX iAExtensionPolyString ON m_assignment_ext_poly (extensionType, eName, orig) INITRANS 30; + +CREATE INDEX iAExtensionReference ON m_assignment_ext_reference (extensionType, eName, targetoid) INITRANS 30; + +CREATE INDEX iAExtensionString ON m_assignment_ext_string (extensionType, eName, stringValue) INITRANS 30; + +CREATE INDEX iAssignmentReferenceTargetOid ON m_assignment_reference (targetOid) INITRANS 30; + +ALTER TABLE m_connector_host +ADD CONSTRAINT uc_connector_host_name UNIQUE (name_norm) INITRANS 30; + +CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus) INITRANS 30; + +CREATE INDEX iFocusEffective ON m_focus (effectiveStatus) INITRANS 30; + +ALTER TABLE m_generic_object +ADD CONSTRAINT uc_generic_object_name UNIQUE (name_norm) INITRANS 30; + +ALTER TABLE m_node +ADD CONSTRAINT uc_node_name UNIQUE (name_norm) INITRANS 30; + +CREATE INDEX iObjectNameOrig ON m_object (name_orig) INITRANS 30; + +CREATE INDEX iObjectNameNorm ON m_object (name_norm) INITRANS 30; + +CREATE INDEX iObjectTypeClass ON m_object (objectTypeClass) INITRANS 30; + +CREATE INDEX iObjectCreateTimestamp ON m_object (createTimestamp) INITRANS 30; + +CREATE INDEX iExtensionDate ON m_object_ext_date (ownerType, eName, dateValue) INITRANS 30; + +CREATE INDEX iExtensionDateDef ON m_object_ext_date (owner_oid, ownerType) INITRANS 30; + +CREATE INDEX iExtensionLong ON m_object_ext_long (ownerType, eName, longValue) INITRANS 30; + +CREATE INDEX iExtensionLongDef ON m_object_ext_long (owner_oid, ownerType) INITRANS 30; + +CREATE INDEX iExtensionPolyString ON m_object_ext_poly (ownerType, eName, orig) INITRANS 30; + +CREATE INDEX iExtensionPolyStringDef ON m_object_ext_poly (owner_oid, ownerType) INITRANS 30; + +CREATE INDEX iExtensionReference ON m_object_ext_reference (ownerType, eName, targetoid) INITRANS 30; + +CREATE INDEX iExtensionReferenceDef ON m_object_ext_reference (owner_oid, ownerType) INITRANS 30; + +CREATE INDEX iExtensionString ON m_object_ext_string (ownerType, eName, stringValue) INITRANS 30; + +CREATE INDEX iExtensionStringDef ON m_object_ext_string (owner_oid, ownerType) INITRANS 30; + +ALTER TABLE m_object_template +ADD CONSTRAINT uc_object_template_name UNIQUE (name_norm) INITRANS 30; + +ALTER TABLE m_org +ADD CONSTRAINT uc_org_name UNIQUE (name_norm) INITRANS 30; + +CREATE INDEX iDisplayOrder ON m_org (displayOrder) INITRANS 30; + +CREATE INDEX iAncestor ON m_org_closure (ancestor_oid) INITRANS 30; + +CREATE INDEX iDescendant ON m_org_closure (descendant_oid) INITRANS 30; + +CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid) INITRANS 30; + +CREATE INDEX iReferenceTargetOid ON m_reference (targetOid) INITRANS 30; + +ALTER TABLE m_report +ADD CONSTRAINT uc_report_name UNIQUE (name_norm) INITRANS 30; + +CREATE INDEX iReportParent ON m_report (parent) INITRANS 30; + +ALTER TABLE m_resource +ADD CONSTRAINT uc_resource_name UNIQUE (name_norm) INITRANS 30; + +ALTER TABLE m_role +ADD CONSTRAINT uc_role_name UNIQUE (name_norm) INITRANS 30; + +ALTER TABLE m_security_policy +ADD CONSTRAINT uc_security_policy_name UNIQUE (name_norm) INITRANS 30; + +CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid) INITRANS 30; + +CREATE INDEX iShadowDead ON m_shadow (dead) INITRANS 30; + +ALTER TABLE m_system_configuration +ADD CONSTRAINT uc_system_configuration_name UNIQUE (name_norm) INITRANS 30; + +CREATE INDEX iParent ON m_task (parent) INITRANS 30; + +CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue) INITRANS 30; + +ALTER TABLE m_user +ADD CONSTRAINT uc_user_name UNIQUE (name_norm) INITRANS 30; + +CREATE INDEX iEmployeeNumber ON m_user (employeeNumber) INITRANS 30; + +CREATE INDEX iFullName ON m_user (fullName_orig) INITRANS 30; + +CREATE INDEX iFamilyName ON m_user (familyName_orig) INITRANS 30; + +CREATE INDEX iGivenName ON m_user (givenName_orig) INITRANS 30; + +CREATE INDEX iLocality ON m_user (locality_orig) INITRANS 30; + +ALTER TABLE m_value_policy +ADD CONSTRAINT uc_value_policy_name UNIQUE (name_norm) INITRANS 30; + ALTER TABLE m_abstract_role ADD CONSTRAINT fk_abstract_role FOREIGN KEY (oid) REFERENCES m_focus; -CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus) INITRANS 30; - -CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus) INITRANS 30; - ALTER TABLE m_assignment ADD CONSTRAINT fk_assignment_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iAExtensionDate ON m_assignment_ext_date (extensionType, eName, dateValue) INITRANS 30; - ALTER TABLE m_assignment_ext_date ADD CONSTRAINT fk_assignment_ext_date FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionLong ON m_assignment_ext_long (extensionType, eName, longValue) INITRANS 30; - ALTER TABLE m_assignment_ext_long ADD CONSTRAINT fk_assignment_ext_long FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionPolyString ON m_assignment_ext_poly (extensionType, eName, orig) INITRANS 30; - ALTER TABLE m_assignment_ext_poly ADD CONSTRAINT fk_assignment_ext_poly FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionReference ON m_assignment_ext_reference (extensionType, eName, targetoid) INITRANS 30; - ALTER TABLE m_assignment_ext_reference ADD CONSTRAINT fk_assignment_ext_reference FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionString ON m_assignment_ext_string (extensionType, eName, stringValue) INITRANS 30; - ALTER TABLE m_assignment_ext_string ADD CONSTRAINT fk_assignment_ext_string FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAssignmentReferenceTargetOid ON m_assignment_reference (targetOid) INITRANS 30; - ALTER TABLE m_assignment_reference ADD CONSTRAINT fk_assignment_reference FOREIGN KEY (owner_id, owner_owner_oid) @@ -646,10 +732,6 @@ ADD CONSTRAINT fk_exclusion_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus) INITRANS 30; - -CREATE INDEX iFocusEffective ON m_focus (effectiveStatus) INITRANS 30; - ALTER TABLE m_focus ADD CONSTRAINT fk_focus FOREIGN KEY (oid) @@ -665,54 +747,26 @@ ADD CONSTRAINT fk_node FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iObjectCreateTimestamp ON m_object (createTimestamp) INITRANS 30; - -CREATE INDEX iObjectTypeClass ON m_object (objectTypeClass) INITRANS 30; - -CREATE INDEX iObjectNameOrig ON m_object (name_orig) INITRANS 30; - -CREATE INDEX iObjectNameNorm ON m_object (name_norm) INITRANS 30; - -CREATE INDEX iExtensionDate ON m_object_ext_date (ownerType, eName, dateValue) INITRANS 30; - -CREATE INDEX iExtensionDateDef ON m_object_ext_date (owner_oid, ownerType) INITRANS 30; - ALTER TABLE m_object_ext_date ADD CONSTRAINT fk_object_ext_date FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionLong ON m_object_ext_long (ownerType, eName, longValue) INITRANS 30; - -CREATE INDEX iExtensionLongDef ON m_object_ext_long (owner_oid, ownerType) INITRANS 30; - ALTER TABLE m_object_ext_long ADD CONSTRAINT fk_object_ext_long FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionPolyString ON m_object_ext_poly (ownerType, eName, orig) INITRANS 30; - -CREATE INDEX iExtensionPolyStringDef ON m_object_ext_poly (owner_oid, ownerType) INITRANS 30; - ALTER TABLE m_object_ext_poly ADD CONSTRAINT fk_object_ext_poly FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionReference ON m_object_ext_reference (ownerType, eName, targetoid) INITRANS 30; - -CREATE INDEX iExtensionReferenceDef ON m_object_ext_reference (owner_oid, ownerType) INITRANS 30; - ALTER TABLE m_object_ext_reference ADD CONSTRAINT fk_object_ext_reference FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionString ON m_object_ext_string (ownerType, eName, stringValue) INITRANS 30; - -CREATE INDEX iExtensionStringDef ON m_object_ext_string (owner_oid, ownerType) INITRANS 30; - ALTER TABLE m_object_ext_string ADD CONSTRAINT fk_object_ext_string FOREIGN KEY (owner_oid) @@ -723,17 +777,11 @@ ADD CONSTRAINT fk_object_template FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iDisplayOrder ON m_org (displayOrder) INITRANS 30; - ALTER TABLE m_org ADD CONSTRAINT fk_org FOREIGN KEY (oid) REFERENCES m_abstract_role; -CREATE INDEX iAncestor ON m_org_closure (ancestor_oid) INITRANS 30; - -CREATE INDEX iDescendant ON m_org_closure (descendant_oid) INITRANS 30; - ALTER TABLE m_org_closure ADD CONSTRAINT fk_ancestor FOREIGN KEY (ancestor_oid) @@ -749,15 +797,11 @@ ADD CONSTRAINT fk_org_org_type FOREIGN KEY (org_oid) REFERENCES m_org; -CREATE INDEX iReferenceTargetOid ON m_reference (targetOid) INITRANS 30; - ALTER TABLE m_reference ADD CONSTRAINT fk_reference_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iReportParent ON m_report (parent) INITRANS 30; - ALTER TABLE m_report ADD CONSTRAINT fk_report FOREIGN KEY (oid) @@ -783,10 +827,6 @@ ADD CONSTRAINT fk_security_policy FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid) INITRANS 30; - -CREATE INDEX iShadowDead ON m_shadow (dead) INITRANS 30; - ALTER TABLE m_shadow ADD CONSTRAINT fk_shadow FOREIGN KEY (oid) @@ -797,8 +837,6 @@ ADD CONSTRAINT fk_system_configuration FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iParent ON m_task (parent) INITRANS 30; - ALTER TABLE m_task ADD CONSTRAINT fk_task FOREIGN KEY (oid) @@ -809,23 +847,11 @@ ADD CONSTRAINT fk_task_dependent FOREIGN KEY (task_oid) REFERENCES m_task; -CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue) INITRANS 30; - ALTER TABLE m_trigger ADD CONSTRAINT fk_trigger_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iEmployeeNumber ON m_user (employeeNumber) INITRANS 30; - -CREATE INDEX iFullName ON m_user (fullName_orig) INITRANS 30; - -CREATE INDEX iFamilyName ON m_user (familyName_orig) INITRANS 30; - -CREATE INDEX iGivenName ON m_user (givenName_orig) INITRANS 30; - -CREATE INDEX iLocality ON m_user (locality_orig) INITRANS 30; - ALTER TABLE m_user ADD CONSTRAINT fk_user FOREIGN KEY (oid) diff --git a/config/sql/_all/postgresql-3.1-all.sql b/config/sql/_all/postgresql-3.1-all.sql index 1db1b93b1be..f90d096ab83 100644 --- a/config/sql/_all/postgresql-3.1-all.sql +++ b/config/sql/_all/postgresql-3.1-all.sql @@ -181,8 +181,7 @@ CREATE TABLE m_connector_host ( name_orig VARCHAR(255), port VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_connector_target_system ( @@ -220,8 +219,7 @@ CREATE TABLE m_generic_object ( name_orig VARCHAR(255), objectType VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_node ( @@ -229,8 +227,7 @@ CREATE TABLE m_node ( name_orig VARCHAR(255), nodeIdentifier VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_object ( @@ -324,8 +321,7 @@ CREATE TABLE m_object_template ( name_orig VARCHAR(255), type INT4, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_org ( @@ -340,15 +336,14 @@ CREATE TABLE m_org ( name_orig VARCHAR(255), tenant BOOLEAN, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_org_closure ( - descendant_oid VARCHAR(36) NOT NULL, ancestor_oid VARCHAR(36) NOT NULL, - val INT4 NOT NULL, - PRIMARY KEY (descendant_oid, ancestor_oid) + descendant_oid VARCHAR(36) NOT NULL, + val INT4, + PRIMARY KEY (ancestor_oid, descendant_oid) ); CREATE TABLE m_org_org_type ( @@ -373,8 +368,7 @@ CREATE TABLE m_report ( parent BOOLEAN, useHibernateSession BOOLEAN, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_report_output ( @@ -396,8 +390,7 @@ CREATE TABLE m_resource ( name_orig VARCHAR(255), o16_lastAvailabilityStatus INT4, oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_role ( @@ -405,16 +398,14 @@ CREATE TABLE m_role ( name_orig VARCHAR(255), roleType VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_security_policy ( name_norm VARCHAR(255), name_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_shadow ( @@ -442,8 +433,7 @@ CREATE TABLE m_system_configuration ( name_norm VARCHAR(255), name_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_task ( @@ -518,8 +508,7 @@ CREATE TABLE m_user ( title_norm VARCHAR(255), title_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_user_employee_type ( @@ -549,63 +538,160 @@ CREATE TABLE m_value_policy ( name_norm VARCHAR(255), name_orig VARCHAR(255), oid VARCHAR(36) NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE INDEX iRequestable ON m_abstract_role (requestable); +CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus); + +CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus); + +CREATE INDEX iAExtensionDate ON m_assignment_ext_date (extensionType, eName, dateValue); + +CREATE INDEX iAExtensionLong ON m_assignment_ext_long (extensionType, eName, longValue); + +CREATE INDEX iAExtensionPolyString ON m_assignment_ext_poly (extensionType, eName, orig); + +CREATE INDEX iAExtensionReference ON m_assignment_ext_reference (extensionType, eName, targetoid); + +CREATE INDEX iAExtensionString ON m_assignment_ext_string (extensionType, eName, stringValue); + +CREATE INDEX iAssignmentReferenceTargetOid ON m_assignment_reference (targetOid); + +ALTER TABLE m_connector_host +ADD CONSTRAINT uc_connector_host_name UNIQUE (name_norm); + +CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus); + +CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); + +ALTER TABLE m_generic_object +ADD CONSTRAINT uc_generic_object_name UNIQUE (name_norm); + +ALTER TABLE m_node +ADD CONSTRAINT uc_node_name UNIQUE (name_norm); + +CREATE INDEX iObjectNameOrig ON m_object (name_orig); + +CREATE INDEX iObjectNameNorm ON m_object (name_norm); + +CREATE INDEX iObjectTypeClass ON m_object (objectTypeClass); + +CREATE INDEX iObjectCreateTimestamp ON m_object (createTimestamp); + +CREATE INDEX iExtensionDate ON m_object_ext_date (ownerType, eName, dateValue); + +CREATE INDEX iExtensionDateDef ON m_object_ext_date (owner_oid, ownerType); + +CREATE INDEX iExtensionLong ON m_object_ext_long (ownerType, eName, longValue); + +CREATE INDEX iExtensionLongDef ON m_object_ext_long (owner_oid, ownerType); + +CREATE INDEX iExtensionPolyString ON m_object_ext_poly (ownerType, eName, orig); + +CREATE INDEX iExtensionPolyStringDef ON m_object_ext_poly (owner_oid, ownerType); + +CREATE INDEX iExtensionReference ON m_object_ext_reference (ownerType, eName, targetoid); + +CREATE INDEX iExtensionReferenceDef ON m_object_ext_reference (owner_oid, ownerType); + +CREATE INDEX iExtensionString ON m_object_ext_string (ownerType, eName, stringValue); + +CREATE INDEX iExtensionStringDef ON m_object_ext_string (owner_oid, ownerType); + +ALTER TABLE m_object_template +ADD CONSTRAINT uc_object_template_name UNIQUE (name_norm); + +ALTER TABLE m_org +ADD CONSTRAINT uc_org_name UNIQUE (name_norm); + +CREATE INDEX iDisplayOrder ON m_org (displayOrder); + +CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); + +CREATE INDEX iDescendant ON m_org_closure (descendant_oid); + +CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid); + +CREATE INDEX iReferenceTargetOid ON m_reference (targetOid); + +ALTER TABLE m_report +ADD CONSTRAINT uc_report_name UNIQUE (name_norm); + +CREATE INDEX iReportParent ON m_report (parent); + +ALTER TABLE m_resource +ADD CONSTRAINT uc_resource_name UNIQUE (name_norm); + +ALTER TABLE m_role +ADD CONSTRAINT uc_role_name UNIQUE (name_norm); + +ALTER TABLE m_security_policy +ADD CONSTRAINT uc_security_policy_name UNIQUE (name_norm); + +CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid); + +CREATE INDEX iShadowDead ON m_shadow (dead); + +ALTER TABLE m_system_configuration +ADD CONSTRAINT uc_system_configuration_name UNIQUE (name_norm); + +CREATE INDEX iParent ON m_task (parent); + +CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue); + +ALTER TABLE m_user +ADD CONSTRAINT uc_user_name UNIQUE (name_norm); + +CREATE INDEX iEmployeeNumber ON m_user (employeeNumber); + +CREATE INDEX iFullName ON m_user (fullName_orig); + +CREATE INDEX iFamilyName ON m_user (familyName_orig); + +CREATE INDEX iGivenName ON m_user (givenName_orig); + +CREATE INDEX iLocality ON m_user (locality_orig); + +ALTER TABLE m_value_policy +ADD CONSTRAINT uc_value_policy_name UNIQUE (name_norm); + ALTER TABLE m_abstract_role ADD CONSTRAINT fk_abstract_role FOREIGN KEY (oid) REFERENCES m_focus; -CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus); - -CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus); - ALTER TABLE m_assignment ADD CONSTRAINT fk_assignment_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iAExtensionDate ON m_assignment_ext_date (extensionType, eName, dateValue); - ALTER TABLE m_assignment_ext_date ADD CONSTRAINT fk_assignment_ext_date FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionLong ON m_assignment_ext_long (extensionType, eName, longValue); - ALTER TABLE m_assignment_ext_long ADD CONSTRAINT fk_assignment_ext_long FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionPolyString ON m_assignment_ext_poly (extensionType, eName, orig); - ALTER TABLE m_assignment_ext_poly ADD CONSTRAINT fk_assignment_ext_poly FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionReference ON m_assignment_ext_reference (extensionType, eName, targetoid); - ALTER TABLE m_assignment_ext_reference ADD CONSTRAINT fk_assignment_ext_reference FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionString ON m_assignment_ext_string (extensionType, eName, stringValue); - ALTER TABLE m_assignment_ext_string ADD CONSTRAINT fk_assignment_ext_string FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAssignmentReferenceTargetOid ON m_assignment_reference (targetOid); - ALTER TABLE m_assignment_reference ADD CONSTRAINT fk_assignment_reference FOREIGN KEY (owner_id, owner_owner_oid) @@ -636,10 +722,6 @@ ADD CONSTRAINT fk_exclusion_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus); - -CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); - ALTER TABLE m_focus ADD CONSTRAINT fk_focus FOREIGN KEY (oid) @@ -655,54 +737,26 @@ ADD CONSTRAINT fk_node FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iObjectCreateTimestamp ON m_object (createTimestamp); - -CREATE INDEX iObjectTypeClass ON m_object (objectTypeClass); - -CREATE INDEX iObjectNameOrig ON m_object (name_orig); - -CREATE INDEX iObjectNameNorm ON m_object (name_norm); - -CREATE INDEX iExtensionDate ON m_object_ext_date (ownerType, eName, dateValue); - -CREATE INDEX iExtensionDateDef ON m_object_ext_date (owner_oid, ownerType); - ALTER TABLE m_object_ext_date ADD CONSTRAINT fk_object_ext_date FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionLong ON m_object_ext_long (ownerType, eName, longValue); - -CREATE INDEX iExtensionLongDef ON m_object_ext_long (owner_oid, ownerType); - ALTER TABLE m_object_ext_long ADD CONSTRAINT fk_object_ext_long FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionPolyString ON m_object_ext_poly (ownerType, eName, orig); - -CREATE INDEX iExtensionPolyStringDef ON m_object_ext_poly (owner_oid, ownerType); - ALTER TABLE m_object_ext_poly ADD CONSTRAINT fk_object_ext_poly FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionReference ON m_object_ext_reference (ownerType, eName, targetoid); - -CREATE INDEX iExtensionReferenceDef ON m_object_ext_reference (owner_oid, ownerType); - ALTER TABLE m_object_ext_reference ADD CONSTRAINT fk_object_ext_reference FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionString ON m_object_ext_string (ownerType, eName, stringValue); - -CREATE INDEX iExtensionStringDef ON m_object_ext_string (owner_oid, ownerType); - ALTER TABLE m_object_ext_string ADD CONSTRAINT fk_object_ext_string FOREIGN KEY (owner_oid) @@ -713,17 +767,11 @@ ADD CONSTRAINT fk_object_template FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iDisplayOrder ON m_org (displayOrder); - ALTER TABLE m_org ADD CONSTRAINT fk_org FOREIGN KEY (oid) REFERENCES m_abstract_role; -CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); - -CREATE INDEX iDescendant ON m_org_closure (descendant_oid); - ALTER TABLE m_org_closure ADD CONSTRAINT fk_ancestor FOREIGN KEY (ancestor_oid) @@ -739,15 +787,11 @@ ADD CONSTRAINT fk_org_org_type FOREIGN KEY (org_oid) REFERENCES m_org; -CREATE INDEX iReferenceTargetOid ON m_reference (targetOid); - ALTER TABLE m_reference ADD CONSTRAINT fk_reference_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iReportParent ON m_report (parent); - ALTER TABLE m_report ADD CONSTRAINT fk_report FOREIGN KEY (oid) @@ -773,10 +817,6 @@ ADD CONSTRAINT fk_security_policy FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid); - -CREATE INDEX iShadowDead ON m_shadow (dead); - ALTER TABLE m_shadow ADD CONSTRAINT fk_shadow FOREIGN KEY (oid) @@ -787,8 +827,6 @@ ADD CONSTRAINT fk_system_configuration FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iParent ON m_task (parent); - ALTER TABLE m_task ADD CONSTRAINT fk_task FOREIGN KEY (oid) @@ -799,23 +837,11 @@ ADD CONSTRAINT fk_task_dependent FOREIGN KEY (task_oid) REFERENCES m_task; -CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue); - ALTER TABLE m_trigger ADD CONSTRAINT fk_trigger_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iEmployeeNumber ON m_user (employeeNumber); - -CREATE INDEX iFullName ON m_user (fullName_orig); - -CREATE INDEX iFamilyName ON m_user (familyName_orig); - -CREATE INDEX iGivenName ON m_user (givenName_orig); - -CREATE INDEX iLocality ON m_user (locality_orig); - ALTER TABLE m_user ADD CONSTRAINT fk_user FOREIGN KEY (oid) diff --git a/config/sql/_all/sqlserver-3.1-all.sql b/config/sql/_all/sqlserver-3.1-all.sql index 2bad3c0e505..47a30f56a14 100644 --- a/config/sql/_all/sqlserver-3.1-all.sql +++ b/config/sql/_all/sqlserver-3.1-all.sql @@ -181,8 +181,7 @@ CREATE TABLE m_connector_host ( name_orig NVARCHAR(255) COLLATE database_default, port NVARCHAR(255) COLLATE database_default, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_connector_target_system ( @@ -220,8 +219,7 @@ CREATE TABLE m_generic_object ( name_orig NVARCHAR(255) COLLATE database_default, objectType NVARCHAR(255) COLLATE database_default, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_node ( @@ -229,8 +227,7 @@ CREATE TABLE m_node ( name_orig NVARCHAR(255) COLLATE database_default, nodeIdentifier NVARCHAR(255) COLLATE database_default, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_object ( @@ -324,8 +321,7 @@ CREATE TABLE m_object_template ( name_orig NVARCHAR(255) COLLATE database_default, type INT, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_org ( @@ -340,15 +336,14 @@ CREATE TABLE m_org ( name_orig NVARCHAR(255) COLLATE database_default, tenant BIT, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_org_closure ( - descendant_oid NVARCHAR(36) COLLATE database_default NOT NULL, ancestor_oid NVARCHAR(36) COLLATE database_default NOT NULL, - val INT NOT NULL, - PRIMARY KEY (descendant_oid, ancestor_oid) + descendant_oid NVARCHAR(36) COLLATE database_default NOT NULL, + val INT, + PRIMARY KEY (ancestor_oid, descendant_oid) ); CREATE TABLE m_org_org_type ( @@ -373,8 +368,7 @@ CREATE TABLE m_report ( parent BIT, useHibernateSession BIT, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_report_output ( @@ -396,8 +390,7 @@ CREATE TABLE m_resource ( name_orig NVARCHAR(255) COLLATE database_default, o16_lastAvailabilityStatus INT, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_role ( @@ -405,16 +398,14 @@ CREATE TABLE m_role ( name_orig NVARCHAR(255) COLLATE database_default, roleType NVARCHAR(255) COLLATE database_default, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_security_policy ( name_norm NVARCHAR(255) COLLATE database_default, name_orig NVARCHAR(255) COLLATE database_default, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_shadow ( @@ -442,8 +433,7 @@ CREATE TABLE m_system_configuration ( name_norm NVARCHAR(255) COLLATE database_default, name_orig NVARCHAR(255) COLLATE database_default, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_task ( @@ -518,8 +508,7 @@ CREATE TABLE m_user ( title_norm NVARCHAR(255) COLLATE database_default, title_orig NVARCHAR(255) COLLATE database_default, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE TABLE m_user_employee_type ( @@ -549,63 +538,160 @@ CREATE TABLE m_value_policy ( name_norm NVARCHAR(255) COLLATE database_default, name_orig NVARCHAR(255) COLLATE database_default, oid NVARCHAR(36) COLLATE database_default NOT NULL, - PRIMARY KEY (oid), - UNIQUE (name_norm) + PRIMARY KEY (oid) ); CREATE INDEX iRequestable ON m_abstract_role (requestable); +CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus); + +CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus); + +CREATE INDEX iAExtensionDate ON m_assignment_ext_date (extensionType, eName, dateValue); + +CREATE INDEX iAExtensionLong ON m_assignment_ext_long (extensionType, eName, longValue); + +CREATE INDEX iAExtensionPolyString ON m_assignment_ext_poly (extensionType, eName, orig); + +CREATE INDEX iAExtensionReference ON m_assignment_ext_reference (extensionType, eName, targetoid); + +CREATE INDEX iAExtensionString ON m_assignment_ext_string (extensionType, eName, stringValue); + +CREATE INDEX iAssignmentReferenceTargetOid ON m_assignment_reference (targetOid); + +ALTER TABLE m_connector_host +ADD CONSTRAINT uc_connector_host_name UNIQUE (name_norm); + +CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus); + +CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); + +ALTER TABLE m_generic_object +ADD CONSTRAINT uc_generic_object_name UNIQUE (name_norm); + +ALTER TABLE m_node +ADD CONSTRAINT uc_node_name UNIQUE (name_norm); + +CREATE INDEX iObjectNameOrig ON m_object (name_orig); + +CREATE INDEX iObjectNameNorm ON m_object (name_norm); + +CREATE INDEX iObjectTypeClass ON m_object (objectTypeClass); + +CREATE INDEX iObjectCreateTimestamp ON m_object (createTimestamp); + +CREATE INDEX iExtensionDate ON m_object_ext_date (ownerType, eName, dateValue); + +CREATE INDEX iExtensionDateDef ON m_object_ext_date (owner_oid, ownerType); + +CREATE INDEX iExtensionLong ON m_object_ext_long (ownerType, eName, longValue); + +CREATE INDEX iExtensionLongDef ON m_object_ext_long (owner_oid, ownerType); + +CREATE INDEX iExtensionPolyString ON m_object_ext_poly (ownerType, eName, orig); + +CREATE INDEX iExtensionPolyStringDef ON m_object_ext_poly (owner_oid, ownerType); + +CREATE INDEX iExtensionReference ON m_object_ext_reference (ownerType, eName, targetoid); + +CREATE INDEX iExtensionReferenceDef ON m_object_ext_reference (owner_oid, ownerType); + +CREATE INDEX iExtensionString ON m_object_ext_string (ownerType, eName, stringValue); + +CREATE INDEX iExtensionStringDef ON m_object_ext_string (owner_oid, ownerType); + +ALTER TABLE m_object_template +ADD CONSTRAINT uc_object_template_name UNIQUE (name_norm); + +ALTER TABLE m_org +ADD CONSTRAINT uc_org_name UNIQUE (name_norm); + +CREATE INDEX iDisplayOrder ON m_org (displayOrder); + +CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); + +CREATE INDEX iDescendant ON m_org_closure (descendant_oid); + +CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid); + +CREATE INDEX iReferenceTargetOid ON m_reference (targetOid); + +ALTER TABLE m_report +ADD CONSTRAINT uc_report_name UNIQUE (name_norm); + +CREATE INDEX iReportParent ON m_report (parent); + +ALTER TABLE m_resource +ADD CONSTRAINT uc_resource_name UNIQUE (name_norm); + +ALTER TABLE m_role +ADD CONSTRAINT uc_role_name UNIQUE (name_norm); + +ALTER TABLE m_security_policy +ADD CONSTRAINT uc_security_policy_name UNIQUE (name_norm); + +CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid); + +CREATE INDEX iShadowDead ON m_shadow (dead); + +ALTER TABLE m_system_configuration +ADD CONSTRAINT uc_system_configuration_name UNIQUE (name_norm); + +CREATE INDEX iParent ON m_task (parent); + +CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue); + +ALTER TABLE m_user +ADD CONSTRAINT uc_user_name UNIQUE (name_norm); + +CREATE INDEX iEmployeeNumber ON m_user (employeeNumber); + +CREATE INDEX iFullName ON m_user (fullName_orig); + +CREATE INDEX iFamilyName ON m_user (familyName_orig); + +CREATE INDEX iGivenName ON m_user (givenName_orig); + +CREATE INDEX iLocality ON m_user (locality_orig); + +ALTER TABLE m_value_policy +ADD CONSTRAINT uc_value_policy_name UNIQUE (name_norm); + ALTER TABLE m_abstract_role ADD CONSTRAINT fk_abstract_role FOREIGN KEY (oid) REFERENCES m_focus; -CREATE INDEX iAssignmentAdministrative ON m_assignment (administrativeStatus); - -CREATE INDEX iAssignmentEffective ON m_assignment (effectiveStatus); - ALTER TABLE m_assignment ADD CONSTRAINT fk_assignment_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iAExtensionDate ON m_assignment_ext_date (extensionType, eName, dateValue); - ALTER TABLE m_assignment_ext_date ADD CONSTRAINT fk_assignment_ext_date FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionLong ON m_assignment_ext_long (extensionType, eName, longValue); - ALTER TABLE m_assignment_ext_long ADD CONSTRAINT fk_assignment_ext_long FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionPolyString ON m_assignment_ext_poly (extensionType, eName, orig); - ALTER TABLE m_assignment_ext_poly ADD CONSTRAINT fk_assignment_ext_poly FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionReference ON m_assignment_ext_reference (extensionType, eName, targetoid); - ALTER TABLE m_assignment_ext_reference ADD CONSTRAINT fk_assignment_ext_reference FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAExtensionString ON m_assignment_ext_string (extensionType, eName, stringValue); - ALTER TABLE m_assignment_ext_string ADD CONSTRAINT fk_assignment_ext_string FOREIGN KEY (anyContainer_owner_id, anyContainer_owner_owner_oid) REFERENCES m_assignment_extension; -CREATE INDEX iAssignmentReferenceTargetOid ON m_assignment_reference (targetOid); - ALTER TABLE m_assignment_reference ADD CONSTRAINT fk_assignment_reference FOREIGN KEY (owner_id, owner_owner_oid) @@ -636,10 +722,6 @@ ADD CONSTRAINT fk_exclusion_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iFocusAdministrative ON m_focus (administrativeStatus); - -CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); - ALTER TABLE m_focus ADD CONSTRAINT fk_focus FOREIGN KEY (oid) @@ -655,54 +737,26 @@ ADD CONSTRAINT fk_node FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iObjectCreateTimestamp ON m_object (createTimestamp); - -CREATE INDEX iObjectTypeClass ON m_object (objectTypeClass); - -CREATE INDEX iObjectNameOrig ON m_object (name_orig); - -CREATE INDEX iObjectNameNorm ON m_object (name_norm); - -CREATE INDEX iExtensionDate ON m_object_ext_date (ownerType, eName, dateValue); - -CREATE INDEX iExtensionDateDef ON m_object_ext_date (owner_oid, ownerType); - ALTER TABLE m_object_ext_date ADD CONSTRAINT fk_object_ext_date FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionLong ON m_object_ext_long (ownerType, eName, longValue); - -CREATE INDEX iExtensionLongDef ON m_object_ext_long (owner_oid, ownerType); - ALTER TABLE m_object_ext_long ADD CONSTRAINT fk_object_ext_long FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionPolyString ON m_object_ext_poly (ownerType, eName, orig); - -CREATE INDEX iExtensionPolyStringDef ON m_object_ext_poly (owner_oid, ownerType); - ALTER TABLE m_object_ext_poly ADD CONSTRAINT fk_object_ext_poly FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionReference ON m_object_ext_reference (ownerType, eName, targetoid); - -CREATE INDEX iExtensionReferenceDef ON m_object_ext_reference (owner_oid, ownerType); - ALTER TABLE m_object_ext_reference ADD CONSTRAINT fk_object_ext_reference FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iExtensionString ON m_object_ext_string (ownerType, eName, stringValue); - -CREATE INDEX iExtensionStringDef ON m_object_ext_string (owner_oid, ownerType); - ALTER TABLE m_object_ext_string ADD CONSTRAINT fk_object_ext_string FOREIGN KEY (owner_oid) @@ -713,17 +767,11 @@ ADD CONSTRAINT fk_object_template FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iDisplayOrder ON m_org (displayOrder); - ALTER TABLE m_org ADD CONSTRAINT fk_org FOREIGN KEY (oid) REFERENCES m_abstract_role; -CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); - -CREATE INDEX iDescendant ON m_org_closure (descendant_oid); - ALTER TABLE m_org_closure ADD CONSTRAINT fk_ancestor FOREIGN KEY (ancestor_oid) @@ -739,15 +787,11 @@ ADD CONSTRAINT fk_org_org_type FOREIGN KEY (org_oid) REFERENCES m_org; -CREATE INDEX iReferenceTargetOid ON m_reference (targetOid); - ALTER TABLE m_reference ADD CONSTRAINT fk_reference_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iReportParent ON m_report (parent); - ALTER TABLE m_report ADD CONSTRAINT fk_report FOREIGN KEY (oid) @@ -773,10 +817,6 @@ ADD CONSTRAINT fk_security_policy FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iShadowResourceRef ON m_shadow (resourceRef_targetOid); - -CREATE INDEX iShadowDead ON m_shadow (dead); - ALTER TABLE m_shadow ADD CONSTRAINT fk_shadow FOREIGN KEY (oid) @@ -787,8 +827,6 @@ ADD CONSTRAINT fk_system_configuration FOREIGN KEY (oid) REFERENCES m_object; -CREATE INDEX iParent ON m_task (parent); - ALTER TABLE m_task ADD CONSTRAINT fk_task FOREIGN KEY (oid) @@ -799,23 +837,11 @@ ADD CONSTRAINT fk_task_dependent FOREIGN KEY (task_oid) REFERENCES m_task; -CREATE INDEX iTriggerTimestamp ON m_trigger (timestampValue); - ALTER TABLE m_trigger ADD CONSTRAINT fk_trigger_owner FOREIGN KEY (owner_oid) REFERENCES m_object; -CREATE INDEX iEmployeeNumber ON m_user (employeeNumber); - -CREATE INDEX iFullName ON m_user (fullName_orig); - -CREATE INDEX iFamilyName ON m_user (familyName_orig); - -CREATE INDEX iGivenName ON m_user (givenName_orig); - -CREATE INDEX iLocality ON m_user (locality_orig); - ALTER TABLE m_user ADD CONSTRAINT fk_user FOREIGN KEY (oid) From bb1c4d52ab470761ee496be8731c78e619f3a9a5 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Mon, 2 Feb 2015 11:53:51 +0100 Subject: [PATCH 091/215] Updating the release text files --- NEWS | 55 ++++++++++++++++++++++++++----------------------------- README | 5 ++--- 2 files changed, 28 insertions(+), 32 deletions(-) diff --git a/NEWS b/NEWS index 81c05efdae8..9b5923082be 100644 --- a/NEWS +++ b/NEWS @@ -1,31 +1,28 @@ -midPoint 3.0 "Newton" +midPoint 3.1 "Sinan" --------------------- -* Generic synchronization: synchronize almost any type of object to the resource -* Entitlement management support allows management of resource groups, privileges and roles in a native and convenient way. -* Delegated Administration: ability to define fine-grained authorizations scoped to a specific organizational unit. Attribute-level authorizations. -* REST API -* Improved reporting (based on Jasper Reports) -* Performance improvements -* Bulk actions: Ability to execute an action on all users/accounts (or subset). -* GUI improvements: Improved GUI design and ergonomics, ability to conveniently adjust some aspects of GUI look&feel -* Switch to common OpenICF/ConnId 1.4 framework -* Schema and interface cleanup -* Scripting Hooks -* Schema documentation automatically generated from the definition (schemadoc) -* Higher-order inducements -* New expression evaluators for assignments and entitlement associations -* Iteration support for focal objects (e.g. users) -* New administration GUI pages -* Partial multi-tenancy support -* Support for resource read-only mode -* Extended function libraries for expressions -* Support for time-based mappings in object template -* Improved synchronization reaction configuration options -* Improved reconciliation and synchronization performance -* Support for filters in protected accounts specification -* Support for binary attribute values -* Support for user photo -* Schema improvements -* Improved logging messages - +* Resource wizard +* Improved role and organization user interface +* Improved entitlement GUI +* Notification support for roles and organizations +* GUI progress indicator for provisioning operations +* Support for account lock-out attributes. Also for lock-out attributes + simulation. +* Conditional roles and assignments/inducements. +* Changes in assignment parameters are provisioned immediately, + reconciliation is no longer needed. +* OID-bound mode for attributes. +* Multi-tenancy improvements in GUI. +* Generic synchronization improvements in GUI. +* Improved provisioning dependencies. +* Support for iteration in inbound expressions (object template). +* Significant performance improvements +** Improved performance of organization structure ("org closure table"). +** Improved import and reconciliation performance (parallelization). +* Polygon versions of LDAP, DBTable and CSVFile connectors +* Significantly improved paging support in LDAP connector +* Support for case-insensitive attribute names. +* Improved authorization and delegated administration support in GUI. +* Support for "priority attributes" to work around some connector problems. +* Improved reporting engine based on Jasper Reports. +* Numerous user experience improvements. \ No newline at end of file diff --git a/README b/README index 1c590d06647..8aae31f30ab 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -midPoint 3.0 "Newton" +midPoint 3.1 "Sinan" --------------------- General informations: @@ -9,7 +9,7 @@ MidPoint also makes the data available in unified form. The most important features of midPoint are: - User provisioning and deprovisioning - - Integration of Identity Connector Framework + - Integration of ConnId connector framework - Administration GUI - Identity repository implemention (SQL) - Custom schema extensibility @@ -29,7 +29,6 @@ The most important features of midPoint are: - Notifications - Local Java APIs, Remote web service interface (SOAP), REST API - High availablity (HA) support - For more information please go to: From b2f654d911c8f183ed80bb127bc787d38ef48912 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Mon, 2 Feb 2015 13:08:21 +0100 Subject: [PATCH 092/215] Release 3.1 --- build-system/pom.xml | 2 +- custom/pom.xml | 2 +- dist/midpoint-api/pom.xml | 10 ++-- dist/pom.xml | 8 +-- gui/admin-gui-en-US/pom.xml | 6 +- gui/admin-gui-es-ES/pom.xml | 6 +- gui/admin-gui-sk-SK/pom.xml | 6 +- gui/admin-gui-tr-TR/pom.xml | 6 +- gui/admin-gui/pom.xml | 56 +++++++++---------- gui/pom.xml | 2 +- icf-connectors/dummy-connector-fake/pom.xml | 4 +- icf-connectors/dummy-connector/pom.xml | 6 +- icf-connectors/dummy-resource/pom.xml | 6 +- icf-connectors/pom.xml | 4 +- infra/common/pom.xml | 10 ++-- infra/pom.xml | 2 +- infra/prism-maven-plugin/pom.xml | 6 +- infra/prism/pom.xml | 8 +-- .../resources/xml/ns/public/annotation-3.xsd | 2 +- .../main/resources/xml/ns/public/query-3.xsd | 2 +- .../main/resources/xml/ns/public/types-3.xsd | 2 +- infra/schema/pom.xml | 12 ++-- .../xml/ns/public/common/api-types-3.xsd | 2 +- .../xml/ns/public/common/common-3.xsd | 2 +- .../connector/icf-1/connector-schema-3.xsd | 2 +- .../connector/icf-1/resource-schema-3.xsd | 2 +- .../xml/ns/public/model/model-3.wsdl | 2 + .../xml/ns/public/resource/annotation-3.xsd | 2 +- .../xml/ns/public/resource/capabilities-3.xsd | 2 +- infra/test-util/pom.xml | 6 +- infra/util/pom.xml | 4 +- infra/ws-util/pom.xml | 4 +- model/model-api/pom.xml | 10 ++-- model/model-client/pom.xml | 10 ++-- model/model-common/pom.xml | 14 ++--- model/model-impl/pom.xml | 46 +++++++-------- model/model-intest/pom.xml | 48 ++++++++-------- model/model-test/pom.xml | 38 ++++++------- model/notifications-api/pom.xml | 18 +++--- model/notifications-impl/pom.xml | 38 ++++++------- model/pom.xml | 2 +- model/report-api/pom.xml | 6 +- model/report-impl/pom.xml | 32 +++++------ model/workflow-api/pom.xml | 8 +-- model/workflow-impl/pom.xml | 44 +++++++-------- pom.xml | 2 +- provisioning/pom.xml | 2 +- provisioning/provisioning-api/pom.xml | 8 +-- provisioning/provisioning-impl/pom.xml | 32 +++++------ repo/audit-api/pom.xml | 8 +-- repo/audit-impl/pom.xml | 16 +++--- repo/pom.xml | 2 +- repo/repo-api/pom.xml | 8 +-- repo/repo-cache/pom.xml | 12 ++-- repo/repo-sql-impl-test/pom.xml | 8 +-- repo/repo-sql-impl/pom.xml | 10 ++-- repo/repo-test-util/pom.xml | 22 ++++---- repo/security-api/pom.xml | 6 +- repo/security-impl/pom.xml | 16 +++--- repo/system-init/pom.xml | 14 ++--- repo/task-api/pom.xml | 6 +- repo/task-quartz-impl/pom.xml | 22 ++++---- samples/model-client-sample/pom.xml | 4 +- samples/pom.xml | 2 +- samples/samples-test/pom.xml | 30 +++++----- testing/conntest/pom.xml | 30 +++++----- testing/consistency-mechanism/pom.xml | 30 +++++----- testing/longtest/pom.xml | 30 +++++----- testing/pom.xml | 2 +- testing/sanity/pom.xml | 42 +++++++------- testing/story/pom.xml | 30 +++++----- tools/gui-i18n/pom.xml | 4 +- tools/pom.xml | 2 +- tools/repo-ninja/pom.xml | 12 ++-- tools/schema-dist-maven-plugin/pom.xml | 6 +- tools/test-ng/pom.xml | 2 +- tools/xjc-plugin/pom.xml | 8 +-- weblogic-build/pom.xml | 4 +- 78 files changed, 472 insertions(+), 470 deletions(-) diff --git a/build-system/pom.xml b/build-system/pom.xml index 62fa7e46a2f..9e66571c427 100644 --- a/build-system/pom.xml +++ b/build-system/pom.xml @@ -25,7 +25,7 @@ com.evolveum.midpoint midpoint - 3.1-SNAPSHOT + 3.1 diff --git a/custom/pom.xml b/custom/pom.xml index 49dc3a28496..44c011f81ea 100644 --- a/custom/pom.xml +++ b/custom/pom.xml @@ -23,7 +23,7 @@ parent com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 ../build-system/pom.xml diff --git a/dist/midpoint-api/pom.xml b/dist/midpoint-api/pom.xml index 8193fe5a096..b2e707b944e 100644 --- a/dist/midpoint-api/pom.xml +++ b/dist/midpoint-api/pom.xml @@ -24,7 +24,7 @@ parent com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 ../../build-system/pom.xml @@ -51,22 +51,22 @@ com.evolveum.midpoint.model model-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.infra common - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.infra schema - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.infra util - 3.1-SNAPSHOT + 3.1 diff --git a/dist/pom.xml b/dist/pom.xml index 7d11226a1b6..bd9e05ae877 100644 --- a/dist/pom.xml +++ b/dist/pom.xml @@ -24,7 +24,7 @@ parent com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 ../build-system/pom.xml @@ -51,20 +51,20 @@ com.evolveum.midpoint.gui admin-gui - 3.1-SNAPSHOT + 3.1 war com.evolveum.midpoint.tools repo-ninja - 3.1-SNAPSHOT + 3.1 zip bin com.evolveum.midpoint.tools repo-ninja - 3.1-SNAPSHOT + 3.1 diff --git a/gui/admin-gui-en-US/pom.xml b/gui/admin-gui-en-US/pom.xml index fab54225be4..ee7147c9c9a 100644 --- a/gui/admin-gui-en-US/pom.xml +++ b/gui/admin-gui-en-US/pom.xml @@ -21,11 +21,11 @@ com.evolveum.midpoint.gui admin-gui-en-US jar - 3.1-SNAPSHOT + 3.1 gui com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -44,7 +44,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test diff --git a/gui/admin-gui-es-ES/pom.xml b/gui/admin-gui-es-ES/pom.xml index db7b113b067..10ec1600c2e 100644 --- a/gui/admin-gui-es-ES/pom.xml +++ b/gui/admin-gui-es-ES/pom.xml @@ -21,11 +21,11 @@ com.evolveum.midpoint.gui admin-gui-es-ES jar - 3.1-SNAPSHOT + 3.1 gui com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -44,7 +44,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test diff --git a/gui/admin-gui-sk-SK/pom.xml b/gui/admin-gui-sk-SK/pom.xml index 3618914e146..d1f9a0a357e 100644 --- a/gui/admin-gui-sk-SK/pom.xml +++ b/gui/admin-gui-sk-SK/pom.xml @@ -21,11 +21,11 @@ com.evolveum.midpoint.gui admin-gui-sk-SK jar - 3.1-SNAPSHOT + 3.1 gui com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -44,7 +44,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test diff --git a/gui/admin-gui-tr-TR/pom.xml b/gui/admin-gui-tr-TR/pom.xml index b5633a3194a..fcb0545150d 100644 --- a/gui/admin-gui-tr-TR/pom.xml +++ b/gui/admin-gui-tr-TR/pom.xml @@ -21,11 +21,11 @@ com.evolveum.midpoint.gui admin-gui-tr-TR jar - 3.1-SNAPSHOT + 3.1 gui com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 @@ -39,7 +39,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test diff --git a/gui/admin-gui/pom.xml b/gui/admin-gui/pom.xml index 4bedce0a079..a9ee0573403 100644 --- a/gui/admin-gui/pom.xml +++ b/gui/admin-gui/pom.xml @@ -20,11 +20,11 @@ com.evolveum.midpoint.gui admin-gui war - 3.1-SNAPSHOT + 3.1 gui com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -188,22 +188,22 @@ com.evolveum.midpoint.gui admin-gui-en-US - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.gui admin-gui-sk-SK - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.gui admin-gui-tr-TR - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.gui admin-gui-es-ES - 3.1-SNAPSHOT + 3.1 @@ -216,7 +216,7 @@ com.evolveum.midpoint.repo repo-api - 3.1-SNAPSHOT + 3.1 jaxb-impl @@ -231,39 +231,39 @@ com.evolveum.midpoint.model report-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model model-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo security-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model workflow-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model notifications-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-sql-impl - 3.1-SNAPSHOT + 3.1 runtime com.evolveum.midpoint.repo repo-cache - 3.1-SNAPSHOT + 3.1 runtime @@ -283,25 +283,25 @@ com.evolveum.midpoint.repo task-quartz-impl - 3.1-SNAPSHOT + 3.1 runtime com.evolveum.midpoint.repo audit-impl - 3.1-SNAPSHOT + 3.1 runtime com.evolveum.midpoint.repo security-impl - 3.1-SNAPSHOT + 3.1 runtime com.evolveum.midpoint.model model-impl - 3.1-SNAPSHOT + 3.1 runtime @@ -313,37 +313,37 @@ com.evolveum.midpoint.model workflow-impl - 3.1-SNAPSHOT + 3.1 runtime com.evolveum.midpoint.model notifications-impl - 3.1-SNAPSHOT + 3.1 runtime com.evolveum.midpoint.provisioning provisioning-impl - 3.1-SNAPSHOT + 3.1 runtime com.evolveum.midpoint.repo system-init - 3.1-SNAPSHOT + 3.1 runtime com.evolveum.midpoint.model report-impl - 3.1-SNAPSHOT + 3.1 runtime com.evolveum.midpoint.infra common - 3.1-SNAPSHOT + 3.1 xml-apis @@ -447,13 +447,13 @@ com.evolveum.midpoint.repo repo-test-util - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo repo-sql-impl-test - 3.1-SNAPSHOT + 3.1 test @@ -470,7 +470,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test @@ -554,7 +554,7 @@ com.evolveum.midpoint.model model-test - 3.1-SNAPSHOT + 3.1 test diff --git a/gui/pom.xml b/gui/pom.xml index 1870a16c6b4..bd83691c51b 100644 --- a/gui/pom.xml +++ b/gui/pom.xml @@ -23,7 +23,7 @@ parent com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 ../build-system/pom.xml diff --git a/icf-connectors/dummy-connector-fake/pom.xml b/icf-connectors/dummy-connector-fake/pom.xml index 4c8e2006d2c..2358a1955ee 100644 --- a/icf-connectors/dummy-connector-fake/pom.xml +++ b/icf-connectors/dummy-connector-fake/pom.xml @@ -20,12 +20,12 @@ Dummy Connector Fake com.evolveum.icf dummy-connector-fake - 3.1-SNAPSHOT + 3.1 jar icf-connectors com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git diff --git a/icf-connectors/dummy-connector/pom.xml b/icf-connectors/dummy-connector/pom.xml index 6dbb8b67194..6e5cf1afe44 100644 --- a/icf-connectors/dummy-connector/pom.xml +++ b/icf-connectors/dummy-connector/pom.xml @@ -20,12 +20,12 @@ Dummy Connector com.evolveum.icf dummy-connector - 3.1-SNAPSHOT + 3.1 jar icf-connectors com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -44,7 +44,7 @@ com.evolveum.icf dummy-resource - 3.1-SNAPSHOT + 3.1 org.testng diff --git a/icf-connectors/dummy-resource/pom.xml b/icf-connectors/dummy-resource/pom.xml index c72c3f1b5e9..d026fb58d15 100644 --- a/icf-connectors/dummy-resource/pom.xml +++ b/icf-connectors/dummy-resource/pom.xml @@ -20,12 +20,12 @@ Dummy Resource com.evolveum.icf dummy-resource - 3.1-SNAPSHOT + 3.1 jar icf-connectors com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -36,7 +36,7 @@ com.evolveum.midpoint.infra util - 3.1-SNAPSHOT + 3.1 org.testng diff --git a/icf-connectors/pom.xml b/icf-connectors/pom.xml index 84efbfee18c..3a8ee4541e7 100644 --- a/icf-connectors/pom.xml +++ b/icf-connectors/pom.xml @@ -23,7 +23,7 @@ parent com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 ../build-system/pom.xml @@ -55,7 +55,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test diff --git a/infra/common/pom.xml b/infra/common/pom.xml index e87aee86f1b..8996c6a2da4 100644 --- a/infra/common/pom.xml +++ b/infra/common/pom.xml @@ -24,7 +24,7 @@ infra com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -35,12 +35,12 @@ com.evolveum.midpoint.infra util - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.infra schema - 3.1-SNAPSHOT + 3.1 commons-beanutils @@ -100,13 +100,13 @@ com.evolveum.midpoint.infra test-util - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test diff --git a/infra/pom.xml b/infra/pom.xml index e89f20bd0c3..9eb1d0dc4e2 100644 --- a/infra/pom.xml +++ b/infra/pom.xml @@ -22,7 +22,7 @@ parent com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 ../build-system/pom.xml diff --git a/infra/prism-maven-plugin/pom.xml b/infra/prism-maven-plugin/pom.xml index 090bfbc783b..661b1495f11 100644 --- a/infra/prism-maven-plugin/pom.xml +++ b/infra/prism-maven-plugin/pom.xml @@ -20,13 +20,13 @@ 4.0.0 com.evolveum.midpoint.infra prism-maven-plugin - 3.1-SNAPSHOT + 3.1 maven-plugin midPoint Infrastructure - prism maven plugin infra com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -52,7 +52,7 @@ com.evolveum.midpoint.infra prism - 3.1-SNAPSHOT + 3.1 commons-lang diff --git a/infra/prism/pom.xml b/infra/prism/pom.xml index 71fec27c7da..040310a76e0 100644 --- a/infra/prism/pom.xml +++ b/infra/prism/pom.xml @@ -20,12 +20,12 @@ 4.0.0 com.evolveum.midpoint.infra prism - 3.1-SNAPSHOT + 3.1 midPoint Infrastructure - prism infra com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -36,7 +36,7 @@ com.evolveum.midpoint.infra util - 3.1-SNAPSHOT + 3.1 @@ -101,61 +101,61 @@ com.evolveum.midpoint.repo repo-cache - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.model model-impl - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.provisioning provisioning-impl - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo task-quartz-impl - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo audit-impl - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo security-impl - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.model model-test - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo repo-sql-impl - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo repo-test-util - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.infra test-util - 3.1-SNAPSHOT + 3.1 test @@ -166,7 +166,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test @@ -182,7 +182,7 @@ com.evolveum.midpoint.repo system-init - 3.1-SNAPSHOT + 3.1 test diff --git a/model/workflow-api/pom.xml b/model/workflow-api/pom.xml index ec2e0cfe9e6..aee785caa43 100644 --- a/model/workflow-api/pom.xml +++ b/model/workflow-api/pom.xml @@ -21,7 +21,7 @@ model com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 4.0.0 midPoint Workflow - api @@ -37,17 +37,17 @@ com.evolveum.midpoint.infra common - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo task-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test diff --git a/model/workflow-impl/pom.xml b/model/workflow-impl/pom.xml index cd996f48dc0..4395adca5c0 100644 --- a/model/workflow-impl/pom.xml +++ b/model/workflow-impl/pom.xml @@ -24,7 +24,7 @@ model com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -35,47 +35,47 @@ com.evolveum.midpoint.model workflow-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model model-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model model-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model notifications-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-cache - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.provisioning provisioning-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo task-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo system-init - 3.1-SNAPSHOT + 3.1 org.activiti @@ -89,33 +89,33 @@ com.evolveum.midpoint.repo repo-sql-impl - 3.1-SNAPSHOT + 3.1 provided com.evolveum.midpoint.model model-impl - 3.1-SNAPSHOT + 3.1 test-jar test com.evolveum.midpoint.model notifications-impl - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.model report-api - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.model report-impl - 3.1-SNAPSHOT + 3.1 test @@ -126,7 +126,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test @@ -152,37 +152,37 @@ com.evolveum.midpoint.repo repo-test-util - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo task-quartz-impl - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo audit-impl - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo security-impl - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.provisioning provisioning-impl - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.model model-test - 3.1-SNAPSHOT + 3.1 test diff --git a/pom.xml b/pom.xml index 2a9e5e8c8da..e7bcccefdaf 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ midPoint Project com.evolveum.midpoint midpoint - 3.1-SNAPSHOT + 3.1 pom Utility module to compile all of the maven based midPoint projects. diff --git a/provisioning/pom.xml b/provisioning/pom.xml index c177aa3aea0..a1a7a7d6bf6 100644 --- a/provisioning/pom.xml +++ b/provisioning/pom.xml @@ -23,7 +23,7 @@ parent com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 ../build-system/pom.xml diff --git a/provisioning/provisioning-api/pom.xml b/provisioning/provisioning-api/pom.xml index c320c5fed32..9e597ca8724 100644 --- a/provisioning/provisioning-api/pom.xml +++ b/provisioning/provisioning-api/pom.xml @@ -20,12 +20,12 @@ midPoint Provisioning - api com.evolveum.midpoint.provisioning provisioning-api - 3.1-SNAPSHOT + 3.1 jar provisioning com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -36,12 +36,12 @@ com.evolveum.midpoint.repo task-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test diff --git a/provisioning/provisioning-impl/pom.xml b/provisioning/provisioning-impl/pom.xml index e815b0e4d4d..2b51c6bc778 100644 --- a/provisioning/provisioning-impl/pom.xml +++ b/provisioning/provisioning-impl/pom.xml @@ -24,7 +24,7 @@ provisioning com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -35,33 +35,33 @@ com.evolveum.midpoint.infra test-util - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.provisioning provisioning-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-cache - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo system-init - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo task-api - 3.1-SNAPSHOT + 3.1 commons-pool @@ -89,7 +89,7 @@ com.evolveum.midpoint.repo audit-impl - 3.1-SNAPSHOT + 3.1 test @@ -100,19 +100,19 @@ com.evolveum.midpoint.repo repo-sql-impl - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo task-quartz-impl - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo security-impl - 3.1-SNAPSHOT + 3.1 test @@ -123,13 +123,13 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo repo-test-util - 3.1-SNAPSHOT + 3.1 test @@ -165,13 +165,13 @@ com.evolveum.icf dummy-connector - 3.1-SNAPSHOT + 3.1 test com.evolveum.icf dummy-resource - 3.1-SNAPSHOT + 3.1 test @@ -192,7 +192,7 @@ com.evolveum.midpoint.repo system-init - 3.1-SNAPSHOT + 3.1 test diff --git a/repo/audit-api/pom.xml b/repo/audit-api/pom.xml index f685d4e5fee..2287b7a3207 100644 --- a/repo/audit-api/pom.xml +++ b/repo/audit-api/pom.xml @@ -24,7 +24,7 @@ repo com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -35,18 +35,18 @@ com.evolveum.midpoint.infra common - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo task-api - 3.1-SNAPSHOT + 3.1 diff --git a/repo/audit-impl/pom.xml b/repo/audit-impl/pom.xml index b926ac7663d..6810e7d61ff 100644 --- a/repo/audit-impl/pom.xml +++ b/repo/audit-impl/pom.xml @@ -24,7 +24,7 @@ repo com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -35,17 +35,17 @@ com.evolveum.midpoint.repo repo-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-cache - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo audit-api - 3.1-SNAPSHOT + 3.1 commons-pool @@ -60,7 +60,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test @@ -76,13 +76,13 @@ com.evolveum.midpoint.repo repo-sql-impl - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo repo-test-util - 3.1-SNAPSHOT + 3.1 test @@ -93,7 +93,7 @@ com.evolveum.midpoint.repo system-init - 3.1-SNAPSHOT + 3.1 test diff --git a/repo/pom.xml b/repo/pom.xml index c817744786a..30f2f9e11b6 100644 --- a/repo/pom.xml +++ b/repo/pom.xml @@ -22,7 +22,7 @@ parent com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 ../build-system/pom.xml diff --git a/repo/repo-api/pom.xml b/repo/repo-api/pom.xml index ea7ecdecfb1..28114e751b0 100644 --- a/repo/repo-api/pom.xml +++ b/repo/repo-api/pom.xml @@ -24,7 +24,7 @@ repo com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -35,17 +35,17 @@ com.evolveum.midpoint.infra common - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.infra schema - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test diff --git a/repo/repo-cache/pom.xml b/repo/repo-cache/pom.xml index 1b7f464aaf6..ad926ceba47 100644 --- a/repo/repo-cache/pom.xml +++ b/repo/repo-cache/pom.xml @@ -24,7 +24,7 @@ repo com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -35,22 +35,22 @@ com.evolveum.midpoint.infra common - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.infra schema - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.infra util - 3.1-SNAPSHOT + 3.1 @@ -61,7 +61,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test diff --git a/repo/repo-sql-impl-test/pom.xml b/repo/repo-sql-impl-test/pom.xml index 9c1bf26bb2e..1d3f9734d60 100644 --- a/repo/repo-sql-impl-test/pom.xml +++ b/repo/repo-sql-impl-test/pom.xml @@ -25,7 +25,7 @@ repo com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -36,12 +36,12 @@ com.evolveum.midpoint.repo repo-sql-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo system-init - 3.1-SNAPSHOT + 3.1 org.testng @@ -80,7 +80,7 @@ com.evolveum.midpoint.infra test-util - 3.1-SNAPSHOT + 3.1 test diff --git a/repo/repo-sql-impl/pom.xml b/repo/repo-sql-impl/pom.xml index 1ae346f31f7..c785567c9c2 100644 --- a/repo/repo-sql-impl/pom.xml +++ b/repo/repo-sql-impl/pom.xml @@ -25,7 +25,7 @@ repo com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -36,17 +36,17 @@ com.evolveum.midpoint.repo repo-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo audit-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.infra common - 3.1-SNAPSHOT + 3.1 @@ -96,7 +96,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test diff --git a/repo/repo-test-util/pom.xml b/repo/repo-test-util/pom.xml index 99eeb3746f6..242216123d2 100644 --- a/repo/repo-test-util/pom.xml +++ b/repo/repo-test-util/pom.xml @@ -23,7 +23,7 @@ repo com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -34,42 +34,42 @@ com.evolveum.midpoint.infra common - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-cache - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo task-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo audit-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-sql-impl-test - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.infra test-util - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.infra util - 3.1-SNAPSHOT + 3.1 org.testng @@ -78,12 +78,12 @@ com.evolveum.icf dummy-resource - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test diff --git a/repo/security-api/pom.xml b/repo/security-api/pom.xml index 4191227b34c..65a7702c8fe 100644 --- a/repo/security-api/pom.xml +++ b/repo/security-api/pom.xml @@ -24,7 +24,7 @@ repo com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -35,12 +35,12 @@ com.evolveum.midpoint.infra common - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test diff --git a/repo/security-impl/pom.xml b/repo/security-impl/pom.xml index 2e879c3f78c..af03dc48116 100644 --- a/repo/security-impl/pom.xml +++ b/repo/security-impl/pom.xml @@ -24,7 +24,7 @@ repo com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -35,17 +35,17 @@ com.evolveum.midpoint.repo security-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-cache - 3.1-SNAPSHOT + 3.1 @@ -56,7 +56,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test @@ -67,19 +67,19 @@ com.evolveum.midpoint.repo repo-sql-impl - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo repo-test-util - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo system-init - 3.1-SNAPSHOT + 3.1 test diff --git a/repo/system-init/pom.xml b/repo/system-init/pom.xml index d8ccf8820a7..9c0530daa42 100644 --- a/repo/system-init/pom.xml +++ b/repo/system-init/pom.xml @@ -24,7 +24,7 @@ repo com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -47,29 +47,29 @@ com.evolveum.midpoint.repo repo-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo audit-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.infra util - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.infra common - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-cache - 3.1-SNAPSHOT + 3.1 @@ -81,7 +81,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test diff --git a/repo/task-api/pom.xml b/repo/task-api/pom.xml index 2a244d09072..cea3f4c1212 100644 --- a/repo/task-api/pom.xml +++ b/repo/task-api/pom.xml @@ -24,7 +24,7 @@ repo com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -35,12 +35,12 @@ com.evolveum.midpoint.infra common - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test diff --git a/repo/task-quartz-impl/pom.xml b/repo/task-quartz-impl/pom.xml index 512242d7b29..e4475264967 100644 --- a/repo/task-quartz-impl/pom.xml +++ b/repo/task-quartz-impl/pom.xml @@ -24,7 +24,7 @@ repo com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -35,22 +35,22 @@ com.evolveum.midpoint.repo repo-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-cache - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo task-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo security-api - 3.1-SNAPSHOT + 3.1 commons-pool @@ -64,7 +64,7 @@ com.evolveum.midpoint.repo repo-sql-impl - 3.1-SNAPSHOT + 3.1 provided @@ -76,7 +76,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test @@ -92,13 +92,13 @@ com.evolveum.midpoint.repo audit-impl - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo security-impl - 3.1-SNAPSHOT + 3.1 test @@ -134,7 +134,7 @@ com.evolveum.midpoint.repo repo-test-util - 3.1-SNAPSHOT + 3.1 test @@ -145,7 +145,7 @@ com.evolveum.midpoint.repo system-init - 3.1-SNAPSHOT + 3.1 test diff --git a/samples/model-client-sample/pom.xml b/samples/model-client-sample/pom.xml index ff27c315ae3..eb35b972995 100644 --- a/samples/model-client-sample/pom.xml +++ b/samples/model-client-sample/pom.xml @@ -21,7 +21,7 @@ com.evolveum.midpoint.samples model-client-sample - 3.1-SNAPSHOT + 3.1 1.7 @@ -137,7 +137,7 @@ com.evolveum.midpoint.model model-client - 3.1-SNAPSHOT + 3.1 org.apache.cxf diff --git a/samples/pom.xml b/samples/pom.xml index 2ad329d6ce3..eebb87faaf9 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -23,7 +23,7 @@ parent com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 ../build-system/pom.xml diff --git a/samples/samples-test/pom.xml b/samples/samples-test/pom.xml index dc9658bf28a..277ad1dca39 100644 --- a/samples/samples-test/pom.xml +++ b/samples/samples-test/pom.xml @@ -23,7 +23,7 @@ parent com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 ../../build-system/pom.xml @@ -60,52 +60,52 @@ com.evolveum.midpoint.infra util - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.infra common - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model model-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model model-test - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.provisioning provisioning-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo task-quartz-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo audit-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo security-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-test-util - 3.1-SNAPSHOT + 3.1 @@ -117,7 +117,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test @@ -133,13 +133,13 @@ com.evolveum.midpoint.infra test-util - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo repo-sql-impl - 3.1-SNAPSHOT + 3.1 test @@ -150,7 +150,7 @@ com.evolveum.midpoint.repo system-init - 3.1-SNAPSHOT + 3.1 test diff --git a/testing/conntest/pom.xml b/testing/conntest/pom.xml index 3a2c67c8b4d..ec7f5e19dc0 100644 --- a/testing/conntest/pom.xml +++ b/testing/conntest/pom.xml @@ -23,7 +23,7 @@ parent com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 ../../build-system/pom.xml @@ -60,52 +60,52 @@ com.evolveum.midpoint.infra util - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.infra common - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model model-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model model-test - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.provisioning provisioning-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo task-quartz-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo audit-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo security-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-test-util - 3.1-SNAPSHOT + 3.1 @@ -117,7 +117,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test @@ -133,13 +133,13 @@ com.evolveum.midpoint.infra test-util - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo repo-sql-impl - 3.1-SNAPSHOT + 3.1 test @@ -150,7 +150,7 @@ com.evolveum.midpoint.repo system-init - 3.1-SNAPSHOT + 3.1 test diff --git a/testing/consistency-mechanism/pom.xml b/testing/consistency-mechanism/pom.xml index e30939e3000..957ee0321e1 100644 --- a/testing/consistency-mechanism/pom.xml +++ b/testing/consistency-mechanism/pom.xml @@ -22,7 +22,7 @@ parent com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 ../../build-system/pom.xml @@ -59,47 +59,47 @@ com.evolveum.midpoint.infra util - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.infra common - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model model-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.provisioning provisioning-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo task-quartz-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo audit-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo security-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-test-util - 3.1-SNAPSHOT + 3.1 @@ -111,7 +111,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test @@ -127,19 +127,19 @@ com.evolveum.midpoint.infra test-util - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo repo-sql-impl - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.model model-test - 3.1-SNAPSHOT + 3.1 test @@ -150,7 +150,7 @@ com.evolveum.midpoint.repo system-init - 3.1-SNAPSHOT + 3.1 test diff --git a/testing/longtest/pom.xml b/testing/longtest/pom.xml index f43cd5ed46f..987f6fab0a3 100644 --- a/testing/longtest/pom.xml +++ b/testing/longtest/pom.xml @@ -23,7 +23,7 @@ parent com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 ../../build-system/pom.xml @@ -60,52 +60,52 @@ com.evolveum.midpoint.infra util - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.infra common - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model model-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model model-test - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.provisioning provisioning-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo task-quartz-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo audit-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo security-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-test-util - 3.1-SNAPSHOT + 3.1 @@ -117,7 +117,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test @@ -133,13 +133,13 @@ com.evolveum.midpoint.infra test-util - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo repo-sql-impl - 3.1-SNAPSHOT + 3.1 test @@ -150,7 +150,7 @@ com.evolveum.midpoint.repo system-init - 3.1-SNAPSHOT + 3.1 test diff --git a/testing/pom.xml b/testing/pom.xml index 0a919adf624..a1234b9a2e3 100644 --- a/testing/pom.xml +++ b/testing/pom.xml @@ -24,7 +24,7 @@ parent com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 ../build-system/pom.xml diff --git a/testing/sanity/pom.xml b/testing/sanity/pom.xml index 18b65e40859..6ae60ef42a6 100644 --- a/testing/sanity/pom.xml +++ b/testing/sanity/pom.xml @@ -23,7 +23,7 @@ parent com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 ../../build-system/pom.xml @@ -60,82 +60,82 @@ com.evolveum.midpoint.infra util - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.infra common - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model model-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model model-test - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.provisioning provisioning-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo task-quartz-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo audit-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo security-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-test-util - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model report-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model report-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model notifications-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model notifications-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model workflow-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model workflow-impl - 3.1-SNAPSHOT + 3.1 @@ -147,7 +147,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test @@ -163,13 +163,13 @@ com.evolveum.midpoint.infra test-util - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo repo-sql-impl - 3.1-SNAPSHOT + 3.1 test @@ -180,7 +180,7 @@ com.evolveum.midpoint.repo system-init - 3.1-SNAPSHOT + 3.1 test diff --git a/testing/story/pom.xml b/testing/story/pom.xml index 6e32d04fdb7..d59a26c3b4a 100644 --- a/testing/story/pom.xml +++ b/testing/story/pom.xml @@ -23,7 +23,7 @@ parent com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 ../../build-system/pom.xml @@ -60,52 +60,52 @@ com.evolveum.midpoint.infra util - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.infra common - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-api - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model model-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.model model-test - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.provisioning provisioning-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo task-quartz-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo audit-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo security-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo repo-test-util - 3.1-SNAPSHOT + 3.1 @@ -117,7 +117,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test @@ -133,13 +133,13 @@ com.evolveum.midpoint.infra test-util - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo repo-sql-impl - 3.1-SNAPSHOT + 3.1 test @@ -150,7 +150,7 @@ com.evolveum.midpoint.repo system-init - 3.1-SNAPSHOT + 3.1 test diff --git a/tools/gui-i18n/pom.xml b/tools/gui-i18n/pom.xml index 890388645aa..0d6e67946e7 100644 --- a/tools/gui-i18n/pom.xml +++ b/tools/gui-i18n/pom.xml @@ -25,7 +25,7 @@ tools com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -48,7 +48,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test diff --git a/tools/pom.xml b/tools/pom.xml index ca5bb04b182..1645b4b2699 100644 --- a/tools/pom.xml +++ b/tools/pom.xml @@ -24,7 +24,7 @@ parent com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 ../build-system/pom.xml diff --git a/tools/repo-ninja/pom.xml b/tools/repo-ninja/pom.xml index b28d5dde28e..afd18f612ea 100644 --- a/tools/repo-ninja/pom.xml +++ b/tools/repo-ninja/pom.xml @@ -25,7 +25,7 @@ tools com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -36,28 +36,28 @@ com.evolveum.midpoint.repo repo-sql-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo system-init - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.repo security-impl - 3.1-SNAPSHOT + 3.1 com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test com.evolveum.midpoint.repo audit-impl - 3.1-SNAPSHOT + 3.1 diff --git a/tools/schema-dist-maven-plugin/pom.xml b/tools/schema-dist-maven-plugin/pom.xml index 562b86409f8..0a63280b5e5 100644 --- a/tools/schema-dist-maven-plugin/pom.xml +++ b/tools/schema-dist-maven-plugin/pom.xml @@ -20,13 +20,13 @@ 4.0.0 com.evolveum.midpoint.tools schema-dist-maven-plugin - 3.1-SNAPSHOT + 3.1 maven-plugin midPoint Tools - schema dist maven plugin tools com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -71,7 +71,7 @@ com.evolveum.midpoint.infra util - 3.1-SNAPSHOT + 3.1 diff --git a/tools/test-ng/pom.xml b/tools/test-ng/pom.xml index 89af4dd8518..d86b7ea1b26 100644 --- a/tools/test-ng/pom.xml +++ b/tools/test-ng/pom.xml @@ -24,7 +24,7 @@ tools com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git diff --git a/tools/xjc-plugin/pom.xml b/tools/xjc-plugin/pom.xml index 788f43dddbc..e36cabf7feb 100644 --- a/tools/xjc-plugin/pom.xml +++ b/tools/xjc-plugin/pom.xml @@ -19,13 +19,13 @@ 4.0.0 com.evolveum.midpoint.tools xjc-plugin - 3.1-SNAPSHOT + 3.1 jar midPoint Infrastructure - xjc plugin tools com.evolveum.midpoint - 3.1-SNAPSHOT + 3.1 https://github.com/Evolveum/midpoint.git @@ -36,7 +36,7 @@ com.evolveum.midpoint.infra prism - 3.1-SNAPSHOT + 3.1 com.sun.xml.bind @@ -62,7 +62,7 @@ com.evolveum.midpoint.tools test-ng - 3.1-SNAPSHOT + 3.1 test diff --git a/weblogic-build/pom.xml b/weblogic-build/pom.xml index 8e91159c4f7..88e0febfdb3 100644 --- a/weblogic-build/pom.xml +++ b/weblogic-build/pom.xml @@ -20,7 +20,7 @@ com.evolveum.midpoint.dist midPoint-weblogic ear - 3.1-SNAPSHOT + 3.1 midPoint distribution for WebLogic Server https://github.com/Evolveum/midpoint.git @@ -36,7 +36,7 @@ com.evolveum.midpoint.gui admin-gui - 3.1-SNAPSHOT + 3.1 war From 18d2f75773d55c2b63986449d12b06bf16a3fbb0 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Mon, 2 Feb 2015 13:47:57 +0100 Subject: [PATCH 093/215] Start of 3.2 development --- build-system/pom.xml | 2 +- custom/pom.xml | 2 +- dist/midpoint-api/pom.xml | 10 ++-- dist/pom.xml | 8 +-- gui/admin-gui-en-US/pom.xml | 6 +- gui/admin-gui-es-ES/pom.xml | 6 +- gui/admin-gui-sk-SK/pom.xml | 6 +- gui/admin-gui-tr-TR/pom.xml | 6 +- gui/admin-gui/pom.xml | 56 +++++++++---------- gui/pom.xml | 2 +- icf-connectors/dummy-connector-fake/pom.xml | 4 +- icf-connectors/dummy-connector/pom.xml | 6 +- icf-connectors/dummy-resource/pom.xml | 6 +- icf-connectors/pom.xml | 4 +- infra/common/pom.xml | 10 ++-- infra/pom.xml | 2 +- infra/prism-maven-plugin/pom.xml | 6 +- infra/prism/pom.xml | 8 +-- infra/schema/pom.xml | 12 ++-- .../xml/ns/public/common/common-3.xsd | 2 +- infra/test-util/pom.xml | 6 +- infra/util/pom.xml | 4 +- infra/ws-util/pom.xml | 4 +- model/model-api/pom.xml | 10 ++-- model/model-client/pom.xml | 10 ++-- model/model-common/pom.xml | 14 ++--- model/model-impl/pom.xml | 46 +++++++-------- model/model-intest/pom.xml | 48 ++++++++-------- model/model-test/pom.xml | 38 ++++++------- model/notifications-api/pom.xml | 18 +++--- model/notifications-impl/pom.xml | 38 ++++++------- model/pom.xml | 2 +- model/report-api/pom.xml | 6 +- model/report-impl/pom.xml | 32 +++++------ model/workflow-api/pom.xml | 8 +-- model/workflow-impl/pom.xml | 44 +++++++-------- pom.xml | 2 +- provisioning/pom.xml | 2 +- provisioning/provisioning-api/pom.xml | 8 +-- provisioning/provisioning-impl/pom.xml | 32 +++++------ repo/audit-api/pom.xml | 8 +-- repo/audit-impl/pom.xml | 16 +++--- repo/pom.xml | 2 +- repo/repo-api/pom.xml | 8 +-- repo/repo-cache/pom.xml | 12 ++-- repo/repo-sql-impl-test/pom.xml | 8 +-- repo/repo-sql-impl/pom.xml | 10 ++-- repo/repo-test-util/pom.xml | 22 ++++---- repo/security-api/pom.xml | 6 +- repo/security-impl/pom.xml | 16 +++--- repo/system-init/pom.xml | 14 ++--- repo/task-api/pom.xml | 6 +- repo/task-quartz-impl/pom.xml | 22 ++++---- samples/model-client-sample/pom.xml | 4 +- samples/pom.xml | 2 +- samples/samples-test/pom.xml | 30 +++++----- testing/conntest/pom.xml | 30 +++++----- testing/consistency-mechanism/pom.xml | 30 +++++----- testing/longtest/pom.xml | 30 +++++----- testing/pom.xml | 2 +- testing/sanity/pom.xml | 42 +++++++------- testing/story/pom.xml | 30 +++++----- tools/gui-i18n/pom.xml | 4 +- tools/pom.xml | 2 +- tools/repo-ninja/pom.xml | 12 ++-- tools/schema-dist-maven-plugin/pom.xml | 6 +- tools/test-ng/pom.xml | 2 +- tools/xjc-plugin/pom.xml | 8 +-- weblogic-build/pom.xml | 2 +- 69 files changed, 461 insertions(+), 461 deletions(-) diff --git a/build-system/pom.xml b/build-system/pom.xml index 9e66571c427..a02cb577d0c 100644 --- a/build-system/pom.xml +++ b/build-system/pom.xml @@ -25,7 +25,7 @@ com.evolveum.midpoint midpoint - 3.1 + 3.2-SNAPSHOT diff --git a/custom/pom.xml b/custom/pom.xml index 44c011f81ea..3d6e3bec8af 100644 --- a/custom/pom.xml +++ b/custom/pom.xml @@ -23,7 +23,7 @@ parent com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT ../build-system/pom.xml diff --git a/dist/midpoint-api/pom.xml b/dist/midpoint-api/pom.xml index b2e707b944e..244503b4db2 100644 --- a/dist/midpoint-api/pom.xml +++ b/dist/midpoint-api/pom.xml @@ -24,7 +24,7 @@ parent com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT ../../build-system/pom.xml @@ -51,22 +51,22 @@ com.evolveum.midpoint.model model-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.infra common - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.infra schema - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.infra util - 3.1 + 3.2-SNAPSHOT diff --git a/dist/pom.xml b/dist/pom.xml index bd9e05ae877..0fdb9dffe30 100644 --- a/dist/pom.xml +++ b/dist/pom.xml @@ -24,7 +24,7 @@ parent com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT ../build-system/pom.xml @@ -51,20 +51,20 @@ com.evolveum.midpoint.gui admin-gui - 3.1 + 3.2-SNAPSHOT war com.evolveum.midpoint.tools repo-ninja - 3.1 + 3.2-SNAPSHOT zip bin com.evolveum.midpoint.tools repo-ninja - 3.1 + 3.2-SNAPSHOT diff --git a/gui/admin-gui-en-US/pom.xml b/gui/admin-gui-en-US/pom.xml index ee7147c9c9a..ff33f66a434 100644 --- a/gui/admin-gui-en-US/pom.xml +++ b/gui/admin-gui-en-US/pom.xml @@ -21,11 +21,11 @@ com.evolveum.midpoint.gui admin-gui-en-US jar - 3.1 + 3.2-SNAPSHOT gui com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -44,7 +44,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test diff --git a/gui/admin-gui-es-ES/pom.xml b/gui/admin-gui-es-ES/pom.xml index 10ec1600c2e..371a8ddd873 100644 --- a/gui/admin-gui-es-ES/pom.xml +++ b/gui/admin-gui-es-ES/pom.xml @@ -21,11 +21,11 @@ com.evolveum.midpoint.gui admin-gui-es-ES jar - 3.1 + 3.2-SNAPSHOT gui com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -44,7 +44,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test diff --git a/gui/admin-gui-sk-SK/pom.xml b/gui/admin-gui-sk-SK/pom.xml index d1f9a0a357e..a4242b50b50 100644 --- a/gui/admin-gui-sk-SK/pom.xml +++ b/gui/admin-gui-sk-SK/pom.xml @@ -21,11 +21,11 @@ com.evolveum.midpoint.gui admin-gui-sk-SK jar - 3.1 + 3.2-SNAPSHOT gui com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -44,7 +44,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test diff --git a/gui/admin-gui-tr-TR/pom.xml b/gui/admin-gui-tr-TR/pom.xml index fcb0545150d..fc17a776749 100644 --- a/gui/admin-gui-tr-TR/pom.xml +++ b/gui/admin-gui-tr-TR/pom.xml @@ -21,11 +21,11 @@ com.evolveum.midpoint.gui admin-gui-tr-TR jar - 3.1 + 3.2-SNAPSHOT gui com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT @@ -39,7 +39,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test diff --git a/gui/admin-gui/pom.xml b/gui/admin-gui/pom.xml index a9ee0573403..02997ff645f 100644 --- a/gui/admin-gui/pom.xml +++ b/gui/admin-gui/pom.xml @@ -20,11 +20,11 @@ com.evolveum.midpoint.gui admin-gui war - 3.1 + 3.2-SNAPSHOT gui com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -188,22 +188,22 @@ com.evolveum.midpoint.gui admin-gui-en-US - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.gui admin-gui-sk-SK - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.gui admin-gui-tr-TR - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.gui admin-gui-es-ES - 3.1 + 3.2-SNAPSHOT @@ -216,7 +216,7 @@ com.evolveum.midpoint.repo repo-api - 3.1 + 3.2-SNAPSHOT jaxb-impl @@ -231,39 +231,39 @@ com.evolveum.midpoint.model report-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model model-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo security-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model workflow-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model notifications-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-sql-impl - 3.1 + 3.2-SNAPSHOT runtime com.evolveum.midpoint.repo repo-cache - 3.1 + 3.2-SNAPSHOT runtime @@ -283,25 +283,25 @@ com.evolveum.midpoint.repo task-quartz-impl - 3.1 + 3.2-SNAPSHOT runtime com.evolveum.midpoint.repo audit-impl - 3.1 + 3.2-SNAPSHOT runtime com.evolveum.midpoint.repo security-impl - 3.1 + 3.2-SNAPSHOT runtime com.evolveum.midpoint.model model-impl - 3.1 + 3.2-SNAPSHOT runtime @@ -313,37 +313,37 @@ com.evolveum.midpoint.model workflow-impl - 3.1 + 3.2-SNAPSHOT runtime com.evolveum.midpoint.model notifications-impl - 3.1 + 3.2-SNAPSHOT runtime com.evolveum.midpoint.provisioning provisioning-impl - 3.1 + 3.2-SNAPSHOT runtime com.evolveum.midpoint.repo system-init - 3.1 + 3.2-SNAPSHOT runtime com.evolveum.midpoint.model report-impl - 3.1 + 3.2-SNAPSHOT runtime com.evolveum.midpoint.infra common - 3.1 + 3.2-SNAPSHOT xml-apis @@ -447,13 +447,13 @@ com.evolveum.midpoint.repo repo-test-util - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo repo-sql-impl-test - 3.1 + 3.2-SNAPSHOT test @@ -470,7 +470,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test @@ -554,7 +554,7 @@ com.evolveum.midpoint.model model-test - 3.1 + 3.2-SNAPSHOT test diff --git a/gui/pom.xml b/gui/pom.xml index bd83691c51b..24b49acdcbf 100644 --- a/gui/pom.xml +++ b/gui/pom.xml @@ -23,7 +23,7 @@ parent com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT ../build-system/pom.xml diff --git a/icf-connectors/dummy-connector-fake/pom.xml b/icf-connectors/dummy-connector-fake/pom.xml index 2358a1955ee..09cccf07b75 100644 --- a/icf-connectors/dummy-connector-fake/pom.xml +++ b/icf-connectors/dummy-connector-fake/pom.xml @@ -20,12 +20,12 @@ Dummy Connector Fake com.evolveum.icf dummy-connector-fake - 3.1 + 3.2-SNAPSHOT jar icf-connectors com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git diff --git a/icf-connectors/dummy-connector/pom.xml b/icf-connectors/dummy-connector/pom.xml index 6e5cf1afe44..cf91ed9e215 100644 --- a/icf-connectors/dummy-connector/pom.xml +++ b/icf-connectors/dummy-connector/pom.xml @@ -20,12 +20,12 @@ Dummy Connector com.evolveum.icf dummy-connector - 3.1 + 3.2-SNAPSHOT jar icf-connectors com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -44,7 +44,7 @@ com.evolveum.icf dummy-resource - 3.1 + 3.2-SNAPSHOT org.testng diff --git a/icf-connectors/dummy-resource/pom.xml b/icf-connectors/dummy-resource/pom.xml index d026fb58d15..3d9860e17cd 100644 --- a/icf-connectors/dummy-resource/pom.xml +++ b/icf-connectors/dummy-resource/pom.xml @@ -20,12 +20,12 @@ Dummy Resource com.evolveum.icf dummy-resource - 3.1 + 3.2-SNAPSHOT jar icf-connectors com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -36,7 +36,7 @@ com.evolveum.midpoint.infra util - 3.1 + 3.2-SNAPSHOT org.testng diff --git a/icf-connectors/pom.xml b/icf-connectors/pom.xml index 3a8ee4541e7..e7b7eff1e10 100644 --- a/icf-connectors/pom.xml +++ b/icf-connectors/pom.xml @@ -23,7 +23,7 @@ parent com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT ../build-system/pom.xml @@ -55,7 +55,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test diff --git a/infra/common/pom.xml b/infra/common/pom.xml index 8996c6a2da4..c435ca21586 100644 --- a/infra/common/pom.xml +++ b/infra/common/pom.xml @@ -24,7 +24,7 @@ infra com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -35,12 +35,12 @@ com.evolveum.midpoint.infra util - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.infra schema - 3.1 + 3.2-SNAPSHOT commons-beanutils @@ -100,13 +100,13 @@ com.evolveum.midpoint.infra test-util - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test diff --git a/infra/pom.xml b/infra/pom.xml index 9eb1d0dc4e2..6696a55ee00 100644 --- a/infra/pom.xml +++ b/infra/pom.xml @@ -22,7 +22,7 @@ parent com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT ../build-system/pom.xml diff --git a/infra/prism-maven-plugin/pom.xml b/infra/prism-maven-plugin/pom.xml index 661b1495f11..b071a88758e 100644 --- a/infra/prism-maven-plugin/pom.xml +++ b/infra/prism-maven-plugin/pom.xml @@ -20,13 +20,13 @@ 4.0.0 com.evolveum.midpoint.infra prism-maven-plugin - 3.1 + 3.2-SNAPSHOT maven-plugin midPoint Infrastructure - prism maven plugin infra com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -52,7 +52,7 @@ com.evolveum.midpoint.infra prism - 3.1 + 3.2-SNAPSHOT commons-lang diff --git a/infra/prism/pom.xml b/infra/prism/pom.xml index 040310a76e0..38d32466def 100644 --- a/infra/prism/pom.xml +++ b/infra/prism/pom.xml @@ -20,12 +20,12 @@ 4.0.0 com.evolveum.midpoint.infra prism - 3.1 + 3.2-SNAPSHOT midPoint Infrastructure - prism infra com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -36,7 +36,7 @@ com.evolveum.midpoint.infra util - 3.1 + 3.2-SNAPSHOT @@ -101,61 +101,61 @@ com.evolveum.midpoint.repo repo-cache - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.model model-impl - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.provisioning provisioning-impl - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo task-quartz-impl - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo audit-impl - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo security-impl - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.model model-test - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo repo-sql-impl - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo repo-test-util - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.infra test-util - 3.1 + 3.2-SNAPSHOT test @@ -166,7 +166,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test @@ -182,7 +182,7 @@ com.evolveum.midpoint.repo system-init - 3.1 + 3.2-SNAPSHOT test diff --git a/model/workflow-api/pom.xml b/model/workflow-api/pom.xml index aee785caa43..264cae92abe 100644 --- a/model/workflow-api/pom.xml +++ b/model/workflow-api/pom.xml @@ -21,7 +21,7 @@ model com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT 4.0.0 midPoint Workflow - api @@ -37,17 +37,17 @@ com.evolveum.midpoint.infra common - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo task-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test diff --git a/model/workflow-impl/pom.xml b/model/workflow-impl/pom.xml index 4395adca5c0..ef9ffce0ab8 100644 --- a/model/workflow-impl/pom.xml +++ b/model/workflow-impl/pom.xml @@ -24,7 +24,7 @@ model com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -35,47 +35,47 @@ com.evolveum.midpoint.model workflow-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model model-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model model-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model notifications-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-cache - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.provisioning provisioning-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo task-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo system-init - 3.1 + 3.2-SNAPSHOT org.activiti @@ -89,33 +89,33 @@ com.evolveum.midpoint.repo repo-sql-impl - 3.1 + 3.2-SNAPSHOT provided com.evolveum.midpoint.model model-impl - 3.1 + 3.2-SNAPSHOT test-jar test com.evolveum.midpoint.model notifications-impl - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.model report-api - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.model report-impl - 3.1 + 3.2-SNAPSHOT test @@ -126,7 +126,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test @@ -152,37 +152,37 @@ com.evolveum.midpoint.repo repo-test-util - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo task-quartz-impl - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo audit-impl - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo security-impl - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.provisioning provisioning-impl - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.model model-test - 3.1 + 3.2-SNAPSHOT test diff --git a/pom.xml b/pom.xml index e7bcccefdaf..621f882b806 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ midPoint Project com.evolveum.midpoint midpoint - 3.1 + 3.2-SNAPSHOT pom Utility module to compile all of the maven based midPoint projects. diff --git a/provisioning/pom.xml b/provisioning/pom.xml index a1a7a7d6bf6..1c10a7dcfab 100644 --- a/provisioning/pom.xml +++ b/provisioning/pom.xml @@ -23,7 +23,7 @@ parent com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT ../build-system/pom.xml diff --git a/provisioning/provisioning-api/pom.xml b/provisioning/provisioning-api/pom.xml index 9e597ca8724..8d458d0355b 100644 --- a/provisioning/provisioning-api/pom.xml +++ b/provisioning/provisioning-api/pom.xml @@ -20,12 +20,12 @@ midPoint Provisioning - api com.evolveum.midpoint.provisioning provisioning-api - 3.1 + 3.2-SNAPSHOT jar provisioning com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -36,12 +36,12 @@ com.evolveum.midpoint.repo task-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test diff --git a/provisioning/provisioning-impl/pom.xml b/provisioning/provisioning-impl/pom.xml index 2b51c6bc778..0654c2b9f22 100644 --- a/provisioning/provisioning-impl/pom.xml +++ b/provisioning/provisioning-impl/pom.xml @@ -24,7 +24,7 @@ provisioning com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -35,33 +35,33 @@ com.evolveum.midpoint.infra test-util - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.provisioning provisioning-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-cache - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo system-init - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo task-api - 3.1 + 3.2-SNAPSHOT commons-pool @@ -89,7 +89,7 @@ com.evolveum.midpoint.repo audit-impl - 3.1 + 3.2-SNAPSHOT test @@ -100,19 +100,19 @@ com.evolveum.midpoint.repo repo-sql-impl - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo task-quartz-impl - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo security-impl - 3.1 + 3.2-SNAPSHOT test @@ -123,13 +123,13 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo repo-test-util - 3.1 + 3.2-SNAPSHOT test @@ -165,13 +165,13 @@ com.evolveum.icf dummy-connector - 3.1 + 3.2-SNAPSHOT test com.evolveum.icf dummy-resource - 3.1 + 3.2-SNAPSHOT test @@ -192,7 +192,7 @@ com.evolveum.midpoint.repo system-init - 3.1 + 3.2-SNAPSHOT test diff --git a/repo/audit-api/pom.xml b/repo/audit-api/pom.xml index 2287b7a3207..59eb6d9749b 100644 --- a/repo/audit-api/pom.xml +++ b/repo/audit-api/pom.xml @@ -24,7 +24,7 @@ repo com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -35,18 +35,18 @@ com.evolveum.midpoint.infra common - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo task-api - 3.1 + 3.2-SNAPSHOT diff --git a/repo/audit-impl/pom.xml b/repo/audit-impl/pom.xml index 6810e7d61ff..43f55527798 100644 --- a/repo/audit-impl/pom.xml +++ b/repo/audit-impl/pom.xml @@ -24,7 +24,7 @@ repo com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -35,17 +35,17 @@ com.evolveum.midpoint.repo repo-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-cache - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo audit-api - 3.1 + 3.2-SNAPSHOT commons-pool @@ -60,7 +60,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test @@ -76,13 +76,13 @@ com.evolveum.midpoint.repo repo-sql-impl - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo repo-test-util - 3.1 + 3.2-SNAPSHOT test @@ -93,7 +93,7 @@ com.evolveum.midpoint.repo system-init - 3.1 + 3.2-SNAPSHOT test diff --git a/repo/pom.xml b/repo/pom.xml index 30f2f9e11b6..0747ae3ef2d 100644 --- a/repo/pom.xml +++ b/repo/pom.xml @@ -22,7 +22,7 @@ parent com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT ../build-system/pom.xml diff --git a/repo/repo-api/pom.xml b/repo/repo-api/pom.xml index 28114e751b0..4c4279d5ae3 100644 --- a/repo/repo-api/pom.xml +++ b/repo/repo-api/pom.xml @@ -24,7 +24,7 @@ repo com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -35,17 +35,17 @@ com.evolveum.midpoint.infra common - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.infra schema - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test diff --git a/repo/repo-cache/pom.xml b/repo/repo-cache/pom.xml index ad926ceba47..aa43b19b4c6 100644 --- a/repo/repo-cache/pom.xml +++ b/repo/repo-cache/pom.xml @@ -24,7 +24,7 @@ repo com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -35,22 +35,22 @@ com.evolveum.midpoint.infra common - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.infra schema - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.infra util - 3.1 + 3.2-SNAPSHOT @@ -61,7 +61,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test diff --git a/repo/repo-sql-impl-test/pom.xml b/repo/repo-sql-impl-test/pom.xml index 1d3f9734d60..b4a79e8b2f8 100644 --- a/repo/repo-sql-impl-test/pom.xml +++ b/repo/repo-sql-impl-test/pom.xml @@ -25,7 +25,7 @@ repo com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -36,12 +36,12 @@ com.evolveum.midpoint.repo repo-sql-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo system-init - 3.1 + 3.2-SNAPSHOT org.testng @@ -80,7 +80,7 @@ com.evolveum.midpoint.infra test-util - 3.1 + 3.2-SNAPSHOT test diff --git a/repo/repo-sql-impl/pom.xml b/repo/repo-sql-impl/pom.xml index c785567c9c2..0d0caf14b38 100644 --- a/repo/repo-sql-impl/pom.xml +++ b/repo/repo-sql-impl/pom.xml @@ -25,7 +25,7 @@ repo com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -36,17 +36,17 @@ com.evolveum.midpoint.repo repo-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo audit-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.infra common - 3.1 + 3.2-SNAPSHOT @@ -96,7 +96,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test diff --git a/repo/repo-test-util/pom.xml b/repo/repo-test-util/pom.xml index 242216123d2..ef79a8e335d 100644 --- a/repo/repo-test-util/pom.xml +++ b/repo/repo-test-util/pom.xml @@ -23,7 +23,7 @@ repo com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -34,42 +34,42 @@ com.evolveum.midpoint.infra common - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-cache - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo task-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo audit-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-sql-impl-test - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.infra test-util - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.infra util - 3.1 + 3.2-SNAPSHOT org.testng @@ -78,12 +78,12 @@ com.evolveum.icf dummy-resource - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test diff --git a/repo/security-api/pom.xml b/repo/security-api/pom.xml index 65a7702c8fe..f4d4e7dc681 100644 --- a/repo/security-api/pom.xml +++ b/repo/security-api/pom.xml @@ -24,7 +24,7 @@ repo com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -35,12 +35,12 @@ com.evolveum.midpoint.infra common - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test diff --git a/repo/security-impl/pom.xml b/repo/security-impl/pom.xml index af03dc48116..36b844020ab 100644 --- a/repo/security-impl/pom.xml +++ b/repo/security-impl/pom.xml @@ -24,7 +24,7 @@ repo com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -35,17 +35,17 @@ com.evolveum.midpoint.repo security-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-cache - 3.1 + 3.2-SNAPSHOT @@ -56,7 +56,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test @@ -67,19 +67,19 @@ com.evolveum.midpoint.repo repo-sql-impl - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo repo-test-util - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo system-init - 3.1 + 3.2-SNAPSHOT test diff --git a/repo/system-init/pom.xml b/repo/system-init/pom.xml index 9c0530daa42..f291e9e626b 100644 --- a/repo/system-init/pom.xml +++ b/repo/system-init/pom.xml @@ -24,7 +24,7 @@ repo com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -47,29 +47,29 @@ com.evolveum.midpoint.repo repo-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo audit-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.infra util - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.infra common - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-cache - 3.1 + 3.2-SNAPSHOT @@ -81,7 +81,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test diff --git a/repo/task-api/pom.xml b/repo/task-api/pom.xml index cea3f4c1212..a4dd2233ddd 100644 --- a/repo/task-api/pom.xml +++ b/repo/task-api/pom.xml @@ -24,7 +24,7 @@ repo com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -35,12 +35,12 @@ com.evolveum.midpoint.infra common - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test diff --git a/repo/task-quartz-impl/pom.xml b/repo/task-quartz-impl/pom.xml index e4475264967..b119f8c3e60 100644 --- a/repo/task-quartz-impl/pom.xml +++ b/repo/task-quartz-impl/pom.xml @@ -24,7 +24,7 @@ repo com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -35,22 +35,22 @@ com.evolveum.midpoint.repo repo-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-cache - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo task-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo security-api - 3.1 + 3.2-SNAPSHOT commons-pool @@ -64,7 +64,7 @@ com.evolveum.midpoint.repo repo-sql-impl - 3.1 + 3.2-SNAPSHOT provided @@ -76,7 +76,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test @@ -92,13 +92,13 @@ com.evolveum.midpoint.repo audit-impl - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo security-impl - 3.1 + 3.2-SNAPSHOT test @@ -134,7 +134,7 @@ com.evolveum.midpoint.repo repo-test-util - 3.1 + 3.2-SNAPSHOT test @@ -145,7 +145,7 @@ com.evolveum.midpoint.repo system-init - 3.1 + 3.2-SNAPSHOT test diff --git a/samples/model-client-sample/pom.xml b/samples/model-client-sample/pom.xml index eb35b972995..90a012f69dc 100644 --- a/samples/model-client-sample/pom.xml +++ b/samples/model-client-sample/pom.xml @@ -21,7 +21,7 @@ com.evolveum.midpoint.samples model-client-sample - 3.1 + 3.2-SNAPSHOT 1.7 @@ -137,7 +137,7 @@ com.evolveum.midpoint.model model-client - 3.1 + 3.2-SNAPSHOT org.apache.cxf diff --git a/samples/pom.xml b/samples/pom.xml index eebb87faaf9..bed60655906 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -23,7 +23,7 @@ parent com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT ../build-system/pom.xml diff --git a/samples/samples-test/pom.xml b/samples/samples-test/pom.xml index 277ad1dca39..6ad73bd6619 100644 --- a/samples/samples-test/pom.xml +++ b/samples/samples-test/pom.xml @@ -23,7 +23,7 @@ parent com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT ../../build-system/pom.xml @@ -60,52 +60,52 @@ com.evolveum.midpoint.infra util - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.infra common - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model model-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model model-test - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.provisioning provisioning-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo task-quartz-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo audit-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo security-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-test-util - 3.1 + 3.2-SNAPSHOT @@ -117,7 +117,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test @@ -133,13 +133,13 @@ com.evolveum.midpoint.infra test-util - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo repo-sql-impl - 3.1 + 3.2-SNAPSHOT test @@ -150,7 +150,7 @@ com.evolveum.midpoint.repo system-init - 3.1 + 3.2-SNAPSHOT test diff --git a/testing/conntest/pom.xml b/testing/conntest/pom.xml index ec7f5e19dc0..c0a7f11805e 100644 --- a/testing/conntest/pom.xml +++ b/testing/conntest/pom.xml @@ -23,7 +23,7 @@ parent com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT ../../build-system/pom.xml @@ -60,52 +60,52 @@ com.evolveum.midpoint.infra util - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.infra common - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model model-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model model-test - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.provisioning provisioning-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo task-quartz-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo audit-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo security-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-test-util - 3.1 + 3.2-SNAPSHOT @@ -117,7 +117,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test @@ -133,13 +133,13 @@ com.evolveum.midpoint.infra test-util - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo repo-sql-impl - 3.1 + 3.2-SNAPSHOT test @@ -150,7 +150,7 @@ com.evolveum.midpoint.repo system-init - 3.1 + 3.2-SNAPSHOT test diff --git a/testing/consistency-mechanism/pom.xml b/testing/consistency-mechanism/pom.xml index 957ee0321e1..cee84858030 100644 --- a/testing/consistency-mechanism/pom.xml +++ b/testing/consistency-mechanism/pom.xml @@ -22,7 +22,7 @@ parent com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT ../../build-system/pom.xml @@ -59,47 +59,47 @@ com.evolveum.midpoint.infra util - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.infra common - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model model-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.provisioning provisioning-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo task-quartz-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo audit-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo security-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-test-util - 3.1 + 3.2-SNAPSHOT @@ -111,7 +111,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test @@ -127,19 +127,19 @@ com.evolveum.midpoint.infra test-util - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo repo-sql-impl - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.model model-test - 3.1 + 3.2-SNAPSHOT test @@ -150,7 +150,7 @@ com.evolveum.midpoint.repo system-init - 3.1 + 3.2-SNAPSHOT test diff --git a/testing/longtest/pom.xml b/testing/longtest/pom.xml index 987f6fab0a3..9d9ace01523 100644 --- a/testing/longtest/pom.xml +++ b/testing/longtest/pom.xml @@ -23,7 +23,7 @@ parent com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT ../../build-system/pom.xml @@ -60,52 +60,52 @@ com.evolveum.midpoint.infra util - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.infra common - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model model-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model model-test - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.provisioning provisioning-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo task-quartz-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo audit-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo security-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-test-util - 3.1 + 3.2-SNAPSHOT @@ -117,7 +117,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test @@ -133,13 +133,13 @@ com.evolveum.midpoint.infra test-util - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo repo-sql-impl - 3.1 + 3.2-SNAPSHOT test @@ -150,7 +150,7 @@ com.evolveum.midpoint.repo system-init - 3.1 + 3.2-SNAPSHOT test diff --git a/testing/pom.xml b/testing/pom.xml index a1234b9a2e3..020aeff4369 100644 --- a/testing/pom.xml +++ b/testing/pom.xml @@ -24,7 +24,7 @@ parent com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT ../build-system/pom.xml diff --git a/testing/sanity/pom.xml b/testing/sanity/pom.xml index 6ae60ef42a6..870e6485ea2 100644 --- a/testing/sanity/pom.xml +++ b/testing/sanity/pom.xml @@ -23,7 +23,7 @@ parent com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT ../../build-system/pom.xml @@ -60,82 +60,82 @@ com.evolveum.midpoint.infra util - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.infra common - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model model-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model model-test - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.provisioning provisioning-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo task-quartz-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo audit-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo security-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-test-util - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model report-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model report-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model notifications-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model notifications-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model workflow-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model workflow-impl - 3.1 + 3.2-SNAPSHOT @@ -147,7 +147,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test @@ -163,13 +163,13 @@ com.evolveum.midpoint.infra test-util - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo repo-sql-impl - 3.1 + 3.2-SNAPSHOT test @@ -180,7 +180,7 @@ com.evolveum.midpoint.repo system-init - 3.1 + 3.2-SNAPSHOT test diff --git a/testing/story/pom.xml b/testing/story/pom.xml index d59a26c3b4a..062dafeb5be 100644 --- a/testing/story/pom.xml +++ b/testing/story/pom.xml @@ -23,7 +23,7 @@ parent com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT ../../build-system/pom.xml @@ -60,52 +60,52 @@ com.evolveum.midpoint.infra util - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.infra common - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-api - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model model-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.model model-test - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.provisioning provisioning-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo task-quartz-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo audit-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo security-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo repo-test-util - 3.1 + 3.2-SNAPSHOT @@ -117,7 +117,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test @@ -133,13 +133,13 @@ com.evolveum.midpoint.infra test-util - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo repo-sql-impl - 3.1 + 3.2-SNAPSHOT test @@ -150,7 +150,7 @@ com.evolveum.midpoint.repo system-init - 3.1 + 3.2-SNAPSHOT test diff --git a/tools/gui-i18n/pom.xml b/tools/gui-i18n/pom.xml index 0d6e67946e7..8d9f3bf09a1 100644 --- a/tools/gui-i18n/pom.xml +++ b/tools/gui-i18n/pom.xml @@ -25,7 +25,7 @@ tools com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -48,7 +48,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test diff --git a/tools/pom.xml b/tools/pom.xml index 1645b4b2699..ca7a609bc8b 100644 --- a/tools/pom.xml +++ b/tools/pom.xml @@ -24,7 +24,7 @@ parent com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT ../build-system/pom.xml diff --git a/tools/repo-ninja/pom.xml b/tools/repo-ninja/pom.xml index afd18f612ea..ba972abedd1 100644 --- a/tools/repo-ninja/pom.xml +++ b/tools/repo-ninja/pom.xml @@ -25,7 +25,7 @@ tools com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -36,28 +36,28 @@ com.evolveum.midpoint.repo repo-sql-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo system-init - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.repo security-impl - 3.1 + 3.2-SNAPSHOT com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test com.evolveum.midpoint.repo audit-impl - 3.1 + 3.2-SNAPSHOT diff --git a/tools/schema-dist-maven-plugin/pom.xml b/tools/schema-dist-maven-plugin/pom.xml index 0a63280b5e5..834ca20d6e6 100644 --- a/tools/schema-dist-maven-plugin/pom.xml +++ b/tools/schema-dist-maven-plugin/pom.xml @@ -20,13 +20,13 @@ 4.0.0 com.evolveum.midpoint.tools schema-dist-maven-plugin - 3.1 + 3.2-SNAPSHOT maven-plugin midPoint Tools - schema dist maven plugin tools com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -71,7 +71,7 @@ com.evolveum.midpoint.infra util - 3.1 + 3.2-SNAPSHOT diff --git a/tools/test-ng/pom.xml b/tools/test-ng/pom.xml index d86b7ea1b26..5251739702d 100644 --- a/tools/test-ng/pom.xml +++ b/tools/test-ng/pom.xml @@ -24,7 +24,7 @@ tools com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git diff --git a/tools/xjc-plugin/pom.xml b/tools/xjc-plugin/pom.xml index e36cabf7feb..5daa9478f5f 100644 --- a/tools/xjc-plugin/pom.xml +++ b/tools/xjc-plugin/pom.xml @@ -19,13 +19,13 @@ 4.0.0 com.evolveum.midpoint.tools xjc-plugin - 3.1 + 3.2-SNAPSHOT jar midPoint Infrastructure - xjc plugin tools com.evolveum.midpoint - 3.1 + 3.2-SNAPSHOT https://github.com/Evolveum/midpoint.git @@ -36,7 +36,7 @@ com.evolveum.midpoint.infra prism - 3.1 + 3.2-SNAPSHOT com.sun.xml.bind @@ -62,7 +62,7 @@ com.evolveum.midpoint.tools test-ng - 3.1 + 3.2-SNAPSHOT test diff --git a/weblogic-build/pom.xml b/weblogic-build/pom.xml index 88e0febfdb3..99b1d70d1c8 100644 --- a/weblogic-build/pom.xml +++ b/weblogic-build/pom.xml @@ -20,7 +20,7 @@ com.evolveum.midpoint.dist midPoint-weblogic ear - 3.1 + 3.2-SNAPSHOT midPoint distribution for WebLogic Server https://github.com/Evolveum/midpoint.git From 4c717bf322a48316453ed6c850747e8ece2ee871 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Mon, 2 Feb 2015 16:04:55 +0100 Subject: [PATCH 094/215] MID-2162 implementation --- .../web/page/admin/resources/PageResources.java | 16 ++++++++++++++++ .../admin/resources/PageResources.properties | 1 + 2 files changed, 17 insertions(+) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResources.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResources.java index 51556ab71ce..56e6ad00800 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResources.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResources.java @@ -49,6 +49,7 @@ import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem; import com.evolveum.midpoint.web.component.util.LoadableModel; import com.evolveum.midpoint.web.component.util.SelectableBean; +import com.evolveum.midpoint.web.page.admin.configuration.PageDebugView; import com.evolveum.midpoint.web.page.admin.configuration.component.HeaderMenuAction; import com.evolveum.midpoint.web.page.admin.resources.component.ContentPanel; import com.evolveum.midpoint.web.page.admin.resources.content.PageContentAccounts; @@ -272,6 +273,14 @@ public void onClick(AjaxRequestTarget target){ editResourcePerformed(getRowModel()); } })); + dto.getMenuItems().add(new InlineMenuItem(createStringResource("pageResources.button.editAsXml"), + new ColumnMenuAction(){ + + @Override + public void onClick(AjaxRequestTarget target) { + editAsXmlPerformed(getRowModel()); + } + })); return dto; } @@ -697,6 +706,13 @@ private void editResourcePerformed(IModel model){ setResponsePage(new PageResourceWizard(parameters)); } + private void editAsXmlPerformed(IModel model){ + PageParameters parameters = new PageParameters(); + parameters.add(PageDebugView.PARAM_OBJECT_ID, model.getObject().getOid()); + parameters.add(PageDebugView.PARAM_OBJECT_TYPE, ResourceType.class.getSimpleName()); + setResponsePage(PageDebugView.class, parameters); + } + private void clearSearchPerformed(AjaxRequestTarget target){ searchModel.setObject(new ResourceSearchDto()); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResources.properties b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResources.properties index 518857efc75..42a74596f82 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResources.properties +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/resources/PageResources.properties @@ -34,6 +34,7 @@ pageResources.inlineMenuItem.deleteSyncToken=Delete Sync. Token pageResources.inlineMenuItem.editResource=Edit Resource pageResources.button.discoveryRemote=Discovery pageResources.button.search=Search +pageResources.button.editAsXml=Edit XML pageResources.searchText.placeholder=Name pageResources.message.deleteResourceConfirm=Do you really want to delete resource '{0}'? From 311e60c69fff2136466130bdaed143a8d637392d Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Tue, 3 Feb 2015 12:33:43 +0100 Subject: [PATCH 095/215] Disabling tolerateDuplicateValues in hope that test will fail. It did not. MID-2193 --- .../src/test/resources/common/resource-dummy-orange.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/model/model-intest/src/test/resources/common/resource-dummy-orange.xml b/model/model-intest/src/test/resources/common/resource-dummy-orange.xml index c007d4434f7..dda59e127ba 100644 --- a/model/model-intest/src/test/resources/common/resource-dummy-orange.xml +++ b/model/model-intest/src/test/resources/common/resource-dummy-orange.xml @@ -46,6 +46,7 @@ orange true true + false whatever From 0f10098d974ac1be0590acc314aad1212f6bb5e8 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Tue, 3 Feb 2015 13:12:04 +0100 Subject: [PATCH 096/215] fix for MID-2194. --- .../midpoint/web/component/assignment/ACAttributeDto.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/ACAttributeDto.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/ACAttributeDto.java index f9a4cad850c..a6a59395b36 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/ACAttributeDto.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/ACAttributeDto.java @@ -130,7 +130,7 @@ public ResourceAttributeDefinitionType getConstruction() throws SchemaException ResourceAttributeDefinitionType attrConstruction = new ResourceAttributeDefinitionType(); attrConstruction.setRef(definition.getName()); - MappingType outbound = new MappingType(); + MappingType outbound = construction != null && construction.getOutbound() != null ? construction.getOutbound().clone() : new MappingType(); attrConstruction.setOutbound(outbound); ExpressionType expression = new ExpressionType(); From 864a2c8bb7b9517045c4a78e598b0a495b5d3515 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Thu, 29 Jan 2015 21:44:59 +0100 Subject: [PATCH 097/215] Fixing MID-2164. --- .../midpoint/util/logging/LoggingUtils.java | 64 +++++++++++-------- .../task/quartzimpl/TaskQuartzImpl.java | 3 +- 2 files changed, 41 insertions(+), 26 deletions(-) diff --git a/infra/util/src/main/java/com/evolveum/midpoint/util/logging/LoggingUtils.java b/infra/util/src/main/java/com/evolveum/midpoint/util/logging/LoggingUtils.java index 89b79a12437..8b81a158725 100644 --- a/infra/util/src/main/java/com/evolveum/midpoint/util/logging/LoggingUtils.java +++ b/infra/util/src/main/java/com/evolveum/midpoint/util/logging/LoggingUtils.java @@ -19,6 +19,7 @@ import java.util.Arrays; import java.util.List; +import ch.qos.logback.classic.Level; import org.apache.commons.lang.Validate; /** @@ -29,36 +30,49 @@ public class LoggingUtils { public static void logException(Trace LOGGER, String message, Throwable ex, Object... objects) { - Validate.notNull(LOGGER, "Logger can't be null."); - Validate.notNull(ex, "Exception can't be null."); - - List args = new ArrayList(); - args.addAll(Arrays.asList(objects)); - args.add(ex.getMessage() + " (" + ex.getClass() + ")"); - - LOGGER.error(message + ", reason: {}", args.toArray()); - // Add exception to the list. It will be the last argument without {} in the message, - // therefore the stack trace will get logged - args.add(ex); - LOGGER.debug(message + ".", args.toArray()); + logExceptionInternal(Level.ERROR, Level.DEBUG, LOGGER, message, ex, objects); } + + public static void logExceptionAsWarning(Trace LOGGER, String message, Throwable ex, Object... objects) { + logExceptionInternal(Level.WARN, Level.DEBUG, LOGGER, message, ex, objects); + } public static void logErrorOnDebugLevel(Trace LOGGER, String message, Throwable ex, Object... objects) { - Validate.notNull(LOGGER, "Logger can't be null."); - Validate.notNull(ex, "Exception can't be null."); - - List args = new ArrayList(); - args.addAll(Arrays.asList(objects)); - args.add(ex.getMessage()); - - LOGGER.debug(message + ", reason: {}", args.toArray()); - // Add exception to the list. It will be the last argument without {} in the message, - // therefore the stack trace will get logged - args.add(ex); - LOGGER.trace(message + ".", args.toArray()); + logExceptionInternal(Level.DEBUG, Level.TRACE, LOGGER, message, ex, objects); } - public static void logStackTrace(final Trace LOGGER, String message) { + private static void logExceptionInternal(Level first, Level second, Trace LOGGER, String message, Throwable ex, Object... objects) { + Validate.notNull(LOGGER, "Logger can't be null."); + Validate.notNull(ex, "Exception can't be null."); + + List args = new ArrayList<>(); + args.addAll(Arrays.asList(objects)); + args.add(ex.getMessage() + " (" + ex.getClass() + ")"); + + log(LOGGER, first, message + ", reason: {}", args.toArray()); + // Add exception to the list. It will be the last argument without {} in the message, + // therefore the stack trace will get logged + args.add(ex); + log(LOGGER, second, message + ".", args.toArray()); + } + + private static void log(Trace logger, Level level, String message, Object[] arguments) { + if (level == Level.ERROR) { + logger.error(message, arguments); + } else if (level == Level.WARN) { + logger.warn(message, arguments); + } else if (level == Level.INFO) { + logger.info(message, arguments); + } else if (level == Level.DEBUG) { + logger.debug(message, arguments); + } else if (level == Level.TRACE) { + logger.trace(message, arguments); + } else { + throw new IllegalArgumentException("Unknown level: " + level); + } + } + + public static void logStackTrace(final Trace LOGGER, String message) { if (LOGGER.isTraceEnabled()) { if (message != null) { LOGGER.trace(message+":\n{}", dumpStackTrace(LoggingUtils.class)); diff --git a/repo/task-quartz-impl/src/main/java/com/evolveum/midpoint/task/quartzimpl/TaskQuartzImpl.java b/repo/task-quartz-impl/src/main/java/com/evolveum/midpoint/task/quartzimpl/TaskQuartzImpl.java index baa11d5348c..ed8cc108374 100644 --- a/repo/task-quartz-impl/src/main/java/com/evolveum/midpoint/task/quartzimpl/TaskQuartzImpl.java +++ b/repo/task-quartz-impl/src/main/java/com/evolveum/midpoint/task/quartzimpl/TaskQuartzImpl.java @@ -59,6 +59,7 @@ import com.evolveum.midpoint.util.exception.ObjectNotFoundException; import com.evolveum.midpoint.util.exception.SchemaException; import com.evolveum.midpoint.util.exception.SystemException; +import com.evolveum.midpoint.util.logging.LoggingUtils; import com.evolveum.midpoint.util.logging.Trace; import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType; @@ -1309,7 +1310,7 @@ PrismObject resolveOwnerRef(OperationResult result) throws SchemaExcep ownerRef.getValue().setObject(owner); return owner; } catch (ObjectNotFoundException e) { - LOGGER.warn("The owner of task "+getOid()+" cannot be found (owner OID: "+ownerRef.getOid()+")",e); + LoggingUtils.logExceptionAsWarning(LOGGER, "The owner of task {} cannot be found (owner OID: {})", e, getOid(), ownerRef.getOid()); return null; } } From eaa578fb4c7ab92d2b9d1e224b18da7fd73cb210 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Thu, 29 Jan 2015 22:49:11 +0100 Subject: [PATCH 098/215] Fixing MID-2190, writing a handful of tests for assignment evaluator. --- .../midpoint/prism/delta/DeltaSetTriple.java | 9 + .../model/impl/lens/AssignmentEvaluator.java | 19 +- .../model/impl/lens/EvaluatedAssignment.java | 10 + .../model/impl/lens/AbstractLensTest.java | 68 ++- .../impl/lens/TestAssignmentEvaluator.java | 417 ++++++++++++++++-- .../impl/lens/TestAssignmentProcessor.java | 228 ++++++++-- .../lens/assignment-role-engineer.xml | 20 + .../lens/assignment-role-manager.xml | 20 + .../lens/assignment-role-visitor.xml | 20 + .../resources/lens/role-corp-contractor.xml | 32 ++ .../resources/lens/role-corp-customer.xml | 25 ++ .../resources/lens/role-corp-employee.xml | 32 ++ .../resources/lens/role-corp-engineer.xml | 35 ++ .../lens/role-corp-generic-metarole.xml | 60 +++ .../resources/lens/role-corp-job-metarole.xml | 59 +++ .../test/resources/lens/role-corp-manager.xml | 35 ++ .../test/resources/lens/role-corp-visitor.xml | 25 ++ ...ck-modify-add-assignment-role-engineer.xml | 30 ++ .../lens/user-jack-modify-set-cost-center.xml | 28 ++ .../test/AbstractModelIntegrationTest.java | 6 + 20 files changed, 1102 insertions(+), 76 deletions(-) create mode 100644 model/model-impl/src/test/resources/lens/assignment-role-engineer.xml create mode 100644 model/model-impl/src/test/resources/lens/assignment-role-manager.xml create mode 100644 model/model-impl/src/test/resources/lens/assignment-role-visitor.xml create mode 100644 model/model-impl/src/test/resources/lens/role-corp-contractor.xml create mode 100644 model/model-impl/src/test/resources/lens/role-corp-customer.xml create mode 100644 model/model-impl/src/test/resources/lens/role-corp-employee.xml create mode 100644 model/model-impl/src/test/resources/lens/role-corp-engineer.xml create mode 100644 model/model-impl/src/test/resources/lens/role-corp-generic-metarole.xml create mode 100644 model/model-impl/src/test/resources/lens/role-corp-job-metarole.xml create mode 100644 model/model-impl/src/test/resources/lens/role-corp-manager.xml create mode 100644 model/model-impl/src/test/resources/lens/role-corp-visitor.xml create mode 100644 model/model-impl/src/test/resources/lens/user-jack-modify-add-assignment-role-engineer.xml create mode 100644 model/model-impl/src/test/resources/lens/user-jack-modify-set-cost-center.xml diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/delta/DeltaSetTriple.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/delta/DeltaSetTriple.java index c96c6868b32..6560c98ef6d 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/delta/DeltaSetTriple.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/delta/DeltaSetTriple.java @@ -162,6 +162,15 @@ public void addAllToZeroSet(Collection items) { } + public Collection getSet(PlusMinusZero whichSet) { + switch (whichSet) { + case ZERO: return getZeroSet(); + case PLUS: return getPlusSet(); + case MINUS: return getMinusSet(); + default: throw new IllegalArgumentException("Unexpected value: " + whichSet); + } + } + public void addAllToSet(PlusMinusZero destination, Collection items) { if (destination == null) { return; diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/AssignmentEvaluator.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/AssignmentEvaluator.java index 75d3a3c6ebc..0b071555fd2 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/AssignmentEvaluator.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/AssignmentEvaluator.java @@ -256,8 +256,9 @@ private void evaluateAssignment(EvaluatedAssignment evalAssignment, Assignmen MappingType conditionType = assignmentType.getCondition(); if (conditionType != null) { + AssignmentPathVariables assignmentPathVariables = LensUtil.computeAssignmentPathVariables(assignmentPath); PrismValueDeltaSetTriple> conditionTriple = evaluateMappingAsCondition(conditionType, - assignmentType, source, task, result); + assignmentType, source, assignmentPathVariables, task, result); boolean condOld = ExpressionUtil.computeConditionResult(conditionTriple.getNonPositiveValues()); boolean condNew = ExpressionUtil.computeConditionResult(conditionTriple.getNonNegativeValues()); PlusMinusZero condMode = ExpressionUtil.computeConditionResultMode(condOld, condNew); @@ -432,8 +433,9 @@ private boolean evaluateAbstractRole(EvaluatedAssignment assignment, Assignme MappingType conditionType = roleType.getCondition(); if (conditionType != null) { + AssignmentPathVariables assignmentPathVariables = LensUtil.computeAssignmentPathVariables(assignmentPath); PrismValueDeltaSetTriple> conditionTriple = evaluateMappingAsCondition(conditionType, - null, source, task, result); + null, source, assignmentPathVariables, task, result); boolean condOld = ExpressionUtil.computeConditionResult(conditionTriple.getNonPositiveValues()); boolean condNew = ExpressionUtil.computeConditionResult(conditionTriple.getNonNegativeValues()); PlusMinusZero condMode = ExpressionUtil.computeConditionResultMode(condOld, condNew); @@ -518,10 +520,11 @@ private boolean evaluateAbstractRole(EvaluatedAssignment assignment, Assignme assignment.addAuthorization(authorization); } - return mode != PlusMinusZero.MINUS; + return mode != PlusMinusZero.MINUS; + } - + private boolean isApplicable(QName focusType, AbstractRoleType roleType) throws SchemaException { if (focusType == null) { return true; @@ -603,7 +606,9 @@ private void checkSchema(AssignmentType assignmentType, String sourceDescription } public PrismValueDeltaSetTriple> evaluateMappingAsCondition(MappingType conditionType, - AssignmentType sourceAssignment, ObjectType source, Task task, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException { + AssignmentType sourceAssignment, ObjectType source, + AssignmentPathVariables assignmentPathVariables, + Task task, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException { String desc; if (sourceAssignment == null) { desc = "condition in " + source; @@ -620,8 +625,8 @@ public PrismValueDeltaSetTriple> evaluateMappingAsCo mapping.setRootNode(focusOdo); mapping.setOriginType(OriginType.ASSIGNMENTS); mapping.setOriginObject(source); - - // TODO: assignment path variables? + + LensUtil.addAssignmentPathVariables(mapping, assignmentPathVariables); ItemDefinition outputDefinition = new PrismPropertyDefinition(CONDITION_OUTPUT_NAME, DOMUtil.XSD_BOOLEAN, prismContext); mapping.setDefaultTargetDefinition(outputDefinition); diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/EvaluatedAssignment.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/EvaluatedAssignment.java index fb5cb55d115..94a1359ed79 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/EvaluatedAssignment.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/EvaluatedAssignment.java @@ -26,6 +26,7 @@ import com.evolveum.midpoint.prism.PrismPropertyValue; import com.evolveum.midpoint.prism.PrismReferenceValue; import com.evolveum.midpoint.prism.delta.DeltaSetTriple; +import com.evolveum.midpoint.prism.delta.PlusMinusZero; import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.security.api.Authorization; import com.evolveum.midpoint.task.api.Task; @@ -83,6 +84,15 @@ public DeltaSetTriple> getConstructions() { return constructions; } + public Collection> getConstructionSet(PlusMinusZero whichSet) { + switch (whichSet) { + case ZERO: return getConstructions().getZeroSet(); + case PLUS: return getConstructions().getPlusSet(); + case MINUS: return getConstructions().getMinusSet(); + default: throw new IllegalArgumentException("whichSet: " + whichSet); + } + } + public void addConstructionZero(Construction contruction) { constructions.addToZeroSet(contruction); } diff --git a/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/AbstractLensTest.java b/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/AbstractLensTest.java index c6fa54ad195..2508d6cce8d 100644 --- a/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/AbstractLensTest.java +++ b/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/AbstractLensTest.java @@ -31,6 +31,11 @@ import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.namespace.QName; +import com.evolveum.midpoint.prism.PrismContainer; +import com.evolveum.midpoint.prism.PrismContainerDefinition; +import com.evolveum.midpoint.util.exception.SchemaException; +import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; @@ -55,7 +60,10 @@ public abstract class AbstractLensTest extends AbstractInternalModelIntegrationT protected static final File ASSIGNMENT_DIRECT_FILE = new File(TEST_DIR, "assignment-direct.xml"); protected static final File ASSIGNMENT_DIRECT_EXPRESSION_FILE = new File(TEST_DIR, "assignment-direct-expression.xml"); - + protected static final File ASSIGNMENT_ROLE_ENGINEER_FILE = new File(TEST_DIR, "assignment-role-engineer.xml"); + protected static final File ASSIGNMENT_ROLE_MANAGER_FILE = new File(TEST_DIR, "assignment-role-manager.xml"); + protected static final File ASSIGNMENT_ROLE_VISITOR_FILE = new File(TEST_DIR, "assignment-role-visitor.xml"); + protected static final File USER_DRAKE_FILE = new File(TEST_DIR, "user-drake.xml"); // protected static final String REQ_USER_JACK_MODIFY_ADD_ASSIGNMENT_ACCOUNT_OPENDJ = TEST_RESOURCE_DIR_NAME + @@ -67,6 +75,12 @@ public abstract class AbstractLensTest extends AbstractInternalModelIntegrationT protected static final File REQ_USER_JACK_MODIFY_ADD_ASSIGNMENT_ACCOUNT_DUMMY_ATTR = new File(TEST_DIR, "user-jack-modify-add-assignment-account-dummy-attr.xml"); + protected static final File REQ_USER_JACK_MODIFY_ADD_ASSIGNMENT_ROLE_ENGINEER = new File(TEST_DIR, + "user-jack-modify-add-assignment-role-engineer.xml"); + + protected static final File REQ_USER_JACK_MODIFY_SET_COST_CENTER = new File(TEST_DIR, + "user-jack-modify-set-cost-center.xml"); + protected static final File REQ_USER_JACK_MODIFY_DELETE_ASSIGNMENT_ACCOUNT_DUMMY = new File(TEST_DIR, "user-jack-modify-delete-assignment-account-dummy.xml"); @@ -81,8 +95,43 @@ public abstract class AbstractLensTest extends AbstractInternalModelIntegrationT protected static final File ROLE_MUTINIER_FILE = new File(TEST_DIR, "role-mutinier.xml"); protected static final String ROLE_MUTINIER_OID = "12345678-d34d-b33f-f00d-555555556668"; - - protected static final File ORG_BRETHREN_FILE = new File(TEST_DIR, "org-brethren.xml"); + + protected static final File ROLE_CORP_CONTRACTOR_FILE = new File(TEST_DIR, "role-corp-contractor.xml"); + protected static final String ROLE_CORP_CONTRACTOR_OID = "12345678-d34d-b33f-f00d-55555555a004"; + + protected static final File ROLE_CORP_CUSTOMER_FILE = new File(TEST_DIR, "role-corp-customer.xml"); + protected static final String ROLE_CORP_CUSTOMER_OID = "12345678-d34d-b33f-f00d-55555555a006"; + + protected static final File ROLE_CORP_EMPLOYEE_FILE = new File(TEST_DIR, "role-corp-employee.xml"); + protected static final String ROLE_CORP_EMPLOYEE_OID = "12345678-d34d-b33f-f00d-55555555a001"; + + protected static final File ROLE_CORP_ENGINEER_FILE = new File(TEST_DIR, "role-corp-engineer.xml"); + protected static final String ROLE_CORP_ENGINEER_OID = "12345678-d34d-b33f-f00d-55555555a002"; + + protected static final File ROLE_CORP_MANAGER_FILE = new File(TEST_DIR, "role-corp-manager.xml"); + protected static final String ROLE_CORP_MANAGER_OID = "12345678-d34d-b33f-f00d-55555555a003"; + + protected static final File ROLE_CORP_VISITOR_FILE = new File(TEST_DIR, "role-corp-visitor.xml"); + protected static final String ROLE_CORP_VISITOR_OID = "12345678-d34d-b33f-f00d-55555555a005"; + + protected static final File ROLE_CORP_GENERIC_METAROLE_FILE = new File(TEST_DIR, "role-corp-generic-metarole.xml"); + protected static final String ROLE_CORP_GENERIC_METAROLE_OID = "12345678-d34d-b33f-f00d-55555555a020"; + + protected static final File ROLE_CORP_JOB_METAROLE_FILE = new File(TEST_DIR, "role-corp-job-metarole.xml"); + protected static final String ROLE_CORP_JOB_METAROLE_OID = "12345678-d34d-b33f-f00d-55555555a010"; + + protected static final File[] ROLE_CORP_FILES = { + ROLE_CORP_GENERIC_METAROLE_FILE, + ROLE_CORP_JOB_METAROLE_FILE, + ROLE_CORP_VISITOR_FILE, + ROLE_CORP_CUSTOMER_FILE, + ROLE_CORP_CONTRACTOR_FILE, + ROLE_CORP_EMPLOYEE_FILE, + ROLE_CORP_ENGINEER_FILE, + ROLE_CORP_MANAGER_FILE + }; + + protected static final File ORG_BRETHREN_FILE = new File(TEST_DIR, "org-brethren.xml"); protected static final String ORG_BRETHREN_OID = "9c6bfc9a-ca01-11e3-a5aa-001e8c717e5b"; protected static final String ORG_BRETHREN_INDUCED_ORGANIZATION = "Pirate Brethren"; @@ -91,6 +140,15 @@ public abstract class AbstractLensTest extends AbstractInternalModelIntegrationT @Autowired(required = true) protected TaskManager taskManager; - - + + + protected AssignmentType getAssignmentType(File assignmentFile) throws java.io.IOException, JAXBException, SchemaException { + AssignmentType assignmentType = unmarshallValueFromFile(assignmentFile, AssignmentType.class); + + // We need to make sure that the assignment has a parent + PrismContainerDefinition assignmentContainerDefinition = userTypeJack.asPrismObject().getDefinition().findContainerDefinition(UserType.F_ASSIGNMENT); + PrismContainer assignmentContainer = assignmentContainerDefinition.instantiate(); + assignmentContainer.add(assignmentType.asPrismContainerValue().clone()); + return assignmentType; + } } diff --git a/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/TestAssignmentEvaluator.java b/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/TestAssignmentEvaluator.java index 248ebff3d3f..88e69f67e37 100644 --- a/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/TestAssignmentEvaluator.java +++ b/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/TestAssignmentEvaluator.java @@ -1,7 +1,7 @@ /* * Copyright (c) 2010-2014 Evolveum * - * Licensed under the Apache License, Version 2.0 (the "License"); + * Licensed under the Apache License, Version 2.0 (the "License"); \ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * @@ -15,18 +15,33 @@ */ package com.evolveum.midpoint.model.impl.lens; +import static com.evolveum.midpoint.prism.delta.PlusMinusZero.MINUS; +import static com.evolveum.midpoint.prism.delta.PlusMinusZero.PLUS; +import static com.evolveum.midpoint.prism.delta.PlusMinusZero.ZERO; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertNotNull; import static com.evolveum.midpoint.test.IntegrationTestTools.*; +import static org.testng.AssertJUnit.assertNull; +import static org.testng.AssertJUnit.assertTrue; +import java.io.File; +import java.util.Arrays; import java.util.Collection; +import java.util.HashSet; +import java.util.Set; import javax.xml.bind.JAXBException; +import javax.xml.namespace.QName; +import com.evolveum.midpoint.prism.delta.DeltaSetTriple; +import com.evolveum.midpoint.prism.delta.PlusMinusZero; +import com.evolveum.midpoint.schema.constants.MidPointConstants; +import com.evolveum.midpoint.schema.constants.SchemaConstants; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; import org.springframework.test.context.ContextConfiguration; +import org.testng.AssertJUnit; import org.testng.annotations.Test; import com.evolveum.midpoint.common.ActivationComputer; @@ -82,6 +97,13 @@ public class TestAssignmentEvaluator extends AbstractLensTest { @Autowired(required=true) private MappingFactory mappingFactory; + + @Override + public void initSystem(Task initTask, OperationResult initResult) throws Exception { + super.initSystem(initTask, initResult); + + addObjects(ROLE_CORP_FILES); + } @Test public void testDirect() throws Exception { @@ -93,13 +115,8 @@ public void testDirect() throws Exception { OperationResult result = task.getResult(); AssignmentEvaluator assignmentEvaluator = createAssignmentEvaluator(); PrismAsserts.assertParentConsistency(userTypeJack.asPrismObject()); - - AssignmentType assignmentType = unmarshallValueFromFile(ASSIGNMENT_DIRECT_FILE, AssignmentType.class); - - // We need to make sure that the assignment has a parent - PrismContainerDefinition assignmentContainerDefinition = userTypeJack.asPrismObject().getDefinition().findContainerDefinition(UserType.F_ASSIGNMENT); - PrismContainer assignmentContainer = assignmentContainerDefinition.instantiate(); - assignmentContainer.add(assignmentType.asPrismContainerValue().clone()); + + AssignmentType assignmentType = getAssignmentType(ASSIGNMENT_DIRECT_FILE); ObjectDeltaObject userOdo = new ObjectDeltaObject<>(userTypeJack.asPrismObject(), null, null); userOdo.recompute(); @@ -119,8 +136,8 @@ public void testDirect() throws Exception { TestUtil.assertSuccess(result); assertNotNull(evaluatedAssignment); - display("Evaluated assignment",evaluatedAssignment.debugDump()); - assertEquals(1,evaluatedAssignment.getConstructions().size()); + display("Evaluated assignment", evaluatedAssignment.debugDump()); + assertEquals(1, evaluatedAssignment.getConstructions().size()); PrismAsserts.assertParentConsistency(userTypeJack.asPrismObject()); Construction construction = evaluatedAssignment.getConstructions().getZeroSet().iterator().next(); @@ -137,14 +154,9 @@ public void testDirectExpression() throws Exception { Task task = taskManager.createTaskInstance(TestAssignmentEvaluator.class.getName() + "." + TEST_NAME); OperationResult result = task.getResult(); PrismAsserts.assertParentConsistency(userTypeJack.asPrismObject()); - - AssignmentType assignmentType = unmarshallValueFromFile(ASSIGNMENT_DIRECT_EXPRESSION_FILE, AssignmentType.class); - - // We need to make sure that the assignment has a parent - PrismContainerDefinition assignmentContainerDefinition = userTypeJack.asPrismObject().getDefinition().findContainerDefinition(UserType.F_ASSIGNMENT); - PrismContainer assignmentContainer = assignmentContainerDefinition.instantiate(); - assignmentContainer.add(assignmentType.asPrismContainerValue().clone()); - + + AssignmentType assignmentType = getAssignmentType(ASSIGNMENT_DIRECT_EXPRESSION_FILE); + ObjectDeltaObject userOdo = new ObjectDeltaObject<>(userTypeJack.asPrismObject(), null, null); userOdo.recompute(); AssignmentEvaluator assignmentEvaluator = createAssignmentEvaluator(userOdo); @@ -164,8 +176,8 @@ public void testDirectExpression() throws Exception { TestUtil.assertSuccess(result); assertNotNull(evaluatedAssignment); - display("Evaluated assignment",evaluatedAssignment); - assertEquals(1,evaluatedAssignment.getConstructions().size()); + display("Evaluated assignment", evaluatedAssignment); + assertEquals(1, evaluatedAssignment.getConstructions().size()); PrismAsserts.assertParentConsistency(userTypeJack.asPrismObject()); Construction construction = evaluatedAssignment.getConstructions().getZeroSet().iterator().next(); @@ -184,7 +196,7 @@ public void testDirectExpressionReplaceDescription() throws Exception { PrismObject user = userTypeJack.asPrismObject().clone(); AssignmentType assignmentType = unmarshallValueFromFile(ASSIGNMENT_DIRECT_EXPRESSION_FILE, AssignmentType.class); user.asObjectable().getAssignment().add(assignmentType.clone()); - + // We need to make sure that the assignment has a parent PrismContainerDefinition assignmentContainerDefinition = user.getDefinition().findContainerDefinition(UserType.F_ASSIGNMENT); PrismContainer assignmentContainer = assignmentContainerDefinition.instantiate(); @@ -228,8 +240,15 @@ public void testDirectExpressionReplaceDescription() throws Exception { PrismAsserts.assertTripleNoZero(outputTriple); PrismAsserts.assertTriplePlus(outputTriple, "The best captain the world has ever seen"); PrismAsserts.assertTripleMinus(outputTriple, "The best pirate the world has ever seen"); - - } + + // the same using other words + + assertConstruction(evaluatedAssignment, ZERO, "title", ZERO); + assertConstruction(evaluatedAssignment, ZERO, "title", PLUS, "The best captain the world has ever seen"); + assertConstruction(evaluatedAssignment, ZERO, "title", MINUS, "The best pirate the world has ever seen"); + assertNoConstruction(evaluatedAssignment, PLUS, "title"); + assertNoConstruction(evaluatedAssignment, MINUS, "title"); + } @Test public void testDirectExpressionReplaceDescriptionFromNull() throws Exception { @@ -288,10 +307,356 @@ public void testDirectExpressionReplaceDescriptionFromNull() throws Exception { PrismAsserts.assertTripleNoZero(outputTriple); PrismAsserts.assertTriplePlus(outputTriple, "The best sailor the world has ever seen"); PrismAsserts.assertTripleMinus(outputTriple, "The best man the world has ever seen"); - + + // the same using other words + + assertConstruction(evaluatedAssignment, ZERO, "title", ZERO); + assertConstruction(evaluatedAssignment, ZERO, "title", PLUS, "The best sailor the world has ever seen"); + assertConstruction(evaluatedAssignment, ZERO, "title", MINUS, "The best man the world has ever seen"); + assertNoConstruction(evaluatedAssignment, PLUS, "title"); + assertNoConstruction(evaluatedAssignment, MINUS, "title"); } - - private AssignmentEvaluator createAssignmentEvaluator() throws ObjectNotFoundException, SchemaException { + + /* + + Explanation for roles structure (copied from role-corp-generic-metarole.xml) + + user-assignable roles: + + roles of unspecified type + - Visitor + - Customer + + roles of type: job + - Contractor + - Employee + - Engineer (induces Employee) + - Manager (induces Employee) + + metaroles: + + - Generic Metarole: assigned to Visitor and Customer [ induces ri:location attribute - from user/locality ] + - Job Metarole (induces Generic Metarole): assigned to Contractor, Employee, Engineer, Manager [ induces ri:title attribute - from role/name ] + + */ + + @Test + public void testRoleVisitor() throws Exception { + final String TEST_NAME = "testRoleVisitor"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = taskManager.createTaskInstance(TestAssignmentEvaluator.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + AssignmentEvaluator assignmentEvaluator = createAssignmentEvaluator(); + PrismAsserts.assertParentConsistency(userTypeJack.asPrismObject()); + + AssignmentType assignmentType = getAssignmentType(ASSIGNMENT_ROLE_VISITOR_FILE); + + ObjectDeltaObject userOdo = new ObjectDeltaObject<>(userTypeJack.asPrismObject(), null, null); + userOdo.recompute(); + + ItemDeltaItem> assignmentIdi = new ItemDeltaItem<>(); + assignmentIdi.setItemOld(LensUtil.createAssignmentSingleValueContainerClone(assignmentType)); + assignmentIdi.recompute(); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + EvaluatedAssignment evaluatedAssignment = assignmentEvaluator.evaluate(assignmentIdi, false, userTypeJack, TEST_NAME, task, result); + evaluatedAssignment.evaluateConstructions(userOdo, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + result.computeStatus(); + TestUtil.assertSuccess(result); + + assertNotNull(evaluatedAssignment); + display("Evaluated assignment",evaluatedAssignment.debugDump()); + assertEquals(1, evaluatedAssignment.getConstructions().size()); + PrismAsserts.assertParentConsistency(userTypeJack.asPrismObject()); + + assertConstruction(evaluatedAssignment, ZERO, "title", ZERO); + assertConstruction(evaluatedAssignment, ZERO, "title", PLUS); + assertConstruction(evaluatedAssignment, ZERO, "title", MINUS); + assertNoConstruction(evaluatedAssignment, PLUS, "title"); + assertNoConstruction(evaluatedAssignment, MINUS, "title"); + assertConstruction(evaluatedAssignment, ZERO, "location", ZERO, "Caribbean"); + assertConstruction(evaluatedAssignment, ZERO, "location", PLUS); + assertConstruction(evaluatedAssignment, ZERO, "location", MINUS); + assertNoConstruction(evaluatedAssignment, PLUS, "location"); + assertNoConstruction(evaluatedAssignment, MINUS, "location"); + } + + @Test + public void testRoleEngineer() throws Exception { + final String TEST_NAME = "testRoleEngineer"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = taskManager.createTaskInstance(TestAssignmentEvaluator.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + AssignmentEvaluator assignmentEvaluator = createAssignmentEvaluator(); + PrismAsserts.assertParentConsistency(userTypeJack.asPrismObject()); + + AssignmentType assignmentType = getAssignmentType(ASSIGNMENT_ROLE_ENGINEER_FILE); + + ObjectDeltaObject userOdo = new ObjectDeltaObject<>(userTypeJack.asPrismObject(), null, null); + userOdo.recompute(); + + ItemDeltaItem> assignmentIdi = new ItemDeltaItem<>(); + assignmentIdi.setItemOld(LensUtil.createAssignmentSingleValueContainerClone(assignmentType)); + assignmentIdi.recompute(); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + EvaluatedAssignment evaluatedAssignment = assignmentEvaluator.evaluate(assignmentIdi, false, userTypeJack, "testRoleEngineer", task, result); + evaluatedAssignment.evaluateConstructions(userOdo, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + result.computeStatus(); + TestUtil.assertSuccess(result); + + assertNotNull(evaluatedAssignment); + display("Evaluated assignment",evaluatedAssignment.debugDump()); + assertEquals(4, evaluatedAssignment.getConstructions().size()); + PrismAsserts.assertParentConsistency(userTypeJack.asPrismObject()); + + assertConstruction(evaluatedAssignment, ZERO, "title", ZERO, "Employee", "Engineer"); + assertConstruction(evaluatedAssignment, ZERO, "title", PLUS); + assertConstruction(evaluatedAssignment, ZERO, "title", MINUS); + assertNoConstruction(evaluatedAssignment, PLUS, "title"); + assertNoConstruction(evaluatedAssignment, MINUS, "title"); + + assertConstruction(evaluatedAssignment, ZERO, "location", ZERO, "Caribbean"); + assertConstruction(evaluatedAssignment, ZERO, "location", PLUS); + assertConstruction(evaluatedAssignment, ZERO, "location", MINUS); + assertNoConstruction(evaluatedAssignment, PLUS, "location"); + assertNoConstruction(evaluatedAssignment, MINUS, "location"); + } + + @Test + public void testAddRoleEngineer() throws Exception { + final String TEST_NAME = "testAddRoleEngineer"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = taskManager.createTaskInstance(TestAssignmentEvaluator.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + PrismObject user = userTypeJack.asPrismObject().clone(); + AssignmentType assignmentType = getAssignmentType(ASSIGNMENT_ROLE_ENGINEER_FILE); + + AssignmentType assignmentForUser = assignmentType.clone(); + assignmentForUser.asPrismContainerValue().setParent(null); + ObjectDelta userDelta = ObjectDelta.createModificationAddContainer(UserType.class, USER_JACK_OID, UserType.F_ASSIGNMENT, prismContext, assignmentForUser.asPrismContainerValue()); + ObjectDeltaObject userOdo = new ObjectDeltaObject<>(user, userDelta, null); + userOdo.recompute(); + AssignmentEvaluator assignmentEvaluator = createAssignmentEvaluator(userOdo); + PrismAsserts.assertParentConsistency(userTypeJack.asPrismObject()); + + ItemDeltaItem> assignmentIdi = new ItemDeltaItem<>(); + assignmentIdi.setItemOld(LensUtil.createAssignmentSingleValueContainerClone(assignmentType)); + assignmentIdi.recompute(); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + EvaluatedAssignment evaluatedAssignment = assignmentEvaluator.evaluate(assignmentIdi, false, userTypeJack, TEST_NAME, task, result); + evaluatedAssignment.evaluateConstructions(userOdo, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + result.computeStatus(); + TestUtil.assertSuccess(result); + + assertNotNull(evaluatedAssignment); + display("Evaluated assignment",evaluatedAssignment.debugDump()); + assertEquals(4, evaluatedAssignment.getConstructions().size()); + PrismAsserts.assertParentConsistency(userTypeJack.asPrismObject()); + + /* + * Here we observe an important thing about AssignmentEvaluator/AssignmentProcessor. + * The evaluator does not consider whether the assignment as such is being added or deleted or stays present. + * In all these cases all the constructions go into the ZERO set of constructions. + * + * However, it considers changes in data that are used by assignments - either in conditions or in mappings. + * Changes of data used in mappings are demonstrated by testDirectExpressionReplaceDescription + * and testDirectExpressionReplaceDescriptionFromNull. Changes of data used in conditions are demonstrated by + * a couple of tests below. + * + * Changes in assignment presence (add/delete) are reflected into plus/minus sets by AssignmentProcessor. + */ + + assertConstruction(evaluatedAssignment, ZERO, "title", ZERO, "Employee", "Engineer"); + assertConstruction(evaluatedAssignment, ZERO, "title", PLUS); + assertConstruction(evaluatedAssignment, ZERO, "title", MINUS); + assertNoConstruction(evaluatedAssignment, PLUS, "title"); + assertNoConstruction(evaluatedAssignment, MINUS, "title"); + + assertConstruction(evaluatedAssignment, ZERO, "location", ZERO, "Caribbean"); + assertConstruction(evaluatedAssignment, ZERO, "location", PLUS); + assertConstruction(evaluatedAssignment, ZERO, "location", MINUS); + assertNoConstruction(evaluatedAssignment, PLUS, "location"); + assertNoConstruction(evaluatedAssignment, MINUS, "location"); + } + + /** + * jack has assigned role Manager. + * + * However, condition in job metarole for Manager is such that it needs "management" + * to be present in user/costCenter in order to be active. + */ + @Test + public void testRoleManagerChangeCostCenter() throws Exception { + final String TEST_NAME = "testRoleManagerChangeCostCenter"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = taskManager.createTaskInstance(TestAssignmentEvaluator.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + PrismObject user = userTypeJack.asPrismObject().clone(); + AssignmentType assignmentType = getAssignmentType(ASSIGNMENT_ROLE_MANAGER_FILE); + + AssignmentType assignmentForUser = assignmentType.clone(); + assignmentForUser.asPrismContainerValue().setParent(null); + user.asObjectable().getAssignment().add(assignmentForUser); + + ObjectDelta userDelta = ObjectDelta.createModificationReplaceProperty(UserType.class, USER_JACK_OID, + UserType.F_COST_CENTER, prismContext, "management"); + ObjectDeltaObject userOdo = new ObjectDeltaObject<>(user, userDelta, null); + userOdo.recompute(); + AssignmentEvaluator assignmentEvaluator = createAssignmentEvaluator(userOdo); + PrismAsserts.assertParentConsistency(userTypeJack.asPrismObject()); + + ItemDeltaItem> assignmentIdi = new ItemDeltaItem<>(); + assignmentIdi.setItemOld(LensUtil.createAssignmentSingleValueContainerClone(assignmentType)); + assignmentIdi.recompute(); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + EvaluatedAssignment evaluatedAssignment = assignmentEvaluator.evaluate(assignmentIdi, false, userTypeJack, TEST_NAME, task, result); + evaluatedAssignment.evaluateConstructions(userOdo, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + result.computeStatus(); + TestUtil.assertSuccess(result); + + assertNotNull(evaluatedAssignment); + display("Evaluated assignment",evaluatedAssignment.debugDump()); + assertEquals(4, evaluatedAssignment.getConstructions().size()); + PrismAsserts.assertParentConsistency(userTypeJack.asPrismObject()); + + assertConstruction(evaluatedAssignment, ZERO, "title", ZERO, "Employee"); // because Employee's job metarole is active even if Manager's is not + assertConstruction(evaluatedAssignment, ZERO, "title", PLUS); + assertConstruction(evaluatedAssignment, ZERO, "title", MINUS); + assertConstruction(evaluatedAssignment, PLUS, "title", ZERO, "Manager"); // because Manager's job metarole is originally not active + assertConstruction(evaluatedAssignment, PLUS, "title", PLUS); + assertConstruction(evaluatedAssignment, PLUS, "title", MINUS); + assertNoConstruction(evaluatedAssignment, MINUS, "title"); + + assertConstruction(evaluatedAssignment, ZERO, "location", ZERO, "Caribbean"); // because Generic Metarole is active all the time + assertConstruction(evaluatedAssignment, ZERO, "location", PLUS); + assertConstruction(evaluatedAssignment, ZERO, "location", MINUS); + assertNoConstruction(evaluatedAssignment, PLUS, "location"); + assertNoConstruction(evaluatedAssignment, MINUS, "location"); + } + + /** + * jack has assigned role Manager. + * + * However, condition in job metarole for Manager is such that it needs "management" + * to be present in user/costCenter in order to be active. + * + * In this test we remove the value of "management" from jack. + */ + @Test + public void testRoleManagerRemoveCostCenter() throws Exception { + final String TEST_NAME = "testRoleManagerRemoveCostCenter"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = taskManager.createTaskInstance(TestAssignmentEvaluator.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + PrismObject user = userTypeJack.asPrismObject().clone(); + user.asObjectable().setCostCenter("management"); + AssignmentType assignmentType = getAssignmentType(ASSIGNMENT_ROLE_MANAGER_FILE); + + AssignmentType assignmentForUser = assignmentType.clone(); + assignmentForUser.asPrismContainerValue().setParent(null); + user.asObjectable().getAssignment().add(assignmentForUser); + + ObjectDelta userDelta = ObjectDelta.createModificationReplaceProperty(UserType.class, USER_JACK_OID, + UserType.F_COST_CENTER, prismContext); + ObjectDeltaObject userOdo = new ObjectDeltaObject<>(user, userDelta, null); + userOdo.recompute(); + AssignmentEvaluator assignmentEvaluator = createAssignmentEvaluator(userOdo); + PrismAsserts.assertParentConsistency(userTypeJack.asPrismObject()); + + ItemDeltaItem> assignmentIdi = new ItemDeltaItem<>(); + assignmentIdi.setItemOld(LensUtil.createAssignmentSingleValueContainerClone(assignmentType)); + assignmentIdi.recompute(); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + EvaluatedAssignment evaluatedAssignment = assignmentEvaluator.evaluate(assignmentIdi, false, userTypeJack, TEST_NAME, task, result); + evaluatedAssignment.evaluateConstructions(userOdo, task, result); + + // THEN + TestUtil.displayThen(TEST_NAME); + result.computeStatus(); + TestUtil.assertSuccess(result); + + assertNotNull(evaluatedAssignment); + display("Evaluated assignment",evaluatedAssignment.debugDump()); + assertEquals(4, evaluatedAssignment.getConstructions().size()); + PrismAsserts.assertParentConsistency(userTypeJack.asPrismObject()); + + assertConstruction(evaluatedAssignment, ZERO, "title", ZERO, "Employee"); // because Employee's job metarole is active even if Manager's is not + assertConstruction(evaluatedAssignment, ZERO, "title", PLUS); + assertConstruction(evaluatedAssignment, ZERO, "title", MINUS); + assertConstruction(evaluatedAssignment, MINUS, "title", ZERO, "Manager"); // because Manager's job metarole is not active any more + assertConstruction(evaluatedAssignment, MINUS, "title", PLUS); + assertConstruction(evaluatedAssignment, MINUS, "title", MINUS); + assertNoConstruction(evaluatedAssignment, PLUS, "title"); + + assertConstruction(evaluatedAssignment, ZERO, "location", ZERO, "Caribbean"); // because Generic Metarole is active all the time + assertConstruction(evaluatedAssignment, ZERO, "location", PLUS); + assertConstruction(evaluatedAssignment, ZERO, "location", MINUS); + assertNoConstruction(evaluatedAssignment, PLUS, "location"); + assertNoConstruction(evaluatedAssignment, MINUS, "location"); + } + + private void assertNoConstruction(EvaluatedAssignment evaluatedAssignment, PlusMinusZero constructionSet, String attributeName) { + Collection> constructions = evaluatedAssignment.getConstructionSet(constructionSet); + for (Construction construction : constructions) { + Mapping> mapping = construction.getAttributeMapping(new QName(MidPointConstants.NS_RI, attributeName)); + assertNull("Unexpected mapping for " + attributeName, mapping); + } + } + + private void assertConstruction(EvaluatedAssignment evaluatedAssignment, PlusMinusZero constructionSet, String attributeName, PlusMinusZero attributeSet, String... expectedValues) { + Collection> constructions = evaluatedAssignment.getConstructionSet(constructionSet); + Set realValues = new HashSet<>(); + for (Construction construction : constructions) { + Mapping> mapping = construction.getAttributeMapping(new QName(MidPointConstants.NS_RI, attributeName)); + if (mapping != null && mapping.getOutputTriple() != null) { + Collection> valsInMapping = mapping.getOutputTriple().getSet(attributeSet); + if (valsInMapping != null) { + for (PrismPropertyValue value : valsInMapping) { + if (value.getValue() instanceof String) { + realValues.add((String) value.getValue()); + } + } + } + } + } + AssertJUnit.assertEquals("Wrong values", new HashSet(Arrays.asList(expectedValues)), realValues); + } + + private AssignmentEvaluator createAssignmentEvaluator() throws ObjectNotFoundException, SchemaException { PrismObject userJack = userTypeJack.asPrismObject(); return createAssignmentEvaluator(new ObjectDeltaObject(userJack, null, null)); } diff --git a/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/TestAssignmentProcessor.java b/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/TestAssignmentProcessor.java index 8fd186ec4d1..8ea9c96470d 100644 --- a/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/TestAssignmentProcessor.java +++ b/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/lens/TestAssignmentProcessor.java @@ -16,59 +16,44 @@ package com.evolveum.midpoint.model.impl.lens; import com.evolveum.midpoint.common.Clock; -import com.evolveum.midpoint.common.refinery.ResourceShadowDiscriminator; -import com.evolveum.midpoint.model.api.PolicyViolationException; -import com.evolveum.midpoint.model.api.context.SynchronizationPolicyDecision; import com.evolveum.midpoint.model.common.mapping.Mapping; -import com.evolveum.midpoint.model.impl.AbstractInternalModelIntegrationTest; -import com.evolveum.midpoint.model.impl.lens.Construction; -import com.evolveum.midpoint.model.impl.lens.LensContext; -import com.evolveum.midpoint.model.impl.lens.LensProjectionContext; import com.evolveum.midpoint.model.impl.lens.projector.AssignmentProcessor; import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.prism.PrismPropertyValue; import com.evolveum.midpoint.prism.delta.ChangeType; import com.evolveum.midpoint.prism.delta.ContainerDelta; +import com.evolveum.midpoint.prism.delta.PlusMinusZero; import com.evolveum.midpoint.prism.delta.PrismValueDeltaSetTriple; import com.evolveum.midpoint.prism.delta.ObjectDelta; -import com.evolveum.midpoint.prism.delta.PropertyDelta; import com.evolveum.midpoint.prism.path.ItemPath; import com.evolveum.midpoint.prism.polystring.PolyString; import com.evolveum.midpoint.prism.util.PrismAsserts; -import com.evolveum.midpoint.schema.constants.SchemaConstants; import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.task.api.Task; import com.evolveum.midpoint.test.DummyResourceContoller; import com.evolveum.midpoint.test.util.TestUtil; -import com.evolveum.midpoint.util.exception.CommunicationException; -import com.evolveum.midpoint.util.exception.ConfigurationException; -import com.evolveum.midpoint.util.exception.ExpressionEvaluationException; -import com.evolveum.midpoint.util.exception.ObjectNotFoundException; -import com.evolveum.midpoint.util.exception.SchemaException; -import com.evolveum.midpoint.util.exception.SecurityViolationException; import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentPolicyEnforcementType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ProjectionPolicyType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.annotation.DirtiesContext.ClassMode; -import org.springframework.test.context.ContextConfiguration; import org.testng.annotations.Test; import javax.xml.bind.JAXBException; import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.namespace.QName; -import java.io.FileNotFoundException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; import java.util.Set; +import static com.evolveum.midpoint.prism.delta.PlusMinusZero.MINUS; +import static com.evolveum.midpoint.prism.delta.PlusMinusZero.PLUS; +import static com.evolveum.midpoint.prism.delta.PlusMinusZero.ZERO; import static com.evolveum.midpoint.test.IntegrationTestTools.display; import static org.testng.AssertJUnit.*; @@ -89,6 +74,13 @@ public TestAssignmentProcessor() throws JAXBException { super(); } + @Override + public void initSystem(Task initTask, OperationResult initResult) throws Exception { + super.initSystem(initTask, initResult); + + addObjects(ROLE_CORP_FILES); + } + /** * Test empty change. Run the outbound processor with empty user (no assignments) and no change. Check that the * resulting changes are also empty. @@ -345,26 +337,26 @@ public void test021AddAssignmentModifyAccountAssignment() throws Exception { "Brethren account construction"); assertZeroAttributeValues(zeroAccountConstruction, - dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_SHIP_NAME), - "Pirate Brethren, Inc."); + dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_SHIP_NAME), + "Pirate Brethren, Inc."); assertNoPlusAttributeValues(zeroAccountConstruction, dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_SHIP_NAME)); assertNoMinusAttributeValues(zeroAccountConstruction, - dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_SHIP_NAME)); + dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_SHIP_NAME)); - assertZeroAttributeValues(zeroAccountConstruction, - dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME), "Caribbean"); - assertNoPlusAttributeValues(zeroAccountConstruction, - dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME)); - assertNoMinusAttributeValues(zeroAccountConstruction, - dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME)); + assertZeroAttributeValues(zeroAccountConstruction, + dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME), "Caribbean"); + assertNoPlusAttributeValues(zeroAccountConstruction, + dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME)); + assertNoMinusAttributeValues(zeroAccountConstruction, + dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME)); - assertZeroAttributeValues(zeroAccountConstruction, - dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_WEAPON_NAME), "Sword"); - assertNoPlusAttributeValues(zeroAccountConstruction, - dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_WEAPON_NAME)); - assertNoMinusAttributeValues(zeroAccountConstruction, - dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_WEAPON_NAME)); + assertZeroAttributeValues(zeroAccountConstruction, + dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_WEAPON_NAME), "Sword"); + assertNoPlusAttributeValues(zeroAccountConstruction, + dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_WEAPON_NAME)); + assertNoMinusAttributeValues(zeroAccountConstruction, + dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_WEAPON_NAME)); assertSetSize("plus", accountConstructionDeltaSetTriple.getPlusSet(), 1); Construction plusAccountConstruction = getPlusAccountConstruction(accountConstructionDeltaSetTriple, "Monkey account construction"); @@ -518,8 +510,168 @@ public void test032ModifyUserLegalizeAccount() throws Exception { assertLegal(accContext); } - - private void assertPlusAttributeValues(Construction accountConstruction, QName attrName, T... expectedValue) { + + @Test + public void test100AddAssignmentWithConditionalMetarole() throws Exception { + final String TEST_NAME = "test100AddAssignmentWithConditionalMetarole"; + TestUtil.displayTestTile(this, TEST_NAME); + // GIVEN + Task task = taskManager.createTaskInstance(TestAssignmentProcessor.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + LensContext context = createUserAccountContext(); + fillContextWithUser(context, USER_JACK_OID, result); + addFocusModificationToContext(context, REQ_USER_JACK_MODIFY_ADD_ASSIGNMENT_ROLE_ENGINEER); + context.recompute(); + + display("Input context", context); + + assertFocusModificationSanity(context); + + // WHEN + assignmentProcessor.processAssignmentsProjections(context, getNow(), task, result); + + // THEN + display("Output context", context); + display("outbound processor result", result); +// assertSuccess("Outbound processor failed (result)", result); + + assertTrue(context.getFocusContext().getPrimaryDelta().getChangeType() == ChangeType.MODIFY); + assertNull("Unexpected user changes", context.getFocusContext().getSecondaryDelta()); + assertFalse("No account changes", context.getProjectionContexts().isEmpty()); + + Collection accountContexts = context.getProjectionContexts(); + assertEquals(1, accountContexts.size()); + LensProjectionContext accContext = accountContexts.iterator().next(); + assertNull(accContext.getPrimaryDelta()); + + ObjectDelta accountSecondaryDelta = accContext.getSecondaryDelta(); + assertNull("Account secondary delta sneaked in", accountSecondaryDelta); + + assertNoDecision(accContext); + assertLegal(accContext); + + assignmentProcessor.processAssignmentsAccountValues(accContext, result); + + PrismValueDeltaSetTriple> accountConstructionDeltaSetTriple = + accContext.getConstructionDeltaSetTriple(); + + PrismAsserts.assertTripleNoMinus(accountConstructionDeltaSetTriple); + PrismAsserts.assertTripleNoZero(accountConstructionDeltaSetTriple); + + final QName TITLE_QNAME = dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME); + final QName LOCATION_QNAME = dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME); + + assertSetSize("plus", accountConstructionDeltaSetTriple.getPlusSet(), 4); + assertAttributeValues(accountConstructionDeltaSetTriple.getPlusSet(), TITLE_QNAME, ZERO, "Engineer", "Employee"); + assertAttributeValues(accountConstructionDeltaSetTriple.getPlusSet(), TITLE_QNAME, PLUS); + assertAttributeValues(accountConstructionDeltaSetTriple.getPlusSet(), TITLE_QNAME, MINUS); + + assertAttributeValues(accountConstructionDeltaSetTriple.getPlusSet(), LOCATION_QNAME, ZERO, "Caribbean"); + assertAttributeValues(accountConstructionDeltaSetTriple.getPlusSet(), LOCATION_QNAME, PLUS); + assertAttributeValues(accountConstructionDeltaSetTriple.getPlusSet(), LOCATION_QNAME, MINUS); + } + + /** + * There is a conditional metarole that references 'costCenter' attribute. + * Let us change the value of this attribute. + */ + @Test + public void test102EnableConditionalMetarole() throws Exception { + final String TEST_NAME = "test102EnableConditionalMetarole"; + TestUtil.displayTestTile(this, TEST_NAME); + // GIVEN + Task task = taskManager.createTaskInstance(TestAssignmentProcessor.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + LensContext context = createUserAccountContext(); + PrismObject user = getUser(USER_JACK_OID); + AssignmentType assignmentType = getAssignmentType(ASSIGNMENT_ROLE_MANAGER_FILE); + assignmentType.asPrismContainerValue().setParent(null); + user.asObjectable().getAssignment().add(assignmentType); + fillContextWithFocus(context, user); + + addFocusModificationToContext(context, REQ_USER_JACK_MODIFY_SET_COST_CENTER); + context.recompute(); + + display("Input context", context); + + assertFocusModificationSanity(context); + + // WHEN + assignmentProcessor.processAssignmentsProjections(context, getNow(), task, result); + + // THEN + display("Output context", context); + display("outbound processor result", result); +// assertSuccess("Outbound processor failed (result)", result); + + assertTrue(context.getFocusContext().getPrimaryDelta().getChangeType() == ChangeType.MODIFY); + assertNull("Unexpected user changes", context.getFocusContext().getSecondaryDelta()); + assertFalse("No account changes", context.getProjectionContexts().isEmpty()); + + Collection accountContexts = context.getProjectionContexts(); + assertEquals(1, accountContexts.size()); + LensProjectionContext accContext = accountContexts.iterator().next(); + assertNull(accContext.getPrimaryDelta()); + + ObjectDelta accountSecondaryDelta = accContext.getSecondaryDelta(); + assertNull("Account secondary delta sneaked in", accountSecondaryDelta); + + assertNoDecision(accContext); + assertLegal(accContext); + + assignmentProcessor.processAssignmentsAccountValues(accContext, result); + + PrismValueDeltaSetTriple> accountConstructionDeltaSetTriple = + accContext.getConstructionDeltaSetTriple(); + + PrismAsserts.assertTripleNoMinus(accountConstructionDeltaSetTriple); + + final QName TITLE_QNAME = dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME); + final QName LOCATION_QNAME = dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME); + + assertSetSize("zero", accountConstructionDeltaSetTriple.getZeroSet(), 3); + assertAttributeValues(accountConstructionDeltaSetTriple.getZeroSet(), TITLE_QNAME, ZERO, "Employee"); + assertAttributeValues(accountConstructionDeltaSetTriple.getZeroSet(), TITLE_QNAME, PLUS); + assertAttributeValues(accountConstructionDeltaSetTriple.getZeroSet(), TITLE_QNAME, MINUS); + + assertAttributeValues(accountConstructionDeltaSetTriple.getZeroSet(), LOCATION_QNAME, ZERO, "Caribbean"); + assertAttributeValues(accountConstructionDeltaSetTriple.getZeroSet(), LOCATION_QNAME, PLUS); + assertAttributeValues(accountConstructionDeltaSetTriple.getZeroSet(), LOCATION_QNAME, MINUS); + + assertSetSize("plus", accountConstructionDeltaSetTriple.getPlusSet(), 1); + assertAttributeValues(accountConstructionDeltaSetTriple.getPlusSet(), TITLE_QNAME, ZERO, "Manager"); + assertAttributeValues(accountConstructionDeltaSetTriple.getPlusSet(), TITLE_QNAME, PLUS); + assertAttributeValues(accountConstructionDeltaSetTriple.getPlusSet(), TITLE_QNAME, MINUS); + + assertAttributeValues(accountConstructionDeltaSetTriple.getPlusSet(), LOCATION_QNAME, ZERO); + assertAttributeValues(accountConstructionDeltaSetTriple.getPlusSet(), LOCATION_QNAME, PLUS); + assertAttributeValues(accountConstructionDeltaSetTriple.getPlusSet(), LOCATION_QNAME, MINUS); + } + + private void assertAttributeValues(Collection> accountConstructions, QName attrName, PlusMinusZero attrSet, T... expectedValue) { + Set realValues = getAttributeValues(accountConstructions, attrName, attrSet); + assertEquals("Unexpected attributes", new HashSet(Arrays.asList(expectedValue)), realValues); + } + + private Set getAttributeValues(Collection> accountConstructions, QName attrName, PlusMinusZero attributeSet) { + Set retval = new HashSet<>(); + for (PrismPropertyValue constructionPropVal : accountConstructions) { + Mapping> mapping = constructionPropVal.getValue().getAttributeMapping(attrName); + if (mapping != null && mapping.getOutputTriple() != null) { + Collection> values = (Collection) mapping.getOutputTriple().getSet(attributeSet); + if (values != null) { + for (PrismPropertyValue value : values) { + retval.add(value.getValue()); + } + } + } + } + return retval; + } + + private void assertPlusAttributeValues(Construction accountConstruction, QName attrName, T... expectedValue) { Mapping> vc = accountConstruction.getAttributeMapping(attrName); assertNotNull("No value construction for attribute "+attrName+" in plus set", vc); PrismValueDeltaSetTriple> triple = vc.getOutputTriple(); diff --git a/model/model-impl/src/test/resources/lens/assignment-role-engineer.xml b/model/model-impl/src/test/resources/lens/assignment-role-engineer.xml new file mode 100644 index 00000000000..9c48f6620e4 --- /dev/null +++ b/model/model-impl/src/test/resources/lens/assignment-role-engineer.xml @@ -0,0 +1,20 @@ + + + + + + diff --git a/model/model-impl/src/test/resources/lens/assignment-role-manager.xml b/model/model-impl/src/test/resources/lens/assignment-role-manager.xml new file mode 100644 index 00000000000..ef3ccc9116c --- /dev/null +++ b/model/model-impl/src/test/resources/lens/assignment-role-manager.xml @@ -0,0 +1,20 @@ + + + + + + diff --git a/model/model-impl/src/test/resources/lens/assignment-role-visitor.xml b/model/model-impl/src/test/resources/lens/assignment-role-visitor.xml new file mode 100644 index 00000000000..7f3767d1817 --- /dev/null +++ b/model/model-impl/src/test/resources/lens/assignment-role-visitor.xml @@ -0,0 +1,20 @@ + + + + + + diff --git a/model/model-impl/src/test/resources/lens/role-corp-contractor.xml b/model/model-impl/src/test/resources/lens/role-corp-contractor.xml new file mode 100644 index 00000000000..8cb8ca3e299 --- /dev/null +++ b/model/model-impl/src/test/resources/lens/role-corp-contractor.xml @@ -0,0 +1,32 @@ + + + + Contractor + Universal role for contractors working for the company + + + + + + + + http://midpoint.evolveum.com/xml/ns/test/authorization#work + + true + job + diff --git a/model/model-impl/src/test/resources/lens/role-corp-customer.xml b/model/model-impl/src/test/resources/lens/role-corp-customer.xml new file mode 100644 index 00000000000..576a4068078 --- /dev/null +++ b/model/model-impl/src/test/resources/lens/role-corp-customer.xml @@ -0,0 +1,25 @@ + + + + Customer + Someone who buys our stuff + + + + true + diff --git a/model/model-impl/src/test/resources/lens/role-corp-employee.xml b/model/model-impl/src/test/resources/lens/role-corp-employee.xml new file mode 100644 index 00000000000..1f2ba7b4fad --- /dev/null +++ b/model/model-impl/src/test/resources/lens/role-corp-employee.xml @@ -0,0 +1,32 @@ + + + + Employee + Universal role for all (internal) employees in the company + + + + + + + + http://midpoint.evolveum.com/xml/ns/test/authorization#work + + true + job + diff --git a/model/model-impl/src/test/resources/lens/role-corp-engineer.xml b/model/model-impl/src/test/resources/lens/role-corp-engineer.xml new file mode 100644 index 00000000000..5f5b94525c5 --- /dev/null +++ b/model/model-impl/src/test/resources/lens/role-corp-engineer.xml @@ -0,0 +1,35 @@ + + + + Engineer + An engineer that is (obviously) also an employee + + + + + + + + + + + http://midpoint.evolveum.com/xml/ns/test/authorization#design + + true + job + diff --git a/model/model-impl/src/test/resources/lens/role-corp-generic-metarole.xml b/model/model-impl/src/test/resources/lens/role-corp-generic-metarole.xml new file mode 100644 index 00000000000..441477c46b0 --- /dev/null +++ b/model/model-impl/src/test/resources/lens/role-corp-generic-metarole.xml @@ -0,0 +1,60 @@ + + + + + + Generic Metarole + Metarole for all roles which are assigned directly to users + + + + account + + ri:location + + + $focus/locality + + + + + 2 + + diff --git a/model/model-impl/src/test/resources/lens/role-corp-job-metarole.xml b/model/model-impl/src/test/resources/lens/role-corp-job-metarole.xml new file mode 100644 index 00000000000..88d18ba8c3c --- /dev/null +++ b/model/model-impl/src/test/resources/lens/role-corp-job-metarole.xml @@ -0,0 +1,59 @@ + + + + Job Metarole + Metarole for all job roles + + + + + + + + + + + account + + ri:title + + + $immediateRole/name + + + + + 2 + + + + $immediateRole/roleType + + + $focus/costCenter + + + + + + + diff --git a/model/model-impl/src/test/resources/lens/role-corp-manager.xml b/model/model-impl/src/test/resources/lens/role-corp-manager.xml new file mode 100644 index 00000000000..be65d7c9c6f --- /dev/null +++ b/model/model-impl/src/test/resources/lens/role-corp-manager.xml @@ -0,0 +1,35 @@ + + + + Manager + A manager that is (obviously) also an employee + + + + + + + + + + + http://midpoint.evolveum.com/xml/ns/test/authorization#manage + + true + management + diff --git a/model/model-impl/src/test/resources/lens/role-corp-visitor.xml b/model/model-impl/src/test/resources/lens/role-corp-visitor.xml new file mode 100644 index 00000000000..4493843526c --- /dev/null +++ b/model/model-impl/src/test/resources/lens/role-corp-visitor.xml @@ -0,0 +1,25 @@ + + + + Visitor + Just a random visitor + + + + true + diff --git a/model/model-impl/src/test/resources/lens/user-jack-modify-add-assignment-role-engineer.xml b/model/model-impl/src/test/resources/lens/user-jack-modify-add-assignment-role-engineer.xml new file mode 100644 index 00000000000..45a01305c6e --- /dev/null +++ b/model/model-impl/src/test/resources/lens/user-jack-modify-add-assignment-role-engineer.xml @@ -0,0 +1,30 @@ + + + + + c0c010c0-d34d-b33f-f00d-111111111111 + + add + c:assignment + + + + + diff --git a/model/model-impl/src/test/resources/lens/user-jack-modify-set-cost-center.xml b/model/model-impl/src/test/resources/lens/user-jack-modify-set-cost-center.xml new file mode 100644 index 00000000000..7edaad00ece --- /dev/null +++ b/model/model-impl/src/test/resources/lens/user-jack-modify-set-cost-center.xml @@ -0,0 +1,28 @@ + + + + + c0c010c0-d34d-b33f-f00d-111111111111 + + replace + c:costCenter + management + + diff --git a/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java b/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java index 24ffa8fb926..21022d6cf8e 100644 --- a/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java +++ b/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java @@ -2028,6 +2028,12 @@ protected PrismObject getObject(Class type, String return object; } + protected void addObjects(File... files) throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException, IOException { + for (File file : files) { + addObject(file); + } + } + protected void addObject(File file) throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException, IOException { PrismObject object = PrismTestUtil.parseObject(file); addObject(object); From ccb1049c9194c4a63cd6a93709e12d25e5754913 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Wed, 4 Feb 2015 09:02:22 +0100 Subject: [PATCH 099/215] Marking '_' char as break-line character in association popover. --- .../evolveum/midpoint/web/component/prism/PrismValuePanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/PrismValuePanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/PrismValuePanel.java index 9e95355dcba..f8ecd3dc5b7 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/PrismValuePanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/PrismValuePanel.java @@ -449,7 +449,7 @@ private String createAssociationTooltipText(PrismProperty property){ sb.append(getAttributeName(attr)); sb.append(":"); if (realValue != null) { - sb.append(realValue.toString().replace(",", ",​").replace("@", "@​")); + sb.append(realValue.toString().replace(",", ",​").replace("@", "@​").replace("_", "@​")); } sb.append("
"); } From 4cf8045e1e1afd962fd602077163a321730047b7 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Wed, 4 Feb 2015 09:15:48 +0100 Subject: [PATCH 100/215] MID-2191, part 1: Configurable handling of undeclared xmlns prefixes (warning/fatal) --- .../midpoint/prism/parser/XPathHolder.java | 5 +--- .../com/evolveum/midpoint/util/DOMUtil.java | 24 +++++++++++++++++-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/XPathHolder.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/XPathHolder.java index d6f162dc478..8a2d0d92108 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/XPathHolder.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/XPathHolder.java @@ -23,7 +23,6 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.Random; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; @@ -36,7 +35,6 @@ import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import com.evolveum.midpoint.prism.path.ItemPath; @@ -175,8 +173,7 @@ private void parse(String xpath, Node domNode, Map namespaceMap) } else { String namespace = findNamespace(qnameArray[0], domNode, namespaceMap); if (namespace == null) { - LOGGER.warn("Undeclared namespace prefix '" + qnameArray[0]+"' in '"+xpath+"'. Default matching will be used to find namespace."); -// throw new IllegalArgumentException("Undeclared namespace prefix '"+qnameArray[0]+"'"); + DOMUtil.reportUndeclaredNamespacePrefix(qnameArray[0], xpath); } qname = new QName(namespace, qnameArray[1], qnameArray[0]); } diff --git a/infra/util/src/main/java/com/evolveum/midpoint/util/DOMUtil.java b/infra/util/src/main/java/com/evolveum/midpoint/util/DOMUtil.java index cfa8a14a303..bdb77366bb4 100644 --- a/infra/util/src/main/java/com/evolveum/midpoint/util/DOMUtil.java +++ b/infra/util/src/main/java/com/evolveum/midpoint/util/DOMUtil.java @@ -47,6 +47,8 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; +import com.evolveum.midpoint.util.logging.Trace; +import com.evolveum.midpoint.util.logging.TraceManager; import com.sun.org.apache.xml.internal.utils.XMLChar; import org.apache.commons.io.IOUtils; @@ -74,6 +76,8 @@ */ public class DOMUtil { + public static final Trace LOGGER = TraceManager.getTrace(DOMUtil.class); + public static final String W3C_XML_SCHEMA_XMLNS_URI = "http://www.w3.org/2000/xmlns/"; public static final String W3C_XML_SCHEMA_XMLNS_PREFIX = "xmlns"; @@ -160,7 +164,11 @@ public class DOMUtil { private static Random rnd = new Random(); private static final DocumentBuilder loader; - + + // Whether we want to tolerate undeclared XML prefixes in QNames + // This is here only for backward compatibility with versions 3.0-3.1. + // Will be set to false starting with 3.2 (MID-2191) + public static boolean tolerateUndeclaredPrefixes = false; static { try { @@ -460,12 +468,24 @@ public static QName resolveQName(Node domNode, String prefixNotation, String def } } else { String namespace = findNamespace(domNode, qnameArray[0]); + if (namespace == null) { + reportUndeclaredNamespacePrefix(qnameArray[0], prefixNotation); + } qname = new QName(namespace, qnameArray[1], qnameArray[0]); } return qname; } - public static String findNamespace(Node domNode, String prefix) { + public static void reportUndeclaredNamespacePrefix(String prefix, String context) { + if (tolerateUndeclaredPrefixes) { + LOGGER.error("Undeclared namespace prefix '" + prefix+"' in '"+context+"'."); + } else { + throw new IllegalArgumentException("Undeclared namespace prefix '"+prefix+"' in '"+context+"'"); + } + } + + + public static String findNamespace(Node domNode, String prefix) { String ns = null; if (domNode != null) { if (prefix == null || prefix.isEmpty()) { From 833d436947e3e82db30fd03d6055d5c8a8c0de04 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Wed, 4 Feb 2015 11:02:45 +0100 Subject: [PATCH 101/215] First hack on LookupTableType --- .../xml/ns/public/common/common-3.xsd | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) diff --git a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd index 37a58eea5a9..c678be667f2 100644 --- a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd +++ b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd @@ -7001,6 +7001,135 @@ + + + +

+ An object that represents lookup table. The lookup table can be used for two purposes: + value enumerations (e.g. for GUI or validation) and value mapping (translation). + The same lookup table can serve both purposes at the same time. +

+

+ The content of the lookup table can be used as enumeration. E.g. the labels for each + table row can be displayed in the user interface. When a particular label is selected then + the associated key will be stored. Similar approach can be used for validation, e.g. when only + a selected set of values is legal for a certain property. In this case the "key" and "label" + columns are used. +

+

+ The content of the lookup table can also be used for value mapping. E.g. in cases when + input value needs to be mapped to the output value. In this case the "key" and "value" + columns are used. +

+

+ Even though the lookup table is represented as a prism object, it is designed to be + stored and queried efficiently. Therefore the contents of the lookup table will + be stored in a specialized table tuned for this purpose. This data type is not + designed to be used with the usual midPoint query mechanism (e.g. searchObjects operation). + Specialized operations are used to efficiently query the lookup tables. The prism + representation (e.g. XML) of the lookup tables is used only for backup, restore, migrations, + upgrades and similar purposes. +

+
+
+ + + + + + + + + +
+ + + + + + Data structure that represents entire content of the lookup table. + + + + + + + + + + + + + + + Lookup table row. The table row is a (complex) property. It is intentionally not + a container, so we can avoid maintaining container IDs for each row. The delta semantics + has a slightly different meaning for the lookup tables. Each key must be unique and the key + functions as an implicit identifier. E.g. adding a new row with a key that does not exist yet + will insert a new row. Adding a new row with key that already exists will overwrite existing row. + Replace operation on this property will efficiently clear the entire table and replace it with a new data. + We do not recommend using this operation as it may be very inefficient. Add and delete operations are + expected during normal operation. + + + + + + + Lookup table key column. This is the mandatory (non-null) column that usually + works as a mapping key. If the lookup table is used as an emumeration (there is no value column) + then the value of key column will be stored in the property when selected. + If the lookup table is used as a map, the value of key column will be matched to the + input variable. + + The value of the key is limited to a usual size of a "databse string". The actual size + constraint depends on the type of the database used as midPoint repository. It is + not recommended to use long values as keys. + + + + + + + Lookup table value column. This is optional column that represents mapping output. + The appropriate row will be selected by using the key. The corresponding value will be used + as output. + + This column has no use if the lookup table is used as an enumeration. + The value of the key is limited to a usual size of a "databse string". The actual size + constraint depends on the type of the database used as midPoint repository. We expect that + this column may contain quasi-structured data. But this column is not intended for a very rich + data structures, such as long XML snippets. If structured data must be stored in this column + then we recommend to use very tight "microformats" such as separating the values with collons. + + A special-purpose CLOB column for richer data formats might be added in the future. + + + + + + + Columnt that contains a user-friendly label for corresponding to the key. + This label will be displayed in user interface as a representation of the key. + The label has no meaning when the lookup table is used to map values. + + + + + + + Timestamp of the last change of the row. This is automatically manintaned by + the repository. It is updated every time the row is created or updated. + This row is intended to act as a "token" if the lookup table needs to be synchronized + with external resource. + + + true + + + + + From 01e4acc6d17fb1c82ee0c3a8631d888905833e58 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Wed, 4 Feb 2015 11:59:30 +0100 Subject: [PATCH 102/215] Fixing two authorization NPE problems --- .../model/impl/controller/ModelController.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java index c8f73a012c5..77abe2fff35 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java @@ -1622,6 +1622,9 @@ private void postProcessObject(PrismObject object, Get } private void removeDeniedItems(List> items, ObjectSecurityConstraints securityContraints, AuthorizationDecisionType defaultDecision) { + if (items == null) { + return; + } Iterator> iterator = items.iterator(); while (iterator.hasNext()) { Item item = iterator.next(); @@ -1643,9 +1646,11 @@ private void removeDeniedItems(List> items, ObjectSec while (vi.hasNext()) { PrismContainerValue cval = vi.next(); List> subitems = cval.getItems(); - removeDeniedItems(subitems, securityContraints, subDefaultDecision); - if (cval.getItems().isEmpty()) { - vi.remove(); + if (subitems != null) { + removeDeniedItems(subitems, securityContraints, subDefaultDecision); + if (subitems.isEmpty()) { + vi.remove(); + } } } if (item.isEmpty()) { From fc2161062f451a087734af56840c2c2e8389fb0d Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Wed, 4 Feb 2015 15:16:20 +0100 Subject: [PATCH 103/215] Refactoring schemaHandling and ObjectTemplate, part 1 --- .../xml/ns/public/common/common-3.xsd | 294 +++++++++++------- 1 file changed, 178 insertions(+), 116 deletions(-) diff --git a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd index c678be667f2..2749ad0a9ba 100644 --- a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd +++ b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd @@ -3557,7 +3557,7 @@ - + Description of the common item handling details, such as display name, @@ -3591,84 +3591,6 @@ - - - - When set to false then both strong and normal mapping values are merged to produce - the final set of values. - When set to true only strong values are used if there is at least one strong mapping. - Normal values are used if there is no strong mapping. - - - - - - - When set to true, allows attribute values that are set outside midPoint. - The synchronization will only remove values that are assigned by midPoint, but will - tolerate extra native values. - When set to false, extra attribute values are not tolerated. When midPoint detects - such value (e.g. during reconciliation) it will remove it. - - - - - - - Modification priority of this item. Items with specified priorities are modified in order that - follows these priorities: these with lower numbers are modified first, these with higher numbers - next, and items with unspecified priorities are modified last. Each priority level gets its own - modify operation (or operations, if required by ICF limitations). - - Currently this field is supported only for attributes, even it is present on associations as well. - - (It is envisioned that 'addingPriority' could be created as well in the future; it would concern - creating new objects. In that case, attributes with numerically lowest adding priority would be - used to create an object, and other attributes would be set via MODIFY operation, again, - according to their priorities.) - - - - - - - Modifications to this attribute are executed in REPLACE form only. I.e. if ADD or DELETE VALUE is - requested, midPoint will fetch the object state, compute the expected result and write it to the - resource object via REPLACE VALUE operation. This works around some weird connector behavior. - - BEWARE: READ+REPLACE is currently supported for attributes only - not for subjectToObject associations. - - EXPERIMENTAL. May change in near future. - - - - - - - Indicated if the attribute should be considered as secondary identifier. If set to true, - this attribue is stored in repository and user for example by synchronization (correlation - rule), consistency mechanism, etc. - - - - - - - - Pattern (regexp) for attribute value. If the value matches the pattern such value is tolerated. - It is left in the attribute even if it is not derived from any mapping. - - - - - - - Pattern (regexp) for attribute value. If the value matches the pattern such value is NOT tolerated. - The value must be derived from a mapping or it will be removed. - - - - @@ -3679,45 +3601,143 @@ - - - - Defines how the attribute value is constructed in case of information flow from IDM to the - resource, e.g. in case of provisioning. - - In case an expression is used, the expression variables should be as follows: - $user - the user to whom the account belongs - $account - the account to be changed - - Motivation: This is "value construction" type, it is - using similar format that is used eleswhere in the system - (e.g. in roles) and therefore a common expression processor can be - used to process all of that. E.g. a single processor may take into a - consideration both schema handling and dynamic attributes set by roles. - - - - - - - Defines how the attribute values are used (assigned) in case of information flow from resource - to IDM, e.g. in case of synchronization, reconciliation or discovery. - - In case a source expression is used, the expression variables should be as follows: - $user - the user to whom the account belongs - $account - the account that has been changed (after the change) - - Explanation: This is not a "value construction" as it is not constructing a new - attribute value. It is rather using attribute value that was set be someone else. - A simpler way how to express the assignement is needed here, especially a simple way how - to express assignment target. Some rules may use that information and we definitelly need that - to - generate correct relative change descriptions. - - - + + + + + Description of the common item handling details, such as display name, + read/write access and value and synchronization expressions. + These are the parts that are common to both attributes and associations. + + This is supposed to be used in schemaHandling part and therefore + describe the decisions of the system administrator about the + way how that attribute or association is used in midPoint. + + + + + + + + + When set to false then both strong and normal mapping values are merged to produce + the final set of values. + When set to true only strong values are used if there is at least one strong mapping. + Normal values are used if there is no strong mapping. + + + + + + + When set to true, allows attribute values that are set outside midPoint. + The synchronization will only remove values that are assigned by midPoint, but will + tolerate extra native values. + When set to false, extra attribute values are not tolerated. When midPoint detects + such value (e.g. during reconciliation) it will remove it. + + + + + + + Modification priority of this item. Items with specified priorities are modified in order that + follows these priorities: these with lower numbers are modified first, these with higher numbers + next, and items with unspecified priorities are modified last. Each priority level gets its own + modify operation (or operations, if required by ICF limitations). + + Currently this field is supported only for attributes, even it is present on associations as well. + + (It is envisioned that 'addingPriority' could be created as well in the future; it would concern + creating new objects. In that case, attributes with numerically lowest adding priority would be + used to create an object, and other attributes would be set via MODIFY operation, again, + according to their priorities.) + + + + + + + Modifications to this attribute are executed in REPLACE form only. I.e. if ADD or DELETE VALUE is + requested, midPoint will fetch the object state, compute the expected result and write it to the + resource object via REPLACE VALUE operation. This works around some weird connector behavior. + + BEWARE: READ+REPLACE is currently supported for attributes only - not for subjectToObject associations. + + EXPERIMENTAL. May change in near future. + + + + + + + Indicated if the attribute should be considered as secondary identifier. If set to true, + this attribue is stored in repository and user for example by synchronization (correlation + rule), consistency mechanism, etc. + + + + + + + + Pattern (regexp) for attribute value. If the value matches the pattern such value is tolerated. + It is left in the attribute even if it is not derived from any mapping. + + + + + + + Pattern (regexp) for attribute value. If the value matches the pattern such value is NOT tolerated. + The value must be derived from a mapping or it will be removed. + + + + + + + + Defines how the attribute value is constructed in case of information flow from IDM to the + resource, e.g. in case of provisioning. + + In case an expression is used, the expression variables should be as follows: + $user - the user to whom the account belongs + $account - the account to be changed + + Motivation: This is "value construction" type, it is + using similar format that is used eleswhere in the system + (e.g. in roles) and therefore a common expression processor can be + used to process all of that. E.g. a single processor may take into a + consideration both schema handling and dynamic attributes set by roles. + + + + + + + Defines how the attribute values are used (assigned) in case of information flow from resource + to IDM, e.g. in case of synchronization, reconciliation or discovery. + + In case a source expression is used, the expression variables should be as follows: + $user - the user to whom the account belongs + $account - the account that has been changed (after the change) + + Explanation: This is not a "value construction" as it is not constructing a new + attribute value. It is rather using attribute value that was set be someone else. + A simpler way how to express the assignement is needed here, especially a simple way how + to express assignment target. Some rules may use that information and we definitelly need that + to + generate correct relative change descriptions. + + + + + + + @@ -6830,6 +6850,8 @@ + @@ -6845,7 +6867,12 @@ Note: the expressions will be evaluated in the order as they are specified in the XML file for now, as the dependency mechanism does not work yet. Later, the order should be insignificant. + + DEPRECATED. Use "item" mechanism instead. + + true + @@ -6855,6 +6882,41 @@ + + + + TODO + + Description of the common item handling details, such as display name, + read/write access and value and synchronization expressions. + These are the parts that are common to both attributes and associations. + + This is supposed to be used in schemaHandling part and therefore + describe the decisions of the system administrator about the + way how that attribute or association is used in midPoint. + + + + + + + + + Defines how any of the object property value should + be constructed. It can contain fixed value or + an expression. + + In case an expression is used following variables should be set: + $user - The user object being created. + $account - (optional) the account from which was the user created (if present) + + + + + + + + From 8fe9e7cb26d7daf3e3241b05463089ba05a4a595 Mon Sep 17 00:00:00 2001 From: katkav Date: Thu, 5 Feb 2015 13:10:51 +0100 Subject: [PATCH 104/215] midPoint - CAS integration (using Jasig CAS Client libraries, spring ctx) --- gui/admin-gui/pom.xml | 17 +++++ .../main/webapp/WEB-INF/ctx-web-security.xml | 72 ++++++++++++++++++- gui/admin-gui/src/main/webapp/WEB-INF/web.xml | 17 +++++ .../impl/security/UserProfileServiceImpl.java | 15 +++- 4 files changed, 119 insertions(+), 2 deletions(-) diff --git a/gui/admin-gui/pom.xml b/gui/admin-gui/pom.xml index 4bedce0a079..6c9624a5c7a 100644 --- a/gui/admin-gui/pom.xml +++ b/gui/admin-gui/pom.xml @@ -549,6 +549,23 @@ servlet-api provided + + + + org.jasig.cas.client + cas-client-integration-tomcat-v7 + 3.3.3 + + + org.jasig.cas.client + cas-client-core + 3.3.3 + + + org.springframework.security + spring-security-cas + 3.2.5.RELEASE + diff --git a/gui/admin-gui/src/main/webapp/WEB-INF/ctx-web-security.xml b/gui/admin-gui/src/main/webapp/WEB-INF/ctx-web-security.xml index 8f40cd87e97..2d109e1c2fc 100644 --- a/gui/admin-gui/src/main/webapp/WEB-INF/ctx-web-security.xml +++ b/gui/admin-gui/src/main/webapp/WEB-INF/ctx-web-security.xml @@ -40,7 +40,7 @@ http://www.springframework.org/schema/security/spring-security-3.2.xsd"> - + @@ -58,6 +58,10 @@ http://www.springframework.org/schema/security/spring-security-3.2.xsd"> + + + + @@ -90,4 +94,70 @@ http://www.springframework.org/schema/security/spring-security-3.2.xsd"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gui/admin-gui/src/main/webapp/WEB-INF/web.xml b/gui/admin-gui/src/main/webapp/WEB-INF/web.xml index 683cdc1b5ee..e7e72454183 100644 --- a/gui/admin-gui/src/main/webapp/WEB-INF/web.xml +++ b/gui/admin-gui/src/main/webapp/WEB-INF/web.xml @@ -66,6 +66,23 @@ /* + + + characterEncodingFilter + org.springframework.web.filter.CharacterEncodingFilter + + encoding + UTF-8 + + + + characterEncodingFilter + /* + + + org.jasig.cas.client.session.SingleSignOutHttpSessionListener + + wicket org.apache.wicket.protocol.http.WicketFilter diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/UserProfileServiceImpl.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/UserProfileServiceImpl.java index 26d96377457..8c2967d4b0b 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/UserProfileServiceImpl.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/UserProfileServiceImpl.java @@ -53,6 +53,9 @@ import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -64,7 +67,7 @@ * @author semancik */ @Service(value = "userDetailsService") -public class UserProfileServiceImpl implements UserProfileService { +public class UserProfileServiceImpl implements UserProfileService, UserDetailsService { private static final Trace LOGGER = TraceManager.getTrace(UserProfileServiceImpl.class); @@ -260,4 +263,14 @@ public PrismObject resolveOwner(PrismObject } return owner; } + + @Override + public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { +// TODO Auto-generated method stub + try { + return getPrincipal(username); + } catch (ObjectNotFoundException e) { + throw new UsernameNotFoundException(e.getMessage(), e); + } + } } From b0fbf33dcf51e571a6ad24b0648dad881a5858e1 Mon Sep 17 00:00:00 2001 From: katkav Date: Thu, 5 Feb 2015 14:52:41 +0100 Subject: [PATCH 105/215] disabling CAS SSO integration (by default use standard authentication) --- gui/admin-gui/pom.xml | 19 ++++++++-- .../main/webapp/WEB-INF/ctx-web-security.xml | 35 +++++++++++-------- gui/admin-gui/src/main/webapp/WEB-INF/web.xml | 5 +-- 3 files changed, 40 insertions(+), 19 deletions(-) diff --git a/gui/admin-gui/pom.xml b/gui/admin-gui/pom.xml index 6c9624a5c7a..a43a697ce4b 100644 --- a/gui/admin-gui/pom.xml +++ b/gui/admin-gui/pom.xml @@ -550,8 +550,9 @@ provided + - + diff --git a/gui/admin-gui/src/main/webapp/WEB-INF/ctx-web-security.xml b/gui/admin-gui/src/main/webapp/WEB-INF/ctx-web-security.xml index 2d109e1c2fc..aa2382a0cba 100644 --- a/gui/admin-gui/src/main/webapp/WEB-INF/ctx-web-security.xml +++ b/gui/admin-gui/src/main/webapp/WEB-INF/ctx-web-security.xml @@ -40,7 +40,8 @@ http://www.springframework.org/schema/security/spring-security-3.2.xsd"> - + + @@ -58,11 +59,16 @@ http://www.springframework.org/schema/security/spring-security-3.2.xsd"> - + + + + + @@ -95,8 +101,9 @@ http://www.springframework.org/schema/security/spring-security-3.2.xsd"> + - + - - + @@ -133,7 +136,7 @@ http://www.springframework.org/schema/security/spring-security-3.2.xsd"> - + @@ -142,22 +145,24 @@ http://www.springframework.org/schema/security/spring-security-3.2.xsd"> +--> + - - - + - - + + --> + diff --git a/gui/admin-gui/src/main/webapp/WEB-INF/web.xml b/gui/admin-gui/src/main/webapp/WEB-INF/web.xml index e7e72454183..515eed4d63e 100644 --- a/gui/admin-gui/src/main/webapp/WEB-INF/web.xml +++ b/gui/admin-gui/src/main/webapp/WEB-INF/web.xml @@ -66,7 +66,8 @@ /* - + + wicket org.apache.wicket.protocol.http.WicketFilter From 325ef3851265ae900c98e62a6bff82b2da86597c Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Thu, 5 Feb 2015 15:02:24 +0100 Subject: [PATCH 106/215] Refacting the ResourceItemItemDefinition - for the use in ObjectTemplateType. --- .../component/assignment/ACAttributeDto.java | 4 ++- .../assignment/AssignmentEditorPanel.java | 4 ++- .../wizard/resource/SchemaHandlingStep.java | 8 +++--- .../ResourceAssociationEditor.java | 5 +++- .../ResourceAttributeEditor.java | 5 +++- .../RefinedAssociationDefinition.java | 3 ++- .../RefinedObjectClassDefinition.java | 12 +++++++-- .../midpoint/prism/util/ItemPathUtil.java | 26 +++++++++++++++++++ .../schema/util/ValueDisplayUtil.java | 2 +- .../xml/ns/public/common/common-3.xsd | 6 ++--- .../midpoint/schema/TestParseResource.java | 18 +++---------- .../model/impl/lens/Construction.java | 9 ++++--- .../intest/TestModelServiceContract.java | 3 ++- .../model/intest/sync/TestRecomputeTask.java | 3 ++- .../resource-GenSync-OpenDJ.xml | 2 +- .../testing/consistency/ConsistencyTest.java | 3 ++- 16 files changed, 76 insertions(+), 37 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/ACAttributeDto.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/ACAttributeDto.java index a6a59395b36..eb8f57e6bb2 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/ACAttributeDto.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/ACAttributeDto.java @@ -18,11 +18,13 @@ import com.evolveum.midpoint.common.StaticExpressionUtil; import com.evolveum.midpoint.prism.*; +import com.evolveum.midpoint.prism.path.ItemPath; import com.evolveum.midpoint.util.exception.SchemaException; import com.evolveum.midpoint.xml.ns._public.common.common_3.ExpressionType; import com.evolveum.midpoint.xml.ns._public.common.common_3.MappingType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory; import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceAttributeDefinitionType; +import com.evolveum.prism.xml.ns._public.types_3.ItemPathType; import com.evolveum.prism.xml.ns._public.types_3.RawType; import org.apache.commons.lang.StringUtils; @@ -129,7 +131,7 @@ public ResourceAttributeDefinitionType getConstruction() throws SchemaException } ResourceAttributeDefinitionType attrConstruction = new ResourceAttributeDefinitionType(); - attrConstruction.setRef(definition.getName()); + attrConstruction.setRef(new ItemPathType(new ItemPath(definition.getName()))); MappingType outbound = construction != null && construction.getOutbound() != null ? construction.getOutbound().clone() : new MappingType(); attrConstruction.setOutbound(outbound); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorPanel.java index bdf594264c0..e0fc17f03ce 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorPanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorPanel.java @@ -20,6 +20,7 @@ import com.evolveum.midpoint.common.refinery.RefinedResourceSchema; import com.evolveum.midpoint.model.api.ModelService; import com.evolveum.midpoint.prism.*; +import com.evolveum.midpoint.prism.path.ItemPath; import com.evolveum.midpoint.prism.query.EqualFilter; import com.evolveum.midpoint.prism.query.ObjectFilter; import com.evolveum.midpoint.prism.query.ObjectQuery; @@ -42,6 +43,7 @@ import com.evolveum.midpoint.web.page.admin.dto.ObjectViewDto; import com.evolveum.midpoint.web.util.WebMiscUtil; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; +import com.evolveum.prism.xml.ns._public.types_3.ItemPathType; import org.apache.wicket.AttributeModifier; import org.apache.wicket.Component; @@ -629,7 +631,7 @@ private ResourceAttributeDefinitionType findOrCreateValueConstruction(PrismPrope } ResourceAttributeDefinitionType construction = new ResourceAttributeDefinitionType(); - construction.setRef(attrDef.getName()); + construction.setRef(new ItemPathType(new ItemPath(attrDef.getName()))); return construction; } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java index 69e4dbc213d..b031a4e132b 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java @@ -20,6 +20,7 @@ import com.evolveum.midpoint.model.api.ModelService; import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.prism.delta.ObjectDelta; +import com.evolveum.midpoint.prism.util.ItemPathUtil; import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.util.logging.LoggingUtils; import com.evolveum.midpoint.util.logging.Trace; @@ -39,8 +40,8 @@ import com.evolveum.midpoint.web.util.WebMiscUtil; import com.evolveum.midpoint.web.util.WebModelUtils; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; - import com.evolveum.prism.xml.ns._public.types_3.ItemPathType; + import org.apache.wicket.AttributeModifier; import org.apache.wicket.Component; import org.apache.wicket.ajax.AjaxRequestTarget; @@ -63,6 +64,7 @@ import org.apache.wicket.util.string.Strings; import javax.xml.namespace.QName; + import java.util.*; /** @@ -369,7 +371,7 @@ public String getObject() { StringBuilder sb = new StringBuilder(); if(model.getObject().getRef() != null){ - sb.append(model.getObject().getRef().getLocalPart()); + sb.append(ItemPathUtil.getOnlySegmentQName(model.getObject().getRef()).getLocalPart()); } else { return null; } @@ -420,7 +422,7 @@ public String getObject() { StringBuilder sb = new StringBuilder(); if(model.getObject().getRef() != null){ - sb.append(model.getObject().getRef().getLocalPart()); + sb.append(ItemPathUtil.getOnlySegmentQName(model.getObject().getRef()).getLocalPart()); } else { return null; } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java index 08785dc0795..320e75a4ce9 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java @@ -17,6 +17,7 @@ package com.evolveum.midpoint.web.component.wizard.resource.component.schemahandling; import com.evolveum.midpoint.prism.PrismObject; +import com.evolveum.midpoint.prism.util.ItemPathUtil; import com.evolveum.midpoint.schema.processor.ObjectClassComplexTypeDefinition; import com.evolveum.midpoint.schema.processor.ResourceAttributeDefinition; import com.evolveum.midpoint.schema.processor.ResourceSchema; @@ -37,6 +38,7 @@ import com.evolveum.midpoint.web.util.InfoTooltipBehavior; import com.evolveum.midpoint.web.util.WebMiscUtil; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; + import org.apache.wicket.RestartResponseException; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.AjaxLink; @@ -50,6 +52,7 @@ import org.w3c.dom.Element; import javax.xml.namespace.QName; + import java.util.ArrayList; import java.util.List; @@ -122,7 +125,7 @@ public String getObject() { if(association.getDisplayName() == null && association.getRef() == null){ return getString("ResourceAssociationEditor.label.new"); } else { - return getString("ResourceAssociationEditor.label.edit", association.getRef().getLocalPart()); + return getString("ResourceAssociationEditor.label.edit", ItemPathUtil.getOnlySegmentQName(association.getRef()).getLocalPart()); } } }); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java index 6084d3fdc60..52c1742b4b5 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java @@ -16,6 +16,7 @@ package com.evolveum.midpoint.web.component.wizard.resource.component.schemahandling; import com.evolveum.midpoint.prism.PrismObject; +import com.evolveum.midpoint.prism.util.ItemPathUtil; import com.evolveum.midpoint.schema.processor.ObjectClassComplexTypeDefinition; import com.evolveum.midpoint.schema.processor.ResourceAttributeDefinition; import com.evolveum.midpoint.schema.processor.ResourceSchema; @@ -36,6 +37,7 @@ import com.evolveum.midpoint.web.util.InfoTooltipBehavior; import com.evolveum.midpoint.web.util.WebMiscUtil; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; + import org.apache.wicket.RestartResponseException; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; @@ -52,6 +54,7 @@ import org.w3c.dom.Element; import javax.xml.namespace.QName; + import java.util.ArrayList; import java.util.List; @@ -117,7 +120,7 @@ public String getObject() { if(attribute.getDisplayName() == null && attribute.getRef() == null){ return getString("ResourceAttributeEditor.label.new"); } else { - return getString("ResourceAttributeEditor.label.edit", attribute.getRef().getLocalPart()); + return getString("ResourceAttributeEditor.label.edit", ItemPathUtil.getOnlySegmentQName(attribute.getRef()).getLocalPart()); } } }); diff --git a/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedAssociationDefinition.java b/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedAssociationDefinition.java index 0001c7f9556..b4bd5b3dea1 100644 --- a/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedAssociationDefinition.java +++ b/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedAssociationDefinition.java @@ -19,6 +19,7 @@ import org.apache.commons.lang.BooleanUtils; +import com.evolveum.midpoint.prism.util.ItemPathUtil; import com.evolveum.midpoint.xml.ns._public.common.common_3.MappingType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectAssociationDirectionType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectAssociationType; @@ -50,7 +51,7 @@ public void setAssociationTarget(RefinedObjectClassDefinition associationTarget) } public QName getName() { - return resourceObjectAssociationType.getRef(); + return ItemPathUtil.getOnlySegmentQName(resourceObjectAssociationType.getRef()); } public ShadowKindType getKind() { diff --git a/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedObjectClassDefinition.java b/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedObjectClassDefinition.java index 45114f014b1..2ce0d6ef0f1 100644 --- a/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedObjectClassDefinition.java +++ b/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedObjectClassDefinition.java @@ -22,6 +22,7 @@ import com.evolveum.midpoint.prism.PrismObjectDefinition; import com.evolveum.midpoint.prism.parser.QueryConvertor; import com.evolveum.midpoint.prism.query.ObjectFilter; +import com.evolveum.midpoint.prism.util.ItemPathUtil; import com.evolveum.midpoint.schema.constants.MidPointConstants; import com.evolveum.midpoint.schema.constants.SchemaConstants; import com.evolveum.midpoint.schema.processor.*; @@ -40,6 +41,7 @@ import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CountObjectsCapabilityType; import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.PagedSearchCapabilityType; import com.evolveum.prism.xml.ns._public.query_3.SearchFilterType; +import com.evolveum.prism.xml.ns._public.types_3.ItemPathType; import javax.xml.namespace.QName; @@ -374,6 +376,11 @@ public void add(RefinedAttributeDefinition refinedAttributeDefinition) { attributeDefinitions.add(refinedAttributeDefinition); } + public boolean containsAttributeDefinition(ItemPathType pathType) { + QName segmentQName = ItemPathUtil.getOnlySegmentQName(pathType); + return containsAttributeDefinition(segmentQName); + } + public boolean containsAttributeDefinition(QName attributeName) { for (RefinedAttributeDefinition rAttributeDef : attributeDefinitions) { if (QNameUtil.match(rAttributeDef.getName(), attributeName)) { @@ -592,11 +599,12 @@ private static ResourceAttributeDefinitionType findAttributeDefinitionType(QName ResourceAttributeDefinitionType foundAttrDefType = null; for (ResourceAttributeDefinitionType attrDefType : rOcDefType.getAttribute()) { if (attrDefType.getRef() != null) { - if (QNameUtil.match(attrDefType.getRef(), attrName)) { + QName ref = ItemPathUtil.getOnlySegmentQName(attrDefType.getRef()); + if (QNameUtil.match(ref, attrName)) { if (foundAttrDefType == null) { foundAttrDefType = attrDefType; } else { - throw new SchemaException("Duplicate definition of attribute " + attrDefType.getRef() + " in "+typeDesc+" type " + throw new SchemaException("Duplicate definition of attribute " + ref + " in "+typeDesc+" type " + rOcDefType.getIntent() + ", in " + contextDescription); } } diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/util/ItemPathUtil.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/util/ItemPathUtil.java index 7f65b9140d4..b02454ed648 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/util/ItemPathUtil.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/util/ItemPathUtil.java @@ -1,6 +1,10 @@ package com.evolveum.midpoint.prism.util; +import javax.xml.namespace.QName; + import com.evolveum.midpoint.prism.path.ItemPath; +import com.evolveum.midpoint.prism.path.ItemPathSegment; +import com.evolveum.midpoint.prism.path.NameItemPathSegment; import com.evolveum.prism.xml.ns._public.types_3.ItemPathType; public class ItemPathUtil { @@ -23,4 +27,26 @@ public static boolean isDefault(ItemPathType itemPathType){ return itemPath.isEmpty(); } + public static QName getOnlySegmentQName(ItemPathType pathType) { + if (pathType == null) { + return null; + } + return getOnlySegmentQName(pathType.getItemPath()); + } + + public static QName getOnlySegmentQName(ItemPath path) { + if (path == null) { + return null; + } + if (path.size() != 1) { + throw new IllegalArgumentException("Expected a single-segment path, bug got "+path); + } + ItemPathSegment segment = path.first(); + if (segment instanceof NameItemPathSegment) { + return ((NameItemPathSegment)segment).getName(); + } else { + throw new IllegalArgumentException("Expected a path with a name segment, bug got "+path); + } + } + } diff --git a/infra/schema/src/main/java/com/evolveum/midpoint/schema/util/ValueDisplayUtil.java b/infra/schema/src/main/java/com/evolveum/midpoint/schema/util/ValueDisplayUtil.java index 1b333429a59..85238be2bfd 100644 --- a/infra/schema/src/main/java/com/evolveum/midpoint/schema/util/ValueDisplayUtil.java +++ b/infra/schema/src/main/java/com/evolveum/midpoint/schema/util/ValueDisplayUtil.java @@ -69,7 +69,7 @@ public static String toStringValue(PrismPropertyValue propertyValue) { return value.toString(); } else if (value instanceof ResourceAttributeDefinitionType) { ResourceAttributeDefinitionType radt = (ResourceAttributeDefinitionType) value; - return "(a value or a more complex mapping for the '" + radt.getRef().getLocalPart() + "' attribute)"; + return "(a value or a more complex mapping for the '" + radt.getRef() + "' attribute)"; } else if (value instanceof QName) { QName qname = (QName) value; if (StringUtils.isNotEmpty(qname.getNamespaceURI())) { diff --git a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd index 2749ad0a9ba..a9377543e74 100644 --- a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd +++ b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd @@ -3570,11 +3570,11 @@ - + - Name of the attribute (XSD element) or association that this - definition describes. It must point to the + Path of the item or association that this + definition describes. It must point to property or the attribute in the resource schema that belongs to an object class that is being described here. diff --git a/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseResource.java b/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseResource.java index dc94be3d885..415cf7e9a81 100644 --- a/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseResource.java +++ b/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseResource.java @@ -31,6 +31,7 @@ import com.evolveum.midpoint.prism.query.ExpressionWrapper; import com.evolveum.midpoint.prism.query.ObjectFilter; import com.evolveum.midpoint.prism.query.ObjectQuery; +import com.evolveum.midpoint.prism.util.ItemPathUtil; import com.evolveum.midpoint.prism.util.PrismAsserts; import com.evolveum.midpoint.prism.util.JaxbTestUtil; import com.evolveum.midpoint.prism.util.PrismTestUtil; @@ -44,19 +45,6 @@ import com.evolveum.midpoint.util.DOMUtil; import com.evolveum.midpoint.util.PrettyPrinter; import com.evolveum.midpoint.util.exception.SchemaException; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ConditionalSearchFilterType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorConfigurationType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.MappingType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectSynchronizationType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceAttributeDefinitionType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectTypeDefinitionType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.SchemaHandlingType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.SynchronizationType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.XmlSchemaType; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; import com.evolveum.prism.xml.ns._public.query_3.SearchFilterType; import com.evolveum.prism.xml.ns._public.types_3.ItemPathType; @@ -573,7 +561,7 @@ private void assertResourceJaxb(ResourceType resourceType, boolean isSimple) thr boolean foundDescription = false; boolean foundDepartmentNumber = false; for (ResourceAttributeDefinitionType attributeDefinitionType : accountType.getAttribute()) { - if ("description".equals(attributeDefinitionType.getRef().getLocalPart())) { + if ("description".equals(ItemPathUtil.getOnlySegmentQName(attributeDefinitionType.getRef()).getLocalPart())) { foundDescription = true; MappingType outbound = attributeDefinitionType.getOutbound(); JAXBElement valueEvaluator = outbound.getExpression().getExpressionEvaluator().get(0); @@ -581,7 +569,7 @@ private void assertResourceJaxb(ResourceType resourceType, boolean isSimple) thr assertNotNull("no expression evaluator for description", valueEvaluator); assertEquals("wrong expression evaluator element name for description", SchemaConstantsGenerated.C_VALUE, valueEvaluator.getName()); assertEquals("wrong expression evaluator actual type for description", RawType.class, valueEvaluator.getValue().getClass()); - } else if ("departmentNumber".equals(attributeDefinitionType.getRef().getLocalPart())) { + } else if ("departmentNumber".equals(ItemPathUtil.getOnlySegmentQName(attributeDefinitionType.getRef()).getLocalPart())) { foundDepartmentNumber = true; MappingType outbound = attributeDefinitionType.getOutbound(); MappingSourceDeclarationType source = outbound.getSource().get(0); diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/Construction.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/Construction.java index 9ee4d39c0df..018f498bfb3 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/Construction.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/Construction.java @@ -43,6 +43,7 @@ import com.evolveum.midpoint.prism.OriginType; import com.evolveum.midpoint.prism.PrismValue; import com.evolveum.midpoint.prism.delta.PrismValueDeltaSetTriple; +import com.evolveum.midpoint.prism.util.ItemPathUtil; import com.evolveum.midpoint.schema.constants.ExpressionConstants; import com.evolveum.midpoint.schema.processor.ResourceAttributeDefinition; import com.evolveum.midpoint.schema.result.OperationResult; @@ -322,7 +323,7 @@ private void evaluateAttributes(Task task, OperationResult result) throws Expres // LOGGER.trace("Assignments used for account construction for {} ({}): {}", new Object[]{this.resource, // assignments.size(), assignments}); for (ResourceAttributeDefinitionType attribudeDefinitionType : constructionType.getAttribute()) { - QName attrName = attribudeDefinitionType.getRef(); + QName attrName = ItemPathUtil.getOnlySegmentQName(attribudeDefinitionType.getRef()); if (attrName == null) { throw new SchemaException("No attribute name (ref) in attribute definition in account construction in "+source); } @@ -343,7 +344,7 @@ private void evaluateAttributes(Task task, OperationResult result) throws Expres private Mapping> evaluateAttribute(ResourceAttributeDefinitionType attribudeDefinitionType, Task task, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException { - QName attrName = attribudeDefinitionType.getRef(); + QName attrName = ItemPathUtil.getOnlySegmentQName(attribudeDefinitionType.getRef()); if (attrName == null) { throw new SchemaException("Missing 'ref' in attribute construction in account construction in "+ObjectTypeUtil.toShortString(source)); } @@ -386,7 +387,7 @@ public boolean hasValueForAttribute(QName attributeName) { private void evaluateAssociations(Task task, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException { associationMappings = new ArrayList>>(); for (ResourceObjectAssociationType associationDefinitionType : constructionType.getAssociation()) { - QName assocName = associationDefinitionType.getRef(); + QName assocName = ItemPathUtil.getOnlySegmentQName(associationDefinitionType.getRef()); if (assocName == null) { throw new SchemaException("No association name (ref) in association definition in construction in "+source); } @@ -404,7 +405,7 @@ private void evaluateAssociations(Task task, OperationResult result) throws Expr private Mapping> evaluateAssociation(ResourceObjectAssociationType associationDefinitionType, Task task, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException { - QName assocName = associationDefinitionType.getRef(); + QName assocName = ItemPathUtil.getOnlySegmentQName(associationDefinitionType.getRef()); if (assocName == null) { throw new SchemaException("Missing 'ref' in association in construction in "+source); } diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestModelServiceContract.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestModelServiceContract.java index b023826043c..efc2d189245 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestModelServiceContract.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestModelServiceContract.java @@ -41,6 +41,7 @@ import com.evolveum.midpoint.prism.query.EqualFilter; import com.evolveum.midpoint.prism.query.NotFilter; import com.evolveum.midpoint.prism.query.ObjectQuery; +import com.evolveum.prism.xml.ns._public.types_3.ItemPathType; import com.evolveum.prism.xml.ns._public.types_3.RawType; import org.apache.commons.lang.StringUtils; @@ -2217,7 +2218,7 @@ public void test191ModifyUserJackModifyAssignment() throws Exception { ConstructionType accountConstruction = createAccountConstruction(RESOURCE_DUMMY_OID, null); ResourceAttributeDefinitionType radt = new ResourceAttributeDefinitionType(); - radt.setRef(gossipDefinition.getName()); + radt.setRef(new ItemPathType(new ItemPath(gossipDefinition.getName()))); MappingType outbound = new MappingType(); radt.setOutbound(outbound); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestRecomputeTask.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestRecomputeTask.java index f1868487b96..c6c106eafea 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestRecomputeTask.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/sync/TestRecomputeTask.java @@ -30,6 +30,7 @@ import javax.xml.bind.JAXBElement; import javax.xml.namespace.QName; +import com.evolveum.midpoint.prism.util.ItemPathUtil; import com.evolveum.midpoint.prism.xnode.PrimitiveXNode; import com.evolveum.midpoint.schema.constants.SchemaConstants; import com.evolveum.prism.xml.ns._public.types_3.RawType; @@ -151,7 +152,7 @@ public void test100RecomputeAll() throws Exception { PrismPropertyValue oldAttrPVal = null; for (PrismPropertyValue pval: attributeProperty.getValues()) { ResourceAttributeDefinitionType attrType = pval.getValue(); - if (attrType.getRef().getLocalPart().equals(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_WEAPON_NAME)) { + if (ItemPathUtil.getOnlySegmentQName(attrType.getRef()).getLocalPart().equals(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_WEAPON_NAME)) { oldAttrPVal = pval; } } diff --git a/samples/demo-generic synchronization/resource-GenSync-OpenDJ.xml b/samples/demo-generic synchronization/resource-GenSync-OpenDJ.xml index 31c893ced05..a014e119e1a 100644 --- a/samples/demo-generic synchronization/resource-GenSync-OpenDJ.xml +++ b/samples/demo-generic synchronization/resource-GenSync-OpenDJ.xml @@ -13240,8 +13240,8 @@ ri:group LDAP Group Membership - true mr:stringIgnoreCase + true entitlement ldapGroup diff --git a/testing/consistency-mechanism/src/test/java/com/evolveum/midpoint/testing/consistency/ConsistencyTest.java b/testing/consistency-mechanism/src/test/java/com/evolveum/midpoint/testing/consistency/ConsistencyTest.java index 49b9025eaae..1dbdb14225d 100644 --- a/testing/consistency-mechanism/src/test/java/com/evolveum/midpoint/testing/consistency/ConsistencyTest.java +++ b/testing/consistency-mechanism/src/test/java/com/evolveum/midpoint/testing/consistency/ConsistencyTest.java @@ -148,6 +148,7 @@ import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; import com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage; import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType; +import com.evolveum.prism.xml.ns._public.types_3.ItemPathType; import com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType; import com.evolveum.prism.xml.ns._public.types_3.RawType; @@ -2026,7 +2027,7 @@ public void test111AssignAccountMorgan() throws Exception { mapping.setExpression(expression); ResourceAttributeDefinitionType attrDefType = new ResourceAttributeDefinitionType(); - attrDefType.setRef(SchemaConstants.ICFS_NAME); + attrDefType.setRef(new ItemPathType(new ItemPath(SchemaConstants.ICFS_NAME))); attrDefType.setOutbound(mapping); ConstructionType construction = new ConstructionType(); From 3811dfdb0c7f88de612a917ae46b4e13187ca61e Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Thu, 5 Feb 2015 15:18:24 +0100 Subject: [PATCH 107/215] Configurable treatment of undeclared prefixes (MID-2191). Temporarily fixing missing XMLNS declarations when serializing RawTypes (MID-2196). --- .../admin/configuration/PageInternals.html | 1 + .../admin/configuration/PageInternals.java | 5 + .../configuration/PageInternals.properties | 1 + .../configuration/dto/InternalsConfigDto.java | 17 +- .../midpoint/common/validator/Validator.java | 18 +- .../midpoint/prism/parser/AbstractParser.java | 3 +- .../midpoint/prism/parser/DomParser.java | 11 +- .../midpoint/prism/parser/DomSerializer.java | 6 +- .../midpoint/prism/parser/JaxbDomHack.java | 1 + .../prism/parser/PrismBeanConverter.java | 9 +- .../midpoint/prism/parser/QueryConvertor.java | 3 +- .../midpoint/prism/parser/XNodeProcessor.java | 7 +- .../prism/parser/XNodeSerializer.java | 6 +- .../prism/parser/json/JsonValueParser.java | 5 + .../prism/util/ValueSerializationUtil.java | 308 +++++++++--------- .../midpoint/prism/xnode/PrimitiveXNode.java | 75 ++++- .../midpoint/prism/xnode/ValueParser.java | 19 +- .../schema/TestParseObjectTemplate.java | 46 ++- .../midpoint/schema/test/XPathTest.java | 2 +- .../common/resource-opendj-no-xmlns.xml | 5 +- .../test/resources/common/resource-opendj.xml | 4 +- .../object-template/object-template.xml | 15 + .../object-template/user-template.xml | 21 +- infra/schema/testng.xml | 1 + .../com/evolveum/midpoint/util/DOMUtil.java | 66 +++- .../expression-user-extension-ship-path.xml | 2 +- .../model/impl/lens/ChangeExecutor.java | 3 +- .../lens/assignment-direct-expression.xml | 2 +- .../negative/TestModelWebServiceNegative.java | 8 +- .../resources/common/resource-dummy-black.xml | 1 + .../common/resource-dummy-blue-deprecated.xml | 1 + .../resources/common/resource-dummy-blue.xml | 1 + .../common/resource-dummy-deprecated.xml | 1 + .../resources/common/resource-dummy-fake.xml | 1 + .../resource-dummy-green-deprecated.xml | 1 + .../resources/common/resource-dummy-green.xml | 1 + .../common/resource-dummy-orange.xml | 4 +- .../resource-dummy-schemaless-no-schema.xml | 1 + .../common/resource-dummy-upcase.xml | 4 +- .../resources/common/resource-dummy-white.xml | 1 + .../common/resource-dummy-yellow.xml | 1 + .../test/resources/common/resource-dummy.xml | 1 + .../common/user-template-complex-include.xml | 2 +- .../common/user-template-complex.xml | 8 +- .../repo/sql/QueryInterpreterTest.java | 2 +- .../src/test/resources/basic/objects.xml | 48 +++ .../modify/account-delete-object-change.xml | 1 + .../test/resources/modify/resource-opendj.xml | 6 +- samples/resources/ad/ad-resource-simple.xml | 3 +- .../mysqluser-localhost-advanced-nosync.xml | 3 +- .../mysqluser/mysqluser-localhost-simple.xml | 3 +- .../office365/office365-federated.xml | 4 +- .../resources/office365/office365-managed.xml | 2 +- .../midpoint/samples/test/TestSamples.java | 2 +- 54 files changed, 544 insertions(+), 229 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.html index 101fb093bc0..931bf7add4d 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.html @@ -52,6 +52,7 @@

+
diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.java index ab17b9bdb7f..8e501be82b2 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.java @@ -39,6 +39,7 @@ public class PageInternals extends PageAdminConfiguration { private static final String ID_CONSISTENCY_CHECKS = "consistencyChecks"; private static final String ID_ENCRYPTION_CHECKS = "encryptionChecks"; private static final String ID_READ_ENCRYPTION_CHECKS = "readEncryptionChecks"; + private static final String ID_TOLERATE_UNDECLARED_PREFIXES = "tolerateUndeclaredPrefixes"; private static final String ID_DETAILED_DEBUG_DUMP = "detailedDebugDump"; private static final String LABEL_SIZE = "col-md-4"; @@ -145,6 +146,10 @@ private void initInternalsConfigForm() { new PropertyModel(internalsModel, InternalsConfigDto.F_READ_ENCRYPTION_CHECKS), createStringResource("PageInternals.checkReadEncrypion"), LABEL_SIZE, INPUT_SIZE); form.add(encryptionRead); + CheckFormGroup tolerateUndeclaredPrefixes = new CheckFormGroup(ID_TOLERATE_UNDECLARED_PREFIXES, + new PropertyModel(internalsModel, InternalsConfigDto.F_TOLERATE_UNDECLARED_PREFIXES), + createStringResource("PageInternals.tolerateUndeclaredPrefixes"), LABEL_SIZE, INPUT_SIZE); + form.add(tolerateUndeclaredPrefixes); AjaxSubmitButton update = new AjaxSubmitButton(ID_UPDATE_INTERNALS_CONFIG, createStringResource("PageBase.button.update")) { diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.properties b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.properties index 5dfe7101a37..4cfd5841e15 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.properties +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.properties @@ -23,6 +23,7 @@ PageInternals.title.timeChange=Time change PageInternals.checkConsistency=Check consistency PageInternals.checkEncryption=Check encryption PageInternals.checkReadEncrypion=Check read encryption +PageInternals.tolerateUndeclaredPrefixes=Tolerate undeclared prefixes in QNames and paths PageInternals.detailedDebugDump=Detailed debug dump diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/dto/InternalsConfigDto.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/dto/InternalsConfigDto.java index ae3c951db6f..c8206603bd8 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/dto/InternalsConfigDto.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/dto/InternalsConfigDto.java @@ -17,6 +17,7 @@ package com.evolveum.midpoint.web.page.admin.configuration.dto; import com.evolveum.midpoint.common.InternalsConfig; +import com.evolveum.midpoint.util.DOMUtil; import com.evolveum.midpoint.util.DebugUtil; import java.io.Serializable; @@ -30,6 +31,7 @@ public class InternalsConfigDto implements Serializable { public static final String F_ENCRYPTION_CHECKS = "encryptionChecks"; public static final String F_READ_ENCRYPTION_CHECKS = "readEncryptionChecks"; public static final String F_DETAILED_DEBUG_DUMP = "detailedDebugDump"; + public static final String F_TOLERATE_UNDECLARED_PREFIXES = "tolerateUndeclaredPrefixes"; //internals config private boolean consistencyChecks; @@ -37,7 +39,8 @@ public class InternalsConfigDto implements Serializable { private boolean readEncryptionChecks; //debug util private boolean detailedDebugDump; - + //DOM util + private boolean tolerateUndeclaredPrefixes; public InternalsConfigDto() { consistencyChecks = InternalsConfig.consistencyChecks; @@ -45,6 +48,8 @@ public InternalsConfigDto() { readEncryptionChecks = InternalsConfig.readEncryptionChecks; detailedDebugDump = DebugUtil.isDetailedDebugDump(); + + tolerateUndeclaredPrefixes = DOMUtil.isTolerateUndeclaredPrefixes(); } public boolean isConsistencyChecks() { @@ -79,10 +84,20 @@ public void setDetailedDebugDump(boolean detailedDebugDump) { this.detailedDebugDump = detailedDebugDump; } + public boolean isTolerateUndeclaredPrefixes() { + return tolerateUndeclaredPrefixes; + } + + public void setTolerateUndeclaredPrefixes(boolean tolerateUndeclaredPrefixes) { + this.tolerateUndeclaredPrefixes = tolerateUndeclaredPrefixes; + } + + // undeclared prefixes is also handled here public void saveInternalsConfig() { InternalsConfig.consistencyChecks = consistencyChecks; InternalsConfig.encryptionChecks = encryptionChecks; InternalsConfig.readEncryptionChecks = readEncryptionChecks; + DOMUtil.setTolerateUndeclaredPrefixes(tolerateUndeclaredPrefixes); } public void saveDebugUtil() { diff --git a/infra/common/src/main/java/com/evolveum/midpoint/common/validator/Validator.java b/infra/common/src/main/java/com/evolveum/midpoint/common/validator/Validator.java index 2ca70dd5f48..56941a9b68c 100644 --- a/infra/common/src/main/java/com/evolveum/midpoint/common/validator/Validator.java +++ b/infra/common/src/main/java/com/evolveum/midpoint/common/validator/Validator.java @@ -417,7 +417,23 @@ private EventResult validateObjectInternal(Element objectElement, OperationResul } objectResult.recordFatalError(ex); return EventResult.skipObject(); - } + } catch (RuntimeException ex) { + validatorResult.recordFatalError("Couldn't parse object: " + ex.getMessage(), ex); + if (verbose) { + ex.printStackTrace(); + } + if (handler != null) { + try { + handler.handleGlobalError(validatorResult); + } catch (RuntimeException e) { + // Make sure that unhandled exceptions are recorded in object result before they are rethrown + objectResult.recordFatalError("Internal error: handleGlobalError call failed: "+e.getMessage(), e); + throw e; + } + } + objectResult.recordFatalError(ex); + return EventResult.skipObject(); + } } diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/AbstractParser.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/AbstractParser.java index f5a80dca780..43363cf43c3 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/AbstractParser.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/AbstractParser.java @@ -256,8 +256,9 @@ private void serializeFromPrimitive(PrimitiveXNode primitive, QName nodeN } T value = primitive.getValue(); - if ( value == null){ + if (value == null) { value = (T) primitive.getStringValue(); + // TODO write also namespace declarations! } if (nodeName == null) { generator.writeObject(value); diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/DomParser.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/DomParser.java index a4bd02576d3..cd72d21de85 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/DomParser.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/DomParser.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Map; import java.util.Map.Entry; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -281,6 +282,10 @@ public String getStringValue() { return element.getTextContent(); } @Override + public Map getPotentiallyRelevantNamespaces() { + return DOMUtil.getAllVisibleNamespaceDeclarations(element); + } + @Override public String toString() { return "ValueParser(DOMe, "+PrettyPrinter.prettyPrint(DOMUtil.getQName(element))+": "+element.getTextContent()+")"; } @@ -313,7 +318,11 @@ public String toString() { return "ValueParser(DOMa, " + PrettyPrinter.prettyPrint(DOMUtil.getQName(attr)) + ": " + attr.getTextContent() + ")"; } - + + @Override + public Map getPotentiallyRelevantNamespaces() { + return DOMUtil.getAllVisibleNamespaceDeclarations(attr); + } } private PrimitiveXNode parsePrimitiveElement(final Element element) throws SchemaException { diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/DomSerializer.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/DomSerializer.java index 6b71af7db5b..6bcfda6aa93 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/DomSerializer.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/DomSerializer.java @@ -192,7 +192,7 @@ private void serializePrimitiveElementOrAttribute(PrimitiveXNode xprim, Eleme } } - if (typeQName == null) { + if (typeQName == null) { // this means that either xprim is unparsed or it is empty if (com.evolveum.midpoint.prism.PrismContext.isAllowSchemalessSerialization()) { // We cannot correctly serialize without a type. But this is needed // sometimes. So just default to string @@ -200,6 +200,7 @@ private void serializePrimitiveElementOrAttribute(PrimitiveXNode xprim, Eleme if (stringValue != null) { if (asAttribute) { DOMUtil.setAttributeValue(parentElement, elementOrAttributeName.getLocalPart(), stringValue); + DOMUtil.setNamespaceDeclarations(parentElement, xprim.getRelevantNamespaceDeclarations()); } else { Element element; try { @@ -210,6 +211,7 @@ private void serializePrimitiveElementOrAttribute(PrimitiveXNode xprim, Eleme } parentElement.appendChild(element); DOMUtil.setElementTextContent(element, stringValue); + DOMUtil.setNamespaceDeclarations(element, xprim.getRelevantNamespaceDeclarations()); } } return; @@ -238,7 +240,7 @@ private void serializePrimitiveElementOrAttribute(PrimitiveXNode xprim, Eleme } } else { - // not an ItemType + // not an ItemPathType if (!asAttribute) { try { diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/JaxbDomHack.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/JaxbDomHack.java index e785c84547c..81229287b5b 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/JaxbDomHack.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/JaxbDomHack.java @@ -314,6 +314,7 @@ public Object toAny(PrismValue value) throws SchemaException { String stringValue = xprim.getStringValue(); Element element = DOMUtil.createElement(document, elementName); element.setTextContent(stringValue); + DOMUtil.setNamespaceDeclarations(element, xprim.getRelevantNamespaceDeclarations()); return element; } else { throw new IllegalArgumentException("Cannot convert raw element "+rawElement+" to xsd:any"); diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/PrismBeanConverter.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/PrismBeanConverter.java index a55f19c3af4..602bf46c487 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/PrismBeanConverter.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/PrismBeanConverter.java @@ -773,8 +773,7 @@ public XNode marshall(T bean) throws SchemaException { private XNode marshalXmlAsStringType(XmlAsStringType bean) { PrimitiveXNode xprim = new PrimitiveXNode<>(); - xprim.setValue(bean.getContentAsString()); - xprim.setTypeQName(DOMUtil.XSD_STRING); + xprim.setValue(bean.getContentAsString(), DOMUtil.XSD_STRING); return xprim; } @@ -901,8 +900,7 @@ private XNode marshallValue(T value, QName fieldTypeName, boolean isAttribut private PrimitiveXNode createPrimitiveXNode(T value, QName fieldTypeName, boolean isAttribute){ PrimitiveXNode xprim = new PrimitiveXNode(); - xprim.setValue(value); - xprim.setTypeQName(fieldTypeName); + xprim.setValue(value, fieldTypeName); xprim.setAttribute(isAttribute); return xprim; } @@ -919,8 +917,7 @@ private XNode marshalItemPathType(ItemPathType itemPath) { PrimitiveXNode xprim = new PrimitiveXNode(); if (itemPath != null){ ItemPath path = itemPath.getItemPath(); - xprim.setValue(path); - xprim.setTypeQName(ItemPathType.COMPLEX_TYPE); + xprim.setValue(path, ItemPathType.COMPLEX_TYPE); } return xprim; } diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/QueryConvertor.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/QueryConvertor.java index 5580fd3920a..2a0e668f8ed 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/QueryConvertor.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/QueryConvertor.java @@ -786,8 +786,7 @@ private static XNode serializePropertyValue(PrismPropertyValue value, Pri private static PrimitiveXNode createPrimitiveXNode(T val, QName type) { PrimitiveXNode xprim = new PrimitiveXNode(); - xprim.setValue(val); - xprim.setTypeQName(type); + xprim.setValue(val, type); return xprim; } diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/XNodeProcessor.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/XNodeProcessor.java index b9fc2dd85de..a99a67cf3ef 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/XNodeProcessor.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/XNodeProcessor.java @@ -443,13 +443,10 @@ private T parseAtomicValueFromPrimitive(PrimitiveXNode xprim, QName typeN // Primitive elements may also have complex Java representations (e.g. enums) return prismContext.getBeanConverter().unmarshallPrimitive(xprim, typeName); } else { - if (!xprim.isParsed()) { - xprim.parseValue(typeName); - } - realValue = xprim.getValue(); + realValue = xprim.getParsedValue(typeName); } - if (realValue == null){ + if (realValue == null) { return realValue; } diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/XNodeSerializer.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/XNodeSerializer.java index 993c1f97e95..56aa1b75be9 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/XNodeSerializer.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/XNodeSerializer.java @@ -335,8 +335,7 @@ private XNode serializePropertyValue(PrismPropertyValue value, PrismPrope private XNode serializePolyString(PolyString realValue) { PrimitiveXNode xprim = new PrimitiveXNode<>(); - xprim.setValue(realValue); - xprim.setTypeQName(PolyStringType.COMPLEX_TYPE); + xprim.setValue(realValue, PolyStringType.COMPLEX_TYPE); return xprim; } @@ -362,8 +361,7 @@ private PrimitiveXNode createPrimitiveXNodeAttr(T val, QName type) { private PrimitiveXNode createPrimitiveXNode(T val, QName type) { PrimitiveXNode xprim = new PrimitiveXNode(); - xprim.setValue(val); - xprim.setTypeQName(type); + xprim.setValue(val, type); return xprim; } //endregion diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/json/JsonValueParser.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/json/JsonValueParser.java index 5ab258d7d71..051ee1a3faf 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/json/JsonValueParser.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/json/JsonValueParser.java @@ -1,6 +1,7 @@ package com.evolveum.midpoint.prism.parser.json; import java.io.IOException; +import java.util.Map; import javax.xml.namespace.QName; @@ -74,4 +75,8 @@ public String toString() { return "JsonValueParser(JSON value: "+node+")"; } + @Override + public Map getPotentiallyRelevantNamespaces() { + return null; // TODO implement + } } diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/util/ValueSerializationUtil.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/util/ValueSerializationUtil.java index b80a6ffb123..dca32273291 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/util/ValueSerializationUtil.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/util/ValueSerializationUtil.java @@ -172,168 +172,168 @@ public static String serializeValue(T value, QName itemName, PrismContext pr // throw new UnsupportedOperationException("need to be implemented"); } - public static String serializeItemValue(QName itemName, ItemDefinition def, PrismValue value, PrismContext prismContext, String language) throws SchemaException{ - XNodeSerializer serializer = prismContext.getXnodeProcessor().createSerializer(); - XNode node = serializer.serializeItemValue(value, def); - String s = prismContext.getParserDom().serializeToString(node, itemName); - //System.out.println("serialized ITEM VALUE: " + s); - return s; - } +// public static String serializeItemValue(QName itemName, ItemDefinition def, PrismValue value, PrismContext prismContext, String language) throws SchemaException{ +// XNodeSerializer serializer = prismContext.getXnodeProcessor().createSerializer(); +// XNode node = serializer.serializeItemValue(value, def); +// String s = prismContext.getParserDom().serializeToString(node, itemName); +// //System.out.println("serialized ITEM VALUE: " + s); +// return s; +// } - public static String serializeFilter(SearchFilterType query, PrismContext prismContext, String language){ - //System.out.println("query serialization"); - throw new UnsupportedOperationException("need to be implemented"); - } +// public static String serializeFilter(SearchFilterType query, PrismContext prismContext, String language){ +// //System.out.println("query serialization"); +// throw new UnsupportedOperationException("need to be implemented"); +// } - public static T deserializeValue(String value, Class clazz, QName itemName, ItemDefinition itemDef, PrismContext prismContext, String language) throws SchemaException{ - //System.out.println("item value deserialization"); - - XNode xnode = prismContext.getParserDom().parse(value); - -// System.out.println("xnode: " + xnode.debugDump()); - - XNode xmap = null; - if (xnode instanceof RootXNode){ - xmap = ((RootXNode) xnode).getSubnode(); - } - -// System.out.println("xmap: " + xmap); -// else if (xnode instanceof MapXNode){ -// xmap = (MapXNode) xnode; -// } else if (xnode instanceof PrimitiveXNode){ -// xmap = new MapXNode(); -// xmap.put(itemName, xnode); +// public static T deserializeValue(String value, Class clazz, QName itemName, ItemDefinition itemDef, PrismContext prismContext, String language) throws SchemaException{ +// //System.out.println("item value deserialization"); +// +// XNode xnode = prismContext.getParserDom().parse(value); +// +//// System.out.println("xnode: " + xnode.debugDump()); +// +// XNode xmap = null; +// if (xnode instanceof RootXNode){ +// xmap = ((RootXNode) xnode).getSubnode(); // } - - Item item = prismContext.getXnodeProcessor().parseItem(xmap, itemName, itemDef); - -// System.out.println("item: " + item.debugDump()); - - if (item instanceof PrismProperty){ - PrismProperty prop = (PrismProperty) item; - - if (prop.isSingleValue()){ - return (T) prop.getRealValue(); - } - return (T) prop.getRealValues(); - } else if (item instanceof PrismContainer){ - PrismContainer cont = (PrismContainer) item; - return (T) cont.getValue().asContainerable(); - } else if (item instanceof PrismReference){ - PrismReference ref = (PrismReference) item; - return (T) ref.getValue(); - } - if (item != null){ - return (T) item.getValue(0); - } -// if (prismContext.getBeanConverter().canConvert(clazz)){ -// prismContext.getBeanConverter().unmarshall(xmap, clazz); -// } else{ -// prismContext.getXnodeProcessor().parseContainer(xnode, clazz); +// +//// System.out.println("xmap: " + xmap); +//// else if (xnode instanceof MapXNode){ +//// xmap = (MapXNode) xnode; +//// } else if (xnode instanceof PrimitiveXNode){ +//// xmap = new MapXNode(); +//// xmap.put(itemName, xnode); +//// } +// +// Item item = prismContext.getXnodeProcessor().parseItem(xmap, itemName, itemDef); +// +//// System.out.println("item: " + item.debugDump()); +// +// if (item instanceof PrismProperty){ +// PrismProperty prop = (PrismProperty) item; +// +// if (prop.isSingleValue()){ +// return (T) prop.getRealValue(); +// } +// return (T) prop.getRealValues(); +// } else if (item instanceof PrismContainer){ +// PrismContainer cont = (PrismContainer) item; +// return (T) cont.getValue().asContainerable(); +// } else if (item instanceof PrismReference){ +// PrismReference ref = (PrismReference) item; +// return (T) ref.getValue(); // } - - throw new UnsupportedOperationException("need to be implemented"); - } - - public static Collection deserializeItemValues(String value, Item item, String language) throws SchemaException{ - //System.out.println("item value deserialization"); - PrismContext prismContext = item.getPrismContext(); - XNode xnode = prismContext.getParserDom().parse(value); - if (xnode instanceof RootXNode){ - xnode = ((RootXNode) xnode).getSubnode(); - } - //System.out.println("value: " + value); - Item parsedItem = prismContext.getXnodeProcessor().parseItem(xnode, item.getElementName(), item.getDefinition()); - return parsedItem.getValues(); +// if (item != null){ +// return (T) item.getValue(0); +// } +//// if (prismContext.getBeanConverter().canConvert(clazz)){ +//// prismContext.getBeanConverter().unmarshall(xmap, clazz); +//// } else{ +//// prismContext.getXnodeProcessor().parseContainer(xnode, clazz); +//// } +// // throw new UnsupportedOperationException("need to be implemented"); - } +// } - public static SearchFilterType deserializeFilter(String query, String language){ - //System.out.println("query deserialization"); - throw new UnsupportedOperationException("need to be implemented"); - } - - public static String serializeValue(T value, PrismPropertyDefinition def, - QName itemName, PrismContext prismContext, String langXml) throws SchemaException{ -// System.out.println("value serialization"); - if (value == null){ - return null; - } - - XNodeSerializer serializer = prismContext.getXnodeProcessor().createSerializer(); - - if (value instanceof List){ - List values = (List) value; - if (values.isEmpty()){ - return null; - } - - if (def instanceof PrismPropertyDefinition){ - PrismProperty prop = (PrismProperty) def.instantiate(); - for (T val : values){ - PrismPropertyValue pValue = new PrismPropertyValue(val); - prop.add(pValue); - } - XNode node = serializer.serializeItem(prop); - if (node instanceof ListXNode){ - ListXNode xList = (ListXNode) node; - MapXNode xmap = new MapXNode(); - xmap.put(def.getName(), xList); - String s = prismContext.getParserDom().serializeToString(xmap, def.getName()); -// System.out.println("serialized: " + s); - return s; - } - String s = prismContext.getParserDom().serializeToString(node, def.getName()); -// System.out.println("serialized: " + s); - return s; - } - - } - - PrismValue pVal = null; - - if (value instanceof Containerable){ - pVal = ((Containerable) value).asPrismContainerValue(); - } else if (value instanceof Referencable){ - pVal = ((Referencable) value).asReferenceValue(); - } else { - PrismProperty pp = def.instantiate(); - pVal = new PrismPropertyValue(value); - pp.add(pVal); - XNode xnode = serializer.serializeItemValue(pVal, def); - if (xnode == null){ - throw new IllegalArgumentException("null node after serialization"); - } - MapXNode xmap = null; - if (xnode instanceof RootXNode){ - XNode sub = ((RootXNode) xnode).getSubnode(); - if (!(sub instanceof MapXNode)){ - throw new IllegalArgumentException("not uspported yet"); - } - xmap = (MapXNode) sub; - } else if (xnode instanceof MapXNode){ - xmap = (MapXNode) xnode; - } else if (xnode instanceof PrimitiveXNode){ - String s = ((PrimitiveXNode) xnode).getStringValue(); - return s; -// - } else{ - throw new IllegalStateException("hmmm"); - } - - XNode node = xmap.get(itemName); - String s = prismContext.getParserDom().serializeToString(node, itemName); - } - +// public static Collection deserializeItemValues(String value, Item item, String language) throws SchemaException{ +// //System.out.println("item value deserialization"); +// PrismContext prismContext = item.getPrismContext(); +// XNode xnode = prismContext.getParserDom().parse(value); +// if (xnode instanceof RootXNode){ +// xnode = ((RootXNode) xnode).getSubnode(); +// } +// //System.out.println("value: " + value); +// Item parsedItem = prismContext.getXnodeProcessor().parseItem(xnode, item.getElementName(), item.getDefinition()); +// return parsedItem.getValues(); +//// throw new UnsupportedOperationException("need to be implemented"); +// } - - XNode node = serializer.serializeItemValue(pVal, def); - String s = prismContext.getParserDom().serializeToString(node, itemName); -// System.out.println("serialized: " + s); - return s; +// public static SearchFilterType deserializeFilter(String query, String language){ +// //System.out.println("query deserialization"); // throw new UnsupportedOperationException("need to be implemented"); - - } +// } + +// public static String serializeValue(T value, PrismPropertyDefinition def, +// QName itemName, PrismContext prismContext, String langXml) throws SchemaException{ +//// System.out.println("value serialization"); +// if (value == null){ +// return null; +// } +// +// XNodeSerializer serializer = prismContext.getXnodeProcessor().createSerializer(); +// +// if (value instanceof List){ +// List values = (List) value; +// if (values.isEmpty()){ +// return null; +// } +// +// if (def instanceof PrismPropertyDefinition){ +// PrismProperty prop = (PrismProperty) def.instantiate(); +// for (T val : values){ +// PrismPropertyValue pValue = new PrismPropertyValue(val); +// prop.add(pValue); +// } +// XNode node = serializer.serializeItem(prop); +// if (node instanceof ListXNode){ +// ListXNode xList = (ListXNode) node; +// MapXNode xmap = new MapXNode(); +// xmap.put(def.getName(), xList); +// String s = prismContext.getParserDom().serializeToString(xmap, def.getName()); +//// System.out.println("serialized: " + s); +// return s; +// } +// String s = prismContext.getParserDom().serializeToString(node, def.getName()); +//// System.out.println("serialized: " + s); +// return s; +// } +// +// } +// +// PrismValue pVal = null; +// +// if (value instanceof Containerable){ +// pVal = ((Containerable) value).asPrismContainerValue(); +// } else if (value instanceof Referencable){ +// pVal = ((Referencable) value).asReferenceValue(); +// } else { +// PrismProperty pp = def.instantiate(); +// pVal = new PrismPropertyValue(value); +// pp.add(pVal); +// XNode xnode = serializer.serializeItemValue(pVal, def); +// if (xnode == null){ +// throw new IllegalArgumentException("null node after serialization"); +// } +// MapXNode xmap = null; +// if (xnode instanceof RootXNode){ +// XNode sub = ((RootXNode) xnode).getSubnode(); +// if (!(sub instanceof MapXNode)){ +// throw new IllegalArgumentException("not uspported yet"); +// } +// xmap = (MapXNode) sub; +// } else if (xnode instanceof MapXNode){ +// xmap = (MapXNode) xnode; +// } else if (xnode instanceof PrimitiveXNode){ +// String s = ((PrimitiveXNode) xnode).getStringValue(); +// return s; +//// +// } else{ +// throw new IllegalStateException("hmmm"); +// } +// +// XNode node = xmap.get(itemName); +// String s = prismContext.getParserDom().serializeToString(node, itemName); +// } +// +// +// +// XNode node = serializer.serializeItemValue(pVal, def); +// String s = prismContext.getParserDom().serializeToString(node, itemName); +//// System.out.println("serialized: " + s); +// return s; +//// throw new UnsupportedOperationException("need to be implemented"); +// +// } } diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/xnode/PrimitiveXNode.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/xnode/PrimitiveXNode.java index 58b8972996d..ec4b8e22ae3 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/xnode/PrimitiveXNode.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/xnode/PrimitiveXNode.java @@ -16,12 +16,13 @@ package com.evolveum.midpoint.prism.xnode; import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; import javax.xml.namespace.QName; -import com.evolveum.midpoint.prism.parser.PrismBeanConverter; import com.evolveum.midpoint.prism.util.CloneUtil; -import com.evolveum.midpoint.util.logging.LoggingUtils; +import com.evolveum.midpoint.prism.xml.XsdTypeMapper; import com.evolveum.midpoint.util.logging.Trace; import com.evolveum.midpoint.util.logging.TraceManager; import org.apache.commons.lang.StringUtils; @@ -33,11 +34,17 @@ import com.evolveum.midpoint.util.PrettyPrinter; import com.evolveum.midpoint.util.QNameUtil; import com.evolveum.midpoint.util.exception.SchemaException; +import org.apache.commons.lang.Validate; public class PrimitiveXNode extends XNode implements Serializable { private static final Trace LOGGER = TraceManager.getTrace(PrimitiveXNode.class); - + + /* + * Invariants: + * - At most one of value-valueParser may be null. + * - If value is non-null, super.typeName must be non-null. + */ private T value; private ValueParser valueParser; @@ -58,6 +65,7 @@ public PrimitiveXNode(T value) { } public void parseValue(QName typeName) throws SchemaException { + Validate.notNull(typeName, "Cannot parse primitive XNode without knowing its type"); if (valueParser != null) { value = valueParser.parse(typeName); // Necessary. It marks that the value is parsed. It also frees some memory. @@ -81,11 +89,24 @@ public ValueParser getValueParser() { } public void setValueParser(ValueParser valueParser) { + Validate.notNull(valueParser, "Value parser cannot be null"); this.valueParser = valueParser; + this.value = null; } - public void setValue(T value) { + public void setValue(T value, QName typeQName) { + if (value != null) { + if (typeQName == null) { + // last desperate attempt to determine type name from the value type + typeQName = XsdTypeMapper.getJavaToXsdMapping(value.getClass()); + if (typeQName == null) { + throw new IllegalStateException("Cannot determine type QName for a value of '" + value + "'"); // todo show only class? (security/size reasons) + } + } + } + this.setTypeQName(typeQName); this.value = value; + this.valueParser = null; } public boolean isParsed() { @@ -121,6 +142,7 @@ public boolean isEmpty() { * value based on wrong type name. */ public T getParsedValueWithoutRecording(QName typeName) throws SchemaException { + Validate.notNull(typeName, "typeName"); if (isParsed()) { return value; } else { @@ -237,8 +259,47 @@ public String getStringValue() { return valueParser.getStringValue(); } } - - @Override + + /** + * This method is used with conjunction with getStringValue, typically when serializing unparsed values. + * Because the string value can represent QName or ItemPath, we have to provide relevant namespace declarations. + * + * Because we cannot know for sure, we are allowed to return namespace declarations that are not actually used. + * We should minimize number of such declarations, however. + * + * Current implementation simply grabs all potential namespace declarations and searches + * the xnode's string value for any 'prefix:' substrings. I'm afraid it is all we can do for now. + * + * THIS METHOD SHOULD BE CALLED ONLY ON EITHER UNPARSED OR EMPTY NODES. + * + * @return + */ + public Map getRelevantNamespaceDeclarations() { + Map retval = new HashMap<>(); + if (isEmpty()) { + return retval; + } + if (valueParser == null) { + throw new IllegalStateException("getRelevantNamespaceDeclarations called on parsed primitive XNode: " + this); + } + Map candidateNamespaces = valueParser.getPotentiallyRelevantNamespaces(); + if (candidateNamespaces == null) { + return retval; + } + String stringValue = getStringValue(); + if (stringValue == null) { + return retval; + } + for (Map.Entry candidateNamespace : candidateNamespaces.entrySet()) { + String prefix = candidateNamespace.getKey(); + if (stringValue.contains(prefix+":")) { + retval.put(candidateNamespace.getKey(), candidateNamespace.getValue()); + } + } + return retval; + } + + @Override public boolean equals(Object obj) { if (!(obj instanceof PrimitiveXNode)) { return false; @@ -248,6 +309,7 @@ public boolean equals(Object obj) { if (other.isParsed() && isParsed()){ return value.equals(other.value); } else if (!other.isParsed() && !isParsed()){ + // TODO consider problem with namespaces (if string value is QName/ItemPath its meaning can depend on namespace declarations that are placed outside the element) String thisStringVal = this.getStringValue(); String otherStringVal = other.getStringValue(); return thisStringVal.equals(otherStringVal); @@ -272,6 +334,7 @@ public int hashCode() { if (isParsed()) { objectToHash = value; } else { + // TODO consider problem with namespaces (if string value is QName/ItemPath its meaning can depend on namespace declarations that are placed outside the element) objectToHash = getStringValue(); } return objectToHash != null ? objectToHash.hashCode() : 0; diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/xnode/ValueParser.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/xnode/ValueParser.java index c7441dfa744..f891e6945bc 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/xnode/ValueParser.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/xnode/ValueParser.java @@ -15,10 +15,19 @@ */ package com.evolveum.midpoint.prism.xnode; +import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import com.evolveum.midpoint.util.exception.SchemaException; +import java.util.Map; + +/** + * Objects of type ValueParser should be immutable. (E.g. when cloning PrimitiveXNode, they are copied, not cloned.) + * + * @param + */ + public interface ValueParser { T parse(QName typeName) throws SchemaException; @@ -35,5 +44,13 @@ public interface ValueParser { * it will NOT cause it to be parsed. It can be invoked without any side effects. */ String getStringValue(); - + + /** + * Returns namespaces that could be relevant when serializing unparsed string value + * of this item. Used to preserve xmlns declarations for QNames and ItemPaths in + * unparsed data. (MID-2196) + * + * @return May return null if not supported or no namespace declarations are present. + */ + Map getPotentiallyRelevantNamespaces(); } diff --git a/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseObjectTemplate.java b/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseObjectTemplate.java index e9929c6ef0d..e4c90694975 100644 --- a/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseObjectTemplate.java +++ b/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseObjectTemplate.java @@ -16,6 +16,7 @@ package com.evolveum.midpoint.schema; import com.evolveum.midpoint.prism.*; +import com.evolveum.midpoint.prism.path.ItemPath; import com.evolveum.midpoint.prism.util.PrismAsserts; import com.evolveum.midpoint.prism.util.PrismTestUtil; import com.evolveum.midpoint.schema.constants.MidPointConstants; @@ -23,21 +24,25 @@ import com.evolveum.midpoint.util.PrettyPrinter; import com.evolveum.midpoint.util.exception.SchemaException; import com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.AsIsExpressionEvaluatorType; import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ExtensionType; import com.evolveum.midpoint.xml.ns._public.common.common_3.MappingType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectTemplateMappingType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectTemplateType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; import com.evolveum.prism.xml.ns._public.types_3.PolyStringType; +import com.evolveum.prism.xml.ns._public.types_3.RawType; import org.testng.annotations.BeforeSuite; import org.testng.annotations.Test; import org.w3c.dom.Element; import org.xml.sax.SAXException; +import javax.xml.bind.JAXBElement; import javax.xml.namespace.QName; import java.io.File; @@ -45,6 +50,7 @@ import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertNotNull; +import static org.testng.AssertJUnit.assertTrue; /** * @author semancik @@ -107,6 +113,7 @@ private void roundTrip(final String TEST_NAME, File file, QName elementName) thr System.out.println(reparsedObject.debugDump()); assertObjectTemplate(reparsedObject, elementName); + assertObjectTemplateInternals(reparsedObject, elementName); } private void assertObjectTemplate(PrismObject object, QName elementName) { @@ -129,16 +136,43 @@ private void assertObjectTemplatePrism(PrismObject object, Q assertPropertyValue(object, "name", PrismTestUtil.createPolyString("Default User Template")); assertPropertyDefinition(object, "name", PolyStringType.COMPLEX_TYPE, 0, 1); - assertPropertyDefinition(object, "mapping", MappingType.COMPLEX_TYPE, 0, -1); - + assertPropertyDefinition(object, "mapping", ObjectTemplateMappingType.COMPLEX_TYPE, 0, -1); + } - - - private void assertSerializedObject(String xml, QName elementName) { + + // checks raw values of mappings + // should be called only on reparsed values in order to catch some raw-data-related serialization issues (MID-2196) + private void assertObjectTemplateInternals(PrismObject object, QName elementName) throws SchemaException { + boolean assignmentFound = false; + for (ObjectTemplateMappingType mappingType : object.asObjectable().getMapping()) { + if (mappingType.getExpression() != null) { + if (mappingType.getTarget() != null && + mappingType.getTarget().getPath() != null && + new ItemPath(UserType.F_ASSIGNMENT).equivalent(mappingType.getTarget().getPath().getItemPath())) { + ItemDefinition assignmentDef = + PrismTestUtil.getPrismContext().getSchemaRegistry() + .findObjectDefinitionByCompileTimeClass(UserType.class) + .findItemDefinition(UserType.F_ASSIGNMENT); + for (JAXBElement evaluator : mappingType.getExpression().getExpressionEvaluator()) { + if (evaluator.getValue() instanceof RawType) { + RawType rawType = (RawType) evaluator.getValue(); + Item assignment = rawType.getParsedItem(assignmentDef); + System.out.println("assignment:\n" + assignment.debugDump()); + assignmentFound = true; + } + } + } + } + } + assertTrue("no assignment found in mapping", assignmentFound); + } + + + private void assertSerializedObject(String xml, QName elementName) { // TODO } - + private void assertPropertyDefinition(PrismContainer container, String propName, QName xsdType, int minOccurs, int maxOccurs) { diff --git a/infra/schema/src/test/java/com/evolveum/midpoint/schema/test/XPathTest.java b/infra/schema/src/test/java/com/evolveum/midpoint/schema/test/XPathTest.java index 396d4e861f4..c53d7b23cae 100644 --- a/infra/schema/src/test/java/com/evolveum/midpoint/schema/test/XPathTest.java +++ b/infra/schema/src/test/java/com/evolveum/midpoint/schema/test/XPathTest.java @@ -219,7 +219,7 @@ public void xPathFromDomNode2() throws ParserConfigurationException, SAXExceptio // Given Element el1 = parseDataGetEl1(); - String xpathString = "/:root/x:el1"; + String xpathString = "declare namespace x='http://xx.com/'; /root/x:el1"; // When diff --git a/infra/schema/src/test/resources/common/resource-opendj-no-xmlns.xml b/infra/schema/src/test/resources/common/resource-opendj-no-xmlns.xml index 2bf6eaf8636..c6ce19fb52f 100644 --- a/infra/schema/src/test/resources/common/resource-opendj-no-xmlns.xml +++ b/infra/schema/src/test/resources/common/resource-opendj-no-xmlns.xml @@ -25,7 +25,8 @@ xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance/ef2bc95b-76e0-59e2-86d6-3d4f02d3ffff" xmlns:dj="http://midpoint.evolveum.com/xml/ns/public/resource/instance/ef2bc95b-76e0-59e2-86d6-3d4f02d3ffff" xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" - xmlns:my="http://myself.me/schemas/whatever"> + xmlns:my="http://myself.me/schemas/whatever" + xmlns:mr="http://midpoint.evolveum.com/xml/ns/public/common/matching-rule-3"> @@ -498,7 +499,7 @@ This is now the only account type that midPoint can work with. --> my:defaultLocation - middle of nowhere + middle of nowhere diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/ChangeExecutor.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/ChangeExecutor.java index 2d88d1fe9ec..f1ec12f1a3d 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/ChangeExecutor.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/ChangeExecutor.java @@ -1285,8 +1285,7 @@ private void evaluateScriptArgument(ProvisioningScriptArgumentType argument, Exp // Element value = DOMUtil.createElement(SchemaConstants.C_VALUE); // value.setTextContent(val.getValue()); PrimitiveXNode prim = new PrimitiveXNode<>(); - prim.setValue(val.getValue()); - prim.setTypeQName(DOMUtil.XSD_STRING); + prim.setValue(val.getValue(), DOMUtil.XSD_STRING); JAXBElement el = new JAXBElement(SchemaConstants.C_VALUE, RawType.class, new RawType(prim, prismContext)); argument.getExpressionEvaluator().add(el); } diff --git a/model/model-impl/src/test/resources/lens/assignment-direct-expression.xml b/model/model-impl/src/test/resources/lens/assignment-direct-expression.xml index 46cbf6c260c..12dfe5c5f5a 100644 --- a/model/model-impl/src/test/resources/lens/assignment-direct-expression.xml +++ b/model/model-impl/src/test/resources/lens/assignment-direct-expression.xml @@ -15,7 +15,7 @@ ~ limitations under the License. --> - + pirate diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/negative/TestModelWebServiceNegative.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/negative/TestModelWebServiceNegative.java index 28d53838970..b4b6c2c5c2e 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/negative/TestModelWebServiceNegative.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/negative/TestModelWebServiceNegative.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; +import java.util.Map; import javax.xml.bind.JAXBException; import javax.xml.namespace.QName; @@ -225,7 +226,12 @@ public boolean isEmpty() { public String getStringValue() { return value; } - }; + + @Override + public Map getPotentiallyRelevantNamespaces() { + throw new UnsupportedOperationException(); + } + }; xnode.setValueParser(valueParser); if (type != null) { xnode.setExplicitTypeDeclaration(true); diff --git a/model/model-intest/src/test/resources/common/resource-dummy-black.xml b/model/model-intest/src/test/resources/common/resource-dummy-black.xml index 55693fc08fa..dc6a08912c0 100644 --- a/model/model-intest/src/test/resources/common/resource-dummy-black.xml +++ b/model/model-intest/src/test/resources/common/resource-dummy-black.xml @@ -19,6 +19,7 @@ xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" + xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3" xmlns:xsd="http://www.w3.org/2001/XMLSchema" diff --git a/model/model-intest/src/test/resources/common/resource-dummy-blue-deprecated.xml b/model/model-intest/src/test/resources/common/resource-dummy-blue-deprecated.xml index 8157b0ef0e6..6eea62649cf 100644 --- a/model/model-intest/src/test/resources/common/resource-dummy-blue-deprecated.xml +++ b/model/model-intest/src/test/resources/common/resource-dummy-blue-deprecated.xml @@ -22,6 +22,7 @@ xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" + xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3" xmlns:xsd="http://www.w3.org/2001/XMLSchema" diff --git a/model/model-intest/src/test/resources/common/resource-dummy-blue.xml b/model/model-intest/src/test/resources/common/resource-dummy-blue.xml index 5a10121adcc..d5db3dc99e0 100644 --- a/model/model-intest/src/test/resources/common/resource-dummy-blue.xml +++ b/model/model-intest/src/test/resources/common/resource-dummy-blue.xml @@ -22,6 +22,7 @@ xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" + xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3" xmlns:xsd="http://www.w3.org/2001/XMLSchema" diff --git a/model/model-intest/src/test/resources/common/resource-dummy-deprecated.xml b/model/model-intest/src/test/resources/common/resource-dummy-deprecated.xml index 54c6f53800c..ae2275e9a87 100644 --- a/model/model-intest/src/test/resources/common/resource-dummy-deprecated.xml +++ b/model/model-intest/src/test/resources/common/resource-dummy-deprecated.xml @@ -19,6 +19,7 @@ xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" + xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance/10000000-0000-0000-0000-000000000004" xmlns:piracy="http://midpoint.evolveum.com/xml/ns/samples/piracy" diff --git a/model/model-intest/src/test/resources/common/resource-dummy-fake.xml b/model/model-intest/src/test/resources/common/resource-dummy-fake.xml index f3bd23e3b6f..d2cd1ca25a3 100644 --- a/model/model-intest/src/test/resources/common/resource-dummy-fake.xml +++ b/model/model-intest/src/test/resources/common/resource-dummy-fake.xml @@ -19,6 +19,7 @@ xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" + xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3" xmlns:piracy="http://midpoint.evolveum.com/xml/ns/samples/piracy" diff --git a/model/model-intest/src/test/resources/common/resource-dummy-green-deprecated.xml b/model/model-intest/src/test/resources/common/resource-dummy-green-deprecated.xml index ca7094b4c9f..90b99cf93bd 100644 --- a/model/model-intest/src/test/resources/common/resource-dummy-green-deprecated.xml +++ b/model/model-intest/src/test/resources/common/resource-dummy-green-deprecated.xml @@ -21,6 +21,7 @@ xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" + xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3" xmlns:piracy="http://midpoint.evolveum.com/xml/ns/samples/piracy" diff --git a/model/model-intest/src/test/resources/common/resource-dummy-green.xml b/model/model-intest/src/test/resources/common/resource-dummy-green.xml index 6c3f71c69ee..b883b1adc4e 100644 --- a/model/model-intest/src/test/resources/common/resource-dummy-green.xml +++ b/model/model-intest/src/test/resources/common/resource-dummy-green.xml @@ -21,6 +21,7 @@ xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" + xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3" xmlns:piracy="http://midpoint.evolveum.com/xml/ns/samples/piracy" diff --git a/model/model-intest/src/test/resources/common/resource-dummy-orange.xml b/model/model-intest/src/test/resources/common/resource-dummy-orange.xml index dda59e127ba..576caedf68b 100644 --- a/model/model-intest/src/test/resources/common/resource-dummy-orange.xml +++ b/model/model-intest/src/test/resources/common/resource-dummy-orange.xml @@ -19,6 +19,7 @@ xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" + xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3" xmlns:xsd="http://www.w3.org/2001/XMLSchema" @@ -426,8 +427,7 @@ $focus/name - declare namespace t="http://prism.evolveum.com/xml/ns/public/types-3"; - t:norm + t:norm diff --git a/model/model-intest/src/test/resources/common/resource-dummy-schemaless-no-schema.xml b/model/model-intest/src/test/resources/common/resource-dummy-schemaless-no-schema.xml index 2267d006db3..c47b488b661 100644 --- a/model/model-intest/src/test/resources/common/resource-dummy-schemaless-no-schema.xml +++ b/model/model-intest/src/test/resources/common/resource-dummy-schemaless-no-schema.xml @@ -18,6 +18,7 @@ $focus/name - declare namespace t="http://prism.evolveum.com/xml/ns/public/types-3"; - t:norm + t:norm diff --git a/model/model-intest/src/test/resources/common/resource-dummy-white.xml b/model/model-intest/src/test/resources/common/resource-dummy-white.xml index 094b1f3b320..5b6d6828f1c 100644 --- a/model/model-intest/src/test/resources/common/resource-dummy-white.xml +++ b/model/model-intest/src/test/resources/common/resource-dummy-white.xml @@ -19,6 +19,7 @@ xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" + xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3" xmlns:xsd="http://www.w3.org/2001/XMLSchema" diff --git a/model/model-intest/src/test/resources/common/resource-dummy-yellow.xml b/model/model-intest/src/test/resources/common/resource-dummy-yellow.xml index 2f473eb2106..45076bf6857 100644 --- a/model/model-intest/src/test/resources/common/resource-dummy-yellow.xml +++ b/model/model-intest/src/test/resources/common/resource-dummy-yellow.xml @@ -22,6 +22,7 @@ xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" + xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance/10000000-0000-0000-0000-000000000704" xmlns:piracy="http://midpoint.evolveum.com/xml/ns/samples/piracy" diff --git a/model/model-intest/src/test/resources/common/resource-dummy.xml b/model/model-intest/src/test/resources/common/resource-dummy.xml index 1031b8f50c8..ea1355de31a 100644 --- a/model/model-intest/src/test/resources/common/resource-dummy.xml +++ b/model/model-intest/src/test/resources/common/resource-dummy.xml @@ -20,6 +20,7 @@ xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance/10000000-0000-0000-0000-000000000004" + xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" xmlns:piracy="http://midpoint.evolveum.com/xml/ns/samples/piracy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> diff --git a/model/model-intest/src/test/resources/common/user-template-complex-include.xml b/model/model-intest/src/test/resources/common/user-template-complex-include.xml index 1792fb9538f..ece1177f2c0 100644 --- a/model/model-intest/src/test/resources/common/user-template-complex-include.xml +++ b/model/model-intest/src/test/resources/common/user-template-complex-include.xml @@ -50,7 +50,7 @@ - + account diff --git a/model/model-intest/src/test/resources/common/user-template-complex.xml b/model/model-intest/src/test/resources/common/user-template-complex.xml index 753ec331f2b..06c1d672a4d 100644 --- a/model/model-intest/src/test/resources/common/user-template-complex.xml +++ b/model/model-intest/src/test/resources/common/user-template-complex.xml @@ -33,7 +33,7 @@ - + @@ -79,7 +79,7 @@ - + @@ -107,10 +107,10 @@ - c:OrgType + OrgType - c:name + name $organizationalUnit diff --git a/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/QueryInterpreterTest.java b/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/QueryInterpreterTest.java index b53c25f1216..be92632d6be 100644 --- a/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/QueryInterpreterTest.java +++ b/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/QueryInterpreterTest.java @@ -1263,7 +1263,7 @@ public void test330queryUserSubstringName() throws Exception { substring = SubstringFilter.createSubstring(ObjectType.F_NAME, ObjectType.class, prismContext, PolyStringOrigMatchingRule.NAME, "a"); count = repositoryService.countObjects(ObjectType.class, ObjectQuery.createObjectQuery(substring), result); - AssertJUnit.assertEquals(16, count); + AssertJUnit.assertEquals(17, count); } finally { close(session); } diff --git a/repo/repo-sql-impl-test/src/test/resources/basic/objects.xml b/repo/repo-sql-impl-test/src/test/resources/basic/objects.xml index 173a990f867..d1daa37e348 100644 --- a/repo/repo-sql-impl-test/src/test/resources/basic/objects.xml +++ b/repo/repo-sql-impl-test/src/test/resources/basic/objects.xml @@ -1242,4 +1242,52 @@ + + + Complex User Template Include + + + + $user/givenName + + + $user/familyName + + + + + + $user/fullName + + + + + + + + + + + + + account + + + + + assignment + + + + diff --git a/repo/repo-sql-impl-test/src/test/resources/modify/account-delete-object-change.xml b/repo/repo-sql-impl-test/src/test/resources/modify/account-delete-object-change.xml index 3d97717859c..0e46e2778b8 100644 --- a/repo/repo-sql-impl-test/src/test/resources/modify/account-delete-object-change.xml +++ b/repo/repo-sql-impl-test/src/test/resources/modify/account-delete-object-change.xml @@ -17,6 +17,7 @@ --> - $c:user/c:fullName/t:orig + $c:user/c:fullName/orig @@ -309,7 +309,7 @@ object. - $c:user/c:familyName/t:orig + $c:user/c:familyName/orig @@ -325,7 +325,7 @@ object. - $c:user/c:givenName/t:orig + $c:user/c:givenName/orig diff --git a/samples/resources/ad/ad-resource-simple.xml b/samples/resources/ad/ad-resource-simple.xml index b998760d533..82dbf654747 100644 --- a/samples/resources/ad/ad-resource-simple.xml +++ b/samples/resources/ad/ad-resource-simple.xml @@ -25,7 +25,8 @@ This resource definition contains only the very basic definitions for midPoint t --> - - -City - $user/extension/p:city + $user/extension/city @@ -230,7 +230,7 @@ This contains configuration for a federated Office 365 domain The unique non changing attribute to link this account in a federated domain - $user/extension/p:adimmutableuid + $user/extension/adimmutableuid diff --git a/samples/resources/office365/office365-managed.xml b/samples/resources/office365/office365-managed.xml index 1b565370947..8311d4460c1 100644 --- a/samples/resources/office365/office365-managed.xml +++ b/samples/resources/office365/office365-managed.xml @@ -209,7 +209,7 @@ This contains configuration for a managed (non federated) Office 365 domain City - $user/extension/p:city + $user/extension/city diff --git a/samples/samples-test/src/test/java/com/evolveum/midpoint/samples/test/TestSamples.java b/samples/samples-test/src/test/java/com/evolveum/midpoint/samples/test/TestSamples.java index 735ff642b0c..ebf5c3935e5 100644 --- a/samples/samples-test/src/test/java/com/evolveum/midpoint/samples/test/TestSamples.java +++ b/samples/samples-test/src/test/java/com/evolveum/midpoint/samples/test/TestSamples.java @@ -142,7 +142,7 @@ public void handleGlobalError(OperationResult currentResult) { validator.setHandler(handler); FileInputStream fis = new FileInputStream(file); OperationResult result = new OperationResult(RESULT_OPERATION_NAME); - + validator.validate(fis, result, OBJECT_RESULT_OPERATION_NAME); if (!result.isSuccess()) { From 5939e14f867610da63d3c19e178cf88f3cac4e4a Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Thu, 5 Feb 2015 18:33:59 +0100 Subject: [PATCH 108/215] created lookup table entity --- .../schema/constants/ObjectTypes.java | 3 + .../repo/sql/data/common/RLookupTable.java | 55 +++++++++ .../sql/data/common/id/RLookupTableRowId.java | 48 ++++++++ .../data/common/other/RLookupTableRow.java | 111 ++++++++++++++++++ .../sql/data/common/other/RObjectType.java | 3 +- .../midpoint/repo/sql/util/ClassMapper.java | 1 + 6 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RLookupTable.java create mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/id/RLookupTableRowId.java create mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RLookupTableRow.java diff --git a/infra/schema/src/main/java/com/evolveum/midpoint/schema/constants/ObjectTypes.java b/infra/schema/src/main/java/com/evolveum/midpoint/schema/constants/ObjectTypes.java index 8b28a0b9d71..fbc95c02aba 100644 --- a/infra/schema/src/main/java/com/evolveum/midpoint/schema/constants/ObjectTypes.java +++ b/infra/schema/src/main/java/com/evolveum/midpoint/schema/constants/ObjectTypes.java @@ -77,6 +77,9 @@ public enum ObjectTypes { SECURITY_POLICY(SecurityPolicyType.COMPLEX_TYPE, SchemaConstants.C_SECURITY_POLICY, SecurityPolicyType.class, ObjectManager.MODEL, "securityPolicies"), + LOOKUP_TABLE(LookupTableType.COMPLEX_TYPE, SchemaConstantsGenerated.C_LOOKUP_TABLE, LookupTableType.class, + ObjectManager.MODEL, "lookupTables"), + // as for now, this has to remain disabled (they could be used e.g. in audit logs, when the repo will support them) //WORK_ITEM(WorkItemType.COMPLEX_TYPE, SchemaConstants.C_WORK_ITEM, WorkItemType.class, ObjectManager.WORKFLOW, "workItems"), //WF_PROCESS_INSTANCE(WfProcessInstanceType.COMPLEX_TYPE, SchemaConstants.C_WF_PROCESS_INSTANCE, WfProcessInstanceType.class, ObjectManager.WORKFLOW, "wfProcessInstances"), diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RLookupTable.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RLookupTable.java new file mode 100644 index 00000000000..c093094b4db --- /dev/null +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RLookupTable.java @@ -0,0 +1,55 @@ +package com.evolveum.midpoint.repo.sql.data.common; + +import com.evolveum.midpoint.prism.PrismContext; +import com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString; +import com.evolveum.midpoint.repo.sql.data.common.other.RLookupTableRow; +import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.schema.GetOperationOptions; +import com.evolveum.midpoint.schema.SelectorOptions; +import com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType; +import org.hibernate.annotations.Cascade; +import org.hibernate.annotations.ForeignKey; + +import javax.persistence.Entity; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.UniqueConstraint; +import java.util.Collection; +import java.util.Set; + +/** + * @author Viliam Repan (lazyman) + */ +@Entity +@ForeignKey(name = "fk_lookup_table") +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_lookup_name", columnNames = {"name_norm"})) +public class RLookupTable extends RObject { + + private RPolyString name; + private Set rows; + + @OneToMany(mappedBy = "owner", orphanRemoval = true) + @Cascade({org.hibernate.annotations.CascadeType.ALL}) + public Set getRows() { + return rows; + } + + public void setRows(Set rows) { + this.rows = rows; + } + + @Override + public RPolyString getName() { + return name; + } + + @Override + public void setName(RPolyString name) { + this.name = name; + } + + @Override + public LookupTableType toJAXB(PrismContext prismContext, Collection> options) throws DtoTranslationException { + return null; + } +} diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/id/RLookupTableRowId.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/id/RLookupTableRowId.java new file mode 100644 index 00000000000..0080fac28c1 --- /dev/null +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/id/RLookupTableRowId.java @@ -0,0 +1,48 @@ +package com.evolveum.midpoint.repo.sql.data.common.id; + +import java.io.Serializable; + +/** + * @author Viliam Repan (lazyman) + */ +public class RLookupTableRowId implements Serializable { + + private String ownerOid; + private String key; + + public String getOwnerOid() { + return ownerOid; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public void setOwnerOid(String ownerOid) { + this.ownerOid = ownerOid; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + RLookupTableRowId that = (RLookupTableRowId) o; + + if (key != null ? !key.equals(that.key) : that.key != null) return false; + if (ownerOid != null ? !ownerOid.equals(that.ownerOid) : that.ownerOid != null) return false; + + return true; + } + + @Override + public int hashCode() { + int result = ownerOid != null ? ownerOid.hashCode() : 0; + result = 31 * result + (key != null ? key.hashCode() : 0); + return result; + } +} diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RLookupTableRow.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RLookupTableRow.java new file mode 100644 index 00000000000..a36edf387df --- /dev/null +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RLookupTableRow.java @@ -0,0 +1,111 @@ +package com.evolveum.midpoint.repo.sql.data.common.other; + +import com.evolveum.midpoint.repo.sql.data.common.RLookupTable; +import com.evolveum.midpoint.repo.sql.data.common.RUser; +import com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString; +import com.evolveum.midpoint.repo.sql.data.common.id.RLookupTableRowId; +import com.evolveum.midpoint.repo.sql.util.RUtil; +import org.hibernate.annotations.ForeignKey; + +import javax.persistence.*; +import java.sql.Timestamp; + +/** + * @author Viliam Repan (lazyman) + */ +@Entity +@IdClass(RLookupTableRowId.class) +public class RLookupTableRow { + + private RLookupTable owner; + private String ownerOid; + + private String key; + private String value; + private RPolyString label; + private Timestamp lastChangeTimestamp; + + @Id + @ForeignKey(name = "fk_lookup_table") + @MapsId("owner") + @ManyToOne(fetch = FetchType.LAZY) + public RLookupTable getOwner() { + return owner; + } + + @Id + @Column(name = "owner_oid", length = RUtil.COLUMN_LENGTH_OID) + public String getOwnerOid() { + if (ownerOid == null && owner != null) { + ownerOid = owner.getOid(); + } + return ownerOid; + } + + @Id + @Column(name = "key") + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public RPolyString getLabel() { + return label; + } + + public void setLabel(RPolyString label) { + this.label = label; + } + + public Timestamp getLastChangeTimestamp() { + return lastChangeTimestamp; + } + + public void setLastChangeTimestamp(Timestamp lastChangeTimestamp) { + this.lastChangeTimestamp = lastChangeTimestamp; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public void setOwner(RLookupTable owner) { + this.owner = owner; + } + + public void setOwnerOid(String ownerOid) { + this.ownerOid = ownerOid; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + RLookupTableRow that = (RLookupTableRow) o; + + if (key != null ? !key.equals(that.key) : that.key != null) return false; + if (label != null ? !label.equals(that.label) : that.label != null) return false; + if (lastChangeTimestamp != null ? !lastChangeTimestamp.equals(that.lastChangeTimestamp) : that.lastChangeTimestamp != null) + return false; + if (value != null ? !value.equals(that.value) : that.value != null) return false; + + return true; + } + + @Override + public int hashCode() { + int result = key != null ? key.hashCode() : 0; + result = 31 * result + (value != null ? value.hashCode() : 0); + result = 31 * result + (label != null ? label.hashCode() : 0); + result = 31 * result + (lastChangeTimestamp != null ? lastChangeTimestamp.hashCode() : 0); + return result; + } +} diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RObjectType.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RObjectType.java index d48cba0f86a..31a39671039 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RObjectType.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RObjectType.java @@ -25,7 +25,8 @@ public enum RObjectType { ORG(ROrg.class), ABSTRACT_ROLE(RAbstractRole.class), FOCUS(RFocus.class), - SECURITY_POLICY(RSecurityPolicy.class); + SECURITY_POLICY(RSecurityPolicy.class), + LOOKUP_TABLE(RLookupTable.class); private Class clazz; diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/ClassMapper.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/ClassMapper.java index f3e13d71857..f47e25fd021 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/ClassMapper.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/ClassMapper.java @@ -59,6 +59,7 @@ private ClassMapper() { types.put(ObjectTypes.ABSTRACT_ROLE, RObjectType.ABSTRACT_ROLE); types.put(ObjectTypes.FOCUS_TYPE, RObjectType.FOCUS); types.put(ObjectTypes.SECURITY_POLICY, RObjectType.SECURITY_POLICY); + types.put(ObjectTypes.LOOKUP_TABLE, RObjectType.LOOKUP_TABLE); for (ObjectTypes type : ObjectTypes.values()) { if (!types.containsKey(type)) { From 9383ff2766df82ff6c9a80d469dcfd98e35fce45 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Fri, 6 Feb 2015 09:25:00 +0100 Subject: [PATCH 109/215] Default namespace is no longer used when parsing and serializing QNames. Plus a bunch of related fixes and tests. Introduced "safe mode" that turns on tolerance to undeclared prefixes. --- .../api/MidpointConfiguration.java | 2 + .../midpoint/prism/PrismReferenceValue.java | 12 +- .../midpoint/prism/parser/DomSerializer.java | 2 +- .../midpoint/prism/schema/SchemaRegistry.java | 18 +- .../midpoint/prism/xml/XmlTypeConverter.java | 20 +- .../schema/TestParseObjectTemplate.java | 6 +- .../schema/TestParsePasswordPolicy.java | 154 +++++++++++++ .../test/resources/common/password-policy.xml | 101 +++++++++ .../object-template/object-template.xml | 6 + .../object-template/user-template.xml | 10 +- infra/schema/testng.xml | 1 + .../com/evolveum/midpoint/util/DOMUtil.java | 202 ++++++++---------- .../com/evolveum/midpoint/util/QNameUtil.java | 4 + .../evolveum/midpoint/util/DOMUtilTest.java | 81 ++++++- .../model/common/expression/Expression.java | 6 +- .../AbstractSearchExpressionEvaluator.java | 5 + .../model/common/mapping/Mapping.java | 9 +- .../midpoint/repo/sql/util/ClassMapper.java | 3 +- .../security/impl/SecurityEnforcerImpl.java | 3 +- .../midpoint/init/StartupConfiguration.java | 16 ++ .../schema/xjc/schema/SchemaProcessor.java | 1 + 21 files changed, 516 insertions(+), 146 deletions(-) create mode 100644 infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParsePasswordPolicy.java create mode 100644 infra/schema/src/test/resources/common/password-policy.xml diff --git a/infra/common/src/main/java/com/evolveum/midpoint/common/configuration/api/MidpointConfiguration.java b/infra/common/src/main/java/com/evolveum/midpoint/common/configuration/api/MidpointConfiguration.java index c8cf284a554..34e4df1d133 100644 --- a/infra/common/src/main/java/com/evolveum/midpoint/common/configuration/api/MidpointConfiguration.java +++ b/infra/common/src/main/java/com/evolveum/midpoint/common/configuration/api/MidpointConfiguration.java @@ -63,4 +63,6 @@ public interface MidpointConfiguration { * @return */ Document getXmlConfigAsDocument(); + + boolean isSafeMode(); } diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismReferenceValue.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismReferenceValue.java index ab366105216..2d2c857e24b 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismReferenceValue.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismReferenceValue.java @@ -128,12 +128,20 @@ public Class getTargetTypeCompileTimeClass() { } } - public void setTargetType(QName targetType) { + public void setTargetType(QName targetType) { + setTargetType(targetType, false); + } + + /** + * @param targetType + * @param allowEmptyNamespace This is an ugly hack. See comment in DOMUtil.validateNonEmptyQName. + */ + public void setTargetType(QName targetType, boolean allowEmptyNamespace) { // Null value is OK if (targetType != null) { // But non-empty is not .. Itemable item = getParent(); - DOMUtil.validateNonEmptyQName(targetType, " in target type in reference "+ (item == null ? "(unknown)" : item.getElementName())); + DOMUtil.validateNonEmptyQName(targetType, " in target type in reference "+ (item == null ? "(unknown)" : item.getElementName()), allowEmptyNamespace); } this.targetType = targetType; } diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/DomSerializer.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/DomSerializer.java index 6bcfda6aa93..099e82d5394 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/DomSerializer.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/DomSerializer.java @@ -253,7 +253,7 @@ private void serializePrimitiveElementOrAttribute(PrimitiveXNode xprim, Eleme } if (typeQName.equals(DOMUtil.XSD_QNAME)) { - QName value = (QName) xprim.getParsedValueWithoutRecording(typeQName); + QName value = (QName) xprim.getParsedValueWithoutRecording(DOMUtil.XSD_QNAME); if (asAttribute) { try { DOMUtil.setQNameAttribute(parentElement, elementOrAttributeName.getLocalPart(), value); diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/schema/SchemaRegistry.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/schema/SchemaRegistry.java index 1355bee0c5e..9dc660c55a1 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/schema/SchemaRegistry.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/schema/SchemaRegistry.java @@ -32,7 +32,6 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.Set; import javax.xml.XMLConstants; import javax.xml.namespace.QName; @@ -42,7 +41,6 @@ import com.evolveum.midpoint.prism.*; import com.evolveum.midpoint.util.QNameUtil; -import com.sun.xml.bind.v2.schemagen.xmlschema.ComplexType; import org.apache.commons.lang.StringUtils; import org.apache.xml.resolver.Catalog; import org.apache.xml.resolver.CatalogManager; @@ -66,7 +64,6 @@ import com.evolveum.midpoint.util.DebugUtil; import com.evolveum.midpoint.util.JAXBUtil; import com.evolveum.midpoint.util.exception.SchemaException; -import com.evolveum.midpoint.util.logging.LoggingUtils; import com.evolveum.midpoint.util.logging.Trace; import com.evolveum.midpoint.util.logging.TraceManager; @@ -602,6 +599,13 @@ public QName resolveUnqualifiedTypeName(QName type) throws SchemaException { } } + public QName qualifyTypeName(QName typeName) throws SchemaException { + if (typeName == null || !QNameUtil.isUnqualified(typeName)) { + return typeName; + } + return resolveUnqualifiedTypeName(typeName); + } + class Input implements LSInput { private String publicId; @@ -863,7 +867,13 @@ public PrismObjectDefinition findObjectDefinitionByEle public PrismContainerDefinition findContainerDefinitionByType(QName typeName) { if (StringUtils.isEmpty(typeName.getNamespaceURI())) { - return resolveGlobalItemDefinitionWithoutNamespace(typeName.getLocalPart(), PrismContainerDefinition.class); + // Maybe not optimal but sufficient way: we resolve complex type definition, and from it we get qualified type name. + // This is then used to find container definition in the traditional way. + ComplexTypeDefinition complexTypeDefinition = resolveGlobalTypeDefinitionWithoutNamespace(typeName.getLocalPart()); + if (complexTypeDefinition == null) { + return null; + } + typeName = complexTypeDefinition.getTypeName(); } PrismSchema schema = findSchemaByNamespace(typeName.getNamespaceURI()); if (schema == null) { diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/xml/XmlTypeConverter.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/xml/XmlTypeConverter.java index d85c11b35c2..453d92be8af 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/xml/XmlTypeConverter.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/xml/XmlTypeConverter.java @@ -192,7 +192,7 @@ public static Object toJavaValue(Element xmlElement) throws SchemaException { * @throws SchemaException if no xsi:type or default type specified */ public static TypedValue toTypedJavaValueWithDefaultType(Element xmlElement, QName defaultType) throws SchemaException { - QName xsiType = DOMUtil.resolveXsiType(xmlElement, null); + QName xsiType = DOMUtil.resolveXsiType(xmlElement); if (xsiType == null) { xsiType = defaultType; if (xsiType == null) { @@ -241,18 +241,14 @@ public static Object toXsdElement(Object val, QName elementName, Document doc, b if (type == null) { throw new IllegalArgumentException("No type mapping for conversion: " + val.getClass() + "(element " + elementName + ")"); } -// if (JAXBUtil.isJaxbClass(type)) { -// JAXBElement jaxbElement = new JAXBElement(elementName, type, val); -// return jaxbElement; -// } else { - if (doc == null) { - doc = DOMUtil.getDocument(); - } - Element element = doc.createElementNS(elementName.getNamespaceURI(), elementName.getLocalPart()); - //TODO: switch to global namespace prefixes map + if (doc == null) { + doc = DOMUtil.getDocument(); + } + Element element = doc.createElementNS(elementName.getNamespaceURI(), elementName.getLocalPart()); + //TODO: switch to global namespace prefixes map // element.setPrefix(MidPointNamespacePrefixMapper.getPreferredPrefix(elementName.getNamespaceURI())); - toXsdElement(val, element, recordType); - return element; + toXsdElement(val, element, recordType); + return element; } public static void toXsdElement(Object val, Element element, boolean recordType) throws SchemaException { diff --git a/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseObjectTemplate.java b/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseObjectTemplate.java index e4c90694975..3203d289a8e 100644 --- a/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseObjectTemplate.java +++ b/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseObjectTemplate.java @@ -143,7 +143,7 @@ private void assertObjectTemplatePrism(PrismObject object, Q // checks raw values of mappings // should be called only on reparsed values in order to catch some raw-data-related serialization issues (MID-2196) private void assertObjectTemplateInternals(PrismObject object, QName elementName) throws SchemaException { - boolean assignmentFound = false; + int assignmentValuesFound = 0; for (ObjectTemplateMappingType mappingType : object.asObjectable().getMapping()) { if (mappingType.getExpression() != null) { if (mappingType.getTarget() != null && @@ -158,13 +158,13 @@ private void assertObjectTemplateInternals(PrismObject objec RawType rawType = (RawType) evaluator.getValue(); Item assignment = rawType.getParsedItem(assignmentDef); System.out.println("assignment:\n" + assignment.debugDump()); - assignmentFound = true; + assignmentValuesFound++; } } } } } - assertTrue("no assignment found in mapping", assignmentFound); + assertEquals("wrong # of assignment values found in mapping", 2, assignmentValuesFound); } diff --git a/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParsePasswordPolicy.java b/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParsePasswordPolicy.java new file mode 100644 index 00000000000..f3e7d7bde79 --- /dev/null +++ b/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParsePasswordPolicy.java @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2010-2015 Evolveum + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.evolveum.midpoint.schema; + +import com.evolveum.midpoint.prism.PrismContainer; +import com.evolveum.midpoint.prism.PrismContainerValue; +import com.evolveum.midpoint.prism.PrismContext; +import com.evolveum.midpoint.prism.PrismObject; +import com.evolveum.midpoint.prism.PrismObjectDefinition; +import com.evolveum.midpoint.prism.PrismProperty; +import com.evolveum.midpoint.prism.PrismPropertyValue; +import com.evolveum.midpoint.prism.delta.ObjectDelta; +import com.evolveum.midpoint.prism.util.PrismAsserts; +import com.evolveum.midpoint.prism.util.PrismTestUtil; +import com.evolveum.midpoint.schema.constants.MidPointConstants; +import com.evolveum.midpoint.util.DOMUtil; +import com.evolveum.midpoint.util.JAXBUtil; +import com.evolveum.midpoint.util.PrettyPrinter; +import com.evolveum.midpoint.util.exception.SchemaException; +import com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordCredentialsPolicyType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskExecutionStatusType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ValuePolicyType; +import com.evolveum.prism.xml.ns._public.types_3.PolyStringType; +import org.testng.annotations.BeforeSuite; +import org.testng.annotations.Test; +import org.xml.sax.SAXException; + +import javax.xml.namespace.QName; +import java.io.File; +import java.io.IOException; + +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertNotNull; +import static org.testng.AssertJUnit.assertNull; +import static org.testng.AssertJUnit.assertTrue; + +/** + * @author semancik + * @author mederly + * + */ +public class TestParsePasswordPolicy { + + public static final File FILE = new File("src/test/resources/common/password-policy.xml"); + + @BeforeSuite + public void setup() throws SchemaException, SAXException, IOException { + PrettyPrinter.setDefaultNamespacePrefix(MidPointConstants.NS_MIDPOINT_PUBLIC_PREFIX); + PrismTestUtil.resetPrismContext(MidPointPrismContextFactory.FACTORY); + } + + + @Test + public void testParsePasswordPolicyFile() throws Exception { + System.out.println("===[ testParsePasswordPolicyFile ]==="); + + // GIVEN + PrismContext prismContext = PrismTestUtil.getPrismContext(); + + // WHEN + PrismObject policy = prismContext.parseObject(FILE, PrismContext.LANG_XML); + + // THEN + System.out.println("Parsed policy:"); + System.out.println(policy.debugDump()); + + assertPolicy(policy); + } + + @Test + public void testParsePolicyRoundtrip() throws Exception { + System.out.println("===[ testParsePolicyRoundtrip ]==="); + + // GIVEN + PrismContext prismContext = PrismTestUtil.getPrismContext(); + + PrismObject policy = prismContext.parseObject(FILE); + + System.out.println("Parsed policy:"); + System.out.println(policy.debugDump()); + + assertPolicy(policy); + + // SERIALIZE + + String serializedPolicy = prismContext.serializeObjectToString(policy, PrismContext.LANG_XML); + + System.out.println("serialized policy:"); + System.out.println(serializedPolicy); + + // RE-PARSE + + PrismObject reparsedPolicy = prismContext.parseObject(serializedPolicy); + + System.out.println("Re-parsed policy:"); + System.out.println(reparsedPolicy.debugDump()); + + // Cannot assert here. It will cause parsing of some of the raw values and diff will fail + assertPolicy(reparsedPolicy); + + ObjectDelta objectDelta = policy.diff(reparsedPolicy); + System.out.println("Delta:"); + System.out.println(objectDelta.debugDump()); + assertTrue("Delta is not empty", objectDelta.isEmpty()); + + PrismAsserts.assertEquivalent("Policy re-parsed equivalence", policy, reparsedPolicy); + } + + private void assertPolicy(PrismObject policy) { + + policy.checkConsistence(); + + assertEquals("Wrong oid", "00000000-0000-0000-0000-000000000003", policy.getOid()); + PrismObjectDefinition usedDefinition = policy.getDefinition(); + assertNotNull("No definition", usedDefinition); + PrismAsserts.assertObjectDefinition(usedDefinition, new QName(SchemaConstantsGenerated.NS_COMMON, "valuePolicy"), + ValuePolicyType.COMPLEX_TYPE, ValuePolicyType.class); + assertEquals("Wrong class in task", ValuePolicyType.class, policy.getCompileTimeClass()); + ValuePolicyType policyType = policy.asObjectable(); + assertNotNull("asObjectable resulted in null", policyType); + + assertPropertyValue(policy, "name", PrismTestUtil.createPolyString("Testing Complex Password Policy")); + assertPropertyDefinition(policy, "name", PolyStringType.COMPLEX_TYPE, 0, 1); + + // TODO... + } + + private void assertPropertyDefinition(PrismContainer container, String propName, QName xsdType, int minOccurs, + int maxOccurs) { + QName propQName = new QName(SchemaConstantsGenerated.NS_COMMON, propName); + PrismAsserts.assertPropertyDefinition(container, propQName, xsdType, minOccurs, maxOccurs); + } + + public static void assertPropertyValue(PrismContainer container, String propName, Object propValue) { + QName propQName = new QName(SchemaConstantsGenerated.NS_COMMON, propName); + PrismAsserts.assertPropertyValue(container, propQName, propValue); + } + +} diff --git a/infra/schema/src/test/resources/common/password-policy.xml b/infra/schema/src/test/resources/common/password-policy.xml new file mode 100644 index 00000000000..e38c239d8ee --- /dev/null +++ b/infra/schema/src/test/resources/common/password-policy.xml @@ -0,0 +1,101 @@ + + + + + Testing Complex Password Policy + Testing complex password policy + + 999 + 9 + 0 + 0 + 0 + + + Testing string policy + + 5 + 8 + 3 + true + + + extreme + 1 + 2 + true + + 345678 + + + + Alphas + 1 + 2 + false + + + + Numbers + 1 + 2 + false + + + + Lowers + 1 + 2 + false + + + + Specials + 1 + 2 + false + + + + Alphanum + 1 + 3 + false + + + + + + + + abcd + + + ABCD + + + + 1234 + + + + !@#$%+* + + + + \ No newline at end of file diff --git a/infra/schema/src/test/resources/object-template/object-template.xml b/infra/schema/src/test/resources/object-template/object-template.xml index 5e8e1adfbc1..85584843cfc 100644 --- a/infra/schema/src/test/resources/object-template/object-template.xml +++ b/infra/schema/src/test/resources/object-template/object-template.xml @@ -49,6 +49,12 @@ account + + + + account + + assignment diff --git a/infra/schema/src/test/resources/object-template/user-template.xml b/infra/schema/src/test/resources/object-template/user-template.xml index 750adac19a2..1d5e12e697a 100644 --- a/infra/schema/src/test/resources/object-template/user-template.xml +++ b/infra/schema/src/test/resources/object-template/user-template.xml @@ -25,7 +25,7 @@ weak - givenName + c:givenName $user/givenName @@ -49,7 +49,13 @@ - + + account + + + + + account diff --git a/infra/schema/testng.xml b/infra/schema/testng.xml index d27c7a425e3..bb36e3f7c60 100644 --- a/infra/schema/testng.xml +++ b/infra/schema/testng.xml @@ -27,6 +27,7 @@ + diff --git a/infra/util/src/main/java/com/evolveum/midpoint/util/DOMUtil.java b/infra/util/src/main/java/com/evolveum/midpoint/util/DOMUtil.java index 7b10209f78b..2a1dc9c2a50 100644 --- a/infra/util/src/main/java/com/evolveum/midpoint/util/DOMUtil.java +++ b/infra/util/src/main/java/com/evolveum/midpoint/util/DOMUtil.java @@ -32,6 +32,7 @@ import java.util.Map.Entry; import java.util.Random; +import javax.xml.XMLConstants; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -451,20 +452,19 @@ public static QName resolveQName(Element element) { return resolveQName(element, element.getTextContent()); } - public static QName resolveQName(Node domNode, String prefixNotation) { - return resolveQName(domNode, prefixNotation, null); - } - /** * Resolves a QName. * - * @param domNode Provides a context in which we will resolve namespace prefixes - * @param qnameStringRepresentation String representation of a QName (e.g. c:RoleType) + * @param domNode Provides a context in which we will resolve namespace prefixes (may be null) + * @param qnameStringRepresentation String representation of a QName (e.g. c:RoleType) (may be null) * * @return parsed QName (or null if string representation is blank) + * + * Contrary to traditional XML handling, a QName without prefix is parsed to a QName without namespace, + * even if default namespace declaration is present. */ - public static QName resolveQName(Node domNode, String qnameStringRepresentation, String defaultNamespacePrefix) { + public static QName resolveQName(Node domNode, String qnameStringRepresentation) { if (StringUtils.isBlank(qnameStringRepresentation)) { // No QName return null; @@ -476,13 +476,8 @@ public static QName resolveQName(Node domNode, String qnameStringRepresentation, } QName qname; if (qnameArray.length == 1 || qnameArray[1] == null || qnameArray[1].isEmpty()) { - // default namespace <= empty prefix - String namespace = findNamespace(domNode, null); - if (defaultNamespacePrefix != null) { - qname = new QName(namespace, qnameArray[0], defaultNamespacePrefix); - } else { - qname = new QName(namespace, qnameArray[0]); - } + // no prefix => no namespace + qname = new QName(null, qnameArray[0]); } else { String namespace = findNamespace(domNode, qnameArray[0]); if (namespace == null) { @@ -518,10 +513,6 @@ public static String findNamespace(Node domNode, String prefix) { } public static QName resolveXsiType(Element element) { - return resolveXsiType(element, null); - } - - public static QName resolveXsiType(Element element, String defaultNamespacePrefix) { String xsiType = element.getAttributeNS(XSI_TYPE.getNamespaceURI(), XSI_TYPE.getLocalPart()); if (xsiType == null || xsiType.isEmpty()) { xsiType = element.getAttribute(HACKED_XSI_TYPE); @@ -529,7 +520,7 @@ public static QName resolveXsiType(Element element, String defaultNamespacePrefi if (xsiType == null || xsiType.isEmpty()) { return null; } - return resolveQName(element, xsiType, defaultNamespacePrefix); + return resolveQName(element, xsiType); } public static boolean hasXsiType(Element element) { @@ -554,7 +545,7 @@ public static void setQNameAttribute(Element element, QName attributeName, QName Document doc = element.getOwnerDocument(); Attr attr = doc.createAttributeNS(attributeName.getNamespaceURI(), attributeName.getLocalPart()); String namePrefix = lookupOrCreateNamespaceDeclaration(element, attributeName.getNamespaceURI(), - attributeName.getPrefix()); + attributeName.getPrefix(), element, true); attr.setPrefix(namePrefix); setQNameAttribute(element, attr, attributeValue, element); } @@ -570,7 +561,7 @@ public static void setQNameAttribute(Element element, QName attributeName, QName Document doc = element.getOwnerDocument(); Attr attr = doc.createAttributeNS(attributeName.getNamespaceURI(), attributeName.getLocalPart()); String namePrefix = lookupOrCreateNamespaceDeclaration(element, attributeName.getNamespaceURI(), - attributeName.getPrefix()); + attributeName.getPrefix(), element, true); attr.setPrefix(namePrefix); setQNameAttribute(element, attr, attributeValue, definitionElement); } @@ -582,56 +573,79 @@ public static void setQNameAttribute(Element element, String attributeName, QNam setQNameAttribute(element, attr, attributeValue, definitionElement); } - private static void setQNameAttribute(Element element, Attr attr, QName attributeValue, - Element definitionElement) { - if (attributeValue.getNamespaceURI() == null || attributeValue.getNamespaceURI().isEmpty()) { - throw new IllegalArgumentException("Namespace of XML attribute value " + attributeValue - + " is empty"); - } - String valuePrefix = lookupOrCreateNamespaceDeclaration(element, attributeValue.getNamespaceURI(), - attributeValue.getPrefix(), definitionElement); - String attrValue = null; - if (valuePrefix == null || valuePrefix.isEmpty()) { - // default namespace - attrValue = attributeValue.getLocalPart(); - } else { - attrValue = valuePrefix + ":" + attributeValue.getLocalPart(); - } + /* + * Actually, it is not possible to create *and use* xmlns declaration pointing to an empty URI. From Section 6.1 in http://www.w3.org/TR/xml-names11/ + * + * + * + * + * + * + * + * + * + * + * + * + * We strictly use localname-only representation of QNames with null NS. When writing, we write it in such a way. + * And when reading, we ignore default namespace when parsing unqualified QNames. + */ + private static void setQNameAttribute(Element element, Attr attr, QName attributeQnameValue, Element definitionElement) { + String attributeStringValue; + + if (attributeQnameValue == null) { + attributeStringValue = ""; + } else if (XMLConstants.NULL_NS_URI.equals(attributeQnameValue.getNamespaceURI())) { + attributeStringValue = attributeQnameValue.getLocalPart(); + } else { + String valuePrefix = lookupOrCreateNamespaceDeclaration(element, attributeQnameValue.getNamespaceURI(), + attributeQnameValue.getPrefix(), definitionElement, false); + assert StringUtils.isNotBlank(valuePrefix); + attributeStringValue = valuePrefix + ":" + attributeQnameValue.getLocalPart(); + } + NamedNodeMap attributes = element.getAttributes(); - checkValidXmlChars(attrValue); - attr.setValue(attrValue); + checkValidXmlChars(attributeStringValue); + attr.setValue(attributeStringValue); attributes.setNamedItem(attr); } + /** + * Sets QName value for a given element. + * + * Contrary to standard XML semantics, namespace-less QNames are specified as simple names without prefix + * (regardless of default prefix used in the XML document). + * + * @param element Element whose text content should be set to represent QName value + * @param elementValue QName value to be stored into the element + */ public static void setQNameValue(Element element, QName elementValue) { - String valuePrefix = lookupOrCreateNamespaceDeclaration(element, elementValue.getNamespaceURI(), - elementValue.getPrefix()); - String stringValue = null; - if (valuePrefix == null || valuePrefix.isEmpty()) { - // default namespace - stringValue = elementValue.getLocalPart(); - } else { - stringValue = valuePrefix + ":" + elementValue.getLocalPart(); - } - setElementTextContent(element, stringValue); - } - - public static String lookupOrCreateNamespaceDeclaration(Element element, String namespaceUri, - String preferredPrefix) { - return lookupOrCreateNamespaceDeclaration(element, namespaceUri, preferredPrefix, element); + if (elementValue == null) { + setElementTextContent(element, ""); + } else if (XMLConstants.NULL_NS_URI.equals(elementValue.getNamespaceURI())) { + setElementTextContent(element, elementValue.getLocalPart()); + } else { + String prefix = lookupOrCreateNamespaceDeclaration(element, elementValue.getNamespaceURI(), + elementValue.getPrefix(), element, false); + assert StringUtils.isNotBlank(prefix); + String stringValue = prefix + ":" + elementValue.getLocalPart(); + setElementTextContent(element, stringValue); + } } /** - * * @param element Element, on which the namespace declaration is evaluated * @param namespaceUri Namespace URI to be assigned to a prefix * @param preferredPrefix Preferred prefix * @param definitionElement Element, on which namespace declaration will be created (there should not be any redefinitions between definitionElement and element in order for this to work...) + * @param allowUseOfDefaultNamespace If we are allowed to use default namespace (i.e. return empty prefix). This is important for QNames, see setQNameValue * @return prefix that is really used + * + * Returned prefix is never null nor "" if allowUseOfDefaultNamespace is false. */ public static String lookupOrCreateNamespaceDeclaration(Element element, String namespaceUri, - String preferredPrefix, Element definitionElement) { + String preferredPrefix, Element definitionElement, boolean allowUseOfDefaultNamespace) { // We need to figure out correct prefix. We have namespace URI, but we // need a prefix to specify in the xsi:type or element name if (!StringUtils.isBlank(preferredPrefix)) { @@ -649,57 +663,27 @@ public static String lookupOrCreateNamespaceDeclaration(Element element, String } } } - if (element.isDefaultNamespace(namespaceUri)) { - // Namespace URI is a default namespace. Return empty prefix; - return ""; - } + if (allowUseOfDefaultNamespace && element.isDefaultNamespace(namespaceUri)) { + // Namespace URI is a default namespace. Return empty prefix; + return ""; + } + // We DO NOT WANT to use default namespace for QNames. QNames without prefix are NOT considered by midPoint to belong to the default namespace. String prefix = element.lookupPrefix(namespaceUri); if (prefix == null) { - // try to use preferred prefix from QName - prefix = preferredPrefix; - if (prefix != null) { - // check if a declaration for it exists - String namespaceDefinedForPreferredPrefix = element.lookupNamespaceURI(prefix); - if (namespaceDefinedForPreferredPrefix == null - || namespaceDefinedForPreferredPrefix.isEmpty()) { - // No namespace definition for preferred prefix. So let's - // use it .. unless is is default namespace - if (prefix.isEmpty()) { - // Default namespace. Never generate definition for - // default namespace unless there is already one. - // This will trigger auto-generated prefix later - prefix = null; - } else { - setNamespaceDeclaration(definitionElement, prefix, namespaceUri); - } - } else if (namespaceUri.equals(namespaceDefinedForPreferredPrefix)) { - // Nothing to do, prefix already defined and the definition - // matches. - // The question is how this could happen. Why has - // element.lookupPrefix() haven't found it? - } else { - // prefix already defined, but the URI is different. - // Fallback to a random prefix. - prefix = null; - } - } - // Empty prefix means default namespace - if (prefix == null) { - // generate random prefix - boolean gotIt = false; - for(int i=0; i < RANDOM_ATTR_PREFIX_MAX_ITERATIONS; i++) { - prefix = generatePrefix(); - if (element.lookupNamespaceURI(prefix) == null) { - // the prefix is free - gotIt = true; - break; - } - } - if (!gotIt) { - throw new IllegalStateException("Unable to generate unique prefix for namespace "+namespaceUri+" even after "+RANDOM_ATTR_PREFIX_MAX_ITERATIONS+" attempts"); - } - setNamespaceDeclaration(definitionElement, prefix, namespaceUri); - } + // generate random prefix + boolean gotIt = false; + for (int i=0; i < RANDOM_ATTR_PREFIX_MAX_ITERATIONS; i++) { + prefix = generatePrefix(); + if (element.lookupNamespaceURI(prefix) == null) { + // the prefix is free + gotIt = true; + break; + } + } + if (!gotIt) { + throw new IllegalStateException("Unable to generate unique prefix for namespace "+namespaceUri+" even after "+RANDOM_ATTR_PREFIX_MAX_ITERATIONS+" attempts"); + } + setNamespaceDeclaration(definitionElement, prefix, namespaceUri); } return prefix; } @@ -1060,7 +1044,7 @@ public static Element createElement(Document document, QName qname) { public static Element createElement(Document document, QName qname, Element parentElement, Element definitionElement) { lookupOrCreateNamespaceDeclaration(parentElement, qname.getNamespaceURI(), qname.getPrefix(), - definitionElement); + definitionElement, true); return createElement(document, qname); } @@ -1245,11 +1229,15 @@ public static boolean isJunk(Node node) { return false; } - public static void validateNonEmptyQName(QName qname, String shortDescription) { + public static void validateNonEmptyQName(QName qname, String shortDescription, boolean allowEmptyNamespace) { if (qname == null) { throw new IllegalArgumentException("null" + shortDescription); } - if (StringUtils.isEmpty(qname.getNamespaceURI())) { + // This is hard to enforce. There are situations where unmarshalling + // object reference types as ObjectReferenceType, not as prism references. + // (E.g. when dealing with reference variables in mappigns/expressions.) + // In these cases we need to qualify types after the unmarshalling is complete. + if (!allowEmptyNamespace && StringUtils.isEmpty(qname.getNamespaceURI())) { throw new IllegalArgumentException("Missing namespace"+shortDescription); } if (StringUtils.isEmpty(qname.getLocalPart())) { diff --git a/infra/util/src/main/java/com/evolveum/midpoint/util/QNameUtil.java b/infra/util/src/main/java/com/evolveum/midpoint/util/QNameUtil.java index 37e6bca6009..81e7d303f34 100644 --- a/infra/util/src/main/java/com/evolveum/midpoint/util/QNameUtil.java +++ b/infra/util/src/main/java/com/evolveum/midpoint/util/QNameUtil.java @@ -156,4 +156,8 @@ public static Collection createCollection(QName... qnames) { public static QName nullNamespace(QName qname) { return new QName(null, qname.getLocalPart(), qname.getPrefix()); } + + public static boolean isUnqualified(QName targetTypeQName) { + return StringUtils.isBlank(targetTypeQName.getNamespaceURI()); + } } diff --git a/infra/util/src/test/java/com/evolveum/midpoint/util/DOMUtilTest.java b/infra/util/src/test/java/com/evolveum/midpoint/util/DOMUtilTest.java index d65858c7056..38d165e76cc 100644 --- a/infra/util/src/test/java/com/evolveum/midpoint/util/DOMUtilTest.java +++ b/infra/util/src/test/java/com/evolveum/midpoint/util/DOMUtilTest.java @@ -24,6 +24,7 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; +import javax.xml.XMLConstants; import javax.xml.namespace.QName; /** @@ -102,7 +103,7 @@ public void testQNameDefaultNamespace1() { // GIVEN Document doc = DOMUtil.getDocument(); - QName in = new QName(DEFAULT_NS,QNAME_IN_LOCAL); + QName in = new QName(DEFAULT_NS, QNAME_IN_LOCAL); Element topElement = doc.createElementNS(DEFAULT_NS, ELEMENT_TOP_LOCAL); // Make sure there is a default ns declaration DOMUtil.setNamespaceDeclaration(topElement,"",DEFAULT_NS); @@ -124,12 +125,76 @@ public void testQNameDefaultNamespace1() { System.out.println(DOMUtil.serializeDOMToString(topElement)); String content = e.getTextContent(); - // Default namespace should be reused - AssertJUnit.assertFalse(content.contains(":")); - AssertJUnit.assertEquals(QNAME_IN_LOCAL, content); + // Default namespace should NOT be reused + AssertJUnit.assertTrue(content.contains(":")); + AssertJUnit.assertTrue(content.contains(":" + QNAME_IN_LOCAL)); } - - @Test + + @Test + public void testQNameDefaultNamespace2() { + System.out.println("===[ testQNameDefaultNamespace2 ]==="); + // GIVEN + Document doc = DOMUtil.getDocument(); + + QName in = new QName(DEFAULT_NS, QNAME_IN_LOCAL, "f"); // the difference w.r.t. testQNameDefaultNamespace1 + Element topElement = doc.createElementNS(DEFAULT_NS, ELEMENT_TOP_LOCAL); + // Make sure there is a default ns declaration + DOMUtil.setNamespaceDeclaration(topElement,"",DEFAULT_NS); + DOMUtil.setNamespaceDeclaration(topElement,"e",ELEMENT_NS); + doc.appendChild(topElement); + Element e = doc.createElementNS(ELEMENT_NS, ELEMENT_LOCAL); + e.setPrefix("e"); + e.setTextContent("foofoo"); + topElement.appendChild(e); + + System.out.println(DOMUtil.serializeDOMToString(topElement)); + + // WHEN + + DOMUtil.setQNameValue(e, in); + + // THEN + + System.out.println(DOMUtil.serializeDOMToString(topElement)); + + String content = e.getTextContent(); + // Default namespace should NOT be reused + AssertJUnit.assertEquals("f:"+QNAME_IN_LOCAL, content); + } + + @Test + public void testQNameNoNamespace() { + System.out.println("===[ testQNameNoNamespace ]==="); + // GIVEN + Document doc = DOMUtil.getDocument(); + + QName in = new QName(XMLConstants.NULL_NS_URI, QNAME_IN_LOCAL); // no namespace + Element topElement = doc.createElementNS(DEFAULT_NS, ELEMENT_TOP_LOCAL); + // Make sure there is a default ns declaration + DOMUtil.setNamespaceDeclaration(topElement,"",DEFAULT_NS); + DOMUtil.setNamespaceDeclaration(topElement,"e",ELEMENT_NS); + doc.appendChild(topElement); + Element e = doc.createElementNS(ELEMENT_NS, ELEMENT_LOCAL); + e.setPrefix("e"); + e.setTextContent("foofoo"); + topElement.appendChild(e); + + System.out.println(DOMUtil.serializeDOMToString(topElement)); + + // WHEN + + DOMUtil.setQNameValue(e, in); + + // THEN + + System.out.println(DOMUtil.serializeDOMToString(topElement)); + + String content = e.getTextContent(); + // There should be no namespace prefix + AssertJUnit.assertEquals(QNAME_IN_LOCAL, content); + } + + @Test public void testXsiType() { System.out.println("===[ testXsiType ]==="); // GIVEN @@ -138,13 +203,13 @@ public void testXsiType() { Element el1 = DOMUtil.getFirstChildElement(root); // WHEN - QName xsiType = DOMUtil.resolveXsiType(el1, "def"); + QName xsiType = DOMUtil.resolveXsiType(el1); // THEN assertNotNull(xsiType); AssertJUnit.assertTrue(XSD_INTEGER.equals(xsiType)); - AssertJUnit.assertTrue("Failed to detect xsi:type",DOMUtil.hasXsiType(el1)); + AssertJUnit.assertTrue("Failed to detect xsi:type", DOMUtil.hasXsiType(el1)); } diff --git a/model/model-common/src/main/java/com/evolveum/midpoint/model/common/expression/Expression.java b/model/model-common/src/main/java/com/evolveum/midpoint/model/common/expression/Expression.java index 2cdd92aff07..a41a505fd0f 100644 --- a/model/model-common/src/main/java/com/evolveum/midpoint/model/common/expression/Expression.java +++ b/model/model-common/src/main/java/com/evolveum/midpoint/model/common/expression/Expression.java @@ -26,6 +26,8 @@ import javax.xml.bind.JAXBElement; import javax.xml.namespace.QName; +import com.evolveum.midpoint.util.QNameUtil; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType; import org.apache.commons.lang.Validate; import org.w3c.dom.Element; @@ -232,7 +234,9 @@ private ExpressionVariables processInnerVariables(ExpressionVariables variables, throw new SchemaException("No variable name in expression in "+contextDescription); } if (variableDefType.getObjectRef() != null) { - ObjectType varObject = objectResolver.resolve(variableDefType.getObjectRef(), ObjectType.class, null, "variable "+varName+" in "+contextDescription, result); + ObjectReferenceType ref = variableDefType.getObjectRef(); + ref.setType(prismContext.getSchemaRegistry().qualifyTypeName(ref.getType())); + ObjectType varObject = objectResolver.resolve(ref, ObjectType.class, null, "variable "+varName+" in "+contextDescription, result); newVariables.addVariableDefinition(varName, varObject); } else if (variableDefType.getValue() != null) { // Only string is supported now diff --git a/model/model-common/src/main/java/com/evolveum/midpoint/model/common/expression/evaluator/AbstractSearchExpressionEvaluator.java b/model/model-common/src/main/java/com/evolveum/midpoint/model/common/expression/evaluator/AbstractSearchExpressionEvaluator.java index 114784f4378..9a09b6006b8 100644 --- a/model/model-common/src/main/java/com/evolveum/midpoint/model/common/expression/evaluator/AbstractSearchExpressionEvaluator.java +++ b/model/model-common/src/main/java/com/evolveum/midpoint/model/common/expression/evaluator/AbstractSearchExpressionEvaluator.java @@ -21,6 +21,7 @@ import javax.xml.namespace.QName; +import com.evolveum.midpoint.util.QNameUtil; import com.evolveum.prism.xml.ns._public.types_3.ItemPathType; import org.apache.commons.lang.BooleanUtils; @@ -134,6 +135,10 @@ protected List transformSingleValue(ExpressionVariables variables, PlusMinusZ if (targetTypeQName == null) { targetTypeQName = getDefaultTargetType(); } + if (targetTypeQName != null && QNameUtil.isUnqualified(targetTypeQName)) { + targetTypeQName = getPrismContext().getSchemaRegistry().resolveUnqualifiedTypeName(targetTypeQName); + } + ObjectTypes targetType = ObjectTypes.getObjectTypeFromTypeQName(targetTypeQName); if (targetType == null) { throw new SchemaException("Unknown target type "+targetTypeQName+" in "+shortDebugDump()); diff --git a/model/model-common/src/main/java/com/evolveum/midpoint/model/common/mapping/Mapping.java b/model/model-common/src/main/java/com/evolveum/midpoint/model/common/mapping/Mapping.java index 5183d20a728..7868e83a7ce 100644 --- a/model/model-common/src/main/java/com/evolveum/midpoint/model/common/mapping/Mapping.java +++ b/model/model-common/src/main/java/com/evolveum/midpoint/model/common/mapping/Mapping.java @@ -271,19 +271,20 @@ public void setRootNode(PrismObject mpObject) { addVariableDefinition(null,(Object)mpObject); } - public void addVariableDefinition(ExpressionVariableDefinitionType varDef) { + public void addVariableDefinition(ExpressionVariableDefinitionType varDef) throws SchemaException { if (varDef.getObjectRef() != null) { - addVariableDefinition(varDef.getName(),varDef.getObjectRef()); + ObjectReferenceType ref = varDef.getObjectRef(); + ref.setType(getPrismContext().getSchemaRegistry().qualifyTypeName(ref.getType())); + addVariableDefinition(varDef.getName(), ref); } else if (varDef.getValue() != null) { addVariableDefinition(varDef.getName(),varDef.getValue()); } else { LOGGER.warn("Empty definition of variable {} in {}, ignoring it",varDef.getName(),getMappingContextDescription()); } - } public void addVariableDefinition(QName name, ObjectReferenceType objectRef) { - addVariableDefinition(name,(Object)objectRef); + addVariableDefinition(name, (Object)objectRef); } public void addVariableDefinition(QName name, ObjectType objectType) { diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/ClassMapper.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/ClassMapper.java index f3e13d71857..b6b59ed8bd8 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/ClassMapper.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/ClassMapper.java @@ -19,6 +19,7 @@ import com.evolveum.midpoint.repo.sql.data.common.RObject; import com.evolveum.midpoint.repo.sql.data.common.other.RObjectType; import com.evolveum.midpoint.schema.constants.ObjectTypes; +import com.evolveum.midpoint.util.QNameUtil; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; import org.apache.commons.lang.Validate; @@ -90,7 +91,7 @@ public static RObjectType getHQLTypeForQName(QName qname) { return null; } for (Map.Entry entry : types.entrySet()) { - if (entry.getKey().getTypeQName().equals(qname)) { + if (QNameUtil.match(entry.getKey().getTypeQName(), qname)) { return entry.getValue(); } } diff --git a/repo/security-impl/src/main/java/com/evolveum/midpoint/security/impl/SecurityEnforcerImpl.java b/repo/security-impl/src/main/java/com/evolveum/midpoint/security/impl/SecurityEnforcerImpl.java index 35713eee6a8..1074b4ce34f 100644 --- a/repo/security-impl/src/main/java/com/evolveum/midpoint/security/impl/SecurityEnforcerImpl.java +++ b/repo/security-impl/src/main/java/com/evolveum/midpoint/security/impl/SecurityEnforcerImpl.java @@ -376,7 +376,7 @@ private boolean isApplicable(ObjectSpecificationType obje } SearchFilterType specFilterType = objectSpecType.getFilter(); ObjectReferenceType specOrgRef = objectSpecType.getOrgRef(); - QName specTypeQName = objectSpecType.getType(); + QName specTypeQName = objectSpecType.getType(); // now it does not matter if it's unqualified PrismObjectDefinition objectDefinition = object.getDefinition(); // Type @@ -830,6 +830,7 @@ private ObjectFilter preProcessObjectFilterInternal(MidPo // Type if (specTypeQName != null) { + specTypeQName = prismContext.getSchemaRegistry().qualifyTypeName(specTypeQName); PrismObjectDefinition specObjectDef = prismContext.getSchemaRegistry().findObjectDefinitionByType(specTypeQName); Class specObjectClass = specObjectDef.getCompileTimeClass(); if (!objectType.isAssignableFrom(specObjectClass)) { diff --git a/repo/system-init/src/main/java/com/evolveum/midpoint/init/StartupConfiguration.java b/repo/system-init/src/main/java/com/evolveum/midpoint/init/StartupConfiguration.java index 6e400c2efec..fb9fe6ff74b 100644 --- a/repo/system-init/src/main/java/com/evolveum/midpoint/init/StartupConfiguration.java +++ b/repo/system-init/src/main/java/com/evolveum/midpoint/init/StartupConfiguration.java @@ -45,6 +45,8 @@ public class StartupConfiguration implements MidpointConfiguration { private static final Trace LOGGER = TraceManager.getTrace(StartupConfiguration.class); private static final String USER_HOME = "user.home"; private static final String MIDPOINT_HOME = "midpoint.home"; + private static final String MIDPOINT_SECTION = "midpoint"; + private static final String SAFE_MODE = "safeMode"; private static final String DEFAULT_CONFIG_FILE_NAME = "config.xml"; private static final String LOGBACK_CONFIG_FILENAME = "logback.xml"; @@ -169,6 +171,11 @@ public void init() { File midpointHome = new File(midpointHomeString); setupInitialLogging(midpointHome); loadConfiguration(midpointHome); + + if (isSafeMode()) { + LOGGER.info("Safe mode is ON; setting tolerateUndeclaredPrefixes to TRUE"); + DOMUtil.setTolerateUndeclaredPrefixes(true); + } } /** @@ -254,6 +261,15 @@ public Document getXmlConfigAsDocument() { return xmlConfigAsDocument; } + @Override + public boolean isSafeMode() { + Configuration c = getConfiguration(MIDPOINT_SECTION); + if (c == null) { + return false; // should not occur + } + return c.getBoolean(SAFE_MODE, false); + } + @Override public String toString() { @SuppressWarnings("unchecked") diff --git a/tools/xjc-plugin/src/main/java/com/evolveum/midpoint/schema/xjc/schema/SchemaProcessor.java b/tools/xjc-plugin/src/main/java/com/evolveum/midpoint/schema/xjc/schema/SchemaProcessor.java index 19b2bf21ee8..2f996b36c3a 100644 --- a/tools/xjc-plugin/src/main/java/com/evolveum/midpoint/schema/xjc/schema/SchemaProcessor.java +++ b/tools/xjc-plugin/src/main/java/com/evolveum/midpoint/schema/xjc/schema/SchemaProcessor.java @@ -298,6 +298,7 @@ private void updateObjectReferenceType(JDefinedClass definedClass, JMethod getRe body = setType.body(); JInvocation invocation = body.invoke(JExpr.invoke(getReference), "setTargetType"); invocation.arg(setType.listParams()[0]); + invocation.arg(JExpr.lit(true)); } private void updateObjectReferenceRelation(JDefinedClass definedClass, JMethod getReference) { From 862e3aca867a424aced79f0e12dfdd7dcd370df7 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Fri, 6 Feb 2015 09:52:08 +0100 Subject: [PATCH 110/215] updated column names for lookup table row. --- .../repo/sql/data/common/other/RLookupTableRow.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RLookupTableRow.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RLookupTableRow.java index a36edf387df..280040048b3 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RLookupTableRow.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RLookupTableRow.java @@ -14,6 +14,12 @@ * @author Viliam Repan (lazyman) */ @Entity +@Table(indexes = { +//todo create indexes after lookup api is created (when we know how we will search through lookup table [lazyman] +// @Index(name = "i_row_key", columnList = "key"), +// @Index(name = "i_row_label_orig", columnList = "label.orig"), +// @Index(name = "i_row_label_norm", columnList = "label.norm") +}) @IdClass(RLookupTableRowId.class) public class RLookupTableRow { @@ -43,7 +49,7 @@ public String getOwnerOid() { } @Id - @Column(name = "key") + @Column(name = "row_key") public String getKey() { return key; } @@ -68,6 +74,7 @@ public void setLastChangeTimestamp(Timestamp lastChangeTimestamp) { this.lastChangeTimestamp = lastChangeTimestamp; } + @Column(name = "row_value") public String getValue() { return value; } From b20da867992cd23f44bfa2df5cf5d579fd7ea071 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Fri, 6 Feb 2015 09:52:21 +0100 Subject: [PATCH 111/215] updated mysql scripts. --- config/sql/midpoint/3.1/mysql/mysql-3.1.sql | 36 +++++++++++++++++++ .../3.1/mysql/mysql-upgrade-3.1-3.1.1.sql | 35 ++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 config/sql/midpoint/3.1/mysql/mysql-upgrade-3.1-3.1.1.sql diff --git a/config/sql/midpoint/3.1/mysql/mysql-3.1.sql b/config/sql/midpoint/3.1/mysql/mysql-3.1.sql index e8640162a14..44511d718bf 100644 --- a/config/sql/midpoint/3.1/mysql/mysql-3.1.sql +++ b/config/sql/midpoint/3.1/mysql/mysql-3.1.sql @@ -286,6 +286,29 @@ CREATE TABLE m_generic_object ( COLLATE utf8_bin ENGINE = InnoDB; +CREATE TABLE m_lookup_table ( + name_norm VARCHAR(255), + name_orig VARCHAR(255), + oid VARCHAR(36) NOT NULL, + PRIMARY KEY (oid) +) + DEFAULT CHARACTER SET utf8 + COLLATE utf8_bin + ENGINE = InnoDB; + +CREATE TABLE m_lookup_table_row ( + row_key VARCHAR(255) NOT NULL, + owner_oid VARCHAR(36) NOT NULL, + label_norm VARCHAR(255), + label_orig VARCHAR(255), + lastChangeTimestamp DATETIME(6), + row_value VARCHAR(255), + PRIMARY KEY (row_key, owner_oid) +) + DEFAULT CHARACTER SET utf8 + COLLATE utf8_bin + ENGINE = InnoDB; + CREATE TABLE m_node ( name_norm VARCHAR(255), name_orig VARCHAR(255), @@ -717,6 +740,9 @@ CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); ALTER TABLE m_generic_object ADD CONSTRAINT uc_generic_object_name UNIQUE (name_norm); +ALTER TABLE m_lookup_table +ADD CONSTRAINT uc_lookup_name UNIQUE (name_norm); + ALTER TABLE m_node ADD CONSTRAINT uc_node_name UNIQUE (name_norm); @@ -882,6 +908,16 @@ ADD CONSTRAINT fk_generic_object FOREIGN KEY (oid) REFERENCES m_object (oid); +ALTER TABLE m_lookup_table +ADD CONSTRAINT fk_lookup_table +FOREIGN KEY (oid) +REFERENCES m_object (oid); + +ALTER TABLE m_lookup_table_row +ADD CONSTRAINT fk_lookup_table +FOREIGN KEY (owner_oid) +REFERENCES m_lookup_table (oid); + ALTER TABLE m_node ADD CONSTRAINT fk_node FOREIGN KEY (oid) diff --git a/config/sql/midpoint/3.1/mysql/mysql-upgrade-3.1-3.1.1.sql b/config/sql/midpoint/3.1/mysql/mysql-upgrade-3.1-3.1.1.sql new file mode 100644 index 00000000000..ee9e9c7ab99 --- /dev/null +++ b/config/sql/midpoint/3.1/mysql/mysql-upgrade-3.1-3.1.1.sql @@ -0,0 +1,35 @@ +CREATE TABLE m_lookup_table ( + name_norm VARCHAR(255), + name_orig VARCHAR(255), + oid VARCHAR(36) NOT NULL, + PRIMARY KEY (oid) +) + DEFAULT CHARACTER SET utf8 + COLLATE utf8_bin + ENGINE = InnoDB; + +CREATE TABLE m_lookup_table_row ( + row_key VARCHAR(255) NOT NULL, + owner_oid VARCHAR(36) NOT NULL, + label_norm VARCHAR(255), + label_orig VARCHAR(255), + lastChangeTimestamp DATETIME(6), + row_value VARCHAR(255), + PRIMARY KEY (row_key, owner_oid) +) + DEFAULT CHARACTER SET utf8 + COLLATE utf8_bin + ENGINE = InnoDB; + +ALTER TABLE m_lookup_table +ADD CONSTRAINT uc_lookup_name UNIQUE (name_norm); + +ALTER TABLE m_lookup_table +ADD CONSTRAINT fk_lookup_table +FOREIGN KEY (oid) +REFERENCES m_object (oid); + +ALTER TABLE m_lookup_table_row +ADD CONSTRAINT fk_lookup_table +FOREIGN KEY (owner_oid) +REFERENCES m_lookup_table (oid); \ No newline at end of file From c21e9018518a2ba7f2c437a55d1522cb5cc507df Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Fri, 6 Feb 2015 09:55:23 +0100 Subject: [PATCH 112/215] updated scripts for sql server --- repo/repo-sql-impl-test/testng.xml | 68 +++++++++++++++--------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/repo/repo-sql-impl-test/testng.xml b/repo/repo-sql-impl-test/testng.xml index 949cc4418b3..31209fa61e8 100644 --- a/repo/repo-sql-impl-test/testng.xml +++ b/repo/repo-sql-impl-test/testng.xml @@ -20,40 +20,40 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From b5cc96f8d592e07621f6c51f77afb21d2831ddc8 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Fri, 6 Feb 2015 09:58:05 +0100 Subject: [PATCH 113/215] reverted testng, updated scripts for sql server and postgres. --- .../3.1/postgresql/postgresql-3.1.sql | 30 ++++++++ .../postgresql-upgrade-3.1-3.1.1.sql | 29 ++++++++ .../midpoint/3.1/sqlserver/sqlserver-3.1.sql | 30 ++++++++ .../sqlserver/sqlserver-upgrade-3.1-3.1.1.sql | 29 ++++++++ repo/repo-sql-impl-test/testng.xml | 68 +++++++++---------- 5 files changed, 152 insertions(+), 34 deletions(-) create mode 100644 config/sql/midpoint/3.1/postgresql/postgresql-upgrade-3.1-3.1.1.sql create mode 100644 config/sql/midpoint/3.1/sqlserver/sqlserver-upgrade-3.1-3.1.1.sql diff --git a/config/sql/midpoint/3.1/postgresql/postgresql-3.1.sql b/config/sql/midpoint/3.1/postgresql/postgresql-3.1.sql index 691dfe140b0..3ee6bb7cc63 100644 --- a/config/sql/midpoint/3.1/postgresql/postgresql-3.1.sql +++ b/config/sql/midpoint/3.1/postgresql/postgresql-3.1.sql @@ -222,6 +222,23 @@ CREATE TABLE m_generic_object ( PRIMARY KEY (oid) ); +CREATE TABLE m_lookup_table ( + name_norm VARCHAR(255), + name_orig VARCHAR(255), + oid VARCHAR(36) NOT NULL, + PRIMARY KEY (oid) +); + +CREATE TABLE m_lookup_table_row ( + row_key VARCHAR(255) NOT NULL, + owner_oid VARCHAR(36) NOT NULL, + label_norm VARCHAR(255), + label_orig VARCHAR(255), + lastChangeTimestamp TIMESTAMP, + row_value VARCHAR(255), + PRIMARY KEY (row_key, owner_oid) +); + CREATE TABLE m_node ( name_norm VARCHAR(255), name_orig VARCHAR(255), @@ -569,6 +586,9 @@ CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); ALTER TABLE m_generic_object ADD CONSTRAINT uc_generic_object_name UNIQUE (name_norm); +ALTER TABLE m_lookup_table +ADD CONSTRAINT uc_lookup_name UNIQUE (name_norm); + ALTER TABLE m_node ADD CONSTRAINT uc_node_name UNIQUE (name_norm); @@ -732,6 +752,16 @@ ADD CONSTRAINT fk_generic_object FOREIGN KEY (oid) REFERENCES m_object; +ALTER TABLE m_lookup_table +ADD CONSTRAINT fk_lookup_table +FOREIGN KEY (oid) +REFERENCES m_object; + +ALTER TABLE m_lookup_table_row +ADD CONSTRAINT fk_lookup_table +FOREIGN KEY (owner_oid) +REFERENCES m_lookup_table; + ALTER TABLE m_node ADD CONSTRAINT fk_node FOREIGN KEY (oid) diff --git a/config/sql/midpoint/3.1/postgresql/postgresql-upgrade-3.1-3.1.1.sql b/config/sql/midpoint/3.1/postgresql/postgresql-upgrade-3.1-3.1.1.sql new file mode 100644 index 00000000000..93f161c3795 --- /dev/null +++ b/config/sql/midpoint/3.1/postgresql/postgresql-upgrade-3.1-3.1.1.sql @@ -0,0 +1,29 @@ +CREATE TABLE m_lookup_table ( + name_norm VARCHAR(255), + name_orig VARCHAR(255), + oid VARCHAR(36) NOT NULL, + PRIMARY KEY (oid) +); + +CREATE TABLE m_lookup_table_row ( + row_key VARCHAR(255) NOT NULL, + owner_oid VARCHAR(36) NOT NULL, + label_norm VARCHAR(255), + label_orig VARCHAR(255), + lastChangeTimestamp TIMESTAMP, + row_value VARCHAR(255), + PRIMARY KEY (row_key, owner_oid) +); + +ALTER TABLE m_lookup_table +ADD CONSTRAINT uc_lookup_name UNIQUE (name_norm); + +ALTER TABLE m_lookup_table +ADD CONSTRAINT fk_lookup_table +FOREIGN KEY (oid) +REFERENCES m_object; + +ALTER TABLE m_lookup_table_row +ADD CONSTRAINT fk_lookup_table +FOREIGN KEY (owner_oid) +REFERENCES m_lookup_table; diff --git a/config/sql/midpoint/3.1/sqlserver/sqlserver-3.1.sql b/config/sql/midpoint/3.1/sqlserver/sqlserver-3.1.sql index a0d68c86fb5..f448293c02e 100644 --- a/config/sql/midpoint/3.1/sqlserver/sqlserver-3.1.sql +++ b/config/sql/midpoint/3.1/sqlserver/sqlserver-3.1.sql @@ -222,6 +222,23 @@ CREATE TABLE m_generic_object ( PRIMARY KEY (oid) ); +CREATE TABLE m_lookup_table ( + name_norm NVARCHAR(255) COLLATE database_default, + name_orig NVARCHAR(255) COLLATE database_default, + oid NVARCHAR(36) COLLATE database_default NOT NULL, + PRIMARY KEY (oid) +); + +CREATE TABLE m_lookup_table_row ( + row_key NVARCHAR(255) COLLATE database_default NOT NULL, + owner_oid NVARCHAR(36) COLLATE database_default NOT NULL, + label_norm NVARCHAR(255) COLLATE database_default, + label_orig NVARCHAR(255) COLLATE database_default, + lastChangeTimestamp DATETIME2, + row_value NVARCHAR(255) COLLATE database_default, + PRIMARY KEY (row_key, owner_oid) +); + CREATE TABLE m_node ( name_norm NVARCHAR(255) COLLATE database_default, name_orig NVARCHAR(255) COLLATE database_default, @@ -569,6 +586,9 @@ CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); ALTER TABLE m_generic_object ADD CONSTRAINT uc_generic_object_name UNIQUE (name_norm); +ALTER TABLE m_lookup_table +ADD CONSTRAINT uc_lookup_name UNIQUE (name_norm); + ALTER TABLE m_node ADD CONSTRAINT uc_node_name UNIQUE (name_norm); @@ -732,6 +752,16 @@ ADD CONSTRAINT fk_generic_object FOREIGN KEY (oid) REFERENCES m_object; +ALTER TABLE m_lookup_table +ADD CONSTRAINT fk_lookup_table +FOREIGN KEY (oid) +REFERENCES m_object; + +ALTER TABLE m_lookup_table_row +ADD CONSTRAINT fk_lookup_table +FOREIGN KEY (owner_oid) +REFERENCES m_lookup_table; + ALTER TABLE m_node ADD CONSTRAINT fk_node FOREIGN KEY (oid) diff --git a/config/sql/midpoint/3.1/sqlserver/sqlserver-upgrade-3.1-3.1.1.sql b/config/sql/midpoint/3.1/sqlserver/sqlserver-upgrade-3.1-3.1.1.sql new file mode 100644 index 00000000000..8bc6cf8ea51 --- /dev/null +++ b/config/sql/midpoint/3.1/sqlserver/sqlserver-upgrade-3.1-3.1.1.sql @@ -0,0 +1,29 @@ +CREATE TABLE m_lookup_table ( + name_norm NVARCHAR(255) COLLATE database_default, + name_orig NVARCHAR(255) COLLATE database_default, + oid NVARCHAR(36) COLLATE database_default NOT NULL, + PRIMARY KEY (oid) +); + +CREATE TABLE m_lookup_table_row ( + row_key NVARCHAR(255) COLLATE database_default NOT NULL, + owner_oid NVARCHAR(36) COLLATE database_default NOT NULL, + label_norm NVARCHAR(255) COLLATE database_default, + label_orig NVARCHAR(255) COLLATE database_default, + lastChangeTimestamp DATETIME2, + row_value NVARCHAR(255) COLLATE database_default, + PRIMARY KEY (row_key, owner_oid) +); + +ALTER TABLE m_lookup_table +ADD CONSTRAINT uc_lookup_name UNIQUE (name_norm); + +ALTER TABLE m_lookup_table +ADD CONSTRAINT fk_lookup_table +FOREIGN KEY (oid) +REFERENCES m_object; + +ALTER TABLE m_lookup_table_row +ADD CONSTRAINT fk_lookup_table +FOREIGN KEY (owner_oid) +REFERENCES m_lookup_table; \ No newline at end of file diff --git a/repo/repo-sql-impl-test/testng.xml b/repo/repo-sql-impl-test/testng.xml index 31209fa61e8..949cc4418b3 100644 --- a/repo/repo-sql-impl-test/testng.xml +++ b/repo/repo-sql-impl-test/testng.xml @@ -20,40 +20,40 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 043bd280a81f5d17d3e2c140f30cf0f153b12117 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Fri, 6 Feb 2015 10:48:26 +0100 Subject: [PATCH 114/215] updated h2 and oracle scripts --- config/sql/midpoint/3.1/h2/h2-3.1.sql | 30 +++++++++++++++++++ .../midpoint/3.1/h2/h2-upgrade-3.1-3.1.1.sql | 29 ++++++++++++++++++ config/sql/midpoint/3.1/oracle/oracle-3.1.sql | 30 +++++++++++++++++++ .../3.1/oracle/oracle-upgrade-3.1-3.1.1.sql | 29 ++++++++++++++++++ 4 files changed, 118 insertions(+) create mode 100644 config/sql/midpoint/3.1/h2/h2-upgrade-3.1-3.1.1.sql create mode 100644 config/sql/midpoint/3.1/oracle/oracle-upgrade-3.1-3.1.1.sql diff --git a/config/sql/midpoint/3.1/h2/h2-3.1.sql b/config/sql/midpoint/3.1/h2/h2-3.1.sql index 83f26b4623b..c30eddf1289 100644 --- a/config/sql/midpoint/3.1/h2/h2-3.1.sql +++ b/config/sql/midpoint/3.1/h2/h2-3.1.sql @@ -222,6 +222,23 @@ CREATE TABLE m_generic_object ( PRIMARY KEY (oid) ); +CREATE TABLE m_lookup_table ( + name_norm VARCHAR(255), + name_orig VARCHAR(255), + oid VARCHAR(36) NOT NULL, + PRIMARY KEY (oid) +); + +CREATE TABLE m_lookup_table_row ( + row_key VARCHAR(255) NOT NULL, + owner_oid VARCHAR(36) NOT NULL, + label_norm VARCHAR(255), + label_orig VARCHAR(255), + lastChangeTimestamp TIMESTAMP, + row_value VARCHAR(255), + PRIMARY KEY (row_key, owner_oid) +); + CREATE TABLE m_node ( name_norm VARCHAR(255), name_orig VARCHAR(255), @@ -569,6 +586,9 @@ CREATE INDEX iFocusEffective ON m_focus (effectiveStatus); ALTER TABLE m_generic_object ADD CONSTRAINT uc_generic_object_name UNIQUE (name_norm); +ALTER TABLE m_lookup_table +ADD CONSTRAINT uc_lookup_name UNIQUE (name_norm); + ALTER TABLE m_node ADD CONSTRAINT uc_node_name UNIQUE (name_norm); @@ -732,6 +752,16 @@ ADD CONSTRAINT fk_generic_object FOREIGN KEY (oid) REFERENCES m_object; +ALTER TABLE m_lookup_table +ADD CONSTRAINT fk_lookup_table +FOREIGN KEY (oid) +REFERENCES m_object; + +ALTER TABLE m_lookup_table_row +ADD CONSTRAINT fk_lookup_table +FOREIGN KEY (owner_oid) +REFERENCES m_lookup_table; + ALTER TABLE m_node ADD CONSTRAINT fk_node FOREIGN KEY (oid) diff --git a/config/sql/midpoint/3.1/h2/h2-upgrade-3.1-3.1.1.sql b/config/sql/midpoint/3.1/h2/h2-upgrade-3.1-3.1.1.sql new file mode 100644 index 00000000000..70d088fb182 --- /dev/null +++ b/config/sql/midpoint/3.1/h2/h2-upgrade-3.1-3.1.1.sql @@ -0,0 +1,29 @@ +CREATE TABLE m_lookup_table ( + name_norm VARCHAR(255), + name_orig VARCHAR(255), + oid VARCHAR(36) NOT NULL, + PRIMARY KEY (oid) +); + +CREATE TABLE m_lookup_table_row ( + row_key VARCHAR(255) NOT NULL, + owner_oid VARCHAR(36) NOT NULL, + label_norm VARCHAR(255), + label_orig VARCHAR(255), + lastChangeTimestamp TIMESTAMP, + row_value VARCHAR(255), + PRIMARY KEY (row_key, owner_oid) +); + +ALTER TABLE m_lookup_table +ADD CONSTRAINT uc_lookup_name UNIQUE (name_norm); + +ALTER TABLE m_lookup_table +ADD CONSTRAINT fk_lookup_table +FOREIGN KEY (oid) +REFERENCES m_object; + +ALTER TABLE m_lookup_table_row +ADD CONSTRAINT fk_lookup_table +FOREIGN KEY (owner_oid) +REFERENCES m_lookup_table; \ No newline at end of file diff --git a/config/sql/midpoint/3.1/oracle/oracle-3.1.sql b/config/sql/midpoint/3.1/oracle/oracle-3.1.sql index c789958e7fa..a09048d1e57 100644 --- a/config/sql/midpoint/3.1/oracle/oracle-3.1.sql +++ b/config/sql/midpoint/3.1/oracle/oracle-3.1.sql @@ -225,6 +225,23 @@ CREATE TABLE m_generic_object ( PRIMARY KEY (oid) ) INITRANS 30; +CREATE TABLE m_lookup_table ( + name_norm VARCHAR2(255 CHAR), + name_orig VARCHAR2(255 CHAR), + oid VARCHAR2(36 CHAR) NOT NULL, + PRIMARY KEY (oid) +) INITRANS 30; + +CREATE TABLE m_lookup_table_row ( + row_key VARCHAR2(255 CHAR) NOT NULL, + owner_oid VARCHAR2(36 CHAR) NOT NULL, + label_norm VARCHAR2(255 CHAR), + label_orig VARCHAR2(255 CHAR), + lastChangeTimestamp TIMESTAMP, + row_value VARCHAR2(255 CHAR), + PRIMARY KEY (row_key, owner_oid) +) INITRANS 30; + CREATE TABLE m_node ( name_norm VARCHAR2(255 CHAR), name_orig VARCHAR2(255 CHAR), @@ -579,6 +596,9 @@ CREATE INDEX iFocusEffective ON m_focus (effectiveStatus) INITRANS 30; ALTER TABLE m_generic_object ADD CONSTRAINT uc_generic_object_name UNIQUE (name_norm) INITRANS 30; +ALTER TABLE m_lookup_table +ADD CONSTRAINT uc_lookup_name UNIQUE (name_norm) INITRANS 30; + ALTER TABLE m_node ADD CONSTRAINT uc_node_name UNIQUE (name_norm) INITRANS 30; @@ -742,6 +762,16 @@ ADD CONSTRAINT fk_generic_object FOREIGN KEY (oid) REFERENCES m_object; +ALTER TABLE m_lookup_table +ADD CONSTRAINT fk_lookup_table +FOREIGN KEY (oid) +REFERENCES m_object; + +ALTER TABLE m_lookup_table_row +ADD CONSTRAINT fk_lookup_table +FOREIGN KEY (owner_oid) +REFERENCES m_lookup_table; + ALTER TABLE m_node ADD CONSTRAINT fk_node FOREIGN KEY (oid) diff --git a/config/sql/midpoint/3.1/oracle/oracle-upgrade-3.1-3.1.1.sql b/config/sql/midpoint/3.1/oracle/oracle-upgrade-3.1-3.1.1.sql new file mode 100644 index 00000000000..2fdcd2ec096 --- /dev/null +++ b/config/sql/midpoint/3.1/oracle/oracle-upgrade-3.1-3.1.1.sql @@ -0,0 +1,29 @@ +CREATE TABLE m_lookup_table ( + name_norm VARCHAR2(255 CHAR), + name_orig VARCHAR2(255 CHAR), + oid VARCHAR2(36 CHAR) NOT NULL, + PRIMARY KEY (oid) +) INITRANS 30; + +CREATE TABLE m_lookup_table_row ( + row_key VARCHAR2(255 CHAR) NOT NULL, + owner_oid VARCHAR2(36 CHAR) NOT NULL, + label_norm VARCHAR2(255 CHAR), + label_orig VARCHAR2(255 CHAR), + lastChangeTimestamp TIMESTAMP, + row_value VARCHAR2(255 CHAR), + PRIMARY KEY (row_key, owner_oid) +) INITRANS 30; + +ALTER TABLE m_lookup_table +ADD CONSTRAINT uc_lookup_name UNIQUE (name_norm) INITRANS 30; + +ALTER TABLE m_lookup_table +ADD CONSTRAINT fk_lookup_table +FOREIGN KEY (oid) +REFERENCES m_object; + +ALTER TABLE m_lookup_table_row +ADD CONSTRAINT fk_lookup_table +FOREIGN KEY (owner_oid) +REFERENCES m_lookup_table; From 8307b9a633c482c407c03fccf846a63ef983f507 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Fri, 6 Feb 2015 10:48:47 +0100 Subject: [PATCH 115/215] moved 3.1 scripts to 3.1.1 --- config/sql/midpoint/{3.1 => 3.1.1}/h2/h2-3.1-closure-upgrade.sql | 0 config/sql/midpoint/{3.1 => 3.1.1}/h2/h2-3.1.sql | 0 config/sql/midpoint/{3.1 => 3.1.1}/h2/h2-upgrade-3.1-3.1.1.sql | 0 .../midpoint/{3.1 => 3.1.1}/mysql/mysql-3.1-closure-upgrade.sql | 0 config/sql/midpoint/{3.1 => 3.1.1}/mysql/mysql-3.1.sql | 0 .../sql/midpoint/{3.1 => 3.1.1}/mysql/mysql-upgrade-3.1-3.1.1.sql | 0 .../midpoint/{3.1 => 3.1.1}/oracle/oracle-3.1-closure-upgrade.sql | 0 config/sql/midpoint/{3.1 => 3.1.1}/oracle/oracle-3.1.sql | 0 .../midpoint/{3.1 => 3.1.1}/oracle/oracle-upgrade-3.1-3.1.1.sql | 0 .../{3.1 => 3.1.1}/postgresql/postgresql-3.1-closure-upgrade.sql | 0 config/sql/midpoint/{3.1 => 3.1.1}/postgresql/postgresql-3.1.sql | 0 .../{3.1 => 3.1.1}/postgresql/postgresql-upgrade-3.1-3.1.1.sql | 0 .../{3.1 => 3.1.1}/sqlserver/sqlserver-3.1-closure-upgrade.sql | 0 config/sql/midpoint/{3.1 => 3.1.1}/sqlserver/sqlserver-3.1.sql | 0 .../{3.1 => 3.1.1}/sqlserver/sqlserver-upgrade-3.1-3.1.1.sql | 0 15 files changed, 0 insertions(+), 0 deletions(-) rename config/sql/midpoint/{3.1 => 3.1.1}/h2/h2-3.1-closure-upgrade.sql (100%) rename config/sql/midpoint/{3.1 => 3.1.1}/h2/h2-3.1.sql (100%) rename config/sql/midpoint/{3.1 => 3.1.1}/h2/h2-upgrade-3.1-3.1.1.sql (100%) rename config/sql/midpoint/{3.1 => 3.1.1}/mysql/mysql-3.1-closure-upgrade.sql (100%) rename config/sql/midpoint/{3.1 => 3.1.1}/mysql/mysql-3.1.sql (100%) rename config/sql/midpoint/{3.1 => 3.1.1}/mysql/mysql-upgrade-3.1-3.1.1.sql (100%) rename config/sql/midpoint/{3.1 => 3.1.1}/oracle/oracle-3.1-closure-upgrade.sql (100%) rename config/sql/midpoint/{3.1 => 3.1.1}/oracle/oracle-3.1.sql (100%) rename config/sql/midpoint/{3.1 => 3.1.1}/oracle/oracle-upgrade-3.1-3.1.1.sql (100%) rename config/sql/midpoint/{3.1 => 3.1.1}/postgresql/postgresql-3.1-closure-upgrade.sql (100%) rename config/sql/midpoint/{3.1 => 3.1.1}/postgresql/postgresql-3.1.sql (100%) rename config/sql/midpoint/{3.1 => 3.1.1}/postgresql/postgresql-upgrade-3.1-3.1.1.sql (100%) rename config/sql/midpoint/{3.1 => 3.1.1}/sqlserver/sqlserver-3.1-closure-upgrade.sql (100%) rename config/sql/midpoint/{3.1 => 3.1.1}/sqlserver/sqlserver-3.1.sql (100%) rename config/sql/midpoint/{3.1 => 3.1.1}/sqlserver/sqlserver-upgrade-3.1-3.1.1.sql (100%) diff --git a/config/sql/midpoint/3.1/h2/h2-3.1-closure-upgrade.sql b/config/sql/midpoint/3.1.1/h2/h2-3.1-closure-upgrade.sql similarity index 100% rename from config/sql/midpoint/3.1/h2/h2-3.1-closure-upgrade.sql rename to config/sql/midpoint/3.1.1/h2/h2-3.1-closure-upgrade.sql diff --git a/config/sql/midpoint/3.1/h2/h2-3.1.sql b/config/sql/midpoint/3.1.1/h2/h2-3.1.sql similarity index 100% rename from config/sql/midpoint/3.1/h2/h2-3.1.sql rename to config/sql/midpoint/3.1.1/h2/h2-3.1.sql diff --git a/config/sql/midpoint/3.1/h2/h2-upgrade-3.1-3.1.1.sql b/config/sql/midpoint/3.1.1/h2/h2-upgrade-3.1-3.1.1.sql similarity index 100% rename from config/sql/midpoint/3.1/h2/h2-upgrade-3.1-3.1.1.sql rename to config/sql/midpoint/3.1.1/h2/h2-upgrade-3.1-3.1.1.sql diff --git a/config/sql/midpoint/3.1/mysql/mysql-3.1-closure-upgrade.sql b/config/sql/midpoint/3.1.1/mysql/mysql-3.1-closure-upgrade.sql similarity index 100% rename from config/sql/midpoint/3.1/mysql/mysql-3.1-closure-upgrade.sql rename to config/sql/midpoint/3.1.1/mysql/mysql-3.1-closure-upgrade.sql diff --git a/config/sql/midpoint/3.1/mysql/mysql-3.1.sql b/config/sql/midpoint/3.1.1/mysql/mysql-3.1.sql similarity index 100% rename from config/sql/midpoint/3.1/mysql/mysql-3.1.sql rename to config/sql/midpoint/3.1.1/mysql/mysql-3.1.sql diff --git a/config/sql/midpoint/3.1/mysql/mysql-upgrade-3.1-3.1.1.sql b/config/sql/midpoint/3.1.1/mysql/mysql-upgrade-3.1-3.1.1.sql similarity index 100% rename from config/sql/midpoint/3.1/mysql/mysql-upgrade-3.1-3.1.1.sql rename to config/sql/midpoint/3.1.1/mysql/mysql-upgrade-3.1-3.1.1.sql diff --git a/config/sql/midpoint/3.1/oracle/oracle-3.1-closure-upgrade.sql b/config/sql/midpoint/3.1.1/oracle/oracle-3.1-closure-upgrade.sql similarity index 100% rename from config/sql/midpoint/3.1/oracle/oracle-3.1-closure-upgrade.sql rename to config/sql/midpoint/3.1.1/oracle/oracle-3.1-closure-upgrade.sql diff --git a/config/sql/midpoint/3.1/oracle/oracle-3.1.sql b/config/sql/midpoint/3.1.1/oracle/oracle-3.1.sql similarity index 100% rename from config/sql/midpoint/3.1/oracle/oracle-3.1.sql rename to config/sql/midpoint/3.1.1/oracle/oracle-3.1.sql diff --git a/config/sql/midpoint/3.1/oracle/oracle-upgrade-3.1-3.1.1.sql b/config/sql/midpoint/3.1.1/oracle/oracle-upgrade-3.1-3.1.1.sql similarity index 100% rename from config/sql/midpoint/3.1/oracle/oracle-upgrade-3.1-3.1.1.sql rename to config/sql/midpoint/3.1.1/oracle/oracle-upgrade-3.1-3.1.1.sql diff --git a/config/sql/midpoint/3.1/postgresql/postgresql-3.1-closure-upgrade.sql b/config/sql/midpoint/3.1.1/postgresql/postgresql-3.1-closure-upgrade.sql similarity index 100% rename from config/sql/midpoint/3.1/postgresql/postgresql-3.1-closure-upgrade.sql rename to config/sql/midpoint/3.1.1/postgresql/postgresql-3.1-closure-upgrade.sql diff --git a/config/sql/midpoint/3.1/postgresql/postgresql-3.1.sql b/config/sql/midpoint/3.1.1/postgresql/postgresql-3.1.sql similarity index 100% rename from config/sql/midpoint/3.1/postgresql/postgresql-3.1.sql rename to config/sql/midpoint/3.1.1/postgresql/postgresql-3.1.sql diff --git a/config/sql/midpoint/3.1/postgresql/postgresql-upgrade-3.1-3.1.1.sql b/config/sql/midpoint/3.1.1/postgresql/postgresql-upgrade-3.1-3.1.1.sql similarity index 100% rename from config/sql/midpoint/3.1/postgresql/postgresql-upgrade-3.1-3.1.1.sql rename to config/sql/midpoint/3.1.1/postgresql/postgresql-upgrade-3.1-3.1.1.sql diff --git a/config/sql/midpoint/3.1/sqlserver/sqlserver-3.1-closure-upgrade.sql b/config/sql/midpoint/3.1.1/sqlserver/sqlserver-3.1-closure-upgrade.sql similarity index 100% rename from config/sql/midpoint/3.1/sqlserver/sqlserver-3.1-closure-upgrade.sql rename to config/sql/midpoint/3.1.1/sqlserver/sqlserver-3.1-closure-upgrade.sql diff --git a/config/sql/midpoint/3.1/sqlserver/sqlserver-3.1.sql b/config/sql/midpoint/3.1.1/sqlserver/sqlserver-3.1.sql similarity index 100% rename from config/sql/midpoint/3.1/sqlserver/sqlserver-3.1.sql rename to config/sql/midpoint/3.1.1/sqlserver/sqlserver-3.1.sql diff --git a/config/sql/midpoint/3.1/sqlserver/sqlserver-upgrade-3.1-3.1.1.sql b/config/sql/midpoint/3.1.1/sqlserver/sqlserver-upgrade-3.1-3.1.1.sql similarity index 100% rename from config/sql/midpoint/3.1/sqlserver/sqlserver-upgrade-3.1-3.1.1.sql rename to config/sql/midpoint/3.1.1/sqlserver/sqlserver-upgrade-3.1-3.1.1.sql From d837061d263953f3b84e80cd9bc619faa52685c0 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Fri, 6 Feb 2015 10:49:52 +0100 Subject: [PATCH 116/215] renamed scripts, removed obsolete --- .../3.1.1/h2/h2-3.1-closure-upgrade.sql | 26 ---------- .../3.1.1/h2/{h2-3.1.sql => h2-3.1.1.sql} | 0 .../3.1.1/mysql/mysql-3.1-closure-upgrade.sql | 33 ------------ .../mysql/{mysql-3.1.sql => mysql-3.1.1.sql} | 0 .../oracle/oracle-3.1-closure-upgrade.sql | 50 ------------------- .../{oracle-3.1.sql => oracle-3.1.1.sql} | 0 .../postgresql-3.1-closure-upgrade.sql | 26 ---------- ...ostgresql-3.1.sql => postgresql-3.1.1.sql} | 0 .../sqlserver-3.1-closure-upgrade.sql | 27 ---------- ...{sqlserver-3.1.sql => sqlserver-3.1.1.sql} | 0 10 files changed, 162 deletions(-) delete mode 100644 config/sql/midpoint/3.1.1/h2/h2-3.1-closure-upgrade.sql rename config/sql/midpoint/3.1.1/h2/{h2-3.1.sql => h2-3.1.1.sql} (100%) delete mode 100644 config/sql/midpoint/3.1.1/mysql/mysql-3.1-closure-upgrade.sql rename config/sql/midpoint/3.1.1/mysql/{mysql-3.1.sql => mysql-3.1.1.sql} (100%) delete mode 100644 config/sql/midpoint/3.1.1/oracle/oracle-3.1-closure-upgrade.sql rename config/sql/midpoint/3.1.1/oracle/{oracle-3.1.sql => oracle-3.1.1.sql} (100%) delete mode 100644 config/sql/midpoint/3.1.1/postgresql/postgresql-3.1-closure-upgrade.sql rename config/sql/midpoint/3.1.1/postgresql/{postgresql-3.1.sql => postgresql-3.1.1.sql} (100%) delete mode 100644 config/sql/midpoint/3.1.1/sqlserver/sqlserver-3.1-closure-upgrade.sql rename config/sql/midpoint/3.1.1/sqlserver/{sqlserver-3.1.sql => sqlserver-3.1.1.sql} (100%) diff --git a/config/sql/midpoint/3.1.1/h2/h2-3.1-closure-upgrade.sql b/config/sql/midpoint/3.1.1/h2/h2-3.1-closure-upgrade.sql deleted file mode 100644 index 9dbf6cc43ec..00000000000 --- a/config/sql/midpoint/3.1.1/h2/h2-3.1-closure-upgrade.sql +++ /dev/null @@ -1,26 +0,0 @@ -DROP TABLE m_org_closure; - -DROP TABLE IF EXISTS m_org_incorrect; - -CREATE TABLE m_org_closure ( - ancestor_oid VARCHAR(36) NOT NULL, - descendant_oid VARCHAR(36) NOT NULL, - val INTEGER, - PRIMARY KEY (ancestor_oid, descendant_oid) -); - -CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); - -CREATE INDEX iDescendant ON m_org_closure (descendant_oid); - -CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid); - -ALTER TABLE m_org_closure -ADD CONSTRAINT fk_ancestor -FOREIGN KEY (ancestor_oid) -REFERENCES m_object; - -ALTER TABLE m_org_closure -ADD CONSTRAINT fk_descendant -FOREIGN KEY (descendant_oid) -REFERENCES m_object; diff --git a/config/sql/midpoint/3.1.1/h2/h2-3.1.sql b/config/sql/midpoint/3.1.1/h2/h2-3.1.1.sql similarity index 100% rename from config/sql/midpoint/3.1.1/h2/h2-3.1.sql rename to config/sql/midpoint/3.1.1/h2/h2-3.1.1.sql diff --git a/config/sql/midpoint/3.1.1/mysql/mysql-3.1-closure-upgrade.sql b/config/sql/midpoint/3.1.1/mysql/mysql-3.1-closure-upgrade.sql deleted file mode 100644 index 75227bbc1ae..00000000000 --- a/config/sql/midpoint/3.1.1/mysql/mysql-3.1-closure-upgrade.sql +++ /dev/null @@ -1,33 +0,0 @@ -DROP TABLE m_org_closure; - -drop table if exists m_org_incorrect; - --- --- Note: if getting --- "[HY000][150] Create table 'midpoint/#sql-7ec_8' with foreign key constraint failed. --- There is no index in the referenced table where the referenced columns appear as the first columns." --- then check the character set/collation compatibility between ancestor_oid/descendant_oid and m_object(oid). --- E.g. try to remove "DEFAULT CHARACTER SET utf8 COLLATE utf8_bin" from definition; or add the same to m_object. --- - -CREATE TABLE m_org_closure ( - ancestor_oid VARCHAR(36) NOT NULL, - descendant_oid VARCHAR(36) NOT NULL, - val INTEGER, - PRIMARY KEY (ancestor_oid, descendant_oid) -) - DEFAULT CHARACTER SET utf8 - COLLATE utf8_bin - ENGINE = InnoDB; - -CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid); - -ALTER TABLE m_org_closure -ADD CONSTRAINT fk_ancestor -FOREIGN KEY (ancestor_oid) -REFERENCES m_object (oid); - -ALTER TABLE m_org_closure -ADD CONSTRAINT fk_descendant -FOREIGN KEY (descendant_oid) -REFERENCES m_object (oid); \ No newline at end of file diff --git a/config/sql/midpoint/3.1.1/mysql/mysql-3.1.sql b/config/sql/midpoint/3.1.1/mysql/mysql-3.1.1.sql similarity index 100% rename from config/sql/midpoint/3.1.1/mysql/mysql-3.1.sql rename to config/sql/midpoint/3.1.1/mysql/mysql-3.1.1.sql diff --git a/config/sql/midpoint/3.1.1/oracle/oracle-3.1-closure-upgrade.sql b/config/sql/midpoint/3.1.1/oracle/oracle-3.1-closure-upgrade.sql deleted file mode 100644 index 62d0ce2f59c..00000000000 --- a/config/sql/midpoint/3.1.1/oracle/oracle-3.1-closure-upgrade.sql +++ /dev/null @@ -1,50 +0,0 @@ -DROP TABLE m_org_closure; - -BEGIN - EXECUTE IMMEDIATE 'DROP TABLE m_org_incorrect'; - EXCEPTION - WHEN OTHERS THEN - IF SQLCODE != -942 THEN - RAISE; - END IF; -END; - -CREATE TABLE m_org_closure ( - ancestor_oid VARCHAR2(36 CHAR) NOT NULL, - descendant_oid VARCHAR2(36 CHAR) NOT NULL, - val NUMBER(10, 0), - PRIMARY KEY (ancestor_oid, descendant_oid) -) INITRANS 30; - -BEGIN - EXECUTE IMMEDIATE 'DROP TABLE m_org_closure_temp_delta'; - EXCEPTION - WHEN OTHERS THEN - IF SQLCODE != -942 THEN - RAISE; - END IF; -END; - -CREATE GLOBAL TEMPORARY TABLE m_org_closure_temp_delta ( - descendant_oid VARCHAR2(36 CHAR) NOT NULL, - ancestor_oid VARCHAR2(36 CHAR) NOT NULL, - val NUMBER (10, 0) NOT NULL, - PRIMARY KEY (descendant_oid, ancestor_oid) -) ON COMMIT DELETE ROWS; - -CREATE INDEX iAncestor ON m_org_closure (ancestor_oid) INITRANS 30; - -CREATE INDEX iDescendant ON m_org_closure (descendant_oid) INITRANS 30; - -CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid) INITRANS 30; - -ALTER TABLE m_org_closure -ADD CONSTRAINT fk_ancestor -FOREIGN KEY (ancestor_oid) -REFERENCES m_object; - -ALTER TABLE m_org_closure -ADD CONSTRAINT fk_descendant -FOREIGN KEY (descendant_oid) -REFERENCES m_object; - diff --git a/config/sql/midpoint/3.1.1/oracle/oracle-3.1.sql b/config/sql/midpoint/3.1.1/oracle/oracle-3.1.1.sql similarity index 100% rename from config/sql/midpoint/3.1.1/oracle/oracle-3.1.sql rename to config/sql/midpoint/3.1.1/oracle/oracle-3.1.1.sql diff --git a/config/sql/midpoint/3.1.1/postgresql/postgresql-3.1-closure-upgrade.sql b/config/sql/midpoint/3.1.1/postgresql/postgresql-3.1-closure-upgrade.sql deleted file mode 100644 index e68c1f4d670..00000000000 --- a/config/sql/midpoint/3.1.1/postgresql/postgresql-3.1-closure-upgrade.sql +++ /dev/null @@ -1,26 +0,0 @@ -DROP TABLE m_org_closure; - -DROP TABLE IF EXISTS m_org_incorrect; - -CREATE TABLE m_org_closure ( - ancestor_oid VARCHAR(36) NOT NULL, - descendant_oid VARCHAR(36) NOT NULL, - val INT4, - PRIMARY KEY (ancestor_oid, descendant_oid) -); - -CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); - -CREATE INDEX iDescendant ON m_org_closure (descendant_oid); - -CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid); - -ALTER TABLE m_org_closure -ADD CONSTRAINT fk_ancestor -FOREIGN KEY (ancestor_oid) -REFERENCES m_object; - -ALTER TABLE m_org_closure -ADD CONSTRAINT fk_descendant -FOREIGN KEY (descendant_oid) -REFERENCES m_object; diff --git a/config/sql/midpoint/3.1.1/postgresql/postgresql-3.1.sql b/config/sql/midpoint/3.1.1/postgresql/postgresql-3.1.1.sql similarity index 100% rename from config/sql/midpoint/3.1.1/postgresql/postgresql-3.1.sql rename to config/sql/midpoint/3.1.1/postgresql/postgresql-3.1.1.sql diff --git a/config/sql/midpoint/3.1.1/sqlserver/sqlserver-3.1-closure-upgrade.sql b/config/sql/midpoint/3.1.1/sqlserver/sqlserver-3.1-closure-upgrade.sql deleted file mode 100644 index da15003e1fc..00000000000 --- a/config/sql/midpoint/3.1.1/sqlserver/sqlserver-3.1-closure-upgrade.sql +++ /dev/null @@ -1,27 +0,0 @@ -DROP TABLE m_org_closure; - -IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'm_org_incorrect') - DROP TABLE m_org_incorrect; - -CREATE TABLE m_org_closure ( - ancestor_oid NVARCHAR(36) COLLATE database_default NOT NULL, - descendant_oid NVARCHAR(36) COLLATE database_default NOT NULL, - val INT, - PRIMARY KEY (ancestor_oid, descendant_oid) -); - -CREATE INDEX iAncestor ON m_org_closure (ancestor_oid); - -CREATE INDEX iDescendant ON m_org_closure (descendant_oid); - -CREATE INDEX iDescendantAncestor ON m_org_closure (descendant_oid, ancestor_oid); - -ALTER TABLE m_org_closure -ADD CONSTRAINT fk_ancestor -FOREIGN KEY (ancestor_oid) -REFERENCES m_object; - -ALTER TABLE m_org_closure -ADD CONSTRAINT fk_descendant -FOREIGN KEY (descendant_oid) -REFERENCES m_object; diff --git a/config/sql/midpoint/3.1.1/sqlserver/sqlserver-3.1.sql b/config/sql/midpoint/3.1.1/sqlserver/sqlserver-3.1.1.sql similarity index 100% rename from config/sql/midpoint/3.1.1/sqlserver/sqlserver-3.1.sql rename to config/sql/midpoint/3.1.1/sqlserver/sqlserver-3.1.1.sql From 453a5fa5e142a929ae45ac7d54112baf8719b256 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Fri, 6 Feb 2015 13:19:28 +0100 Subject: [PATCH 117/215] LoggingUtils.logUnexpectedException that always shows stack trace --- .../midpoint/util/logging/LoggingUtils.java | 24 ++++++++++++++++--- .../model/impl/controller/ModelUtils.java | 21 ++-------------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/infra/util/src/main/java/com/evolveum/midpoint/util/logging/LoggingUtils.java b/infra/util/src/main/java/com/evolveum/midpoint/util/logging/LoggingUtils.java index 8b81a158725..0a3dd4eac47 100644 --- a/infra/util/src/main/java/com/evolveum/midpoint/util/logging/LoggingUtils.java +++ b/infra/util/src/main/java/com/evolveum/midpoint/util/logging/LoggingUtils.java @@ -29,15 +29,31 @@ */ public class LoggingUtils { + /** + * Standard way of logging exception: message is presented at ERROR level, stack trace on DEBUG. + */ public static void logException(Trace LOGGER, String message, Throwable ex, Object... objects) { logExceptionInternal(Level.ERROR, Level.DEBUG, LOGGER, message, ex, objects); } + /** + * When logging unexpected exception, we always want to see the stack trace (so everything is logged on ERROR level) + */ + public static void logUnexpectedException(Trace LOGGER, String message, Throwable ex, Object... objects) { + logExceptionInternal(Level.ERROR, Level.ERROR, LOGGER, message, ex, objects); + } + + /** + * Non-critical exceptions (warnings, with details as debug) + */ public static void logExceptionAsWarning(Trace LOGGER, String message, Throwable ex, Object... objects) { logExceptionInternal(Level.WARN, Level.DEBUG, LOGGER, message, ex, objects); } - - public static void logErrorOnDebugLevel(Trace LOGGER, String message, Throwable ex, Object... objects) { + + /** + * Exceptions that shouldn't be even visible on INFO level. + */ + public static void logExceptionOnDebugLevel(Trace LOGGER, String message, Throwable ex, Object... objects) { logExceptionInternal(Level.DEBUG, Level.TRACE, LOGGER, message, ex, objects); } @@ -49,7 +65,9 @@ private static void logExceptionInternal(Level first, Level second, Trace LOGGER args.addAll(Arrays.asList(objects)); args.add(ex.getMessage() + " (" + ex.getClass() + ")"); - log(LOGGER, first, message + ", reason: {}", args.toArray()); + if (!first.equals(second)) { + log(LOGGER, first, message + ", reason: {}", args.toArray()); + } // Add exception to the list. It will be the last argument without {} in the message, // therefore the stack trace will get logged args.add(ex); diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelUtils.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelUtils.java index c03b64c6079..477954cb640 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelUtils.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelUtils.java @@ -15,31 +15,14 @@ */ package com.evolveum.midpoint.model.impl.controller; -import java.util.Calendar; -import java.util.GregorianCalendar; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.Validate; - -import com.evolveum.midpoint.common.Utils; import com.evolveum.midpoint.model.api.ModelAuthorizationAction; -import com.evolveum.midpoint.model.api.ModelService; -import com.evolveum.midpoint.prism.crypto.EncryptionException; -import com.evolveum.midpoint.prism.crypto.Protector; import com.evolveum.midpoint.prism.delta.ObjectDelta; import com.evolveum.midpoint.prism.query.ObjectPaging; import com.evolveum.midpoint.schema.result.OperationResult; -import com.evolveum.midpoint.util.RandomString; import com.evolveum.midpoint.util.logging.LoggingUtils; import com.evolveum.midpoint.util.logging.Trace; import com.evolveum.midpoint.util.logging.TraceManager; -import com.evolveum.midpoint.xml.ns._public.common.api_types_3.PropertyReferenceListType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; /** * @@ -71,7 +54,7 @@ public static void recordFatalError(OperationResult result, String message, Thro // Do not log at ERROR level. This is too harsh. Especially in object not found case. // What model considers an error may be just a normal situation for the code is using model API. // If this is really an error then it should be logged by the invoking code. - LoggingUtils.logErrorOnDebugLevel(LOGGER, message, e); + LoggingUtils.logExceptionOnDebugLevel(LOGGER, message, e); result.recordFatalError(message, e); result.cleanupResult(e); } @@ -84,7 +67,7 @@ public static void recordPartialError(OperationResult result, String message, Th // Do not log at ERROR level. This is too harsh. Especially in object not found case. // What model considers an error may be just a normal situation for the code is using model API. // If this is really an error then it should be logged by the invoking code. - LoggingUtils.logErrorOnDebugLevel(LOGGER, message, e); + LoggingUtils.logExceptionOnDebugLevel(LOGGER, message, e); result.recordPartialError(message, e); result.cleanupResult(e); } From 5d314ae5e3ad56f6a404f6cd4eef0327baa80345 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Fri, 6 Feb 2015 13:51:23 +0100 Subject: [PATCH 118/215] Cosmetics --- .../midpoint/prism/PrismObjectDefinition.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismObjectDefinition.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismObjectDefinition.java index 444005a38b0..428718d8a62 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismObjectDefinition.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismObjectDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Evolveum + * Copyright (c) 2010-2015 Evolveum * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,36 +34,36 @@ * @author Radovan Semancik * */ -public class PrismObjectDefinition extends PrismContainerDefinition { +public class PrismObjectDefinition extends PrismContainerDefinition { private static final long serialVersionUID = -8298581031956931008L; public PrismObjectDefinition(QName elementName, ComplexTypeDefinition complexTypeDefinition, PrismContext prismContext, - Class compileTimeClass) { + Class compileTimeClass) { // Object definition can only be top-level, hence null parent super(elementName, complexTypeDefinition, prismContext, compileTimeClass); } @Override - public PrismObject instantiate() { - PrismObject midPointObject = new PrismObject(getName(), this, prismContext); + public PrismObject instantiate() { + PrismObject midPointObject = new PrismObject(getName(), this, prismContext); return midPointObject; } @Override - public PrismObject instantiate(QName name) { + public PrismObject instantiate(QName name) { name = addNamespaceIfApplicable(name); - PrismObject midPointObject = new PrismObject(name, this, prismContext); + PrismObject midPointObject = new PrismObject(name, this, prismContext); return midPointObject; } - public PrismObjectDefinition clone() { - PrismObjectDefinition clone = new PrismObjectDefinition(name, complexTypeDefinition, prismContext, compileTimeClass); + public PrismObjectDefinition clone() { + PrismObjectDefinition clone = new PrismObjectDefinition(name, complexTypeDefinition, prismContext, compileTimeClass); copyDefinitionData(clone); return clone; } - public PrismObjectDefinition cloneWithReplacedDefinition(QName itemName, ItemDefinition newDefinition) { - return (PrismObjectDefinition) super.cloneWithReplacedDefinition(itemName, newDefinition); + public PrismObjectDefinition cloneWithReplacedDefinition(QName itemName, ItemDefinition newDefinition) { + return (PrismObjectDefinition) super.cloneWithReplacedDefinition(itemName, newDefinition); } public PrismContainerDefinition getExtensionDefinition() { From 63e5ce91cb32e58729108044e780b380e918e147 Mon Sep 17 00:00:00 2001 From: "Katarina Valalikova (katkav)" Date: Fri, 6 Feb 2015 13:59:02 +0100 Subject: [PATCH 119/215] fixing CAS SSO integration - bad reference on the user details service --- .../src/main/webapp/WEB-INF/ctx-web-security.xml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/gui/admin-gui/src/main/webapp/WEB-INF/ctx-web-security.xml b/gui/admin-gui/src/main/webapp/WEB-INF/ctx-web-security.xml index aa2382a0cba..84f2bff61ea 100644 --- a/gui/admin-gui/src/main/webapp/WEB-INF/ctx-web-security.xml +++ b/gui/admin-gui/src/main/webapp/WEB-INF/ctx-web-security.xml @@ -101,13 +101,13 @@ http://www.springframework.org/schema/security/spring-security-3.2.xsd"> - + From e033b8b25e7f99bdc14f2038807b9a99afd733d8 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Fri, 6 Feb 2015 14:28:47 +0100 Subject: [PATCH 120/215] Preliminary fixing MID-2198 (abundant xmlns declarations) by putting frequently used ones on root element of each document --- .../midpoint/prism/parser/DomSerializer.java | 33 ++++++++++++++----- .../midpoint/prism/parser/XPathHolder.java | 1 + .../prism/schema/SchemaDescription.java | 11 ++++++- .../midpoint/prism/schema/SchemaRegistry.java | 23 ++++++++++--- .../xml/DynamicNamespacePrefixMapper.java | 12 +++++-- .../GlobalDynamicNamespacePrefixMapper.java | 24 ++++++++++++-- .../schema/MidPointPrismContextFactory.java | 12 ++++--- .../object-template/object-template.xml | 2 ++ .../object-template/user-template.xml | 2 ++ 9 files changed, 98 insertions(+), 22 deletions(-) diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/DomSerializer.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/DomSerializer.java index 099e82d5394..54bbce85d30 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/DomSerializer.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/DomSerializer.java @@ -27,6 +27,7 @@ import com.evolveum.midpoint.prism.xnode.XNode; import com.evolveum.midpoint.util.DOMUtil; import com.evolveum.midpoint.util.exception.SchemaException; +import com.ibm.wsdl.extensions.schema.SchemaConstants; import com.sun.org.apache.xml.internal.utils.XMLChar; import org.apache.commons.lang.StringUtils; import org.w3c.dom.Comment; @@ -36,6 +37,10 @@ import org.w3c.dom.Node; import javax.xml.namespace.QName; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; /** @@ -48,8 +53,8 @@ public class DomSerializer { private Element topElement; private boolean serializeCompositeObjects = false; private SchemaRegistry schemaRegistry; - - DomSerializer(DomParser parser, SchemaRegistry schemaRegistry) { + + DomSerializer(DomParser parser, SchemaRegistry schemaRegistry) { super(); this.schemaRegistry = schemaRegistry; } @@ -99,7 +104,7 @@ private Element serializeInternal(RootXNode rootxnode) throws SchemaException { typeQName = rootxnode.getSubnode().getTypeQName(); } if (typeQName != null && !schemaRegistry.hasImplicitTypeDefinition(rootElementName, typeQName)) { - DOMUtil.setXsiType(topElement, typeQName); + DOMUtil.setXsiType(topElement, setQNamePrefixExplicitIfNeeded(typeQName)); } XNode subnode = rootxnode.getSubnode(); if (subnode instanceof PrimitiveXNode){ @@ -109,11 +114,14 @@ private Element serializeInternal(RootXNode rootxnode) throws SchemaException { if (!(subnode instanceof MapXNode)) { throw new SchemaException("Sub-root xnode is not map, cannot serialize to XML (it is "+subnode+")"); } - serializeMap((MapXNode)subnode, topElement); + // at this point we can put frequently used namespaces (e.g. c, t, q, ri) into the document to eliminate their use + // on many places inside the doc (MID-2198) + DOMUtil.setNamespaceDeclarations(topElement, getNamespacePrefixMapper().getNamespacesDeclaredByDefault()); + serializeMap((MapXNode) subnode, topElement); return topElement; } - - public Element serializeToElement(MapXNode xmap, QName elementName) throws SchemaException { + + public Element serializeToElement(MapXNode xmap, QName elementName) throws SchemaException { initialize(); Element element = createElement(elementName, null); topElement = element; @@ -149,7 +157,7 @@ private void serializeSubnode(XNode xsubnode, Element parentElement, QName eleme Element element = createElement(elementName, parentElement); appendCommentIfPresent(element, xsubnode); if (xsubnode.isExplicitTypeDeclaration() && xsubnode.getTypeQName() != null){ - DOMUtil.setXsiType(element, xsubnode.getTypeQName()); + DOMUtil.setXsiType(element, setQNamePrefixExplicitIfNeeded(xsubnode.getTypeQName())); } parentElement.appendChild(element); // System.out.println("subnode " + xsubnode.debugDump()); @@ -254,6 +262,7 @@ private void serializePrimitiveElementOrAttribute(PrimitiveXNode xprim, Eleme if (typeQName.equals(DOMUtil.XSD_QNAME)) { QName value = (QName) xprim.getParsedValueWithoutRecording(DOMUtil.XSD_QNAME); + value = setQNamePrefixExplicitIfNeeded(value); if (asAttribute) { try { DOMUtil.setQNameAttribute(parentElement, elementOrAttributeName.getLocalPart(), value); @@ -276,7 +285,7 @@ private void serializePrimitiveElementOrAttribute(PrimitiveXNode xprim, Eleme } if (!asAttribute && xprim.isExplicitTypeDeclaration()) { - DOMUtil.setXsiType(element, typeQName); + DOMUtil.setXsiType(element, setQNamePrefixExplicitIfNeeded(typeQName)); } } @@ -323,6 +332,14 @@ private QName setQNamePrefix(QName qname) { } return namespacePrefixMapper.setQNamePrefix(qname); } + + private QName setQNamePrefixExplicitIfNeeded(QName name) { + if (name != null && StringUtils.isNotBlank(name.getNamespaceURI()) && StringUtils.isBlank(name.getPrefix())) { + return setQNamePrefixExplicit(name); + } else { + return name; + } + } private QName setQNamePrefixExplicit(QName qname) { DynamicNamespacePrefixMapper namespacePrefixMapper = getNamespacePrefixMapper(); diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/XPathHolder.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/XPathHolder.java index 8a2d0d92108..5db2f544c01 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/XPathHolder.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/XPathHolder.java @@ -401,6 +401,7 @@ public Element toElement(QName elementQName, Document document) { return toElement(elementQName.getNamespaceURI(), elementQName.getLocalPart(), document); } + // really ugly implementation... (ignores overall context of serialization, so produces elements even if common is default namespace) TODO rework [med] public Element toElement(String elementNamespace, String localElementName, Document document) { Element element = document.createElementNS(elementNamespace, localElementName); if (!StringUtils.isBlank(elementNamespace)) { diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/schema/SchemaDescription.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/schema/SchemaDescription.java index 745a89cb155..5499352c477 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/schema/SchemaDescription.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/schema/SchemaDescription.java @@ -54,6 +54,7 @@ public class SchemaDescription implements DebugDumpable { private Node node; private boolean isPrismSchema = false; private boolean isDefault = false; + private boolean isDeclaredByDefault = false; private PrismSchema schema; private Package compileTimeClassesPackage; private Map> xsdTypeTocompileTimeClassMap; @@ -114,7 +115,15 @@ public void setDefault(boolean isDefault) { this.isDefault = isDefault; } - public PrismSchema getSchema() { + public boolean isDeclaredByDefault() { + return isDeclaredByDefault; + } + + public void setDeclaredByDefault(boolean isDeclaredByDefault) { + this.isDeclaredByDefault = isDeclaredByDefault; + } + + public PrismSchema getSchema() { return schema; } diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/schema/SchemaRegistry.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/schema/SchemaRegistry.java index 9dc660c55a1..56ca50ff31c 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/schema/SchemaRegistry.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/schema/SchemaRegistry.java @@ -178,25 +178,35 @@ public void registerPrismSchemasFromWsdlResource(String resourcePath, List getNamespacesDeclaredByDefault(); } diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/xml/GlobalDynamicNamespacePrefixMapper.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/xml/GlobalDynamicNamespacePrefixMapper.java index b393ab0865d..87ccae2a1a3 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/xml/GlobalDynamicNamespacePrefixMapper.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/xml/GlobalDynamicNamespacePrefixMapper.java @@ -16,7 +16,9 @@ package com.evolveum.midpoint.prism.xml; +import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Map.Entry; import java.util.Random; @@ -50,6 +52,7 @@ public class GlobalDynamicNamespacePrefixMapper extends NamespacePrefixMapper im private Map localNamespacePrefixMap = new HashMap(); private String defaultNamespace = null; private boolean alwaysExplicit = false; + private final Set prefixesDeclaredByDefault = new HashSet<>(); public String getDefaultNamespace() { return defaultNamespace; @@ -69,7 +72,24 @@ public void setAlwaysExplicit(boolean alwaysExplicit) { this.alwaysExplicit = alwaysExplicit; } - @Override + @Override + public void addDeclaredByDefault(String prefix) { + prefixesDeclaredByDefault.add(prefix); + } + + @Override + public synchronized Map getNamespacesDeclaredByDefault() { + Map retval = new HashMap<>(); + for (Map.Entry entry : globalNamespacePrefixMap.entrySet()) { + String prefix = entry.getValue(); + if (prefixesDeclaredByDefault.contains(prefix)) { + retval.put(prefix, entry.getKey()); + } + } + return retval; + } + + @Override public synchronized void registerPrefix(String namespace, String prefix, boolean isDefaultNamespace) { registerPrefixGlobal(namespace, prefix); if (isDefaultNamespace || prefix == null) { @@ -77,7 +97,7 @@ public synchronized void registerPrefix(String namespace, String prefix, boolean } } - public static synchronized void registerPrefixGlobal(String namespace, String prefix) { + private static synchronized void registerPrefixGlobal(String namespace, String prefix) { globalNamespacePrefixMap.put(namespace, prefix); } diff --git a/infra/schema/src/main/java/com/evolveum/midpoint/schema/MidPointPrismContextFactory.java b/infra/schema/src/main/java/com/evolveum/midpoint/schema/MidPointPrismContextFactory.java index 8008eeda2a3..af67a8f5064 100644 --- a/infra/schema/src/main/java/com/evolveum/midpoint/schema/MidPointPrismContextFactory.java +++ b/infra/schema/src/main/java/com/evolveum/midpoint/schema/MidPointPrismContextFactory.java @@ -111,15 +111,15 @@ private void registerBuiltinSchemas(SchemaRegistry schemaRegistry) throws Schema schemaRegistry.registerPrismSchemaResource("xml/ns/public/annotation-3.xsd", "a"); schemaRegistry.registerPrismSchemaResource("xml/ns/public/types-3.xsd", "t", - com.evolveum.prism.xml.ns._public.types_3.ObjectFactory.class.getPackage()); + com.evolveum.prism.xml.ns._public.types_3.ObjectFactory.class.getPackage(), true); // declared by default schemaRegistry.registerPrismSchemaResource("xml/ns/public/query-3.xsd", "q", - com.evolveum.prism.xml.ns._public.query_3.ObjectFactory.class.getPackage()); + com.evolveum.prism.xml.ns._public.query_3.ObjectFactory.class.getPackage(), true); // declared by default // midPoint schemas schemaRegistry.registerPrismDefaultSchemaResource("xml/ns/public/common/common-3.xsd", "c", - com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory.class.getPackage()); + com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory.class.getPackage()); // declared by default schemaRegistry.registerPrismSchemaResource("xml/ns/public/common/api-types-3.xsd", "apti", com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectFactory.class.getPackage()); @@ -136,7 +136,7 @@ private void registerBuiltinSchemas(SchemaRegistry schemaRegistry) throws Schema com.evolveum.midpoint.xml.ns._public.connector.icf_1.connector_schema_3.ObjectFactory.class.getPackage()); schemaRegistry.registerPrismSchemaResource("xml/ns/public/connector/icf-1/resource-schema-3.xsd", "icfs", - com.evolveum.midpoint.xml.ns._public.connector.icf_1.resource_schema_3.ObjectFactory.class.getPackage()); + com.evolveum.midpoint.xml.ns._public.connector.icf_1.resource_schema_3.ObjectFactory.class.getPackage(), true); // declared by default schemaRegistry.registerPrismSchemaResource("xml/ns/public/model/extension-3.xsd", "mext"); @@ -161,6 +161,10 @@ private void registerBuiltinSchemas(SchemaRegistry schemaRegistry) throws Schema schemaRegistry.registerPrismSchemaResource("xml/ns/public/connector/icf-1/connector-extension-3.xsd", "connext"); schemaRegistry.registerPrismSchemaResource("xml/ns/public/model/scripting/extension-3.xsd", "se"); + + schemaRegistry.getNamespacePrefixMapper().registerPrefix(MidPointConstants.NS_RI, MidPointConstants.PREFIX_NS_RI, false); + schemaRegistry.getNamespacePrefixMapper().addDeclaredByDefault(MidPointConstants.PREFIX_NS_RI); // declared by default + } private void setupDebug() { diff --git a/infra/schema/src/test/resources/object-template/object-template.xml b/infra/schema/src/test/resources/object-template/object-template.xml index 85584843cfc..42874d0c31f 100644 --- a/infra/schema/src/test/resources/object-template/object-template.xml +++ b/infra/schema/src/test/resources/object-template/object-template.xml @@ -20,6 +20,8 @@ xmlns:c='http://midpoint.evolveum.com/xml/ns/public/common/common-3' xmlns:t='http://prism.evolveum.com/xml/ns/public/types-3'> Default User Template + + weak diff --git a/infra/schema/src/test/resources/object-template/user-template.xml b/infra/schema/src/test/resources/object-template/user-template.xml index 1d5e12e697a..584ef703831 100644 --- a/infra/schema/src/test/resources/object-template/user-template.xml +++ b/infra/schema/src/test/resources/object-template/user-template.xml @@ -22,6 +22,8 @@ xmlns:c='http://midpoint.evolveum.com/xml/ns/public/common/common-3' xmlns:t='http://prism.evolveum.com/xml/ns/public/types-3'> Default User Template + + weak From f444ba6ca87c61b10854ca63629cef683e2965bc Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Mon, 9 Feb 2015 12:11:21 +0100 Subject: [PATCH 121/215] few small fixes in wizard. --- .../com/evolveum/midpoint/web/component/wizard/Wizard.java | 2 +- .../evolveum/midpoint/web/component/wizard/WizardStep.java | 7 ++++--- .../evolveum/midpoint/web/page/admin/users/PageUser.java | 6 +++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/Wizard.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/Wizard.java index 56977b8e1f0..9c22228b5b2 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/Wizard.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/Wizard.java @@ -212,6 +212,6 @@ private void changeStep(AjaxRequestTarget target, WizardStepDto dto){ onActiveStepChanged(newStep); } - target.add(this); + target.add(this, getPageBase().getFeedbackPanel()); } } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/WizardStep.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/WizardStep.java index 2ff19822505..efa57b2c67a 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/WizardStep.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/WizardStep.java @@ -111,10 +111,11 @@ protected List loadResourceObjectClassList(IModel Date: Mon, 9 Feb 2015 13:32:05 +0100 Subject: [PATCH 122/215] fixed schema/prism version in dist --- dist/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/pom.xml b/dist/pom.xml index 0fdb9dffe30..94cab7d2acf 100644 --- a/dist/pom.xml +++ b/dist/pom.xml @@ -85,14 +85,14 @@ com.evolveum.midpoint.infra prism - 3.1-SNAPSHOT + 3.2-SNAPSHOT jar META-INF/catalog-runtime.xml com.evolveum.midpoint.infra schema - 3.1-SNAPSHOT + 3.2-SNAPSHOT jar META-INF/jax-ws-catalog.xml From 9f2d2c4a0526437aa2ec80e3ca59531c70d67076 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Mon, 9 Feb 2015 13:35:15 +0100 Subject: [PATCH 123/215] updated lookup table entities --- .../src/test/resources/basic/objects.xml | 35 +++++++++++++++++ .../repo/sql/data/common/RLookupTable.java | 39 ++++++++++++++++--- .../data/common/other/RLookupTableRow.java | 7 ++-- 3 files changed, 73 insertions(+), 8 deletions(-) diff --git a/repo/repo-sql-impl-test/src/test/resources/basic/objects.xml b/repo/repo-sql-impl-test/src/test/resources/basic/objects.xml index 173a990f867..b391d5287c7 100644 --- a/repo/repo-sql-impl-test/src/test/resources/basic/objects.xml +++ b/repo/repo-sql-impl-test/src/test/resources/basic/objects.xml @@ -1242,4 +1242,39 @@ + + + first lookup + description of lookuptable + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RLookupTable.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RLookupTable.java index c093094b4db..1eff4417e72 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RLookupTable.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RLookupTable.java @@ -4,16 +4,17 @@ import com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString; import com.evolveum.midpoint.repo.sql.data.common.other.RLookupTableRow; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; +import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; +import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; +import com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableTableType; import com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType; import org.hibernate.annotations.Cascade; import org.hibernate.annotations.ForeignKey; -import javax.persistence.Entity; -import javax.persistence.OneToMany; -import javax.persistence.Table; -import javax.persistence.UniqueConstraint; +import javax.persistence.*; import java.util.Collection; import java.util.Set; @@ -39,6 +40,7 @@ public void setRows(Set rows) { } @Override + @Embedded public RPolyString getName() { return name; } @@ -48,8 +50,35 @@ public void setName(RPolyString name) { this.name = name; } + public static void copyFromJAXB(LookupTableType jaxb, RLookupTable repo, PrismContext prismContext, + IdGeneratorResult generatorResult) throws DtoTranslationException { + RObject.copyFromJAXB(jaxb, repo, prismContext, generatorResult); + + repo.setName(RPolyString.copyFromJAXB(jaxb.getName())); + + LookupTableTableType table = jaxb.getTable(); + if (table == null) { + return; + } + + for (LookupTableRowType row : table.getRow()) { + RLookupTableRow rRow = new RLookupTableRow(); + rRow.setOwner(repo); + rRow.setKey(row.getKey()); + rRow.setLabel(RPolyString.copyFromJAXB(row.getLabel())); + rRow.setLastChangeTimestamp(row.getLastChangeTimestamp()); + rRow.setValue(row.getValue()); + + repo.getRows().add(rRow); + } + } + @Override public LookupTableType toJAXB(PrismContext prismContext, Collection> options) throws DtoTranslationException { - return null; + LookupTableType object = new LookupTableType(); + RUtil.revive(object, prismContext); + RLookupTable.copyToJAXB(this, object, prismContext, options); + + return object; } } diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RLookupTableRow.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RLookupTableRow.java index 280040048b3..d24c624c41a 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RLookupTableRow.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RLookupTableRow.java @@ -8,6 +8,7 @@ import org.hibernate.annotations.ForeignKey; import javax.persistence.*; +import javax.xml.datatype.XMLGregorianCalendar; import java.sql.Timestamp; /** @@ -29,7 +30,7 @@ public class RLookupTableRow { private String key; private String value; private RPolyString label; - private Timestamp lastChangeTimestamp; + private XMLGregorianCalendar lastChangeTimestamp; @Id @ForeignKey(name = "fk_lookup_table") @@ -66,11 +67,11 @@ public void setLabel(RPolyString label) { this.label = label; } - public Timestamp getLastChangeTimestamp() { + public XMLGregorianCalendar getLastChangeTimestamp() { return lastChangeTimestamp; } - public void setLastChangeTimestamp(Timestamp lastChangeTimestamp) { + public void setLastChangeTimestamp(XMLGregorianCalendar lastChangeTimestamp) { this.lastChangeTimestamp = lastChangeTimestamp; } From d5df87dfc8c8e7c0b1ce4aa34effeed0e19c7f29 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Mon, 9 Feb 2015 16:28:48 +0100 Subject: [PATCH 124/215] adjusting wizard to attribute ref. type change from QName to ItemPathType --- .../web/component/input/QNameEditorPanel.java | 24 +++++++----- .../wizard/resource/SchemaHandlingStep.java | 7 +++- .../ResourceAssociationEditor.java | 9 +++-- .../ResourceAttributeEditor.java | 38 ++++++++----------- 4 files changed, 41 insertions(+), 37 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/QNameEditorPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/QNameEditorPanel.java index 4254d1848ff..23ba0fa4c19 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/QNameEditorPanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/QNameEditorPanel.java @@ -18,6 +18,7 @@ import com.evolveum.midpoint.web.component.util.SimplePanel; import com.evolveum.midpoint.web.util.InfoTooltipBehavior; +import com.evolveum.prism.xml.ns._public.types_3.ItemPathType; import org.apache.wicket.behavior.AttributeAppender; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.DropDownChoice; @@ -25,14 +26,15 @@ import org.apache.wicket.model.IModel; import org.apache.wicket.model.PropertyModel; -import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.List; /** * @author shood + * + * TODO - this component should probably be renamed to ItemPathType editor * */ -public class QNameEditorPanel extends SimplePanel{ +public class QNameEditorPanel extends SimplePanel{ private static final String ID_LOCAL_PART = "localPart"; private static final String ID_NAMESPACE = "namespace"; @@ -41,12 +43,14 @@ public class QNameEditorPanel extends SimplePanel{ private static final String ID_T_LOCAL_PART = "localPartTooltip"; private static final String ID_T_NAMESPACE = "namespaceTooltip"; - public QNameEditorPanel(String id, IModel model){ + private String namespace; + + public QNameEditorPanel(String id, IModel model){ this(id, model, "QNameEditor.label.localPart", "QNameEditor.tooltip.localPart", "QNameEditor.label.namespace", "QNameEditor.tooltip.namespace"); } - public QNameEditorPanel(String id, IModel model, String localPartLabelKey, String localPartTooltipKey, + public QNameEditorPanel(String id, IModel model, String localPartLabelKey, String localPartTooltipKey, String namespaceLabelKey, String namespaceTooltipKey){ super(id, model); @@ -54,12 +58,12 @@ public QNameEditorPanel(String id, IModel model, String localPartLabelKey } @Override - public IModel getModel() { - IModel model = super.getModel(); - QName modelObject = model.getObject(); + public IModel getModel() { + IModel model = super.getModel(); + ItemPathType modelObject = model.getObject(); if(modelObject == null){ - model.setObject(new QName("")); + model.setObject(new ItemPathType()); } return model; @@ -78,13 +82,13 @@ protected void initLayout(String localPartLabelKey, String localPartTooltipKey, namespaceLabel.setOutputMarkupPlaceholderTag(true); add(namespaceLabel); - TextField localPart = new TextField<>(ID_LOCAL_PART, new PropertyModel(getModel(), "localPart")); + TextField localPart = new TextField<>(ID_LOCAL_PART, new PropertyModel(getModel(), "itemPath")); localPart.setOutputMarkupId(true); localPart.setOutputMarkupPlaceholderTag(true); localPart.setRequired(isLocalPartRequired()); add(localPart); - DropDownChoice namespace = new DropDownChoice<>(ID_NAMESPACE, new PropertyModel(getModel(), "namespaceURI"), + DropDownChoice namespace = new DropDownChoice<>(ID_NAMESPACE, new PropertyModel(this, "namespace"), prepareNamespaceList()); namespace.setOutputMarkupId(true); namespace.setOutputMarkupPlaceholderTag(true); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java index b031a4e132b..f7cd9017c22 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java @@ -422,7 +422,12 @@ public String getObject() { StringBuilder sb = new StringBuilder(); if(model.getObject().getRef() != null){ - sb.append(ItemPathUtil.getOnlySegmentQName(model.getObject().getRef()).getLocalPart()); + ItemPathType itemPathType = model.getObject().getRef(); + if(itemPathType.getItemPath() != null){ + sb.append(itemPathType.getItemPath().toString()); + } else { + sb.append(model.getObject().getRef()); + } } else { return null; } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java index 320e75a4ce9..3143ba711cd 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java @@ -17,7 +17,6 @@ package com.evolveum.midpoint.web.component.wizard.resource.component.schemahandling; import com.evolveum.midpoint.prism.PrismObject; -import com.evolveum.midpoint.prism.util.ItemPathUtil; import com.evolveum.midpoint.schema.processor.ObjectClassComplexTypeDefinition; import com.evolveum.midpoint.schema.processor.ResourceAttributeDefinition; import com.evolveum.midpoint.schema.processor.ResourceSchema; @@ -39,6 +38,7 @@ import com.evolveum.midpoint.web.util.WebMiscUtil; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; +import com.evolveum.prism.xml.ns._public.types_3.ItemPathType; import org.apache.wicket.RestartResponseException; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.AjaxLink; @@ -125,7 +125,10 @@ public String getObject() { if(association.getDisplayName() == null && association.getRef() == null){ return getString("ResourceAssociationEditor.label.new"); } else { - return getString("ResourceAssociationEditor.label.edit", ItemPathUtil.getOnlySegmentQName(association.getRef()).getLocalPart()); + if(association.getRef().getItemPath() != null){ + return getString("ResourceAssociationEditor.label.edit", association.getRef().getItemPath().toString()); + } + return getString("ResourceAssociationEditor.label.edit", ""); } } }); @@ -199,7 +202,7 @@ public String getIdValue(QName object, int index) { new PropertyModel(getModel(), "explicitReferentialIntegrity")); add(explicitRefIntegrity); - QNameEditorPanel nonSchemaRefPanel = new QNameEditorPanel(ID_ASSOCIATION_ATTRIBUTE_PANEL, new PropertyModel(getModel(), "ref"), + QNameEditorPanel nonSchemaRefPanel = new QNameEditorPanel(ID_ASSOCIATION_ATTRIBUTE_PANEL, new PropertyModel(getModel(), "ref"), "SchemaHandlingStep.association.label.associationName", "SchemaHandlingStep.association.tooltip.associationLocalPart", "SchemaHandlingStep.association.label.associationNamespace", "SchemaHandlingStep.association.tooltip.associationNamespace"); nonSchemaRefPanel.setOutputMarkupId(true); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java index 52c1742b4b5..91fb9ad931c 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java @@ -38,6 +38,7 @@ import com.evolveum.midpoint.web.util.WebMiscUtil; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; +import com.evolveum.prism.xml.ns._public.types_3.ItemPathType; import org.apache.wicket.RestartResponseException; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; @@ -126,7 +127,7 @@ public String getObject() { }); add(label); - QNameEditorPanel nonSchemaRefPanel = new QNameEditorPanel(ID_NON_SCHEMA_REF_PANEL, new PropertyModel(getModel(), "ref"), + QNameEditorPanel nonSchemaRefPanel = new QNameEditorPanel(ID_NON_SCHEMA_REF_PANEL, new PropertyModel(getModel(), "ref"), "SchemaHandlingStep.attribute.label.attributeName", "SchemaHandlingStep.attribute.tooltip.attributeLocalPart", "SchemaHandlingStep.attribute.label.attributeNamespace", "SchemaHandlingStep.attribute.tooltip.attributeNamespace"); @@ -160,22 +161,22 @@ public boolean isVisible() { refTooltip.setOutputMarkupId(true); schemaRefPanel.add(refTooltip); - DropDownChoice refSelect = new DropDownChoice<>(ID_REFERENCE_SELECT, new PropertyModel(getModel(), "ref"), - new AbstractReadOnlyModel>() { + DropDownChoice refSelect = new DropDownChoice<>(ID_REFERENCE_SELECT, new PropertyModel(getModel(), "ref"), + new AbstractReadOnlyModel>() { @Override - public List getObject() { + public List getObject() { return loadObjectReferences(); } - }, new IChoiceRenderer() { + }, new IChoiceRenderer() { @Override - public Object getDisplayValue(QName object) { + public Object getDisplayValue(ItemPathType object) { return prepareReferenceDisplayValue(object); } @Override - public String getIdValue(QName object, int index) { + public String getIdValue(ItemPathType object, int index) { return Integer.toString(index); } }); @@ -378,8 +379,8 @@ public void updateComponents(AjaxRequestTarget target) { add(outboundEditor); } - private List loadObjectReferences(){ - List references = new ArrayList<>(); + private List loadObjectReferences(){ + List references = new ArrayList<>(); ResourceSchema schema = loadResourceSchema(); if (schema == null) { @@ -390,7 +391,7 @@ private List loadObjectReferences(){ if(objectType != null && def.getTypeName().equals(objectType.getObjectClass())){ for (ResourceAttributeDefinition attributeDefinition : def.getAttributeDefinitions()) { - references.add(attributeDefinition.getName()); + references.add(new ItemPathType(attributeDefinition.getName().getLocalPart())); } } } @@ -418,21 +419,12 @@ private ResourceSchema loadResourceSchema() { return null; } - private String prepareReferenceDisplayValue(QName object){ - StringBuilder sb = new StringBuilder(); - - if(object != null){ - sb.append(object.getLocalPart()); - - if(object.getNamespaceURI() != null){ - sb.append(" ("); - String[] ns = object.getNamespaceURI().split("/"); - sb.append(ns[ns.length-1]); - sb.append(")"); - } + private String prepareReferenceDisplayValue(ItemPathType object){ + if(object != null && object.getItemPath() != null){ + return object.getItemPath().toString(); } - return sb.toString(); + return ""; } private void limitationsEditPerformed(AjaxRequestTarget target){ From d40370ca4cc64181dd71aac6871754de61158262 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Mon, 9 Feb 2015 16:42:42 +0100 Subject: [PATCH 125/215] switching back to development mode --- gui/admin-gui/src/main/webapp/WEB-INF/web.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/admin-gui/src/main/webapp/WEB-INF/web.xml b/gui/admin-gui/src/main/webapp/WEB-INF/web.xml index 515eed4d63e..10e85c93632 100644 --- a/gui/admin-gui/src/main/webapp/WEB-INF/web.xml +++ b/gui/admin-gui/src/main/webapp/WEB-INF/web.xml @@ -89,8 +89,8 @@ org.apache.wicket.protocol.http.WicketFilter configuration - - deployment + development + applicationBean From c1eda5765b7ba04ff311f521124935d017ef1eab Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Mon, 9 Feb 2015 18:14:57 +0100 Subject: [PATCH 126/215] Fixed MID-2176. --- .../model/impl/lens/ChangeExecutor.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/ChangeExecutor.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/ChangeExecutor.java index f1ec12f1a3d..bd95bd492b0 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/ChangeExecutor.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/ChangeExecutor.java @@ -420,15 +420,18 @@ private void updateLinks(LensFocusCo if (!focusContext.isDelete()) { PrismObject objectCurrent = focusContext.getObjectCurrent(); - PrismReference linkRef = objectCurrent.findReference(FocusType.F_LINK_REF); - if (linkRef != null) { - for (PrismReferenceValue linkRefVal: linkRef.getValues()) { - if (linkRefVal.getOid().equals(projOid)) { - // Linked, need to unlink - unlinkShadow(focusContext.getOid(), linkRefVal, focusObjectContext, task, result); - } - } - } + // it is possible that objectCurrent is null (and objectNew is non-null), in case of User ADD operation (MID-2176) + if (objectCurrent != null) { + PrismReference linkRef = objectCurrent.findReference(FocusType.F_LINK_REF); + if (linkRef != null) { + for (PrismReferenceValue linkRefVal : linkRef.getValues()) { + if (linkRefVal.getOid().equals(projOid)) { + // Linked, need to unlink + unlinkShadow(focusContext.getOid(), linkRefVal, focusObjectContext, task, result); + } + } + } + } } if (projCtx.isDelete() || projCtx.isThombstone()) { From f4cf73c8eca5d4d32465b6f278057d5c4427a502 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Mon, 9 Feb 2015 18:45:23 +0100 Subject: [PATCH 127/215] Refactor to allow universal refined schema --- .../midpoint/prism/ComplexTypeDefinition.java | 11 ++++++++- .../midpoint/prism/ItemDefinition.java | 4 ++++ .../prism/PrismContainerDefinition.java | 13 ++++++++++- .../midpoint/prism/PrismObjectDefinition.java | 5 ++++ .../midpoint/prism/util/PrismUtil.java | 7 ++++-- .../impl/controller/ModelController.java | 23 +++++-------------- 6 files changed, 42 insertions(+), 21 deletions(-) diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/ComplexTypeDefinition.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/ComplexTypeDefinition.java index 7c2d9b165dc..61f5d48fb92 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/ComplexTypeDefinition.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/ComplexTypeDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Evolveum + * Copyright (c) 2010-2015 Evolveum * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -271,6 +271,15 @@ public ComplexTypeDefinition clone() { return clone; } + public ComplexTypeDefinition deepClone() { + ComplexTypeDefinition clone = clone(); + clone.itemDefinitions.clear(); + for (ItemDefinition itemDef: this.itemDefinitions) { + clone.itemDefinitions.add(itemDef.deepClone()); + } + return clone; + } + protected void copyDefinitionData(ComplexTypeDefinition clone) { super.copyDefinitionData(clone); clone.superType = this.superType; diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/ItemDefinition.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/ItemDefinition.java index 4f8a2abcf2a..0a312e26a4a 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/ItemDefinition.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/ItemDefinition.java @@ -315,6 +315,10 @@ protected void copyDefinitionData(ItemDefinition clone) { clone.operational = this.operational; } + public ItemDefinition deepClone() { + return clone(); + } + @Override public void revive(PrismContext prismContext) { if (this.prismContext != null) { diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismContainerDefinition.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismContainerDefinition.java index 93627c95044..d10bfd14040 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismContainerDefinition.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismContainerDefinition.java @@ -356,7 +356,18 @@ protected void copyDefinitionData(PrismContainerDefinition clone) { clone.compileTimeClass = this.compileTimeClass; } - public PrismContainerDefinition cloneWithReplacedDefinition(QName itemName, ItemDefinition newDefinition) { + @Override + public ItemDefinition deepClone() { + PrismContainerDefinition clone = clone(); + ComplexTypeDefinition ctd = getComplexTypeDefinition(); + if (ctd != null) { + ctd = ctd.deepClone(); + clone.setComplexTypeDefinition(ctd); + } + return clone; + } + + public PrismContainerDefinition cloneWithReplacedDefinition(QName itemName, ItemDefinition newDefinition) { PrismContainerDefinition clone = clone(); ComplexTypeDefinition originalComplexTypeDefinition = getComplexTypeDefinition(); ComplexTypeDefinition cloneComplexTypeDefinition = originalComplexTypeDefinition.clone(); diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismObjectDefinition.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismObjectDefinition.java index 428718d8a62..b861ddc51eb 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismObjectDefinition.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismObjectDefinition.java @@ -62,6 +62,11 @@ public PrismObjectDefinition clone() { return clone; } + @Override + public PrismObjectDefinition deepClone() { + return (PrismObjectDefinition) super.deepClone(); + } + public PrismObjectDefinition cloneWithReplacedDefinition(QName itemName, ItemDefinition newDefinition) { return (PrismObjectDefinition) super.cloneWithReplacedDefinition(itemName, newDefinition); } diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/util/PrismUtil.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/util/PrismUtil.java index 7e2a07363d1..e62c5069884 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/util/PrismUtil.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/util/PrismUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Evolveum + * Copyright (c) 2010-2015 Evolveum * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,10 @@ */ package com.evolveum.midpoint.prism.util; +import com.evolveum.midpoint.prism.ComplexTypeDefinition; +import com.evolveum.midpoint.prism.ItemDefinition; import com.evolveum.midpoint.prism.PrismConstants; +import com.evolveum.midpoint.prism.PrismContainerDefinition; import com.evolveum.midpoint.prism.PrismContext; import com.evolveum.midpoint.prism.PrismProperty; import com.evolveum.midpoint.prism.PrismPropertyDefinition; @@ -188,5 +191,5 @@ public static PrismProperty convertProperty(PrismProperty srcProp, P return targetProp; } } - + } diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java index 77abe2fff35..d76a5900736 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java @@ -818,7 +818,7 @@ public ModelContext previewChanges( @Override public PrismObjectDefinition getEditObjectDefinition(PrismObject object, AuthorizationPhaseType phase) throws SchemaException { - PrismObjectDefinition origDefinition = object.getDefinition(); + PrismObjectDefinition objectDefinition = object.getDefinition().deepClone(); // TODO: maybe we need to expose owner resolver in the interface? ObjectSecurityConstraints securityConstraints = securityEnforcer.compileSecurityConstraints(object, null); if (LOGGER.isTraceEnabled()) { @@ -827,24 +827,16 @@ public PrismObjectDefinition getEditObjectDefinition(P if (securityConstraints == null) { return null; } - PrismObjectDefinition finalDefinition = applySecurityContraints(origDefinition, new ItemPath(), securityConstraints, + applySecurityContraints(objectDefinition, new ItemPath(), securityConstraints, securityConstraints.getActionDecision(ModelAuthorizationAction.READ.getUrl(), phase), securityConstraints.getActionDecision(ModelAuthorizationAction.ADD.getUrl(), phase), securityConstraints.getActionDecision(ModelAuthorizationAction.MODIFY.getUrl(), phase), phase); - return finalDefinition; + return objectDefinition; } - private D applySecurityContraints(D origItemDefinition, ItemPath itemPath, ObjectSecurityConstraints securityConstraints, + private void applySecurityContraints(D itemDefinition, ItemPath itemPath, ObjectSecurityConstraints securityConstraints, AuthorizationDecisionType defaultReadDecition, AuthorizationDecisionType defaultAddDecition, AuthorizationDecisionType defaultModifyDecition, AuthorizationPhaseType phase) { - D itemDefinition = (D) origItemDefinition.clone(); - // We need to make a super-deep clone here. Even make sure that the complex types inside are cloned. - // Otherwise permissions from one part of the definition tree may be incorrectly propagated to another part - if (itemDefinition instanceof PrismContainerDefinition) { - PrismContainerDefinition containerDefinition = (PrismContainerDefinition)itemDefinition; - ComplexTypeDefinition origCtd = containerDefinition.getComplexTypeDefinition(); - containerDefinition.setComplexTypeDefinition(origCtd.clone()); - } AuthorizationDecisionType readDecision = computeItemDecision(securityConstraints, itemPath, ModelAuthorizationAction.READ.getUrl(), defaultReadDecition, phase); AuthorizationDecisionType addDecision = computeItemDecision(securityConstraints, itemPath, ModelAuthorizationAction.ADD.getUrl(), defaultAddDecition, phase); AuthorizationDecisionType modifyDecision = computeItemDecision(securityConstraints, itemPath, ModelAuthorizationAction.MODIFY.getUrl(), defaultModifyDecition, phase); @@ -862,19 +854,16 @@ private D applySecurityContraints(D origItemDefinitio if (itemDefinition instanceof PrismContainerDefinition) { PrismContainerDefinition containerDefinition = (PrismContainerDefinition)itemDefinition; // The items are still shallow-clonned, we need to deep-clone them - List origSubDefinitions = ((PrismContainerDefinition)origItemDefinition).getDefinitions(); - containerDefinition.getDefinitions().clear(); + List origSubDefinitions = ((PrismContainerDefinition)containerDefinition).getDefinitions(); for (ItemDefinition subDef: origSubDefinitions) { // TODO fix this brutal hack - it is necessary to avoid endless recursion in the style of "Decision for authorization/object/owner/owner/......../owner/special: ALLOW" // it's too late to come up with a serious solution if (!(itemPath.lastNamed() != null && ObjectSpecificationType.F_OWNER.equals(itemPath.lastNamed().getName()) && ObjectSpecificationType.F_OWNER.equals(subDef.getName()))) { - ItemDefinition newDef = applySecurityContraints(subDef, new ItemPath(itemPath, subDef.getName()), securityConstraints, + applySecurityContraints(subDef, new ItemPath(itemPath, subDef.getName()), securityConstraints, readDecision, addDecision, modifyDecision, phase); - containerDefinition.getComplexTypeDefinition().add(newDef); } } } - return itemDefinition; } private AuthorizationDecisionType computeItemDecision(ObjectSecurityConstraints securityConstraints, ItemPath itemPath, String actionUrl, From a3b297a0b708355e86ae19fb9ef343e10a29d295 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Mon, 9 Feb 2015 20:39:36 +0100 Subject: [PATCH 128/215] More footwork for universal refined schema --- .../web/component/util/ObjectWrapperUtil.java | 8 +++- .../model/api/ModelInteractionService.java | 7 +-- .../impl/controller/ModelController.java | 40 +++++++++++++++- .../model/impl/controller/ModelUtils.java | 45 ++++++++++++++++++ .../impl/lens/projector/ContextLoader.java | 46 ++++--------------- .../midpoint/model/intest/TestSecurity.java | 12 ++++- 6 files changed, 112 insertions(+), 46 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/util/ObjectWrapperUtil.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/util/ObjectWrapperUtil.java index 85e7fcf1a44..3e35d22b092 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/util/ObjectWrapperUtil.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/util/ObjectWrapperUtil.java @@ -6,6 +6,9 @@ import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.prism.PrismObjectDefinition; import com.evolveum.midpoint.prism.PrismReference; +import com.evolveum.midpoint.schema.result.OperationResult; +import com.evolveum.midpoint.util.exception.ConfigurationException; +import com.evolveum.midpoint.util.exception.ObjectNotFoundException; import com.evolveum.midpoint.util.exception.SchemaException; import com.evolveum.midpoint.util.exception.SystemException; import com.evolveum.midpoint.web.component.prism.ContainerStatus; @@ -26,7 +29,8 @@ public static ObjectWrapper createObjectWrapper(String di public static ObjectWrapper createObjectWrapper(String displayName, String description, PrismObject object, ContainerStatus status, boolean delayContainerCreation, PageBase pageBase) { try { - PrismContainerDefinition objectDefinitionForEditing = pageBase.getModelInteractionService().getEditObjectDefinition(object, AuthorizationPhaseType.REQUEST); + OperationResult result = new OperationResult(ObjectWrapperUtil.class+".createObjectWrapper"); + PrismContainerDefinition objectDefinitionForEditing = pageBase.getModelInteractionService().getEditObjectDefinition(object, AuthorizationPhaseType.REQUEST, result); RefinedObjectClassDefinition objectClassDefinitionForEditing = null; if (isShadow(object)) { PrismReference resourceRef = object.findReference(ShadowType.F_RESOURCE_REF); @@ -36,7 +40,7 @@ public static ObjectWrapper createObjectWrapper(String di ObjectWrapper wrapper = new ObjectWrapper(displayName, description, object, objectDefinitionForEditing, objectClassDefinitionForEditing, status, delayContainerCreation, pageBase); return wrapper; - } catch (SchemaException ex){ + } catch (SchemaException | ConfigurationException | ObjectNotFoundException ex){ throw new SystemException(ex); } } diff --git a/model/model-api/src/main/java/com/evolveum/midpoint/model/api/ModelInteractionService.java b/model/model-api/src/main/java/com/evolveum/midpoint/model/api/ModelInteractionService.java index 0219abf2edd..70f6a4b96cc 100644 --- a/model/model-api/src/main/java/com/evolveum/midpoint/model/api/ModelInteractionService.java +++ b/model/model-api/src/main/java/com/evolveum/midpoint/model/api/ModelInteractionService.java @@ -53,8 +53,9 @@ */ public interface ModelInteractionService { - String CLASS_NAME_WITH_DOT = ModelInteractionService.class.getName() + "."; - String PREVIEW_CHANGES = CLASS_NAME_WITH_DOT + "previewChanges"; + static final String CLASS_NAME_WITH_DOT = ModelInteractionService.class.getName() + "."; + static final String PREVIEW_CHANGES = CLASS_NAME_WITH_DOT + "previewChanges"; + static final String GET_EDIT_OBJECT_DEFINITION = CLASS_NAME_WITH_DOT + "getEditObjectDefinition"; /** * Computes the most likely changes triggered by the provided delta. The delta may be any change of any object, e.g. @@ -100,7 +101,7 @@ ModelContext previewChanges( * @return schema with correctly set constraint parts or null * @throws SchemaException */ - PrismObjectDefinition getEditObjectDefinition(PrismObject object, AuthorizationPhaseType phase) throws SchemaException; + PrismObjectDefinition getEditObjectDefinition(PrismObject object, AuthorizationPhaseType phase, OperationResult result) throws SchemaException, ConfigurationException, ObjectNotFoundException; RefinedObjectClassDefinition getEditObjectClassDefinition(PrismObject shadow, PrismObject resource, AuthorizationPhaseType phase) throws SchemaException; diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java index d76a5900736..40eae19042c 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2014 Evolveum + * Copyright (c) 2010-2015 Evolveum * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -140,8 +140,10 @@ import com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorType; import com.evolveum.midpoint.xml.ns._public.common.common_3.LayerType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectPolicyConfigurationType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectSynchronizationType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectTemplateType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType; import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType; @@ -817,7 +819,8 @@ public ModelContext previewChanges( } @Override - public PrismObjectDefinition getEditObjectDefinition(PrismObject object, AuthorizationPhaseType phase) throws SchemaException { + public PrismObjectDefinition getEditObjectDefinition(PrismObject object, AuthorizationPhaseType phase, OperationResult parentResult) throws SchemaException, ConfigurationException, ObjectNotFoundException { + OperationResult result = parentResult.createMinorSubresult(GET_EDIT_OBJECT_DEFINITION); PrismObjectDefinition objectDefinition = object.getDefinition().deepClone(); // TODO: maybe we need to expose owner resolver in the interface? ObjectSecurityConstraints securityConstraints = securityEnforcer.compileSecurityConstraints(object, null); @@ -825,12 +828,28 @@ public PrismObjectDefinition getEditObjectDefinition(P LOGGER.trace("Security constrains for {}:\n{}", object, securityConstraints==null?"null":securityConstraints.debugDump()); } if (securityConstraints == null) { + // Nothing allowed => everything denied + result.setStatus(OperationResultStatus.NOT_APPLICABLE); return null; } + + ObjectTemplateType objectTemplateType; + try { + objectTemplateType = determineObjectTemplate(object, phase, result); + } catch (ConfigurationException | ObjectNotFoundException e) { + result.recordFatalError(e); + throw e; + } + if (objectTemplateType != null) { + // TODO + } + applySecurityContraints(objectDefinition, new ItemPath(), securityConstraints, securityConstraints.getActionDecision(ModelAuthorizationAction.READ.getUrl(), phase), securityConstraints.getActionDecision(ModelAuthorizationAction.ADD.getUrl(), phase), securityConstraints.getActionDecision(ModelAuthorizationAction.MODIFY.getUrl(), phase), phase); + + result.computeStatus(); return objectDefinition; } @@ -877,6 +896,23 @@ private AuthorizationDecisionType computeItemDecision(ObjectSecurityConstraints } } + public ObjectTemplateType determineObjectTemplate(PrismObject object, AuthorizationPhaseType phase, OperationResult result) throws SchemaException, ConfigurationException, ObjectNotFoundException { + PrismObject systemConfiguration = Utils.getSystemConfiguration(cacheRepositoryService, result); + if (systemConfiguration == null) { + return null; + } + ObjectPolicyConfigurationType objectPolicyConfiguration = ModelUtils.determineObjectPolicyConfiguration(object.getCompileTimeClass(), systemConfiguration.asObjectable()); + if (objectPolicyConfiguration == null) { + return null; + } + ObjectReferenceType objectTemplateRef = objectPolicyConfiguration.getObjectTemplateRef(); + if (objectTemplateRef == null) { + return null; + } + PrismObject template = cacheRepositoryService.getObject(ObjectTemplateType.class, objectTemplateRef.getOid(), null, result); + return template.asObjectable(); + } + @Override public RefinedObjectClassDefinition getEditObjectClassDefinition(PrismObject shadow, PrismObject resource, AuthorizationPhaseType phase) throws SchemaException { diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelUtils.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelUtils.java index 477954cb640..f461a934c1a 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelUtils.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelUtils.java @@ -15,14 +15,24 @@ */ package com.evolveum.midpoint.model.impl.controller; +import javax.xml.namespace.QName; + import com.evolveum.midpoint.model.api.ModelAuthorizationAction; +import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.prism.delta.ObjectDelta; import com.evolveum.midpoint.prism.query.ObjectPaging; +import com.evolveum.midpoint.schema.constants.ObjectTypes; import com.evolveum.midpoint.schema.result.OperationResult; +import com.evolveum.midpoint.util.exception.ConfigurationException; import com.evolveum.midpoint.util.logging.LoggingUtils; import com.evolveum.midpoint.util.logging.Trace; import com.evolveum.midpoint.util.logging.TraceManager; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectPolicyConfigurationType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectTemplateType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; /** * @@ -87,5 +97,40 @@ public static String getOperationUrlFromDelta(ObjectDelta } throw new IllegalArgumentException("Unknown delta type "+delta); } + + public static ObjectPolicyConfigurationType determineObjectPolicyConfiguration(Class objectClass, SystemConfigurationType systemConfigurationType) throws ConfigurationException { + for (ObjectPolicyConfigurationType aPolicyConfigurationType: systemConfigurationType.getDefaultObjectPolicyConfiguration()) { + QName typeQName = aPolicyConfigurationType.getType(); + ObjectTypes objectType = ObjectTypes.getObjectTypeFromTypeQName(typeQName); + if (objectType == null) { + throw new ConfigurationException("Unknown type "+typeQName+" in default object policy definition in system configuration"); + } + if (objectType.getClassDefinition() == objectClass) { + return aPolicyConfigurationType; + } + } + + // Deprecated + for (ObjectPolicyConfigurationType aPolicyConfigurationType: systemConfigurationType.getObjectTemplate()) { + QName typeQName = aPolicyConfigurationType.getType(); + ObjectTypes objectType = ObjectTypes.getObjectTypeFromTypeQName(typeQName); + if (objectType == null) { + throw new ConfigurationException("Unknown type "+typeQName+" in object template definition in system configuration"); + } + if (objectType.getClassDefinition() == objectClass) { + return aPolicyConfigurationType; + } + } + + // Deprecated method to specify user template. For compatibility only + if (objectClass == UserType.class) { + ObjectReferenceType templateRef = systemConfigurationType.getDefaultUserTemplateRef(); + ObjectPolicyConfigurationType policy = new ObjectPolicyConfigurationType(); + policy.setObjectTemplateRef(templateRef.clone()); + return policy; + } + + return null; + } } diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ContextLoader.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ContextLoader.java index 91357da0b76..0f0b54e3d29 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ContextLoader.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ContextLoader.java @@ -37,6 +37,7 @@ import com.evolveum.midpoint.common.refinery.ResourceShadowDiscriminator; import com.evolveum.midpoint.model.api.ModelExecuteOptions; import com.evolveum.midpoint.model.api.context.SynchronizationPolicyDecision; +import com.evolveum.midpoint.model.impl.controller.ModelUtils; import com.evolveum.midpoint.model.impl.lens.LensContext; import com.evolveum.midpoint.model.impl.lens.LensFocusContext; import com.evolveum.midpoint.model.impl.lens.LensObjectDeltaOperation; @@ -395,50 +396,19 @@ private PrismObject determineFocusTem } Class focusType = focusContext.getObjectTypeClass(); - ObjectReferenceType templateRef = null; - ObjectPolicyConfigurationType policyConfigurationType = null; - for (ObjectPolicyConfigurationType aPolicyConfigurationType: systemConfigurationType.getDefaultObjectPolicyConfiguration()) { - QName typeQName = aPolicyConfigurationType.getType(); - ObjectTypes objectType = ObjectTypes.getObjectTypeFromTypeQName(typeQName); - if (objectType == null) { - throw new ConfigurationException("Unknown type "+typeQName+" in default object policy definition in system configuration"); - } - if (objectType.getClassDefinition() == focusType) { - templateRef = aPolicyConfigurationType.getObjectTemplateRef(); - focusContext.setObjectPolicyConfigurationType(aPolicyConfigurationType); - policyConfigurationType = aPolicyConfigurationType; - } - } - + ObjectPolicyConfigurationType policyConfigurationType = ModelUtils.determineObjectPolicyConfiguration(focusType, systemConfigurationType); if (policyConfigurationType == null) { - // Deprecated - for (ObjectPolicyConfigurationType aPolicyConfigurationType: systemConfigurationType.getObjectTemplate()) { - QName typeQName = aPolicyConfigurationType.getType(); - ObjectTypes objectType = ObjectTypes.getObjectTypeFromTypeQName(typeQName); - if (objectType == null) { - throw new ConfigurationException("Unknown type "+typeQName+" in object template definition in system configuration"); - } - if (objectType.getClassDefinition() == focusType) { - templateRef = aPolicyConfigurationType.getObjectTemplateRef(); - focusContext.setObjectPolicyConfigurationType(aPolicyConfigurationType); - policyConfigurationType = aPolicyConfigurationType; - } - } - } - - // Deprecated method to specify user template. For compatibility only - if (templateRef == null && context.getFocusClass() == UserType.class) { - templateRef = systemConfigurationType.getDefaultUserTemplateRef(); + LOGGER.trace("No default object template"); + return null; } - + ObjectReferenceType templateRef = policyConfigurationType.getObjectTemplateRef(); if (templateRef == null) { LOGGER.trace("No default object template"); return null; - } else { - PrismObject template = cacheRepositoryService.getObject(ObjectTemplateType.class, templateRef.getOid(), null, result); - return template; } - + + PrismObject template = cacheRepositoryService.getObject(ObjectTemplateType.class, templateRef.getOid(), null, result); + return template; } diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestSecurity.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestSecurity.java index d559494da4c..356e109291d 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestSecurity.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestSecurity.java @@ -802,7 +802,7 @@ public void testAutzJackPropReadSomeModifySome(final String TEST_NAME, String ro PrismAsserts.assertNoItem(userJack, new ItemPath(UserType.F_ACTIVATION, ActivationType.F_EFFECTIVE_STATUS)); assertAssignmentsWithTargets(userJack, 1); - PrismObjectDefinition userJackEditSchema = modelInteractionService.getEditObjectDefinition(userJack, null); + PrismObjectDefinition userJackEditSchema = getEditObjectDefinition(userJack); display("Jack's edit schema", userJackEditSchema); assertItemFlags(userJackEditSchema, UserType.F_NAME, true, false, false); assertItemFlags(userJackEditSchema, UserType.F_FULL_NAME, true, false, true); @@ -1909,5 +1909,15 @@ private void assertAllow(String opname, Attempt attempt) interface Attempt { void run(Task task, OperationResult result) throws Exception; } + + private PrismObjectDefinition getEditObjectDefinition(PrismObject object) throws SchemaException, ConfigurationException, ObjectNotFoundException { + OperationResult result = new OperationResult(TestSecurity.class+".getEditObjectDefinition"); + PrismObjectDefinition editSchema = modelInteractionService.getEditObjectDefinition(object, null, result); + result.computeStatus(); + TestUtil.assertSuccess(result); + return editSchema; + } + + } From 8acdbe3a9743d233130cf55900d891c6172482b2 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Mon, 9 Feb 2015 21:16:05 +0100 Subject: [PATCH 129/215] Test for MID-2174 + a small fix. --- .../midpoint/prism/xnode/PrimitiveXNode.java | 8 +- .../midpoint/schema/TestParseDiffPatch.java | 106 +++++++++++++++++- .../src/test/resources/diff/shadow-before.xml | 86 ++++++++++++++ .../impl/ShadowCacheReconciler.java | 2 +- 4 files changed, 196 insertions(+), 6 deletions(-) create mode 100644 infra/schema/src/test/resources/diff/shadow-before.xml diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/xnode/PrimitiveXNode.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/xnode/PrimitiveXNode.java index ec4b8e22ae3..6d22939104f 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/xnode/PrimitiveXNode.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/xnode/PrimitiveXNode.java @@ -314,9 +314,13 @@ public boolean equals(Object obj) { String otherStringVal = other.getStringValue(); return thisStringVal.equals(otherStringVal); } else if (other.isParsed() && !isParsed()){ - return other.value.equals(this.getStringValue()); + String thisStringValue = this.getStringValue(); + String otherStringValue = String.valueOf(other.value); + return otherStringValue.equals(thisStringValue); } else if (!other.isParsed() && isParsed()){ - return value.equals(other.getStringValue()); + String thisStringValue = String.valueOf(value);; + String otherStringValue = other.getStringValue(); + return thisStringValue.equals(otherStringValue); } return false; diff --git a/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseDiffPatch.java b/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseDiffPatch.java index feba8eefb93..9dfe87f7fec 100644 --- a/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseDiffPatch.java +++ b/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseDiffPatch.java @@ -25,16 +25,18 @@ import java.util.Collection; import java.util.List; -import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBException; import javax.xml.namespace.QName; +import com.evolveum.midpoint.prism.PrismContext; +import com.evolveum.midpoint.prism.PrismPropertyDefinition; import com.evolveum.midpoint.prism.path.ItemPath; import com.evolveum.midpoint.prism.polystring.PolyString; import com.evolveum.midpoint.prism.xnode.XNode; import com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectModificationType; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; +import com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType; import org.testng.AssertJUnit; import org.testng.annotations.BeforeSuite; import org.testng.annotations.Test; @@ -52,8 +54,6 @@ import com.evolveum.midpoint.schema.constants.MidPointConstants; import com.evolveum.midpoint.schema.constants.SchemaConstants; import com.evolveum.midpoint.schema.util.SchemaTestConstants; -import com.evolveum.midpoint.util.DOMUtil; -import com.evolveum.midpoint.util.JAXBUtil; import com.evolveum.midpoint.util.MiscUtil; import com.evolveum.midpoint.util.PrettyPrinter; import com.evolveum.midpoint.util.exception.SchemaException; @@ -591,6 +591,106 @@ public void testResourceNsChangeLiteral() throws SchemaException, SAXException, } + /** + * This test illustrates MID-2174. + * + * We take a shadow having objectChange set. + * We delete it via asObjectable().setObjectChange(null). + * Then we compute the delta via diff. + * All these operations are done on a shadow that contains PARSED values in objectChange property. + * + * The problem of MID-2174 is that (in reality) we then try to apply the delta to the shadow as stored in repository, + * i.e. to shadow with RAW values in objectChange property. + * + * MidPoint uses an approximation there - it compares XNode serializations of values. Sometimes they match, + * sometimes they do not. In this particular case they fail to match on serialization of c:ObjectReferenceType, + * because PrismBeanConverter is used, and ObjectReferenceType.getFilter() returns empty filter instead of null. + * This could be fixed; however, it would not help much, because it is almost sure that other similar problems + * would sooner or later emerge. + */ + @Test(enabled = false) + public void testShadowObjectChange() throws SchemaException, SAXException, IOException, JAXBException { + System.out.println("===[ testShadowObjectChange ]==="); + + // WHEN + + PrismContext prismContext = PrismTestUtil.getPrismContext(); + PrismObject oldObject = getParsedShadowBefore(prismContext); + PrismObject newObject = getShadowAfter(oldObject); + + ObjectDelta diffDelta = DiffUtil.diff(oldObject, newObject); + + // THEN + + System.out.println("DELTA:"); + System.out.println(diffDelta.debugDump()); + + diffDelta.checkConsistence(); + assertEquals("Wrong delta OID", "19a27a9d-c7f0-4e41-bcbf-5fa9fc229b10", diffDelta.getOid()); + assertEquals("Wrong change type", ChangeType.MODIFY, diffDelta.getChangeType()); + // ... (not important now) ... + + // ROUNDTRIP + + // without resolving RawTypes! + PrismObject shadow = getRawShadowBefore(prismContext); + shadow.checkConsistence(); + PrismObject shadowAfter = getShadowAfter(shadow); + shadowAfter.checkConsistence(); + + // patch + diffDelta.applyTo(shadow); + + System.out.println("Shadow after roundtrip patching"); + System.out.println(shadow.debugDump()); + + diffDelta.checkConsistence(); + shadow.checkConsistence(); + + assertTrue("Not equivalent", shadow.equivalent(shadowAfter)); + + diffDelta.checkConsistence(); + shadow.checkConsistence(); + shadowAfter.checkConsistence(); + + ObjectDelta roundTripDelta = DiffUtil.diff(shadow, shadowAfter); + System.out.println("roundtrip DELTA:"); + System.out.println(roundTripDelta.debugDump()); + + assertTrue("Roundtrip delta is not empty", roundTripDelta.isEmpty()); + + roundTripDelta.checkConsistence(); + diffDelta.checkConsistence(); + shadow.checkConsistence(); + shadowAfter.checkConsistence(); + } + + protected PrismObject getShadowAfter(PrismObject oldObject) { + PrismObject newObject = oldObject.clone(); + newObject.asObjectable().setObjectChange(null); + return newObject; + } + + protected PrismObject getParsedShadowBefore(PrismContext prismContext) throws SchemaException, IOException { + PrismObject oldObject = getRawShadowBefore(prismContext); + // resolve rawtypes + ObjectDeltaType objectChange = oldObject.asObjectable().getObjectChange(); + for (ItemDeltaType itemDeltaType : objectChange.getItemDelta()) { + for (RawType rawType : itemDeltaType.getValue()) { + rawType.getParsedItem( + new PrismPropertyDefinition(itemDeltaType.getPath().getItemPath().lastNamed().getName(), + rawType.getXnode().getTypeQName(), + prismContext)); + } + } + return oldObject; + } + + protected PrismObject getRawShadowBefore(PrismContext prismContext) throws SchemaException, IOException { + PrismObject oldObject = prismContext.parseObject(new File(TEST_DIR, "shadow-before.xml")); + return oldObject; + } + private void assertXmlPolyMod(ObjectModificationType objectModificationType, QName propertyName, ModificationTypeType modType, PolyStringType... expectedValues) throws SchemaException { //FIXME: diff --git a/infra/schema/src/test/resources/diff/shadow-before.xml b/infra/schema/src/test/resources/diff/shadow-before.xml new file mode 100644 index 00000000000..16ed73f1630 --- /dev/null +++ b/infra/schema/src/test/resources/diff/shadow-before.xml @@ -0,0 +1,86 @@ + + + + + uid=u1,ou=people,dc=example,dc=com + + 2015-01-27T11:02:07.187+01:00 + + http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user + + + + modify + ShadowType + 19a27a9d-c7f0-4e41-bcbf-5fa9fc229b10 + + add + c:attributes/gen280:cn + G1 F1a + + + delete + c:attributes/gen280:cn + G1 F1 + + + replace + c:metadata/c:modifyChannel + http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user + + + replace + c:metadata/c:modifyTimestamp + 2015-01-27T11:05:57.663+01:00 + + + replace + c:metadata/c:modifierRef + + + + linked + 2015-01-27T11:05:58.720+01:00 + 2015-01-27T11:02:08.436+01:00 + + linked + 2015-01-27T11:05:58.720+01:00 + http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user + false + + qn948:AccountObjectClass + account + 0 + + + uid=u1,ou=people,dc=example,dc=com + 1ff0ee34-cec8-4261-9a13-83318932d139 + + + enabled + 2015-01-27T11:02:06.196+01:00 + + \ No newline at end of file diff --git a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCacheReconciler.java b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCacheReconciler.java index 80baa573de9..2020874b6fb 100644 --- a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCacheReconciler.java +++ b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/ShadowCacheReconciler.java @@ -96,7 +96,7 @@ private void cleanShadowInRepository(PrismObject shadow, OperationRe ObjectDelta delta = oldShadow.diff(normalizedShadow); - // TODO: remove this ugly hack (problem is in prism - objectChange does not get deleted by delta produced by diff method) + // TODO: remove this ugly hack (problem is in prism - objectChange does not get deleted by delta produced by diff method) - see MID-2174 PropertyDelta clearObjectChange = PropertyDelta.createModificationReplaceProperty( ShadowType.F_OBJECT_CHANGE, oldShadow.getDefinition()); delta.removePropertyModification(ShadowType.F_OBJECT_CHANGE); From 27a2909c74687ca1071634977fed5a5fd90f41b3 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Tue, 10 Feb 2015 09:55:31 +0100 Subject: [PATCH 130/215] Fixing NPE --- .../evolveum/midpoint/model/impl/controller/ModelUtils.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelUtils.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelUtils.java index f461a934c1a..9ad79d1affb 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelUtils.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelUtils.java @@ -125,6 +125,9 @@ public static ObjectPolicyConfigurationType determineObje // Deprecated method to specify user template. For compatibility only if (objectClass == UserType.class) { ObjectReferenceType templateRef = systemConfigurationType.getDefaultUserTemplateRef(); + if (templateRef == null) { + return null; + } ObjectPolicyConfigurationType policy = new ObjectPolicyConfigurationType(); policy.setObjectTemplateRef(templateRef.clone()); return policy; From 8c4b45404d5917cb61fafd87da56941b76fe7545 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Tue, 10 Feb 2015 10:21:21 +0100 Subject: [PATCH 131/215] typo fix in module name. --- gui/admin-gui-es-ES/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/admin-gui-es-ES/pom.xml b/gui/admin-gui-es-ES/pom.xml index 371a8ddd873..dd4e639770d 100644 --- a/gui/admin-gui-es-ES/pom.xml +++ b/gui/admin-gui-es-ES/pom.xml @@ -17,7 +17,7 @@ 4.0.0 - midPoint User Interface - admin web gui en_US + midPoint User Interface - admin web gui es_ES com.evolveum.midpoint.gui admin-gui-es-ES jar From 98c1a49c9550e8a1213823d528e70eb6a6c01233 Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Tue, 10 Feb 2015 11:03:42 +0100 Subject: [PATCH 132/215] failing test for lookup table. --- .../midpoint/schema/TestParseLookupTable.java | 76 +++++++++++++++++++ .../test/resources/common/lookup-table.xml | 40 ++++++++++ infra/schema/testng.xml | 1 + 3 files changed, 117 insertions(+) create mode 100644 infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseLookupTable.java create mode 100644 infra/schema/src/test/resources/common/lookup-table.xml diff --git a/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseLookupTable.java b/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseLookupTable.java new file mode 100644 index 00000000000..c8c0cc4efed --- /dev/null +++ b/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseLookupTable.java @@ -0,0 +1,76 @@ +package com.evolveum.midpoint.schema; + +import com.evolveum.midpoint.prism.PrismContainer; +import com.evolveum.midpoint.prism.PrismContext; +import com.evolveum.midpoint.prism.PrismObject; +import com.evolveum.midpoint.prism.util.PrismAsserts; +import com.evolveum.midpoint.prism.util.PrismTestUtil; +import com.evolveum.midpoint.schema.constants.MidPointConstants; +import com.evolveum.midpoint.util.PrettyPrinter; +import com.evolveum.midpoint.util.exception.SchemaException; +import com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType; +import com.evolveum.prism.xml.ns._public.types_3.PolyStringType; +import org.testng.annotations.BeforeSuite; +import org.testng.annotations.Test; +import org.xml.sax.SAXException; + +import javax.xml.namespace.QName; +import java.io.File; +import java.io.IOException; + +import static org.testng.AssertJUnit.assertEquals; + +/** + * @author Viliam Repan (lazyman) + */ +public class TestParseLookupTable { + + public static final File LOOKUP_TABLE_FILE = new File("src/test/resources/common/lookup-table.xml"); + + @BeforeSuite + public void setup() throws SchemaException, SAXException, IOException { + PrettyPrinter.setDefaultNamespacePrefix(MidPointConstants.NS_MIDPOINT_PUBLIC_PREFIX); + PrismTestUtil.resetPrismContext(MidPointPrismContextFactory.FACTORY); + } + + + @Test + public void testParseTableFile() throws Exception { + System.out.println("===[ testParseTableFile ]==="); + + // GIVEN + PrismContext prismContext = PrismTestUtil.getPrismContext(); + + // WHEN + PrismObject task = prismContext.parseObject(LOOKUP_TABLE_FILE, PrismContext.LANG_XML); + + // THEN + System.out.println("Parsed table:"); + System.out.println(task.debugDump()); + + assertTask(task); + } + + private void assertTask(PrismObject table) { + table.checkConsistence(); + + assertEquals("Wrong oid", "44444444-4444-4444-4444-000000001111", table.getOid()); + + assertPropertyValue(table, "name", PrismTestUtil.createPolyString("Example Task")); + assertPropertyDefinition(table, "name", PolyStringType.COMPLEX_TYPE, 0, 1); + + //todo more asserts + } + + private void assertPropertyDefinition(PrismContainer container, String propName, QName xsdType, int minOccurs, + int maxOccurs) { + QName propQName = new QName(SchemaConstantsGenerated.NS_COMMON, propName); + PrismAsserts.assertPropertyDefinition(container, propQName, xsdType, minOccurs, maxOccurs); + } + + public static void assertPropertyValue(PrismContainer container, String propName, Object propValue) { + QName propQName = new QName(SchemaConstantsGenerated.NS_COMMON, propName); + PrismAsserts.assertPropertyValue(container, propQName, propValue); + } +} diff --git a/infra/schema/src/test/resources/common/lookup-table.xml b/infra/schema/src/test/resources/common/lookup-table.xml new file mode 100644 index 00000000000..fcbd41090a2 --- /dev/null +++ b/infra/schema/src/test/resources/common/lookup-table.xml @@ -0,0 +1,40 @@ + + + + + first lookup + description of lookup table + + + first key + first value + + 2013-05-07T10:38:21.350+02:00 + + + 2 key + 2 value + + 2013-05-07T10:38:21.350+02:00 + +
+
\ No newline at end of file diff --git a/infra/schema/testng.xml b/infra/schema/testng.xml index bb36e3f7c60..d11f0900bc4 100644 --- a/infra/schema/testng.xml +++ b/infra/schema/testng.xml @@ -24,6 +24,7 @@ + From e1bca58a307f67ee46e956ee79aadc395e3e387c Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Tue, 10 Feb 2015 11:20:13 +0100 Subject: [PATCH 133/215] Test&fix for deepClone stack overflow --- .../midpoint/prism/ComplexTypeDefinition.java | 15 ++++++-- .../midpoint/prism/ItemDefinition.java | 6 ++++ .../prism/PrismContainerDefinition.java | 7 +++- .../midpoint/schema/TestSchemaRegistry.java | 34 ++++++++++++++++++- 4 files changed, 58 insertions(+), 4 deletions(-) diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/ComplexTypeDefinition.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/ComplexTypeDefinition.java index 61f5d48fb92..61f415cd08c 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/ComplexTypeDefinition.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/ComplexTypeDefinition.java @@ -22,8 +22,10 @@ import com.evolveum.midpoint.util.PrettyPrinter; import java.util.ArrayList; +import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import javax.xml.namespace.QName; @@ -272,10 +274,19 @@ public ComplexTypeDefinition clone() { } public ComplexTypeDefinition deepClone() { - ComplexTypeDefinition clone = clone(); + return deepClone(new HashMap()); + } + + ComplexTypeDefinition deepClone(Map ctdMap) { + ComplexTypeDefinition clone = ctdMap.get(this.getTypeName()); + if (clone != null) { + return clone; // already cloned + } + clone = clone(); // shallow + ctdMap.put(this.getTypeName(), clone); clone.itemDefinitions.clear(); for (ItemDefinition itemDef: this.itemDefinitions) { - clone.itemDefinitions.add(itemDef.deepClone()); + clone.itemDefinitions.add(itemDef.deepClone(ctdMap)); } return clone; } diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/ItemDefinition.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/ItemDefinition.java index 0a312e26a4a..d696a3903ce 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/ItemDefinition.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/ItemDefinition.java @@ -18,6 +18,7 @@ import java.io.Serializable; import java.util.List; +import java.util.Map; import javax.xml.namespace.QName; @@ -26,6 +27,7 @@ import com.evolveum.midpoint.util.PrettyPrinter; import com.evolveum.midpoint.util.QNameUtil; import com.evolveum.midpoint.util.exception.SchemaException; + import org.apache.commons.lang.StringUtils; /** @@ -319,6 +321,10 @@ public ItemDefinition deepClone() { return clone(); } + ItemDefinition deepClone(Map ctdMap) { + return clone(); + } + @Override public void revive(PrismContext prismContext) { if (this.prismContext != null) { diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismContainerDefinition.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismContainerDefinition.java index d10bfd14040..89e9d15eb73 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismContainerDefinition.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismContainerDefinition.java @@ -358,10 +358,15 @@ protected void copyDefinitionData(PrismContainerDefinition clone) { @Override public ItemDefinition deepClone() { + return deepClone(new HashMap()); + } + + @Override + public ItemDefinition deepClone(Map ctdMap) { PrismContainerDefinition clone = clone(); ComplexTypeDefinition ctd = getComplexTypeDefinition(); if (ctd != null) { - ctd = ctd.deepClone(); + ctd = ctd.deepClone(ctdMap); clone.setComplexTypeDefinition(ctd); } return clone; diff --git a/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestSchemaRegistry.java b/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestSchemaRegistry.java index 3369a7ed4ed..6a510e26317 100644 --- a/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestSchemaRegistry.java +++ b/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestSchemaRegistry.java @@ -51,6 +51,7 @@ import com.evolveum.midpoint.util.DOMUtil; import com.evolveum.midpoint.util.exception.SchemaException; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; @@ -143,7 +144,7 @@ public void testReferenceInExtension() throws SchemaException, SAXException, IOE } @Test - public void testUserType() throws SchemaException, SAXException, IOException { + public void testUserType() throws Exception { MidPointPrismContextFactory factory = getContextFactory(); PrismContext context = factory.createInitializedPrismContext(); @@ -166,6 +167,37 @@ public void testUserType() throws SchemaException, SAXException, IOException { PrismPropertyDefinition givenNameDef = userDefinition.findPropertyDefinition(UserType.F_GIVEN_NAME); assertNotNull("No givenName definition", givenNameDef); + + // Just make sure this does not end with NPE or stack overflow + PrismObjectDefinition shallowClone = userDefinition.clone(); + PrismObjectDefinition deepClone = userDefinition.deepClone(); + } + + @Test + public void testRoleType() throws Exception { + + MidPointPrismContextFactory factory = getContextFactory(); + PrismContext context = factory.createInitializedPrismContext(); + SchemaRegistry schemaRegistry = context.getSchemaRegistry(); + + PrismObjectDefinition roleDefinition = schemaRegistry.findObjectDefinitionByCompileTimeClass(RoleType.class); + assertNotNull("No role definition", roleDefinition); + + assertFalse("Role definition is marked as runtime", roleDefinition.isRuntimeSchema()); + + PrismPropertyDefinition nameDef = roleDefinition.findPropertyDefinition(ObjectType.F_NAME); + assertNotNull("No name definition", nameDef); + + PrismContainerDefinition extensionDef = roleDefinition.findContainerDefinition(ObjectType.F_EXTENSION); + assertNotNull("No 'extension' definition", extensionDef); + assertTrue("Extension definition is NOT marked as runtime", extensionDef.isRuntimeSchema()); + + PrismPropertyDefinition identifierDef = roleDefinition.findPropertyDefinition(RoleType.F_IDENTIFIER); + assertNotNull("No identifier definition", identifierDef); + + // Just make sure this does not end with NPE or stack overflow + PrismObjectDefinition shallowClone = roleDefinition.clone(); + PrismObjectDefinition deepClone = roleDefinition.deepClone(); } @Test From e6e7b7b02b867315088ec4c9869f82babdbc2f2d Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Tue, 10 Feb 2015 11:39:12 +0100 Subject: [PATCH 134/215] Minor test package and name refactor --- .../midpoint/model/intest/TestSecurity.java | 12 +--- .../{ => gensync}/TestRoleEntitlement.java | 3 +- .../TestSchemaMisc.java} | 60 ++++++++++++++++++- model/model-intest/testng.xml | 4 +- .../test/AbstractModelIntegrationTest.java | 10 +++- 5 files changed, 71 insertions(+), 18 deletions(-) rename model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/{ => gensync}/TestRoleEntitlement.java (99%) rename model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/{TestIntent.java => gensync/TestSchemaMisc.java} (89%) diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestSecurity.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestSecurity.java index 356e109291d..619229f0e8f 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestSecurity.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestSecurity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2014 Evolveum + * Copyright (c) 2010-2015 Evolveum * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1910,14 +1910,4 @@ interface Attempt { void run(Task task, OperationResult result) throws Exception; } - private PrismObjectDefinition getEditObjectDefinition(PrismObject object) throws SchemaException, ConfigurationException, ObjectNotFoundException { - OperationResult result = new OperationResult(TestSecurity.class+".getEditObjectDefinition"); - PrismObjectDefinition editSchema = modelInteractionService.getEditObjectDefinition(object, null, result); - result.computeStatus(); - TestUtil.assertSuccess(result); - return editSchema; - } - - - } diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestRoleEntitlement.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestRoleEntitlement.java similarity index 99% rename from model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestRoleEntitlement.java rename to model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestRoleEntitlement.java index c7f42252385..957a4151996 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestRoleEntitlement.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestRoleEntitlement.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.evolveum.midpoint.model.intest; +package com.evolveum.midpoint.model.intest.gensync; import static com.evolveum.midpoint.test.IntegrationTestTools.display; import static org.testng.AssertJUnit.assertEquals; @@ -28,6 +28,7 @@ import javax.xml.datatype.XMLGregorianCalendar; import com.evolveum.icf.dummy.resource.DummyGroup; +import com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest; import com.evolveum.midpoint.prism.Containerable; import com.evolveum.midpoint.prism.PrismContainer; import com.evolveum.midpoint.prism.path.ItemPath; diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIntent.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestSchemaMisc.java similarity index 89% rename from model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIntent.java rename to model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestSchemaMisc.java index d31f4ce16b0..f2135dd64d6 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIntent.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestSchemaMisc.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Evolveum + * Copyright (c) 2010-2015 Evolveum * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.evolveum.midpoint.model.intest; +package com.evolveum.midpoint.model.intest.gensync; import static com.evolveum.midpoint.test.IntegrationTestTools.display; import static org.testng.AssertJUnit.assertEquals; @@ -28,8 +28,11 @@ import javax.xml.datatype.XMLGregorianCalendar; import com.evolveum.icf.dummy.resource.DummyGroup; +import com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest; +import com.evolveum.midpoint.model.intest.TestModelServiceContract; import com.evolveum.midpoint.prism.Containerable; import com.evolveum.midpoint.prism.PrismContainer; +import com.evolveum.midpoint.prism.PrismObjectDefinition; import com.evolveum.midpoint.prism.path.ItemPath; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; @@ -68,7 +71,7 @@ */ @ContextConfiguration(locations = {"classpath:ctx-model-intest-test-main.xml"}) @DirtiesContext(classMode = ClassMode.AFTER_CLASS) -public class TestIntent extends AbstractInitializedModelIntegrationTest { +public class TestSchemaMisc extends AbstractInitializedModelIntegrationTest { public static final File TEST_DIR = new File("src/test/resources/gensync"); private static final String ACCOUNT_INTENT_TEST = "test"; @@ -390,6 +393,57 @@ public void test149ModifyUserJackUnassignAccountTest() throws Exception { assertSteadyResources(); } + @Test + public void test200EditSchemaUser() throws Exception { + final String TEST_NAME="test200EditSchemaUser"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = taskManager.createTaskInstance(TestModelServiceContract.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + preTestCleanup(AssignmentPolicyEnforcementType.RELATIVE); + + PrismObjectDefinition userDef = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(UserType.class); + PrismObject user = userDef.instantiate(); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + PrismObjectDefinition editDef = getEditObjectDefinition(user); + + // THEN + TestUtil.displayThen(TEST_NAME); + + // TODO + + assertSteadyResources(); + } + + @Test + public void test210EditSchemaRole() throws Exception { + final String TEST_NAME="test210EditSchemaRole"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = taskManager.createTaskInstance(TestModelServiceContract.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + preTestCleanup(AssignmentPolicyEnforcementType.RELATIVE); + + PrismObjectDefinition roleDef = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(RoleType.class); + PrismObject role = roleDef.instantiate(); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + PrismObjectDefinition editDef = getEditObjectDefinition(role); + + // THEN + TestUtil.displayThen(TEST_NAME); + + // TODO + + assertSteadyResources(); + } + + private void preTestCleanup(AssignmentPolicyEnforcementType enforcementPolicy) throws ObjectNotFoundException, SchemaException, ObjectAlreadyExistsException { assumeAssignmentPolicy(enforcementPolicy); dummyAuditService.clear(); diff --git a/model/model-intest/testng.xml b/model/model-intest/testng.xml index 6cf01b7a4fa..15452684710 100644 --- a/model/model-intest/testng.xml +++ b/model/model-intest/testng.xml @@ -41,11 +41,11 @@ - - + + diff --git a/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java b/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java index 21022d6cf8e..2d039475f1a 100644 --- a/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java +++ b/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2014 Evolveum + * Copyright (c) 2010-2015 Evolveum * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -2708,4 +2708,12 @@ protected Collection createConfigAttributes(String action) { attrs.add(new SecurityConfig(action)); return attrs; } + + protected PrismObjectDefinition getEditObjectDefinition(PrismObject object) throws SchemaException, ConfigurationException, ObjectNotFoundException { + OperationResult result = new OperationResult(AbstractModelIntegrationTest.class+".getEditObjectDefinition"); + PrismObjectDefinition editSchema = modelInteractionService.getEditObjectDefinition(object, null, result); + result.computeStatus(); + TestUtil.assertSuccess(result); + return editSchema; + } } From 8ea0f3a7d3eb49245d0ce61e6c234efb6de5cc6f Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Tue, 10 Feb 2015 12:19:51 +0100 Subject: [PATCH 135/215] Fixed parsing of PolyStringTypes in PrismProperties (e.g. in LookupTableRowType) --- .../prism/parser/PrismBeanConverter.java | 37 ++++++---- .../midpoint/prism/util/PrismTestUtil.java | 8 +++ .../ns/_public/types_3/PolyStringType.java | 7 +- .../midpoint/schema/TestParseLookupTable.java | 69 ++++++++++++++++--- .../test/resources/common/lookup-table.xml | 6 +- 5 files changed, 99 insertions(+), 28 deletions(-) diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/PrismBeanConverter.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/PrismBeanConverter.java index 602bf46c487..2d8105d8d44 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/PrismBeanConverter.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/parser/PrismBeanConverter.java @@ -373,7 +373,7 @@ public T unmarshall(MapXNode xnode, Class beanClass) throws SchemaExcepti if (setter != null) { try { - setter.invoke(bean, wrapInJaxb(propValue, wrapInJaxbElement, objectFactory, elementMethod, propName, beanClass)); + setter.invoke(bean, prepareValueToBeStored(propValue, wrapInJaxbElement, objectFactory, elementMethod, propName, beanClass)); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new SystemException("Cannot invoke setter "+setter+" on bean of type "+beanClass+": "+e.getMessage(), e); } @@ -391,10 +391,10 @@ public T unmarshall(MapXNode xnode, Class beanClass) throws SchemaExcepti throw new SystemException("Getter "+getter+" on bean of type "+beanClass+" returned "+getterReturn+" instead of collection"); } if (propValue != null) { - col.add(wrapInJaxb(propValue, wrapInJaxbElement, objectFactory, elementMethod, propName, beanClass)); + col.add(prepareValueToBeStored(propValue, wrapInJaxbElement, objectFactory, elementMethod, propName, beanClass)); } else if (propValues != null) { for (Object propVal: propValues) { - col.add(wrapInJaxb(propVal, wrapInJaxbElement, objectFactory, elementMethod, propName, beanClass)); + col.add(prepareValueToBeStored(propVal, wrapInJaxbElement, objectFactory, elementMethod, propName, beanClass)); } } else { throw new IllegalStateException("Strange. Multival property "+propName+" in "+beanClass+" produced null values list, parsed from "+xnode); @@ -455,8 +455,14 @@ private Type getTypeArgument(Type origType, String desc) { } return actualTypeArguments[0]; } - - private Object wrapInJaxb(Object propVal, boolean wrapInJaxbElement, Object objectFactory, Method factoryMehtod, String propName, Class beanClass) { + + // Prepares value to be stored into the bean - e.g. converts PolyString->PolyStringType, wraps a value to JAXB if specified, ... + private Object prepareValueToBeStored(Object propVal, boolean wrapInJaxbElement, Object objectFactory, Method factoryMehtod, String propName, Class beanClass) { + + if (propVal instanceof PolyString) { + propVal = new PolyStringType((PolyString) propVal); + } + if (wrapInJaxbElement) { if (factoryMehtod == null) { throw new IllegalArgumentException("Param type is JAXB element but no factory method found for it, property "+propName+" in "+beanClass); @@ -464,7 +470,7 @@ private Object wrapInJaxb(Object propVal, boolean wrapInJaxbElement, Object try { return factoryMehtod.invoke(objectFactory, propVal); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - throw new SystemException("Unable to ivokeke factory method "+factoryMehtod+" on "+objectFactory.getClass()+" for property "+propName+" in "+beanClass); + throw new SystemException("Unable to invoke factory method "+factoryMehtod+" on "+objectFactory.getClass()+" for property "+propName+" in "+beanClass); } } else { return propVal; @@ -531,17 +537,22 @@ private T unmarshallPrimitive(PrimitiveXNode xprim, Class classType) t RawType rawType = new RawType(xprim, prismContext); return (T) rawType; } + + if (PolyStringType.class.isAssignableFrom(classType)) { + String value = (String) xprim.getParsedValue(DOMUtil.XSD_STRING); + PolyString polyString = new PolyString(value); + if (value != null) { + if (prismContext != null) { // actually this should be always so [med] + // TODO should we always use default normalizer? + polyString.recompute(prismContext.getDefaultPolyStringNormalizer()); + } + } + return (T) new PolyStringType(polyString); + } if (ItemPathType.class.isAssignableFrom(classType)){ - QName typeQName = xprim.getTypeQName(); - if (typeQName == null) { - typeQName = DOMUtil.XSD_STRING; - } Object parsedValue = xprim.getParsedValue(ItemPathType.COMPLEX_TYPE); T primValue = postConvertUnmarshall(parsedValue); -// ItemPath itemPath = new RawType(); -// rawType.setType(typeQName); -// rawType.setValue(parsedValue); return (T) primValue; } diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/util/PrismTestUtil.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/util/PrismTestUtil.java index 8575ab2e6c2..b7a0088ec0a 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/util/PrismTestUtil.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/util/PrismTestUtil.java @@ -185,10 +185,18 @@ public static PolyString createPolyString(String orig) { return polyString; } + public static PolyString createPolyString(String orig, String norm) { + return new PolyString(orig, norm); + } + public static PolyStringType createPolyStringType(String string) { return new PolyStringType(createPolyString(string)); } + public static PolyStringType createPolyStringType(String orig, String norm) { + return new PolyStringType(createPolyString(orig, norm)); + } + public static void displayTestTitle(String testName) { System.out.println("\n\n===[ "+testName+" ]===\n"); LOGGER.info("===[ {} ]===",testName); diff --git a/infra/prism/src/main/java/com/evolveum/prism/xml/ns/_public/types_3/PolyStringType.java b/infra/prism/src/main/java/com/evolveum/prism/xml/ns/_public/types_3/PolyStringType.java index 07bad556d79..7f8da401fb1 100644 --- a/infra/prism/src/main/java/com/evolveum/prism/xml/ns/_public/types_3/PolyStringType.java +++ b/infra/prism/src/main/java/com/evolveum/prism/xml/ns/_public/types_3/PolyStringType.java @@ -512,9 +512,12 @@ public boolean equals(Object obj) { return false; PolyStringType other = (PolyStringType) obj; if (any == null) { - if (other.any != null) + if (other.any != null && !other.any.isEmpty()) // because any is instantiated on get (so null and empty should be considered equivalent) return false; - } else if (!any.equals(other.any)) + } else if (any.isEmpty()) { + if (other.any != null && !other.any.isEmpty()) + return false; + } else if (!any.equals(other.any)) return false; if (norm == null) { if (other.norm != null) diff --git a/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseLookupTable.java b/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseLookupTable.java index c8c0cc4efed..b70ddd8a729 100644 --- a/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseLookupTable.java +++ b/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestParseLookupTable.java @@ -1,20 +1,29 @@ package com.evolveum.midpoint.schema; import com.evolveum.midpoint.prism.PrismContainer; +import com.evolveum.midpoint.prism.PrismContainerValue; import com.evolveum.midpoint.prism.PrismContext; import com.evolveum.midpoint.prism.PrismObject; +import com.evolveum.midpoint.prism.PrismProperty; +import com.evolveum.midpoint.prism.PrismPropertyValue; +import com.evolveum.midpoint.prism.PrismValue; import com.evolveum.midpoint.prism.util.PrismAsserts; import com.evolveum.midpoint.prism.util.PrismTestUtil; +import com.evolveum.midpoint.prism.xml.XmlTypeConverter; import com.evolveum.midpoint.schema.constants.MidPointConstants; +import com.evolveum.midpoint.util.DOMUtil; import com.evolveum.midpoint.util.PrettyPrinter; import com.evolveum.midpoint.util.exception.SchemaException; +import com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableTableType; import com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectTemplateType; import com.evolveum.prism.xml.ns._public.types_3.PolyStringType; import org.testng.annotations.BeforeSuite; import org.testng.annotations.Test; import org.xml.sax.SAXException; +import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.namespace.QName; import java.io.File; import java.io.IOException; @@ -36,31 +45,71 @@ public void setup() throws SchemaException, SAXException, IOException { @Test - public void testParseTableFile() throws Exception { - System.out.println("===[ testParseTableFile ]==="); + public void testParseTableFileRoundTrip() throws Exception { + System.out.println("===[ testParseTableFileRoundTrip ]==="); // GIVEN PrismContext prismContext = PrismTestUtil.getPrismContext(); // WHEN - PrismObject task = prismContext.parseObject(LOOKUP_TABLE_FILE, PrismContext.LANG_XML); + PrismObject table = prismContext.parseObject(LOOKUP_TABLE_FILE, PrismContext.LANG_XML); // THEN System.out.println("Parsed table:"); - System.out.println(task.debugDump()); + System.out.println(table.debugDump()); - assertTask(task); + assertTable(table); + + // WHEN + String xml = prismContext.serializeObjectToString(table, PrismContext.LANG_XML); + + // THEN + System.out.println("Serialized object:"); + System.out.println(xml); + + // WHEN + PrismObject reparsedObject = prismContext.parseObject(xml); + + // THEN + System.out.println("Re-parsed object:"); + System.out.println(reparsedObject.debugDump()); + + assertTable(table); + PrismAsserts.assertEquals(table.asObjectable(), reparsedObject.asObjectable()); } - private void assertTask(PrismObject table) { + + private void assertTable(PrismObject table) { table.checkConsistence(); assertEquals("Wrong oid", "44444444-4444-4444-4444-000000001111", table.getOid()); - - assertPropertyValue(table, "name", PrismTestUtil.createPolyString("Example Task")); + assertPropertyValue(table, "name", PrismTestUtil.createPolyString("first lookup")); assertPropertyDefinition(table, "name", PolyStringType.COMPLEX_TYPE, 0, 1); + assertPropertyValue(table, "description", "description of lookup table"); + assertPropertyDefinition(table, "description", DOMUtil.XSD_STRING, 0, 1); + PrismContainer tableContainer = table.findContainer(LookupTableType.F_TABLE); + assertEquals("wrong number of tables", 1, tableContainer.size()); + PrismContainerValue tableValue = tableContainer.getValue(); + PrismProperty rowsProperty = tableValue.findProperty(LookupTableTableType.F_ROW); + assertEquals("wrong number of rows", 2, rowsProperty.size()); + assertRow((PrismPropertyValue) rowsProperty.getValue(0), + "first key", + "first value", + PrismTestUtil.createPolyStringType("first label"), + XmlTypeConverter.createXMLGregorianCalendar("2013-05-07T10:38:21.350+02:00")); + assertRow((PrismPropertyValue) rowsProperty.getValue(1), + "2 key", + "2 value", + PrismTestUtil.createPolyStringType("second ľábeľ", "second label"), + XmlTypeConverter.createXMLGregorianCalendar("2013-05-07T10:40:21.350+02:00")); + } - //todo more asserts + private void assertRow(PrismPropertyValue rowValue, String key, String value, PolyStringType label, XMLGregorianCalendar lastChangeTimestamp) { + LookupTableRowType row = rowValue.getValue(); + assertEquals("wrong key", key, row.getKey()); + assertEquals("wrong value", value, row.getValue()); + assertEquals("wrong label", label, row.getLabel()); + assertEquals("wrong lastChangeTimestamp", lastChangeTimestamp, row.getLastChangeTimestamp()); } private void assertPropertyDefinition(PrismContainer container, String propName, QName xsdType, int minOccurs, diff --git a/infra/schema/src/test/resources/common/lookup-table.xml b/infra/schema/src/test/resources/common/lookup-table.xml index fcbd41090a2..6ac111aedc2 100644 --- a/infra/schema/src/test/resources/common/lookup-table.xml +++ b/infra/schema/src/test/resources/common/lookup-table.xml @@ -31,10 +31,10 @@ 2 key 2 value - 2013-05-07T10:38:21.350+02:00 + 2013-05-07T10:40:21.350+02:00 \ No newline at end of file From 6df12db53aac1c1003af83519f77fc8a9705c28c Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Tue, 10 Feb 2015 12:20:15 +0100 Subject: [PATCH 136/215] Upgraded activiti to current version + small fix in GUI --- build-system/pom.xml | 4 +- .../web/component/prism/ObjectWrapper.java | 38 +++++++++++-------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/build-system/pom.xml b/build-system/pom.xml index a02cb577d0c..1c49065d1d4 100644 --- a/build-system/pom.xml +++ b/build-system/pom.xml @@ -68,8 +68,8 @@ 5.1.31 6.17.0 1.8.6 - 5.15.1 - 5.15.1 + 5.17.0 + 5.17.0 1.3 2.0.1 1.4.0.49 diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ObjectWrapper.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ObjectWrapper.java index 22641cff6e0..21ca26f7008 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ObjectWrapper.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ObjectWrapper.java @@ -325,7 +325,7 @@ private List createContainers(PageBase pageBase) { containers.addAll(createContainerWrapper(object, null, pageBase)); } } catch (Exception ex) { - LoggingUtils.logException(LOGGER, "Error occurred during container wrapping", ex); + LoggingUtils.logUnexpectedException(LOGGER, "Error occurred during container wrapping", ex); result.recordFatalError("Error occurred during container wrapping, reason: " + ex.getMessage(), ex); } @@ -428,22 +428,28 @@ private List createContainerWrapper(PrismContainer parent, Ite } ItemPath newPath = createPropertyPath(parentPath, containerDef.getName()); - - PrismContainer prismContainer = null; - prismContainer = parent.findContainer(def.getName()); - - ContainerWrapper container; - if (prismContainer != null && !prismContainer.getElementName().equals(CredentialsType.F_PASSWORD)) { - container = new ContainerWrapper(this, prismContainer, ContainerStatus.MODIFYING, newPath, pageBase); - } else { - prismContainer = containerDef.instantiate(); - container = new ContainerWrapper(this, prismContainer, ContainerStatus.ADDING, newPath, pageBase); - } - addSubresult(container.getResult()); - wrappers.add(container); - if (!AssignmentType.COMPLEX_TYPE.equals(containerDef.getTypeName()) || !ShadowType.F_ASSOCIATION.equals(parent.getElementName())){ // do not show internals of Assignments (e.g. activation) - wrappers.addAll(createContainerWrapper(prismContainer, newPath, pageBase)); + // [med] + // The following code fails to work when parent is multivalued. + // Therefore (as a brutal hack), for multivalued parents we simply + // skip it. + if (parent.size() != 1) { + PrismContainer prismContainer = null; + prismContainer = parent.findContainer(def.getName()); + + ContainerWrapper container; + if (prismContainer != null && !prismContainer.getElementName().equals(CredentialsType.F_PASSWORD)) { + container = new ContainerWrapper(this, prismContainer, ContainerStatus.MODIFYING, newPath, pageBase); + } else { + prismContainer = containerDef.instantiate(); + container = new ContainerWrapper(this, prismContainer, ContainerStatus.ADDING, newPath, pageBase); + } + addSubresult(container.getResult()); + wrappers.add(container); + + if (!AssignmentType.COMPLEX_TYPE.equals(containerDef.getTypeName()) || !ShadowType.F_ASSOCIATION.equals(parent.getElementName())) { // do not show internals of Assignments (e.g. activation) + wrappers.addAll(createContainerWrapper(prismContainer, newPath, pageBase)); + } } } From e165863885484b41fa9bae8f06547088e678f101 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Tue, 10 Feb 2015 13:06:11 +0100 Subject: [PATCH 137/215] Fix for MID-2177, removed obsolete wfAnswer from WfProcessInstanceType --- .../web/page/admin/workflow/dto/ProcessInstanceDto.java | 5 ++++- .../src/main/resources/xml/ns/public/common/common-3.xsd | 7 ------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/workflow/dto/ProcessInstanceDto.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/workflow/dto/ProcessInstanceDto.java index 5a565dc65ee..41e1e13e96f 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/workflow/dto/ProcessInstanceDto.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/workflow/dto/ProcessInstanceDto.java @@ -90,7 +90,10 @@ public List getWorkItems() { } public String getAnswer() { - return processInstance.getAnswer(); + if (processInstanceState == null) { + return null; + } + return processInstanceState.getAnswer(); } public boolean isAnswered() { diff --git a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd index a9377543e74..a0327a1ebbf 100644 --- a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd +++ b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd @@ -10156,13 +10156,6 @@ - - - - The result of the workflow process instance (if any). - - - From 29ac92e9a93ed4d168bd7d01efa0b78d32443932 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Tue, 10 Feb 2015 14:16:38 +0100 Subject: [PATCH 138/215] More test moving. Basic refined schema impl (still in progress). Some basic tests. --- .../impl/controller/ModelController.java | 47 +++++- .../TestSchemaMisc.java => TestIntent.java} | 60 +------- .../gensync/AbstractGenericSyncTest.java | 104 +++++++++++++ .../model/intest/gensync/TestEditSchema.java | 140 ++++++++++++++++++ .../intest/gensync/TestRoleEntitlement.java | 33 +---- .../common/user-template-complex.xml | 10 +- .../test/resources/common/user-template.xml | 3 +- .../gensync/object-template-role.xml | 8 +- model/model-intest/testng.xml | 3 +- 9 files changed, 309 insertions(+), 99 deletions(-) rename model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/{gensync/TestSchemaMisc.java => TestIntent.java} (90%) create mode 100644 model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/AbstractGenericSyncTest.java create mode 100644 model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestEditSchema.java diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java index 40eae19042c..e866ccf3939 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java @@ -143,10 +143,12 @@ import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectPolicyConfigurationType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectSynchronizationType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectTemplateItemDefinitionType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectTemplateType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType; import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.PropertyLimitationsType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType; @@ -157,6 +159,7 @@ import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; import com.evolveum.midpoint.xml.ns._public.common.common_3.WfProcessInstanceType; import com.evolveum.midpoint.xml.ns._public.common.common_3.WorkItemType; +import com.evolveum.prism.xml.ns._public.types_3.ItemPathType; /** * This used to be an interface, but it was switched to class for simplicity. I @@ -840,11 +843,10 @@ public PrismObjectDefinition getEditObjectDefinition(P result.recordFatalError(e); throw e; } - if (objectTemplateType != null) { - // TODO - } + applyObjectTemplateToDefinition(objectDefinition, objectTemplateType, result); - applySecurityContraints(objectDefinition, new ItemPath(), securityConstraints, + + applySecurityConstraints(objectDefinition, new ItemPath(), securityConstraints, securityConstraints.getActionDecision(ModelAuthorizationAction.READ.getUrl(), phase), securityConstraints.getActionDecision(ModelAuthorizationAction.ADD.getUrl(), phase), securityConstraints.getActionDecision(ModelAuthorizationAction.MODIFY.getUrl(), phase), phase); @@ -853,7 +855,39 @@ public PrismObjectDefinition getEditObjectDefinition(P return objectDefinition; } - private void applySecurityContraints(D itemDefinition, ItemPath itemPath, ObjectSecurityConstraints securityConstraints, + private void applyObjectTemplateToDefinition(PrismObjectDefinition objectDefinition, ObjectTemplateType objectTemplateType, OperationResult result) throws ObjectNotFoundException, SchemaException { + if (objectTemplateType == null) { + return; + } + for (ObjectReferenceType includeRef: objectTemplateType.getIncludeRef()) { + PrismObject subTemplate = cacheRepositoryService.getObject(ObjectTemplateType.class, includeRef.getOid(), null, result); + applyObjectTemplateToDefinition(objectDefinition, subTemplate.asObjectable(), result); + } + for (ObjectTemplateItemDefinitionType templateItemDefType: objectTemplateType.getItem()) { + ItemPathType ref = templateItemDefType.getRef(); + if (ref == null) { + throw new SchemaException("No 'ref' in item definition in "+objectTemplateType); + } + ItemPath itemPath = ref.getItemPath(); + ItemDefinition itemDef = objectDefinition.findItemDefinition(itemPath); + if (itemDef == null) { + throw new SchemaException("No definition for item "+itemPath+" in object type "+objectDefinition.getTypeName()+" as specified in item definition in "+objectTemplateType); + } + String displayName = templateItemDefType.getDisplayName(); + if (displayName != null) { + itemDef.setDisplayName(displayName); + } + List limitations = templateItemDefType.getLimitations(); + if (limitations != null) { + // TODO + } + + // TODO + + } + } + + private void applySecurityConstraints(D itemDefinition, ItemPath itemPath, ObjectSecurityConstraints securityConstraints, AuthorizationDecisionType defaultReadDecition, AuthorizationDecisionType defaultAddDecition, AuthorizationDecisionType defaultModifyDecition, AuthorizationPhaseType phase) { AuthorizationDecisionType readDecision = computeItemDecision(securityConstraints, itemPath, ModelAuthorizationAction.READ.getUrl(), defaultReadDecition, phase); @@ -872,13 +906,12 @@ private void applySecurityContraints(D itemDefinition if (itemDefinition instanceof PrismContainerDefinition) { PrismContainerDefinition containerDefinition = (PrismContainerDefinition)itemDefinition; - // The items are still shallow-clonned, we need to deep-clone them List origSubDefinitions = ((PrismContainerDefinition)containerDefinition).getDefinitions(); for (ItemDefinition subDef: origSubDefinitions) { // TODO fix this brutal hack - it is necessary to avoid endless recursion in the style of "Decision for authorization/object/owner/owner/......../owner/special: ALLOW" // it's too late to come up with a serious solution if (!(itemPath.lastNamed() != null && ObjectSpecificationType.F_OWNER.equals(itemPath.lastNamed().getName()) && ObjectSpecificationType.F_OWNER.equals(subDef.getName()))) { - applySecurityContraints(subDef, new ItemPath(itemPath, subDef.getName()), securityConstraints, + applySecurityConstraints(subDef, new ItemPath(itemPath, subDef.getName()), securityConstraints, readDecision, addDecision, modifyDecision, phase); } } diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestSchemaMisc.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIntent.java similarity index 90% rename from model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestSchemaMisc.java rename to model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIntent.java index f2135dd64d6..9444a7a8e2b 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestSchemaMisc.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestIntent.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.evolveum.midpoint.model.intest.gensync; +package com.evolveum.midpoint.model.intest; import static com.evolveum.midpoint.test.IntegrationTestTools.display; import static org.testng.AssertJUnit.assertEquals; @@ -28,11 +28,10 @@ import javax.xml.datatype.XMLGregorianCalendar; import com.evolveum.icf.dummy.resource.DummyGroup; -import com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest; -import com.evolveum.midpoint.model.intest.TestModelServiceContract; import com.evolveum.midpoint.prism.Containerable; import com.evolveum.midpoint.prism.PrismContainer; import com.evolveum.midpoint.prism.PrismObjectDefinition; +import com.evolveum.midpoint.prism.PrismPropertyDefinition; import com.evolveum.midpoint.prism.path.ItemPath; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; @@ -71,9 +70,9 @@ */ @ContextConfiguration(locations = {"classpath:ctx-model-intest-test-main.xml"}) @DirtiesContext(classMode = ClassMode.AFTER_CLASS) -public class TestSchemaMisc extends AbstractInitializedModelIntegrationTest { +public class TestIntent extends AbstractInitializedModelIntegrationTest { - public static final File TEST_DIR = new File("src/test/resources/gensync"); + public static final File TEST_DIR = new File("src/test/resources/xxxxxxxxxx"); private static final String ACCOUNT_INTENT_TEST = "test"; private String accountOid; @@ -392,58 +391,7 @@ public void test149ModifyUserJackUnassignAccountTest() throws Exception { assertSteadyResources(); } - - @Test - public void test200EditSchemaUser() throws Exception { - final String TEST_NAME="test200EditSchemaUser"; - TestUtil.displayTestTile(this, TEST_NAME); - - // GIVEN - Task task = taskManager.createTaskInstance(TestModelServiceContract.class.getName() + "." + TEST_NAME); - OperationResult result = task.getResult(); - preTestCleanup(AssignmentPolicyEnforcementType.RELATIVE); - - PrismObjectDefinition userDef = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(UserType.class); - PrismObject user = userDef.instantiate(); - - // WHEN - TestUtil.displayWhen(TEST_NAME); - PrismObjectDefinition editDef = getEditObjectDefinition(user); - - // THEN - TestUtil.displayThen(TEST_NAME); - - // TODO - assertSteadyResources(); - } - - @Test - public void test210EditSchemaRole() throws Exception { - final String TEST_NAME="test210EditSchemaRole"; - TestUtil.displayTestTile(this, TEST_NAME); - - // GIVEN - Task task = taskManager.createTaskInstance(TestModelServiceContract.class.getName() + "." + TEST_NAME); - OperationResult result = task.getResult(); - preTestCleanup(AssignmentPolicyEnforcementType.RELATIVE); - - PrismObjectDefinition roleDef = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(RoleType.class); - PrismObject role = roleDef.instantiate(); - - // WHEN - TestUtil.displayWhen(TEST_NAME); - PrismObjectDefinition editDef = getEditObjectDefinition(role); - - // THEN - TestUtil.displayThen(TEST_NAME); - - // TODO - - assertSteadyResources(); - } - - private void preTestCleanup(AssignmentPolicyEnforcementType enforcementPolicy) throws ObjectNotFoundException, SchemaException, ObjectAlreadyExistsException { assumeAssignmentPolicy(enforcementPolicy); dummyAuditService.clear(); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/AbstractGenericSyncTest.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/AbstractGenericSyncTest.java new file mode 100644 index 00000000000..8db9490c5d9 --- /dev/null +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/AbstractGenericSyncTest.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2010-2013 Evolveum + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.evolveum.midpoint.model.intest.gensync; + +import static com.evolveum.midpoint.test.IntegrationTestTools.display; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertFalse; +import static org.testng.AssertJUnit.assertNotNull; +import static org.testng.AssertJUnit.assertNull; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collection; + +import javax.xml.datatype.XMLGregorianCalendar; + +import com.evolveum.icf.dummy.resource.DummyGroup; +import com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest; +import com.evolveum.midpoint.prism.Containerable; +import com.evolveum.midpoint.prism.PrismContainer; +import com.evolveum.midpoint.prism.path.ItemPath; +import com.evolveum.midpoint.schema.GetOperationOptions; +import com.evolveum.midpoint.schema.SelectorOptions; +import com.evolveum.midpoint.schema.result.OperationResultStatus; +import com.evolveum.midpoint.schema.util.MiscSchemaUtil; +import com.evolveum.midpoint.test.DummyResourceContoller; +import com.evolveum.midpoint.test.IntegrationTestTools; +import com.evolveum.midpoint.util.exception.ObjectNotFoundException; +import com.evolveum.midpoint.util.exception.SchemaException; +import com.evolveum.midpoint.xml.ns._public.common.common_3.*; + +import org.apache.commons.lang.StringUtils; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.annotation.DirtiesContext.ClassMode; +import org.springframework.test.context.ContextConfiguration; +import org.testng.AssertJUnit; +import org.testng.annotations.Test; + +import com.evolveum.midpoint.prism.PrismObject; +import com.evolveum.midpoint.prism.PrismReferenceValue; +import com.evolveum.midpoint.prism.delta.ChangeType; +import com.evolveum.midpoint.prism.delta.ObjectDelta; +import com.evolveum.midpoint.prism.delta.ReferenceDelta; +import com.evolveum.midpoint.prism.util.PrismAsserts; +import com.evolveum.midpoint.prism.util.PrismTestUtil; +import com.evolveum.midpoint.schema.result.OperationResult; +import com.evolveum.midpoint.task.api.Task; +import com.evolveum.midpoint.test.util.TestUtil; +import com.evolveum.midpoint.util.MiscUtil; + +/** + * Generic synchronization test. We create role and assign a resource to it. + * Entitlement (group) should be created. + * + * @author Radovan Semancik + * + */ +@ContextConfiguration(locations = {"classpath:ctx-model-intest-test-main.xml"}) +@DirtiesContext(classMode = ClassMode.AFTER_CLASS) +public class AbstractGenericSyncTest extends AbstractInitializedModelIntegrationTest { + + public static final File TEST_DIR = new File("src/test/resources/gensync"); + + protected static final File ROLE_SWASHBUCKLER_FILE = new File(TEST_DIR, "role-swashbuckler.xml"); + protected static final String ROLE_SWASHBUCKLER_OID = "12345678-d34d-b33f-f00d-5b5b5b5b5b5b"; + protected static final String ROLE_SWASHBUCKLER_NAME = "Swashbuckler"; + protected static final String ROLE_SWASHBUCKLER_DESCRIPTION = "Requestable role Swashbuckler"; + + protected static final String GROUP_SWASHBUCKLER_DUMMY_NAME = "swashbuckler"; + + protected static final File ROLE_META_DUMMYGROUP_FILE = new File(TEST_DIR, "role-meta-dummygroup.xml"); + protected static final String ROLE_META_DUMMYGROUP_OID = "12348888-d34d-8888-8888-555555556666"; + + protected static final File SYSTEM_CONFIGURATION_GENSYNC_FILE = new File(TEST_DIR, "system-configuration.xml"); + + protected static final File OBJECT_TEMPLATE_ROLE_FILE = new File(TEST_DIR, "object-template-role.xml"); + + @Override + public void initSystem(Task initTask, OperationResult initResult) throws Exception { + super.initSystem(initTask, initResult); + + repoAddObjectFromFile(OBJECT_TEMPLATE_ROLE_FILE, ObjectTemplateType.class, initResult); + repoAddObjectFromFile(ROLE_META_DUMMYGROUP_FILE, RoleType.class, initResult); + } + + @Override + protected File getSystemConfigurationFile() { + return SYSTEM_CONFIGURATION_GENSYNC_FILE; + } + +} diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestEditSchema.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestEditSchema.java new file mode 100644 index 00000000000..1cd7845e3fa --- /dev/null +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestEditSchema.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2010-2015 Evolveum + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.evolveum.midpoint.model.intest.gensync; + +import static com.evolveum.midpoint.test.IntegrationTestTools.display; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertFalse; +import static org.testng.AssertJUnit.assertNotNull; +import static org.testng.AssertJUnit.assertNull; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collection; + +import javax.xml.datatype.XMLGregorianCalendar; + +import com.evolveum.icf.dummy.resource.DummyGroup; +import com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest; +import com.evolveum.midpoint.model.intest.TestModelServiceContract; +import com.evolveum.midpoint.prism.Containerable; +import com.evolveum.midpoint.prism.PrismContainer; +import com.evolveum.midpoint.prism.PrismObjectDefinition; +import com.evolveum.midpoint.prism.PrismPropertyDefinition; +import com.evolveum.midpoint.prism.path.ItemPath; +import com.evolveum.midpoint.schema.GetOperationOptions; +import com.evolveum.midpoint.schema.SelectorOptions; +import com.evolveum.midpoint.schema.constants.SchemaConstants; +import com.evolveum.midpoint.schema.result.OperationResultStatus; +import com.evolveum.midpoint.schema.util.MiscSchemaUtil; +import com.evolveum.midpoint.test.DummyResourceContoller; +import com.evolveum.midpoint.test.IntegrationTestTools; +import com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException; +import com.evolveum.midpoint.util.exception.ObjectNotFoundException; +import com.evolveum.midpoint.util.exception.SchemaException; +import com.evolveum.midpoint.xml.ns._public.common.common_3.*; + +import org.apache.commons.lang.StringUtils; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.annotation.DirtiesContext.ClassMode; +import org.springframework.test.context.ContextConfiguration; +import org.testng.AssertJUnit; +import org.testng.annotations.Test; + +import com.evolveum.midpoint.prism.PrismObject; +import com.evolveum.midpoint.prism.PrismReferenceValue; +import com.evolveum.midpoint.prism.delta.ChangeType; +import com.evolveum.midpoint.prism.delta.ObjectDelta; +import com.evolveum.midpoint.prism.delta.ReferenceDelta; +import com.evolveum.midpoint.prism.util.PrismAsserts; +import com.evolveum.midpoint.prism.util.PrismTestUtil; +import com.evolveum.midpoint.schema.result.OperationResult; +import com.evolveum.midpoint.task.api.Task; +import com.evolveum.midpoint.test.util.TestUtil; +import com.evolveum.midpoint.util.MiscUtil; + +/** + * @author semancik + * + */ +@ContextConfiguration(locations = {"classpath:ctx-model-intest-test-main.xml"}) +@DirtiesContext(classMode = ClassMode.AFTER_CLASS) +public class TestEditSchema extends AbstractGenericSyncTest { + + @Override + public void initSystem(Task initTask, OperationResult initResult) throws Exception { + super.initSystem(initTask, initResult); + + setDefaultUserTemplate(USER_TEMPLATE_COMPLEX_OID); + + rememberSteadyResources(); + } + + @Test + public void test200EditSchemaUser() throws Exception { + final String TEST_NAME="test200EditSchemaUser"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = taskManager.createTaskInstance(TestModelServiceContract.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + PrismObjectDefinition userDef = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(UserType.class); + PrismObject user = userDef.instantiate(); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + PrismObjectDefinition editDef = getEditObjectDefinition(user); + + // THEN + TestUtil.displayThen(TEST_NAME); + + PrismPropertyDefinition additionalNameDef = editDef.findPropertyDefinition(UserType.F_ADDITIONAL_NAME); + assertNotNull("No definition for additionalName in user", additionalNameDef); + assertEquals("Wrong additionalName displayName", "Middle Name", additionalNameDef.getDisplayName()); + + assertSteadyResources(); + } + + @Test + public void test210EditSchemaRole() throws Exception { + final String TEST_NAME="test210EditSchemaRole"; + TestUtil.displayTestTile(this, TEST_NAME); + + // GIVEN + Task task = taskManager.createTaskInstance(TestModelServiceContract.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + PrismObjectDefinition roleDef = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(RoleType.class); + PrismObject role = roleDef.instantiate(); + + // WHEN + TestUtil.displayWhen(TEST_NAME); + PrismObjectDefinition editDef = getEditObjectDefinition(role); + + // THEN + TestUtil.displayThen(TEST_NAME); + + // TODO + PrismPropertyDefinition requestableDef = editDef.findPropertyDefinition(RoleType.F_REQUESTABLE); + assertNotNull("No definition for requestable in role", requestableDef); + assertEquals("Wrong requestable displayName", "Can request", requestableDef.getDisplayName()); + + assertSteadyResources(); + } + + +} diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestRoleEntitlement.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestRoleEntitlement.java index 957a4151996..aef36cc9702 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestRoleEntitlement.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestRoleEntitlement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Evolveum + * Copyright (c) 2010-2015 Evolveum * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,39 +70,10 @@ */ @ContextConfiguration(locations = {"classpath:ctx-model-intest-test-main.xml"}) @DirtiesContext(classMode = ClassMode.AFTER_CLASS) -public class TestRoleEntitlement extends AbstractInitializedModelIntegrationTest { +public class TestRoleEntitlement extends AbstractGenericSyncTest { - public static final File TEST_DIR = new File("src/test/resources/gensync"); - - protected static final File ROLE_SWASHBUCKLER_FILE = new File(TEST_DIR, "role-swashbuckler.xml"); - protected static final String ROLE_SWASHBUCKLER_OID = "12345678-d34d-b33f-f00d-5b5b5b5b5b5b"; - protected static final String ROLE_SWASHBUCKLER_NAME = "Swashbuckler"; - protected static final String ROLE_SWASHBUCKLER_DESCRIPTION = "Requestable role Swashbuckler"; - - protected static final String GROUP_SWASHBUCKLER_DUMMY_NAME = "swashbuckler"; - - protected static final File ROLE_META_DUMMYGROUP_FILE = new File(TEST_DIR, "role-meta-dummygroup.xml"); - protected static final String ROLE_META_DUMMYGROUP_OID = "12348888-d34d-8888-8888-555555556666"; - - private static final File SYSTEM_CONFIGURATION_GENSYNC_FILE = new File(TEST_DIR, "system-configuration.xml"); - - private static final File OBJECT_TEMPLATE_ROLE_FILE = new File(TEST_DIR, "object-template-role.xml"); - private static String groupOid; - @Override - public void initSystem(Task initTask, OperationResult initResult) throws Exception { - super.initSystem(initTask, initResult); - - repoAddObjectFromFile(OBJECT_TEMPLATE_ROLE_FILE, ObjectTemplateType.class, initResult); - repoAddObjectFromFile(ROLE_META_DUMMYGROUP_FILE, RoleType.class, initResult); - } - - @Override - protected File getSystemConfigurationFile() { - return SYSTEM_CONFIGURATION_GENSYNC_FILE; - } - @Test public void test050GetRolePirate() throws Exception { final String TEST_NAME = "test050GetRolePirate"; diff --git a/model/model-intest/src/test/resources/common/user-template-complex.xml b/model/model-intest/src/test/resources/common/user-template-complex.xml index 06c1d672a4d..6ba57e69536 100644 --- a/model/model-intest/src/test/resources/common/user-template-complex.xml +++ b/model/model-intest/src/test/resources/common/user-template-complex.xml @@ -1,6 +1,6 @@ true @@ -253,5 +258,6 @@ additionalName + diff --git a/model/model-intest/src/test/resources/common/user-template.xml b/model/model-intest/src/test/resources/common/user-template.xml index 005650ef7b1..177bf75f284 100644 --- a/model/model-intest/src/test/resources/common/user-template.xml +++ b/model/model-intest/src/test/resources/common/user-template.xml @@ -1,6 +1,6 @@ + + net.sf.jasperreports + jasperreports + ${jasper.version} + + + xml-apis + xml-apis + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + diff --git a/gui/admin-gui/pom.xml b/gui/admin-gui/pom.xml index db58dc53598..10765f698bd 100644 --- a/gui/admin-gui/pom.xml +++ b/gui/admin-gui/pom.xml @@ -526,13 +526,6 @@ net.sf.jasperreports jasperreports - 6.0.0 - - - xml-apis - xml-apis - - commons-javaflow diff --git a/model/report-impl/pom.xml b/model/report-impl/pom.xml index 30cc5f1cc55..0b04eaec361 100644 --- a/model/report-impl/pom.xml +++ b/model/report-impl/pom.xml @@ -78,7 +78,6 @@ net.sf.jasperreports jasperreports - 6.0.0 From 25fb53c43d3004b1573e6a6c82833dba521d2a9b Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Tue, 10 Feb 2015 14:49:20 +0100 Subject: [PATCH 140/215] Support for in object template. --- .../xml/ns/public/common/common-3.xsd | 2 +- .../projector/ObjectTemplateProcessor.java | 23 +++++++- .../common/user-template-complex.xml | 59 +++++++++---------- 3 files changed, 52 insertions(+), 32 deletions(-) diff --git a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd index a9377543e74..a04e3112770 100644 --- a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd +++ b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd @@ -6899,7 +6899,7 @@ - + Defines how any of the object property value should diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ObjectTemplateProcessor.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ObjectTemplateProcessor.java index aef75cc1e53..220305c02b3 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ObjectTemplateProcessor.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ObjectTemplateProcessor.java @@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -61,7 +62,10 @@ import com.evolveum.midpoint.util.logging.Trace; import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.MappingTargetDeclarationType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.MappingType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectTemplateItemDefinitionType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectTemplateMappingEvaluationPhaseType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectTemplateMappingType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectTemplateType; @@ -226,7 +230,7 @@ private XMLGregorianCalendar collectTripleFromTemplate(Len } // Process own mappings - Collection mappings = objectTemplateType.getMapping(); + Collection mappings = collectMapings(objectTemplateType); XMLGregorianCalendar templateNextRecomputeTime = collectTripleFromMappings(mappings, phase, context, objectTemplateType, userOdo, outputTripleMap, iteration, iterationToken, now, contextDesc, task, result); if (templateNextRecomputeTime != null) { @@ -239,6 +243,23 @@ private XMLGregorianCalendar collectTripleFromTemplate(Len } + private Collection collectMapings(ObjectTemplateType objectTemplateType) { + List mappings = new ArrayList(); + mappings.addAll(objectTemplateType.getMapping()); + for (ObjectTemplateItemDefinitionType templateItemDefType: objectTemplateType.getItem()) { + for (ObjectTemplateMappingType mapping: templateItemDefType.getMapping()) { + MappingTargetDeclarationType target = mapping.getTarget(); + if (target == null) { + target = new MappingTargetDeclarationType(); + target.setPath(templateItemDefType.getRef()); + mapping.setTarget(target); + } + mappings.add(mapping); + } + } + return mappings; + } + private XMLGregorianCalendar collectTripleFromMappings( Collection mappings, ObjectTemplateMappingEvaluationPhaseType phase, LensContext context, ObjectTemplateType objectTemplateType, ObjectDeltaObject userOdo, diff --git a/model/model-intest/src/test/resources/common/user-template-complex.xml b/model/model-intest/src/test/resources/common/user-template-complex.xml index 6ba57e69536..6f45b9cc177 100644 --- a/model/model-intest/src/test/resources/common/user-template-complex.xml +++ b/model/model-intest/src/test/resources/common/user-template-complex.xml @@ -29,6 +29,34 @@ additionalName Middle Name + + + costCenter + + weak + + G001 + + afterAssignments + + + true + strong + + employeeType + + + B666 + + + + + + + @@ -148,37 +176,8 @@ assignment + - - weak - - G001 - - - costCenter - - afterAssignments - - - - true - strong - - employeeType - - - B666 - - - costCenter - - - - - From a5d1a507564df7e50be02e7640ccf2ae177bf9fb Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Tue, 10 Feb 2015 15:36:33 +0100 Subject: [PATCH 141/215] valueEnumerationRef --- .../midpoint/prism/ItemDefinition.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/ItemDefinition.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/ItemDefinition.java index d696a3903ce..b10632810a2 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/ItemDefinition.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/ItemDefinition.java @@ -65,6 +65,7 @@ public abstract class ItemDefinition extends Definition implements Serializable private boolean canAdd = true; private boolean canRead = true; private boolean canModify = true; + private PrismReferenceValue valueEnumerationRef; // TODO: annotations @@ -242,7 +243,22 @@ public boolean canAdd() { return canAdd; } - public boolean isValidFor(QName elementQName, Class clazz) { + /** + * Reference to an object that directly or indirectly represents possible values for + * this item. We do not define here what exactly the object has to be. It can be a lookup + * table, script that dynamically produces the values or anything similar. + * The object must produce the values of the correct type for this item otherwise an + * error occurs. + */ + public PrismReferenceValue getValueEnumerationRef() { + return valueEnumerationRef; + } + + public void setValueEnumerationRef(PrismReferenceValue valueEnumerationRef) { + this.valueEnumerationRef = valueEnumerationRef; + } + + public boolean isValidFor(QName elementQName, Class clazz) { return isValidFor(elementQName, clazz, false); } From e82e5fce13cd7a3fce1608faf28dda632bb26f65 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Tue, 10 Feb 2015 15:40:51 +0100 Subject: [PATCH 142/215] MID-2175 - adding option to setrelation between user and org. unit - user can be made manager from UI. --- .../assignment/AssignmentEditorDto.java | 38 ++++++ .../assignment/AssignmentEditorPanel.html | 4 +- .../assignment/AssignmentEditorPanel.java | 30 ++++- .../AssignmentEditorPanel.properties | 2 + .../component/input/TwoStateBooleanPanel.html | 27 ++++ .../component/input/TwoStateBooleanPanel.java | 126 ++++++++++++++++++ 6 files changed, 221 insertions(+), 6 deletions(-) create mode 100644 gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/TwoStateBooleanPanel.html create mode 100644 gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/TwoStateBooleanPanel.java diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorDto.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorDto.java index 45ba17669e2..b456d0ec6e1 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorDto.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorDto.java @@ -19,6 +19,7 @@ import com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition; import com.evolveum.midpoint.common.refinery.RefinedResourceSchema; import com.evolveum.midpoint.prism.*; +import com.evolveum.midpoint.schema.constants.SchemaConstants; import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.task.api.Task; import com.evolveum.midpoint.util.exception.SchemaException; @@ -60,6 +61,7 @@ public class AssignmentEditorDto extends SelectableBean implements Comparable attributes; @@ -102,6 +105,23 @@ public AssignmentEditorDto(ObjectType targetObject, AssignmentEditorDtoType type this.altName = getAlternativeName(assignment); this.attributes = prepareAssignmentAttributes(assignment, pageBase); + this.isOrgUnitManager = determineUserOrgRelation(assignment); + } + + private Boolean determineUserOrgRelation(AssignmentType assignment){ + if(!AssignmentEditorDtoType.ORG_UNIT.equals(getType())){ + return Boolean.FALSE; + } + + if(assignment == null || assignment.getTargetRef() == null || assignment.getTargetRef().getRelation() == null){ + return Boolean.FALSE; + } + + if(SchemaConstants.ORG_MANAGER.equals(assignment.getTargetRef().getRelation())){ + return Boolean.TRUE; + } + + return Boolean.FALSE; } private List prepareAssignmentAttributes(AssignmentType assignment, PageBase pageBase){ @@ -336,6 +356,14 @@ public PrismContainerValue getOldValue() { } public PrismContainerValue getNewValue() throws SchemaException { + if(AssignmentEditorDtoType.ORG_UNIT.equals(getType())){ + if(isOrgUnitManager()){ + newAssignment.getTargetRef().setRelation(SchemaConstants.ORG_MANAGER); + } else { + newAssignment.getTargetRef().setRelation(null); + } + } + //this removes activation element if it's empty ActivationType activation = newAssignment.getActivation(); if (activation == null || activation.asPrismContainerValue().isEmpty()) { @@ -388,6 +416,14 @@ public void setDescription(String description) { newAssignment.setDescription(description); } + public Boolean isOrgUnitManager() { + return isOrgUnitManager; + } + + public void setOrgUnitManager(Boolean orgUnitManager) { + isOrgUnitManager = orgUnitManager; + } + @Override public int compareTo(AssignmentEditorDto other) { Validate.notNull(other, "Can't compare assignment editor dto with null."); @@ -441,6 +477,7 @@ public boolean equals(Object o) { AssignmentEditorDto that = (AssignmentEditorDto) o; + if (isOrgUnitManager != that.isOrgUnitManager) return false; if (minimized != that.minimized) return false; if (showEmpty != that.showEmpty) return false; if (altName != null ? !altName.equals(that.altName) : that.altName != null) return false; @@ -467,6 +504,7 @@ public int hashCode() { result = 31 * result + (tenantRef != null ? tenantRef.hashCode() : 0); result = 31 * result + (showEmpty ? 1 : 0); result = 31 * result + (minimized ? 1 : 0); + result = 31 * result + (isOrgUnitManager ? 1 : 0); result = 31 * result + (newAssignment != null ? newAssignment.hashCode() : 0); result = 31 * result + (attributes != null ? attributes.hashCode() : 0); return result; diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorPanel.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorPanel.html index 5380a846133..b2e3cdc0d47 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorPanel.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorPanel.html @@ -46,14 +46,14 @@ -
+
- +
diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorPanel.java index e0fc17f03ce..cc42831fbee 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorPanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorPanel.java @@ -34,6 +34,7 @@ import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.web.component.DateInput; import com.evolveum.midpoint.web.component.input.DropDownChoicePanel; +import com.evolveum.midpoint.web.component.input.TwoStateBooleanPanel; import com.evolveum.midpoint.web.component.prism.InputPanel; import com.evolveum.midpoint.web.component.util.LoadableModel; import com.evolveum.midpoint.web.component.util.SimplePanel; @@ -57,7 +58,6 @@ import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.FormComponent; import org.apache.wicket.markup.html.form.TextArea; -import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.list.ListItem; import org.apache.wicket.markup.html.list.ListView; import org.apache.wicket.model.AbstractReadOnlyModel; @@ -95,6 +95,7 @@ public class AssignmentEditorPanel extends SimplePanel { private static final String ID_ACTIVATION_BLOCK = "activationBlock"; private static final String ID_BODY = "body"; private static final String ID_DESCRIPTION = "description"; + private static final String ID_RELATION_CONTAINER = "relationContainer"; private static final String ID_RELATION = "relation"; private static final String ID_ADMINISTRATIVE_STATUS = "administrativeStatus"; private static final String ID_VALID_FROM = "validFrom"; @@ -319,9 +320,30 @@ private void initBodyLayout(WebMarkupContainer body) { new PropertyModel(getModel(), AssignmentEditorDto.F_DESCRIPTION)); body.add(description); - TextField relation = new TextField<>(ID_RELATION, new PropertyModel(getModel(), AssignmentEditorDto.F_RELATION)); - relation.setEnabled(false); - body.add(relation); + WebMarkupContainer relationContainer = new WebMarkupContainer(ID_RELATION_CONTAINER); + relationContainer.setOutputMarkupId(true); + relationContainer.setOutputMarkupPlaceholderTag(true); + relationContainer.add(new VisibleEnableBehaviour(){ + + @Override + public boolean isVisible() { + AssignmentEditorDto dto = getModel().getObject(); + if(dto != null){ + if(AssignmentEditorDtoType.ORG_UNIT.equals(dto.getType())){ + return true; + } + } + + return false; + } + }); + body.add(relationContainer); + + TwoStateBooleanPanel relation = new TwoStateBooleanPanel(ID_RELATION, new PropertyModel(getModel(), AssignmentEditorDto.F_IS_ORG_UNIT_MANAGER), + "AssignmentEditorPanel.member", "AssignmentEditorPanel.manager", null); + relation.setOutputMarkupId(true); + relation.setOutputMarkupPlaceholderTag(true); + relationContainer.add(relation); WebMarkupContainer tenantRefContainer = new WebMarkupContainer(ID_CONTAINER_TENANT_REF); ChooseTypePanel tenantRef = new ChooseTypePanel(ID_TENANT_CHOOSER, diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorPanel.properties b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorPanel.properties index 0122dbb6208..80461f2a5d2 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorPanel.properties +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorPanel.properties @@ -28,6 +28,8 @@ AssignmentEditorPanel.tenantRef=Tenant AssignmentEditorPanel.name.focus=(focus mapping) AssignmentEditorPanel.name.noTarget=(no target) AssignmentEditorPanel.showMore=Show more +AssignmentEditorPanel.member=Member +AssignmentEditorPanel.manager=Manager AssignmentEditorPanel.targetError=Assignment target was not found. Either target oid is malformed or target object does not exist. diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/TwoStateBooleanPanel.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/TwoStateBooleanPanel.html new file mode 100644 index 00000000000..ec445b1281b --- /dev/null +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/TwoStateBooleanPanel.html @@ -0,0 +1,27 @@ + + + + + + +
+ + +
+ +
+ \ No newline at end of file diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/TwoStateBooleanPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/TwoStateBooleanPanel.java new file mode 100644 index 00000000000..b4e6e52ddc8 --- /dev/null +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/TwoStateBooleanPanel.java @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2010-2013 Evolveum + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.evolveum.midpoint.web.component.input; + +import com.evolveum.midpoint.web.component.AjaxButton; +import com.evolveum.midpoint.web.component.util.SimplePanel; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.behavior.AttributeAppender; +import org.apache.wicket.model.AbstractReadOnlyModel; +import org.apache.wicket.model.IModel; + +/** + * Use this component when two-state widget is needed (e.g. boolean attributes - true/false) + * Bear in mind that: + * - first button represents FALSE + * - second button represents TRUE + * + * @author shood + * */ +public class TwoStateBooleanPanel extends SimplePanel{ + + private static final String ID_BUTTON_ONE = "optionOne"; + private static final String ID_BUTTON_TWO = "optionTwo"; + + private static final String DEFAULT_BUTTON_CLASS = "btn-default"; + + public TwoStateBooleanPanel(String id, IModel model){ + this(id, model, null, null, null); + } + + public TwoStateBooleanPanel(String id, IModel model, String optionOneLabel, + String optionTwoLabel, String buttonCssClass){ + super(id, model); + + setOutputMarkupId(true); + initLayout(optionOneLabel, optionTwoLabel, buttonCssClass); + } + + protected void initLayout(final String optionOneLabel, final String optionTwoLabel, final String buttonCssClass){ + + AjaxButton buttonFalse = new AjaxButton(ID_BUTTON_ONE, new AbstractReadOnlyModel() { + + @Override + public String getObject() { + if(optionOneLabel == null){ + return getString("ThreeStateBooleanPanel.false"); + } else { + return getString(optionOneLabel); + } + } + }) { + + @Override + public void onClick(AjaxRequestTarget target) { + stateChanged(Boolean.FALSE, target); + } + }; + buttonFalse.setOutputMarkupId(true); + buttonFalse.add(prepareButtonCssClass(buttonCssClass)); + buttonFalse.add(prepareActiveButtonAppender(Boolean.FALSE)); + add(buttonFalse); + + AjaxButton buttonTrue = new AjaxButton(ID_BUTTON_TWO, new AbstractReadOnlyModel() { + + @Override + public String getObject() { + if(optionTwoLabel == null){ + return getString("ThreeStateBooleanPanel.true"); + } else { + return getString(optionTwoLabel); + } + } + }) { + + @Override + public void onClick(AjaxRequestTarget target) { + stateChanged(Boolean.TRUE, target); + } + }; + buttonTrue.setOutputMarkupId(true); + buttonTrue.add(prepareButtonCssClass(buttonCssClass)); + buttonTrue.add(prepareActiveButtonAppender(Boolean.TRUE)); + add(buttonTrue); + } + + private void stateChanged(Boolean newValue, AjaxRequestTarget target){ + getModel().setObject(newValue); + target.add(this); + } + + private AttributeAppender prepareActiveButtonAppender(final Boolean value){ + return new AttributeAppender("class", new AbstractReadOnlyModel() { + + @Override + public String getObject() { + if(getModel() != null){ + return getModel().getObject() == value ? " active" : null; + } + + return null; + } + }); + } + + private AttributeAppender prepareButtonCssClass(String cssClass){ + if(cssClass == null){ + return new AttributeAppender("class", " " + DEFAULT_BUTTON_CLASS); + } else { + return new AttributeAppender("class", " " + cssClass); + } + } +} From f7f9302221e67ffa4a9bf1b6df57fa839088e69d Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Tue, 10 Feb 2015 17:01:18 +0100 Subject: [PATCH 143/215] Fixing circular type definition, reworked deep clone, this fixes broken security tests --- .../midpoint/prism/ComplexTypeDefinition.java | 13 +++-- .../midpoint/prism/ItemDefinition.java | 16 +++++- .../prism/PrismContainerDefinition.java | 7 +-- .../midpoint/prism/PrismObjectDefinition.java | 4 +- .../xml/ns/public/common/common-3.xsd | 37 ++++++++---- .../midpoint/schema/TestSchemaRegistry.java | 6 +- .../impl/controller/ModelController.java | 12 ++-- .../midpoint/model/intest/TestSecurity.java | 5 +- .../model/intest/gensync/TestEditSchema.java | 12 ++++ .../src/test/resources/logback-test.xml | 2 +- .../midpoint/security/api/Authorization.java | 5 +- .../security/impl/SecurityEnforcerImpl.java | 57 ++++++++++--------- 12 files changed, 111 insertions(+), 65 deletions(-) diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/ComplexTypeDefinition.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/ComplexTypeDefinition.java index 61f415cd08c..3428207004b 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/ComplexTypeDefinition.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/ComplexTypeDefinition.java @@ -278,12 +278,17 @@ public ComplexTypeDefinition deepClone() { } ComplexTypeDefinition deepClone(Map ctdMap) { - ComplexTypeDefinition clone = ctdMap.get(this.getTypeName()); - if (clone != null) { - return clone; // already cloned + ComplexTypeDefinition clone; + if (ctdMap != null) { + clone = ctdMap.get(this.getTypeName()); + if (clone != null) { + return clone; // already cloned + } } clone = clone(); // shallow - ctdMap.put(this.getTypeName(), clone); + if (ctdMap != null) { + ctdMap.put(this.getTypeName(), clone); + } clone.itemDefinitions.clear(); for (ItemDefinition itemDef: this.itemDefinitions) { clone.itemDefinitions.add(itemDef.deepClone(ctdMap)); diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/ItemDefinition.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/ItemDefinition.java index b10632810a2..9554a1b4c89 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/ItemDefinition.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/ItemDefinition.java @@ -17,6 +17,7 @@ package com.evolveum.midpoint.prism; import java.io.Serializable; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -333,8 +334,19 @@ protected void copyDefinitionData(ItemDefinition clone) { clone.operational = this.operational; } - public ItemDefinition deepClone() { - return clone(); + /** + * Make a deep clone, cloning all the sub-items and definitions. + * + * @param ultraDeep if set to true then even the objects that were same instance in the original will be + * cloned as separate instances in the clone. + * + */ + public ItemDefinition deepClone(boolean ultraDeep) { + if (ultraDeep) { + return deepClone(null); + } else { + return deepClone(new HashMap()); + } } ItemDefinition deepClone(Map ctdMap) { diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismContainerDefinition.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismContainerDefinition.java index 89e9d15eb73..fb034feadd9 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismContainerDefinition.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismContainerDefinition.java @@ -357,12 +357,7 @@ protected void copyDefinitionData(PrismContainerDefinition clone) { } @Override - public ItemDefinition deepClone() { - return deepClone(new HashMap()); - } - - @Override - public ItemDefinition deepClone(Map ctdMap) { + ItemDefinition deepClone(Map ctdMap) { PrismContainerDefinition clone = clone(); ComplexTypeDefinition ctd = getComplexTypeDefinition(); if (ctd != null) { diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismObjectDefinition.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismObjectDefinition.java index b861ddc51eb..d0fee015444 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismObjectDefinition.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismObjectDefinition.java @@ -63,8 +63,8 @@ public PrismObjectDefinition clone() { } @Override - public PrismObjectDefinition deepClone() { - return (PrismObjectDefinition) super.deepClone(); + public PrismObjectDefinition deepClone(boolean ultraDeep) { + return (PrismObjectDefinition) super.deepClone(ultraDeep); } public PrismObjectDefinition cloneWithReplacedDefinition(QName itemName, ItemDefinition newDefinition) { diff --git a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd index a04e3112770..f60c2ddfba8 100644 --- a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd +++ b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd @@ -6357,7 +6357,7 @@ - + Object part from the (subject,action,object) authorization triple. @@ -6373,7 +6373,7 @@ - + Target of the operation. E.g. an role that is being assigned. It can be considered an operation @@ -6493,17 +6493,34 @@ - - - - The object matches the specification if it has an owner specified by this element. - The "owner" means a focus that has a link to the object. - - - + + + + + Selects some objects from all the objects in midPoint. + + + + + + + + + + + + The object matches the specification if it has an owner specified by this element. + The "owner" means a focus that has a link to the object. + + + + + + + diff --git a/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestSchemaRegistry.java b/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestSchemaRegistry.java index 6a510e26317..65962ed3e98 100644 --- a/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestSchemaRegistry.java +++ b/infra/schema/src/test/java/com/evolveum/midpoint/schema/TestSchemaRegistry.java @@ -170,7 +170,8 @@ public void testUserType() throws Exception { // Just make sure this does not end with NPE or stack overflow PrismObjectDefinition shallowClone = userDefinition.clone(); - PrismObjectDefinition deepClone = userDefinition.deepClone(); + PrismObjectDefinition deepClone = userDefinition.deepClone(false); + PrismObjectDefinition ultraDeepClone = userDefinition.deepClone(true); } @Test @@ -197,7 +198,8 @@ public void testRoleType() throws Exception { // Just make sure this does not end with NPE or stack overflow PrismObjectDefinition shallowClone = roleDefinition.clone(); - PrismObjectDefinition deepClone = roleDefinition.deepClone(); + PrismObjectDefinition deepClone = roleDefinition.deepClone(false); + PrismObjectDefinition ultraDeepClone = roleDefinition.deepClone(true); } @Test diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java index e866ccf3939..f981a5ae7fe 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java @@ -824,7 +824,7 @@ public ModelContext previewChanges( @Override public PrismObjectDefinition getEditObjectDefinition(PrismObject object, AuthorizationPhaseType phase, OperationResult parentResult) throws SchemaException, ConfigurationException, ObjectNotFoundException { OperationResult result = parentResult.createMinorSubresult(GET_EDIT_OBJECT_DEFINITION); - PrismObjectDefinition objectDefinition = object.getDefinition().deepClone(); + PrismObjectDefinition objectDefinition = object.getDefinition().deepClone(true); // TODO: maybe we need to expose owner resolver in the interface? ObjectSecurityConstraints securityConstraints = securityEnforcer.compileSecurityConstraints(object, null); if (LOGGER.isTraceEnabled()) { @@ -893,7 +893,7 @@ private void applySecurityConstraints(D itemDefinitio AuthorizationDecisionType readDecision = computeItemDecision(securityConstraints, itemPath, ModelAuthorizationAction.READ.getUrl(), defaultReadDecition, phase); AuthorizationDecisionType addDecision = computeItemDecision(securityConstraints, itemPath, ModelAuthorizationAction.ADD.getUrl(), defaultAddDecition, phase); AuthorizationDecisionType modifyDecision = computeItemDecision(securityConstraints, itemPath, ModelAuthorizationAction.MODIFY.getUrl(), defaultModifyDecition, phase); -// LOGGER.trace("Decision for {}: {}", itemPath, readDecision); + LOGGER.trace("Decision for {}: {}", itemPath, readDecision); if (readDecision != AuthorizationDecisionType.ALLOW) { itemDefinition.setCanRead(false); } @@ -908,12 +908,8 @@ private void applySecurityConstraints(D itemDefinitio PrismContainerDefinition containerDefinition = (PrismContainerDefinition)itemDefinition; List origSubDefinitions = ((PrismContainerDefinition)containerDefinition).getDefinitions(); for (ItemDefinition subDef: origSubDefinitions) { - // TODO fix this brutal hack - it is necessary to avoid endless recursion in the style of "Decision for authorization/object/owner/owner/......../owner/special: ALLOW" - // it's too late to come up with a serious solution - if (!(itemPath.lastNamed() != null && ObjectSpecificationType.F_OWNER.equals(itemPath.lastNamed().getName()) && ObjectSpecificationType.F_OWNER.equals(subDef.getName()))) { - applySecurityConstraints(subDef, new ItemPath(itemPath, subDef.getName()), securityConstraints, - readDecision, addDecision, modifyDecision, phase); - } + applySecurityConstraints(subDef, new ItemPath(itemPath, subDef.getName()), securityConstraints, + readDecision, addDecision, modifyDecision, phase); } } } diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestSecurity.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestSecurity.java index 619229f0e8f..1aa2b7e5d7b 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestSecurity.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestSecurity.java @@ -60,10 +60,12 @@ import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectSpecificationType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; import com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.OwnedObjectSpecificationType; import com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; import com.evolveum.midpoint.xml.ns._public.common.common_3.SpecialObjectSpecificationType; import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; + import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; import org.springframework.test.context.ContextConfiguration; @@ -71,6 +73,7 @@ import org.testng.annotations.Test; import javax.xml.namespace.QName; + import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -250,7 +253,7 @@ public void test000Sanity() throws Exception { assertEquals("Wrong number of authorizations", 2, authorizations.size()); AuthorizationType authRead = findAutz(authorizations, ModelAuthorizationAction.READ.getUrl()); assertEquals("Wrong action in authorization", ModelAuthorizationAction.READ.getUrl(), authRead.getAction().get(0)); - List objectSpecs = authRead.getObject(); + List objectSpecs = authRead.getObject(); assertEquals("Wrong number of object specs in authorization", 1, objectSpecs.size()); ObjectSpecificationType objectSpec = objectSpecs.get(0); List specials = objectSpec.getSpecial(); diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestEditSchema.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestEditSchema.java index 1cd7845e3fa..56a89618db1 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestEditSchema.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestEditSchema.java @@ -15,6 +15,7 @@ */ package com.evolveum.midpoint.model.intest.gensync; +import static org.testng.AssertJUnit.assertTrue; import static com.evolveum.midpoint.test.IntegrationTestTools.display; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertFalse; @@ -32,6 +33,7 @@ import com.evolveum.midpoint.model.intest.TestModelServiceContract; import com.evolveum.midpoint.prism.Containerable; import com.evolveum.midpoint.prism.PrismContainer; +import com.evolveum.midpoint.prism.PrismContainerDefinition; import com.evolveum.midpoint.prism.PrismObjectDefinition; import com.evolveum.midpoint.prism.PrismPropertyDefinition; import com.evolveum.midpoint.prism.path.ItemPath; @@ -105,7 +107,17 @@ public void test200EditSchemaUser() throws Exception { PrismPropertyDefinition additionalNameDef = editDef.findPropertyDefinition(UserType.F_ADDITIONAL_NAME); assertNotNull("No definition for additionalName in user", additionalNameDef); assertEquals("Wrong additionalName displayName", "Middle Name", additionalNameDef.getDisplayName()); + assertTrue("additionalName not readable", additionalNameDef.canRead()); + PrismContainerDefinition credentialsDef = editDef.findContainerDefinition(UserType.F_CREDENTIALS); + assertNotNull("No definition for credentials in user", credentialsDef); + assertTrue("Credentials not readable", credentialsDef.canRead()); + + ItemPath passwdValPath = new ItemPath(UserType.F_CREDENTIALS, CredentialsType.F_PASSWORD, PasswordType.F_VALUE); + PrismPropertyDefinition passwdValDef = editDef.findPropertyDefinition(passwdValPath); + assertNotNull("No definition for "+passwdValPath+" in user", passwdValDef); + assertTrue("Password not readable", passwdValDef.canRead()); + assertSteadyResources(); } diff --git a/model/model-intest/src/test/resources/logback-test.xml b/model/model-intest/src/test/resources/logback-test.xml index 00a5e0df010..42999ee9da1 100644 --- a/model/model-intest/src/test/resources/logback-test.xml +++ b/model/model-intest/src/test/resources/logback-test.xml @@ -70,7 +70,7 @@ - + diff --git a/repo/security-api/src/main/java/com/evolveum/midpoint/security/api/Authorization.java b/repo/security-api/src/main/java/com/evolveum/midpoint/security/api/Authorization.java index d2cbcc6419b..3c2bab32134 100644 --- a/repo/security-api/src/main/java/com/evolveum/midpoint/security/api/Authorization.java +++ b/repo/security-api/src/main/java/com/evolveum/midpoint/security/api/Authorization.java @@ -28,6 +28,7 @@ import com.evolveum.midpoint.xml.ns._public.common.common_3.AuthorizationPhaseType; import com.evolveum.midpoint.xml.ns._public.common.common_3.AuthorizationType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectSpecificationType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.OwnedObjectSpecificationType; /** * @author semancik @@ -71,7 +72,7 @@ public AuthorizationPhaseType getPhase() { return authorizationType.getPhase(); } - public List getObject() { + public List getObject() { return authorizationType.getObject(); } @@ -79,7 +80,7 @@ public List getItem() { return authorizationType.getItem(); } - public List getTarget() { + public List getTarget() { return authorizationType.getTarget(); } diff --git a/repo/security-impl/src/main/java/com/evolveum/midpoint/security/impl/SecurityEnforcerImpl.java b/repo/security-impl/src/main/java/com/evolveum/midpoint/security/impl/SecurityEnforcerImpl.java index 1074b4ce34f..6af4e995cb4 100644 --- a/repo/security-impl/src/main/java/com/evolveum/midpoint/security/impl/SecurityEnforcerImpl.java +++ b/repo/security-impl/src/main/java/com/evolveum/midpoint/security/impl/SecurityEnforcerImpl.java @@ -84,6 +84,7 @@ import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectSpecificationType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.OwnedObjectSpecificationType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; import com.evolveum.midpoint.xml.ns._public.common.common_3.SpecialObjectSpecificationType; import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; @@ -349,14 +350,14 @@ public void authorize(String operat } } - private boolean isApplicable(List objectSpecTypes, PrismObject object, + private boolean isApplicable(List objectSpecTypes, PrismObject object, MidPointPrincipal midPointPrincipal, OwnerResolver ownerResolver, String desc) throws SchemaException { if (objectSpecTypes != null && !objectSpecTypes.isEmpty()) { if (object == null) { LOGGER.trace(" Authorization not applicable for null "+desc); return false; } - for (ObjectSpecificationType autzObject: objectSpecTypes) { + for (OwnedObjectSpecificationType autzObject: objectSpecTypes) { if (isApplicable(autzObject, object, midPointPrincipal, ownerResolver, desc)) { return true; } @@ -451,34 +452,36 @@ private boolean isApplicable(ObjectSpecificationType obje } } - // Owner - ObjectSpecificationType ownerSpec = objectSpecType.getOwner(); - if (ownerSpec != null) { - if (!object.canRepresent(ShadowType.class)) { - LOGGER.trace(" owner object spec not applicable for {}, object OID {} because it is not a shadow", - new Object[]{desc, object.getOid()}); - return false; - } - if (ownerResolver == null) { - ownerResolver = userProfileService; + if (objectSpecType instanceof OwnedObjectSpecificationType) { + // Owner + ObjectSpecificationType ownerSpec = ((OwnedObjectSpecificationType)objectSpecType).getOwner(); + if (ownerSpec != null) { + if (!object.canRepresent(ShadowType.class)) { + LOGGER.trace(" owner object spec not applicable for {}, object OID {} because it is not a shadow", + new Object[]{desc, object.getOid()}); + return false; + } if (ownerResolver == null) { - LOGGER.trace(" owner object spec not applicable for {}, object OID {} because there is no owner resolver", + ownerResolver = userProfileService; + if (ownerResolver == null) { + LOGGER.trace(" owner object spec not applicable for {}, object OID {} because there is no owner resolver", + new Object[]{desc, object.getOid()}); + return false; + } + } + PrismObject owner = ownerResolver.resolveOwner((PrismObject)object); + if (owner == null) { + LOGGER.trace(" owner object spec not applicable for {}, object OID {} because it has no owner", new Object[]{desc, object.getOid()}); return false; } + boolean ownerApplicable = isApplicable(ownerSpec, owner, principal, ownerResolver, "owner of "+desc); + if (!ownerApplicable) { + LOGGER.trace(" owner object spec not applicable for {}, object OID {} because owner does not match (owner={})", + new Object[]{desc, object.getOid(), owner}); + return false; + } } - PrismObject owner = ownerResolver.resolveOwner((PrismObject)object); - if (owner == null) { - LOGGER.trace(" owner object spec not applicable for {}, object OID {} because it has no owner", - new Object[]{desc, object.getOid()}); - return false; - } - boolean ownerApplicable = isApplicable(ownerSpec, owner, principal, ownerResolver, "owner of "+desc); - if (!ownerApplicable) { - LOGGER.trace(" owner object spec not applicable for {}, object OID {} because owner does not match (owner={})", - new Object[]{desc, object.getOid(), owner}); - return false; - } } LOGGER.trace(" Authorization applicable for {} (filter)", desc); @@ -816,11 +819,11 @@ private ObjectFilter preProcessObjectFilterInternal(MidPo // object ObjectFilter autzObjSecurityFilter = null; - List objectSpecTypes = autz.getObject(); + List objectSpecTypes = autz.getObject(); boolean applicable = true; if (objectSpecTypes != null && !objectSpecTypes.isEmpty()) { applicable = false; - for (ObjectSpecificationType objectSpecType: objectSpecTypes) { + for (OwnedObjectSpecificationType objectSpecType: objectSpecTypes) { ObjectFilter objSpecSecurityFilter = null; TypeFilter objSpecTypeFilter = null; SearchFilterType specFilterType = objectSpecType.getFilter(); From 967724f0a7670faabce42478ed84a1cb9760bc1f Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Tue, 10 Feb 2015 17:13:59 +0100 Subject: [PATCH 144/215] Test for MID-2178 (failing, so disabled) --- .../midpoint/repo/sql/ModifyUser.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/ModifyUser.java b/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/ModifyUser.java index e13360cf720..75480ed9bf5 100644 --- a/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/ModifyUser.java +++ b/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/ModifyUser.java @@ -17,13 +17,17 @@ import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.prism.PrismObjectDefinition; +import com.evolveum.midpoint.prism.PrismReferenceValue; import com.evolveum.midpoint.prism.delta.ObjectDelta; import com.evolveum.midpoint.prism.delta.PropertyDelta; +import com.evolveum.midpoint.prism.delta.ReferenceDelta; +import com.evolveum.midpoint.prism.path.ItemPath; import com.evolveum.midpoint.prism.util.PrismTestUtil; import com.evolveum.midpoint.schema.DeltaConvertor; import com.evolveum.midpoint.schema.MidPointPrismContextFactory; import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectModificationType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; @@ -124,4 +128,20 @@ public void test070ModifyBigUser() throws Exception { repositoryService.modifyObject(UserType.class, userBigOid, delta.getModifications(), new OperationResult("asdf")); } + + @Test(enabled = false) + public void test100ModifyUserApproverMetadata() throws Exception { + PrismObjectDefinition userDefinition = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(UserType.class); + ReferenceDelta delta1 = ReferenceDelta.createModificationAdd( + new ItemPath(UserType.F_METADATA, MetadataType.F_CREATE_APPROVER_REF), + userDefinition, + new PrismReferenceValue("target-oid-1", UserType.COMPLEX_TYPE)); + ReferenceDelta delta2 = ReferenceDelta.createModificationAdd( + new ItemPath(UserType.F_METADATA, MetadataType.F_MODIFY_APPROVER_REF), + userDefinition, + new PrismReferenceValue("target-oid-1", UserType.COMPLEX_TYPE)); // the same as in delta1 + + repositoryService.modifyObject(UserType.class, userOid, Arrays.asList(delta1, delta2), new OperationResult("asdf")); + } + } From 5c645b991391bd43bf099d0cb560c5be33de4f31 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Tue, 10 Feb 2015 17:33:44 +0100 Subject: [PATCH 145/215] valueEnumerationRef in ItemRefinedDefinitionType --- .../main/resources/xml/ns/public/common/common-3.xsd | 11 +++++++++++ .../model/impl/controller/ModelController.java | 3 +-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd index f60c2ddfba8..ac84e9ff932 100644 --- a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd +++ b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd @@ -3601,6 +3601,17 @@ + + + + Reference to an object that directly or indirectly represents possible values for + this item. We do not define here what exactly the object has to be. It can be a lookup + table, script that dynamically produces the values or anything similar. + The object must produce the values of the correct type for this item otherwise an + error occurs. + + + diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java index f981a5ae7fe..4cc5e5383a7 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java @@ -845,7 +845,6 @@ public PrismObjectDefinition getEditObjectDefinition(P } applyObjectTemplateToDefinition(objectDefinition, objectTemplateType, result); - applySecurityConstraints(objectDefinition, new ItemPath(), securityConstraints, securityConstraints.getActionDecision(ModelAuthorizationAction.READ.getUrl(), phase), securityConstraints.getActionDecision(ModelAuthorizationAction.ADD.getUrl(), phase), @@ -893,7 +892,7 @@ private void applySecurityConstraints(D itemDefinitio AuthorizationDecisionType readDecision = computeItemDecision(securityConstraints, itemPath, ModelAuthorizationAction.READ.getUrl(), defaultReadDecition, phase); AuthorizationDecisionType addDecision = computeItemDecision(securityConstraints, itemPath, ModelAuthorizationAction.ADD.getUrl(), defaultAddDecition, phase); AuthorizationDecisionType modifyDecision = computeItemDecision(securityConstraints, itemPath, ModelAuthorizationAction.MODIFY.getUrl(), defaultModifyDecition, phase); - LOGGER.trace("Decision for {}: {}", itemPath, readDecision); +// LOGGER.trace("Decision for {}: {}", itemPath, readDecision); if (readDecision != AuthorizationDecisionType.ALLOW) { itemDefinition.setCanRead(false); } From 7c17ab13c80944a48d814790bc4df817b8b7839e Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Tue, 10 Feb 2015 18:39:09 +0100 Subject: [PATCH 146/215] lookup table test disabled. --- .../src/test/resources/basic/objects.xml | 55 +++++++++---------- .../repo/sql/data/common/RLookupTable.java | 19 +++++++ 2 files changed, 45 insertions(+), 29 deletions(-) diff --git a/repo/repo-sql-impl-test/src/test/resources/basic/objects.xml b/repo/repo-sql-impl-test/src/test/resources/basic/objects.xml index 323d170e0ff..fae45433297 100644 --- a/repo/repo-sql-impl-test/src/test/resources/basic/objects.xml +++ b/repo/repo-sql-impl-test/src/test/resources/basic/objects.xml @@ -1292,41 +1292,38 @@ - - + - - - - - - - - - - - - - - - - - - - - - - - - - - + + first key + + 2013-05-07T10:38:21.350+02:00 + first value + + + 2 key + + 2013-05-07T10:38:21.350+02:00 + 2 value + + + 3 key + + 2013-05-07T10:38:21.350+02:00 + 3 value + + --> diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RLookupTable.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RLookupTable.java index 1eff4417e72..88dc505e0d0 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RLookupTable.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RLookupTable.java @@ -11,11 +11,13 @@ import com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableRowType; import com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableTableType; import com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; import org.hibernate.annotations.Cascade; import org.hibernate.annotations.ForeignKey; import javax.persistence.*; import java.util.Collection; +import java.util.HashSet; import java.util.Set; /** @@ -32,6 +34,9 @@ public class RLookupTable extends RObject { @OneToMany(mappedBy = "owner", orphanRemoval = true) @Cascade({org.hibernate.annotations.CascadeType.ALL}) public Set getRows() { + if (rows == null) { + rows = new HashSet<>(); + } return rows; } @@ -73,6 +78,20 @@ public static void copyFromJAXB(LookupTableType jaxb, RLookupTable repo, PrismCo } } + protected static void copyToJAXB(RLookupTable repo, LookupTableType jaxb, PrismContext prismContext, + Collection> options) + throws DtoTranslationException { + + //todo wtf with this + + RObject.copyToJAXB(repo, jaxb, prismContext, options); + + if (repo.getRows() != null && !repo.getRows().isEmpty()) { + + + } + } + @Override public LookupTableType toJAXB(PrismContext prismContext, Collection> options) throws DtoTranslationException { LookupTableType object = new LookupTableType(); From 2d7d3513c8107e838059d36d64d5fb9717af1003 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Tue, 10 Feb 2015 18:53:24 +0100 Subject: [PATCH 147/215] DisplayOrder override in schemaHandling (work in progress), rudimentary implemnetation of valueEnumerationRef. --- .../refinery/RefinedAttributeDefinition.java | 21 +++++++++++++------ .../midpoint/schema/util/MiscSchemaUtil.java | 15 +++++++++++++ .../xml/ns/public/common/common-3.xsd | 1 + .../impl/controller/ModelController.java | 14 +++++++++++++ .../model/intest/gensync/TestEditSchema.java | 5 +++++ .../common/user-template-complex.xml | 1 + 6 files changed, 51 insertions(+), 6 deletions(-) diff --git a/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedAttributeDefinition.java b/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedAttributeDefinition.java index 2aa8a24dbf8..e05f1823938 100644 --- a/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedAttributeDefinition.java +++ b/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedAttributeDefinition.java @@ -319,12 +319,21 @@ static RefinedAttributeDefinition parse(ResourceAttributeDefinition schemaAttrDe RefinedAttributeDefinition rAttrDef = new RefinedAttributeDefinition(schemaAttrDef, prismContext); - if (schemaHandlingAttrDefType != null && schemaHandlingAttrDefType.getDisplayName() != null) { - rAttrDef.setDisplayName(schemaHandlingAttrDefType.getDisplayName()); - } else { - if (schemaAttrDef.getDisplayName() != null) { - rAttrDef.setDisplayName(schemaAttrDef.getDisplayName()); - } + if (schemaHandlingAttrDefType != null) { + if (schemaHandlingAttrDefType.getDisplayName() != null) { + rAttrDef.setDisplayName(schemaHandlingAttrDefType.getDisplayName()); + } else { + if (schemaAttrDef.getDisplayName() != null) { + rAttrDef.setDisplayName(schemaAttrDef.getDisplayName()); + } + } + if (schemaHandlingAttrDefType.getDisplayOrder() != null) { + rAttrDef.setDisplayOrder(schemaHandlingAttrDefType.getDisplayOrder()); + } else { + if (schemaAttrDef.getDisplayOrder() != null) { + rAttrDef.setDisplayOrder(schemaAttrDef.getDisplayOrder()); + } + } } if (schemaHandlingAttrDefType != null) { diff --git a/infra/schema/src/main/java/com/evolveum/midpoint/schema/util/MiscSchemaUtil.java b/infra/schema/src/main/java/com/evolveum/midpoint/schema/util/MiscSchemaUtil.java index ff219631351..171e313c508 100644 --- a/infra/schema/src/main/java/com/evolveum/midpoint/schema/util/MiscSchemaUtil.java +++ b/infra/schema/src/main/java/com/evolveum/midpoint/schema/util/MiscSchemaUtil.java @@ -28,6 +28,7 @@ import org.w3c.dom.Element; import com.evolveum.midpoint.prism.PrismObject; +import com.evolveum.midpoint.prism.PrismReferenceValue; import com.evolveum.midpoint.prism.delta.ItemDelta; import com.evolveum.midpoint.prism.delta.ObjectDelta; import com.evolveum.midpoint.prism.parser.XPathHolder; @@ -265,4 +266,18 @@ public static boolean compareRelation(QName a, QName b) { return a.equals(b); } + public static PrismReferenceValue objectReferenceTypeToReferenceValue(ObjectReferenceType refType) { + if (refType == null) { + return null; + } + PrismReferenceValue rval = new PrismReferenceValue(); + rval.setOid(refType.getOid()); + rval.setDescription(refType.getDescription()); + rval.setFilter(refType.getFilter()); + rval.setRelation(refType.getRelation()); + rval.setTargetType(refType.getType()); + return rval; + + } + } diff --git a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd index 0907008ea58..326e287ca52 100644 --- a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd +++ b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd @@ -3582,6 +3582,7 @@ + diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java index 4cc5e5383a7..112088059e8 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java @@ -115,6 +115,7 @@ import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.schema.result.OperationResultRunner; import com.evolveum.midpoint.schema.result.OperationResultStatus; +import com.evolveum.midpoint.schema.util.MiscSchemaUtil; import com.evolveum.midpoint.security.api.AuthorizationConstants; import com.evolveum.midpoint.security.api.ObjectSecurityConstraints; import com.evolveum.midpoint.security.api.SecurityEnforcer; @@ -872,15 +873,28 @@ private void applyObjectTemplateToDefinition(PrismObjectD if (itemDef == null) { throw new SchemaException("No definition for item "+itemPath+" in object type "+objectDefinition.getTypeName()+" as specified in item definition in "+objectTemplateType); } + String displayName = templateItemDefType.getDisplayName(); if (displayName != null) { itemDef.setDisplayName(displayName); } + + Integer displayOrder = templateItemDefType.getDisplayOrder(); + if (displayOrder != null) { + itemDef.setDisplayOrder(displayOrder); + } + List limitations = templateItemDefType.getLimitations(); if (limitations != null) { // TODO } + ObjectReferenceType valueEnumerationRef = templateItemDefType.getValueEnumerationRef(); + if (valueEnumerationRef != null) { + PrismReferenceValue valueEnumerationRVal = MiscSchemaUtil.objectReferenceTypeToReferenceValue(valueEnumerationRef); + itemDef.setValueEnumerationRef(valueEnumerationRVal); + } + // TODO } diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestEditSchema.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestEditSchema.java index 56a89618db1..be0207aeff1 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestEditSchema.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/gensync/TestEditSchema.java @@ -108,6 +108,11 @@ public void test200EditSchemaUser() throws Exception { assertNotNull("No definition for additionalName in user", additionalNameDef); assertEquals("Wrong additionalName displayName", "Middle Name", additionalNameDef.getDisplayName()); assertTrue("additionalName not readable", additionalNameDef.canRead()); + + PrismPropertyDefinition costCenterDef = editDef.findPropertyDefinition(UserType.F_COST_CENTER); + assertNotNull("No definition for costCenter in user", costCenterDef); + assertEquals("Wrong costCenter displayOrder", (Integer)123, costCenterDef.getDisplayOrder()); + assertTrue("costCenter not readable", costCenterDef.canRead()); PrismContainerDefinition credentialsDef = editDef.findContainerDefinition(UserType.F_CREDENTIALS); assertNotNull("No definition for credentials in user", credentialsDef); diff --git a/model/model-intest/src/test/resources/common/user-template-complex.xml b/model/model-intest/src/test/resources/common/user-template-complex.xml index 6f45b9cc177..dd909e31b5f 100644 --- a/model/model-intest/src/test/resources/common/user-template-complex.xml +++ b/model/model-intest/src/test/resources/common/user-template-complex.xml @@ -32,6 +32,7 @@ costCenter + 123 weak From c75352062b1777ccbc39c75cd5f3585670c52811 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Tue, 10 Feb 2015 19:27:22 +0100 Subject: [PATCH 148/215] More displayOrder work --- .../common/refinery/TestRefinedSchema.java | 13 ++++++----- .../resources/refinery/resource-complex.xml | 22 +++++++++++++++---- .../connector/icf-1/resource-schema-3.xsd | 2 ++ 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/infra/common/src/test/java/com/evolveum/midpoint/common/refinery/TestRefinedSchema.java b/infra/common/src/test/java/com/evolveum/midpoint/common/refinery/TestRefinedSchema.java index c979d5e9d84..4954e5f471f 100644 --- a/infra/common/src/test/java/com/evolveum/midpoint/common/refinery/TestRefinedSchema.java +++ b/infra/common/src/test/java/com/evolveum/midpoint/common/refinery/TestRefinedSchema.java @@ -433,18 +433,18 @@ private void assertRObjectClassDef(RefinedObjectClassDefinition rAccount, Resour Collection attrs = rAccount.getAttributeDefinitions(); assertFalse(attrs.isEmpty()); - assertAttributeDef(attrs, SchemaTestConstants.ICFS_NAME, DOMUtil.XSD_STRING, 1, 1, "Distinguished Name", + assertAttributeDef(attrs, SchemaTestConstants.ICFS_NAME, DOMUtil.XSD_STRING, 1, 1, "Distinguished Name", 110, true, false, true, true, validationLayer == LayerType.SCHEMA, // Access: create, read, update sourceLayer, validationLayer); - assertAttributeDef(attrs, SchemaTestConstants.ICFS_UID, DOMUtil.XSD_STRING, 1, 1, "Entry UUID", + assertAttributeDef(attrs, SchemaTestConstants.ICFS_UID, DOMUtil.XSD_STRING, 1, 1, "Entry UUID", 100, false, false, false, true, false, // Access: create, read, update sourceLayer, validationLayer); assertAttributeDef(attrs, new QName(ResourceTypeUtil.getResourceNamespace(resourceType), "cn"), DOMUtil.XSD_STRING, - 1, (validationLayer == LayerType.MODEL || validationLayer == LayerType.PRESENTATION) ? 1 : -1, "Common Name", + 1, (validationLayer == LayerType.MODEL || validationLayer == LayerType.PRESENTATION) ? 1 : -1, "Common Name", 1, true, validationLayer == LayerType.PRESENTATION, true, true, true, // Access: create, read, update sourceLayer, validationLayer); @@ -453,20 +453,20 @@ private void assertRObjectClassDef(RefinedObjectClassDefinition rAccount, Resour DOMUtil.XSD_STRING, validationLayer == LayerType.SCHEMA ? 0 : 1 , // minOccurs validationLayer == LayerType.SCHEMA ? -1 : 1, // maxOccurs - "Login Name", + "Login Name", 2, true, false, true, true, validationLayer != LayerType.PRESENTATION, // Access: create, read, update sourceLayer, validationLayer); assertAttributeDef(attrs, new QName(ResourceTypeUtil.getResourceNamespace(resourceType), "employeeNumber"), - DOMUtil.XSD_STRING, 0, 1, null, + DOMUtil.XSD_STRING, 0, 1, null, null, false, false, true, true, true, // Access: create, read, update sourceLayer, validationLayer); } private void assertAttributeDef(Collection attrDefs, QName name, - QName typeName, int minOccurs, int maxOccurs, String displayName, + QName typeName, int minOccurs, int maxOccurs, String displayName, Integer displayOrder, boolean hasOutbound, boolean ignore, boolean canCreate, boolean canRead, boolean canUpdate, LayerType sourceLayer, LayerType validationLayer) { for (RefinedAttributeDefinition def : attrDefs) { @@ -476,6 +476,7 @@ private void assertAttributeDef(Collection assertEquals("Attribute " + name + " ("+sourceLayer+") maxOccurs mismatch", maxOccurs, def.getMaxOccurs()); if (validationLayer == LayerType.MODEL || validationLayer == LayerType.PRESENTATION) { assertEquals("Attribute " + name + " ("+sourceLayer+") displayName mismatch", displayName, def.getDisplayName()); + assertEquals("Attribute " + name + " ("+sourceLayer+") displayOrder mismatch", displayOrder, def.getDisplayOrder()); assertEquals("Attribute " + name + " ("+sourceLayer+") outbound mismatch", hasOutbound, def.getOutboundMappingType() != null); } assertEquals("Attribute " + name + " ("+sourceLayer+") ignored flag mismatch", ignore, def.isIgnored()); diff --git a/infra/common/src/test/resources/refinery/resource-complex.xml b/infra/common/src/test/resources/refinery/resource-complex.xml index 0239d5efd02..c05ad4c2574 100644 --- a/infra/common/src/test/resources/refinery/resource-complex.xml +++ b/infra/common/src/test/resources/refinery/resource-complex.xml @@ -134,7 +134,13 @@ - + + + + 120 + + + @@ -150,7 +156,7 @@ - + @@ -159,7 +165,13 @@ - + + + + 130 + + + @@ -167,7 +179,7 @@ - + @@ -229,6 +241,7 @@ ri:cn Common Name + 1 1 @@ -305,6 +318,7 @@ ri:uid Login Name + 2 1 1 diff --git a/infra/schema/src/main/resources/xml/ns/public/connector/icf-1/resource-schema-3.xsd b/infra/schema/src/main/resources/xml/ns/public/connector/icf-1/resource-schema-3.xsd index 23d39c65706..34119039200 100644 --- a/infra/schema/src/main/resources/xml/ns/public/connector/icf-1/resource-schema-3.xsd +++ b/infra/schema/src/main/resources/xml/ns/public/connector/icf-1/resource-schema-3.xsd @@ -38,6 +38,7 @@ read 1 + 100 @@ -49,6 +50,7 @@ 1 + 110 From efce0fc339b6b625a0c164e68cc8826ed3796e57 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Wed, 11 Feb 2015 08:53:46 +0100 Subject: [PATCH 149/215] Logging libraries upgrade --- build-system/pom.xml | 4 ++-- .../evolveum/midpoint/model/impl/ModelRestService.java | 8 -------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/build-system/pom.xml b/build-system/pom.xml index 1c49065d1d4..2c1ab1a0ede 100644 --- a/build-system/pom.xml +++ b/build-system/pom.xml @@ -56,7 +56,7 @@ 1.10.8 2.1.3 1.0.1 - 1.6.4 + 1.7.10 4.0.6.RELEASE 3.2.5.RELEASE 6.8.8 @@ -172,7 +172,7 @@ ch.qos.logback logback-classic - 0.9.29 + 1.1.2 com.sleepycat diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/ModelRestService.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/ModelRestService.java index f2baa0d4f87..f5793d3713e 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/ModelRestService.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/ModelRestService.java @@ -4,7 +4,6 @@ import java.util.Collection; import java.util.List; -import javax.jws.WebMethod; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -27,8 +26,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import antlr.Utils; - import com.evolveum.midpoint.audit.api.AuditEventRecord; import com.evolveum.midpoint.audit.api.AuditEventStage; import com.evolveum.midpoint.audit.api.AuditEventType; @@ -41,10 +38,7 @@ import com.evolveum.midpoint.prism.delta.ItemDelta; import com.evolveum.midpoint.prism.query.ObjectQuery; import com.evolveum.midpoint.prism.query.QueryJaxbConvertor; -import com.evolveum.midpoint.provisioning.api.GenericConnectorException; import com.evolveum.midpoint.schema.DeltaConvertor; -import com.evolveum.midpoint.schema.GetOperationOptions; -import com.evolveum.midpoint.schema.SelectorOptions; import com.evolveum.midpoint.schema.constants.MidPointConstants; import com.evolveum.midpoint.schema.constants.ObjectTypes; import com.evolveum.midpoint.schema.constants.SchemaConstants; @@ -65,9 +59,7 @@ import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectListType; import com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectModificationType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationalStateType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectShadowChangeDescriptionType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType; From 8db758bf5e78eb91a8670e26aab8f02fcf04dae2 Mon Sep 17 00:00:00 2001 From: Viliam Repan <1azyman@users.noreply.github.com> Date: Wed, 11 Feb 2015 09:19:45 +0100 Subject: [PATCH 150/215] disable lookuptable entity for now --- .../midpoint/repo/sql/data/common/RLookupTable.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RLookupTable.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RLookupTable.java index 88dc505e0d0..070e27b260a 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RLookupTable.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RLookupTable.java @@ -23,9 +23,9 @@ /** * @author Viliam Repan (lazyman) */ -@Entity -@ForeignKey(name = "fk_lookup_table") -@Table(uniqueConstraints = @UniqueConstraint(name = "uc_lookup_name", columnNames = {"name_norm"})) +//@Entity +//@ForeignKey(name = "fk_lookup_table") +//@Table(uniqueConstraints = @UniqueConstraint(name = "uc_lookup_name", columnNames = {"name_norm"})) public class RLookupTable extends RObject { private RPolyString name; From 8ec761f7dc0964310aa2ebd561909296cf5baf38 Mon Sep 17 00:00:00 2001 From: Viliam Repan <1azyman@users.noreply.github.com> Date: Wed, 11 Feb 2015 09:20:09 +0100 Subject: [PATCH 151/215] disable lookuptable entity for now --- .../repo/sql/data/common/other/RLookupTableRow.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RLookupTableRow.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RLookupTableRow.java index d24c624c41a..a50da27db6a 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RLookupTableRow.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RLookupTableRow.java @@ -14,14 +14,14 @@ /** * @author Viliam Repan (lazyman) */ -@Entity -@Table(indexes = { +//@Entity +//@Table(indexes = { //todo create indexes after lookup api is created (when we know how we will search through lookup table [lazyman] // @Index(name = "i_row_key", columnList = "key"), // @Index(name = "i_row_label_orig", columnList = "label.orig"), // @Index(name = "i_row_label_norm", columnList = "label.norm") -}) -@IdClass(RLookupTableRowId.class) +//}) +//@IdClass(RLookupTableRowId.class) public class RLookupTableRow { private RLookupTable owner; From 9255dbb64fa544d3d5123b7fa4c036824ac4bf15 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Wed, 11 Feb 2015 10:17:49 +0100 Subject: [PATCH 152/215] Fixing displayName which I broke yesterday. --- .../refinery/RefinedAttributeDefinition.java | 27 +++++++++---------- .../connector/icf-1/resource-schema-3.xsd | 2 ++ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedAttributeDefinition.java b/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedAttributeDefinition.java index e05f1823938..abc7eb28e2f 100644 --- a/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedAttributeDefinition.java +++ b/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedAttributeDefinition.java @@ -319,21 +319,20 @@ static RefinedAttributeDefinition parse(ResourceAttributeDefinition schemaAttrDe RefinedAttributeDefinition rAttrDef = new RefinedAttributeDefinition(schemaAttrDef, prismContext); - if (schemaHandlingAttrDefType != null) { - if (schemaHandlingAttrDefType.getDisplayName() != null) { - rAttrDef.setDisplayName(schemaHandlingAttrDefType.getDisplayName()); - } else { - if (schemaAttrDef.getDisplayName() != null) { - rAttrDef.setDisplayName(schemaAttrDef.getDisplayName()); - } - } - if (schemaHandlingAttrDefType.getDisplayOrder() != null) { + if (schemaHandlingAttrDefType != null && schemaHandlingAttrDefType.getDisplayName() != null) { + rAttrDef.setDisplayName(schemaHandlingAttrDefType.getDisplayName()); + } else { + if (schemaAttrDef.getDisplayName() != null) { + rAttrDef.setDisplayName(schemaAttrDef.getDisplayName()); + } + } + + if (schemaHandlingAttrDefType != null && schemaHandlingAttrDefType.getDisplayOrder() != null) { rAttrDef.setDisplayOrder(schemaHandlingAttrDefType.getDisplayOrder()); - } else { - if (schemaAttrDef.getDisplayOrder() != null) { - rAttrDef.setDisplayOrder(schemaAttrDef.getDisplayOrder()); - } - } + } else { + if (schemaAttrDef.getDisplayOrder() != null) { + rAttrDef.setDisplayOrder(schemaAttrDef.getDisplayOrder()); + } } if (schemaHandlingAttrDefType != null) { diff --git a/infra/schema/src/main/resources/xml/ns/public/connector/icf-1/resource-schema-3.xsd b/infra/schema/src/main/resources/xml/ns/public/connector/icf-1/resource-schema-3.xsd index 34119039200..7a69faf7e01 100644 --- a/infra/schema/src/main/resources/xml/ns/public/connector/icf-1/resource-schema-3.xsd +++ b/infra/schema/src/main/resources/xml/ns/public/connector/icf-1/resource-schema-3.xsd @@ -38,6 +38,7 @@ read 1 + ConnId UID 100 @@ -50,6 +51,7 @@ 1 + ConnId Name 110 From 5d065709d48efcbcbaac5db4f64b4c8a0b9a7c39 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Wed, 11 Feb 2015 11:39:22 +0100 Subject: [PATCH 153/215] Fixed stupid bug preventing showing activation, password, extension containers in GUI --- .../evolveum/midpoint/web/component/prism/ObjectWrapper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ObjectWrapper.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ObjectWrapper.java index 21ca26f7008..b412a09c957 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ObjectWrapper.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ObjectWrapper.java @@ -433,7 +433,7 @@ private List createContainerWrapper(PrismContainer parent, Ite // The following code fails to work when parent is multivalued. // Therefore (as a brutal hack), for multivalued parents we simply // skip it. - if (parent.size() != 1) { + if (parent.size() <= 1) { PrismContainer prismContainer = null; prismContainer = parent.findContainer(def.getName()); From d4ea8bb981aeab567f7aeee37af6f3df4ae2f3d8 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Wed, 11 Feb 2015 13:42:30 +0100 Subject: [PATCH 154/215] Adapted notification test to a change in schema. --- .../midpoint/notifications/impl/TestTextFormatter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/model/notifications-impl/src/test/java/com/evolveum/midpoint/notifications/impl/TestTextFormatter.java b/model/notifications-impl/src/test/java/com/evolveum/midpoint/notifications/impl/TestTextFormatter.java index 1f60579dce2..205f522f96f 100644 --- a/model/notifications-impl/src/test/java/com/evolveum/midpoint/notifications/impl/TestTextFormatter.java +++ b/model/notifications-impl/src/test/java/com/evolveum/midpoint/notifications/impl/TestTextFormatter.java @@ -222,12 +222,12 @@ public void test030FormatAccount() throws Exception { // THEN - assertTrue("account name is not shown", jackFormattedHideNone.contains("name: jack")); + assertTrue("account name is not shown", jackFormattedHideNone.contains("Name: jack")); assertTrue("account password is not shown", jackFormattedHideNone.contains("(protected string)")); assertTrue("administrative status is not shown", jackFormattedHideNone.contains("Administrative Status: ENABLED")); assertTrue("effective status is not shown", jackFormattedHideNone.contains("Effective Status: ENABLED")); - assertTrue("account name is not shown", jackFormattedHideAux.contains("name: jack")); + assertTrue("account name is not shown", jackFormattedHideAux.contains("Name: jack")); assertTrue("account password is not shown", jackFormattedHideAux.contains("(protected string)")); assertTrue("administrative status is not shown", jackFormattedHideAux.contains("Administrative Status: ENABLED")); assertTrue("effective status is shown although it should be hidden", !jackFormattedHideAux.contains("Effective Status: ENABLED")); From 4d1b9619cad47bc9a55999bb46e02707d50eb0c1 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Wed, 11 Feb 2015 14:28:02 +0100 Subject: [PATCH 155/215] Explicitly generating displayOrder in resource ICF schema. --- .../provisioning/ucf/impl/ConnectorFactoryIcfImpl.java | 8 ++++++++ .../ucf/impl/ConnectorInstanceIcfImpl.java | 10 ++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/ucf/impl/ConnectorFactoryIcfImpl.java b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/ucf/impl/ConnectorFactoryIcfImpl.java index a39e5893b99..01152b74327 100644 --- a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/ucf/impl/ConnectorFactoryIcfImpl.java +++ b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/ucf/impl/ConnectorFactoryIcfImpl.java @@ -108,7 +108,11 @@ public class ConnectorFactoryIcfImpl implements ConnectorFactory { public static final String NS_ICF_SCHEMA_PREFIX = "icfs"; public static final String NS_ICF_RESOURCE_INSTANCE_PREFIX = "ri"; public static final QName ICFS_NAME = new QName(NS_ICF_SCHEMA, "name"); + public static final String ICFS_NAME_DISPLAY_NAME = "ConnId Name"; + public static final int ICFS_NAME_DISPLAY_ORDER = 110; public static final QName ICFS_UID = new QName(NS_ICF_SCHEMA, "uid"); + public static final String ICFS_UID_DISPLAY_NAME = "ConnId UID"; + public static final int ICFS_UID_DISPLAY_ORDER = 100; public static final QName ICFS_ACCOUNT = new QName(NS_ICF_SCHEMA, "account"); public static final String ACCOUNT_OBJECT_CLASS_LOCAL_NAME = "AccountObjectClass"; public static final String GROUP_OBJECT_CLASS_LOCAL_NAME = "GroupObjectClass"; @@ -157,12 +161,16 @@ public class ConnectorFactoryIcfImpl implements ConnectorFactory { private static final String ICF_CONFIGURATION_NAMESPACE_PREFIX = ICF_FRAMEWORK_URI + "/bundle/"; private static final String CONNECTOR_IDENTIFIER_SEPARATOR = "/"; + + public static final int ATTR_DISPLAY_ORDER_START = 120; + public static final int ATTR_DISPLAY_ORDER_INCREMENT = 10; private static final Trace LOGGER = TraceManager.getTrace(ConnectorFactoryIcfImpl.class); // This is not really used in the code. It is here just to make sure that the JUL logger is loaded // by the parent classloader so we can correctly adjust the log levels from the main code static final java.util.logging.Logger JUL_LOGGER = java.util.logging.Logger.getLogger(ConnectorFactoryIcfImpl.class.getName()); + private ConnectorInfoManagerFactory connectorInfoManagerFactory; private ConnectorInfoManager localConnectorInfoManager; diff --git a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/ucf/impl/ConnectorInstanceIcfImpl.java b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/ucf/impl/ConnectorInstanceIcfImpl.java index 6f69c9f22ce..81efa585412 100644 --- a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/ucf/impl/ConnectorInstanceIcfImpl.java +++ b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/ucf/impl/ConnectorInstanceIcfImpl.java @@ -651,10 +651,12 @@ private void parseResourceSchema(org.identityconnectors.framework.common.objects // Make it read-only uidDefinition.setReadOnly(); // Set a default display name - uidDefinition.setDisplayName("ICF UID"); + uidDefinition.setDisplayName(ConnectorFactoryIcfImpl.ICFS_UID_DISPLAY_NAME); + uidDefinition.setDisplayOrder(ConnectorFactoryIcfImpl.ICFS_UID_DISPLAY_ORDER); // Uid is a primary identifier of every object (this is the ICF way) ((Collection)roDefinition.getIdentifiers()).add(uidDefinition); + int displayOrder = ConnectorFactoryIcfImpl.ATTR_DISPLAY_ORDER_START; // Let's iterate over all attributes in this object class ... Set attributeInfoSet = objectClassInfo.getAttributeInfo(); for (AttributeInfo attributeInfo : attributeInfoSet) { @@ -710,8 +712,12 @@ private void parseResourceSchema(org.identityconnectors.framework.common.objects // Set a better display name for __NAME__. The "name" is s very // overloaded term, so let's try to make things // a bit clearer - attrDef.setDisplayName("ICF NAME"); + attrDef.setDisplayName(ConnectorFactoryIcfImpl.ICFS_NAME_DISPLAY_NAME); + attrDef.setDisplayOrder(ConnectorFactoryIcfImpl.ICFS_NAME_DISPLAY_ORDER); ((Collection)roDefinition.getSecondaryIdentifiers()).add(attrDef); + } else { + attrDef.setDisplayOrder(displayOrder); + displayOrder += ConnectorFactoryIcfImpl.ATTR_DISPLAY_ORDER_INCREMENT; } // Now we are going to process flags such as optional and From c8a0d9a078510a01848156c1d932c0f073d514e3 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Wed, 11 Feb 2015 15:13:29 +0100 Subject: [PATCH 156/215] Fixing displayOrder in resource schema --- .../prism/schema/SchemaToDomProcessor.java | 4 ++++ .../midpoint/test/DummyResourceContoller.java | 1 + .../midpoint/test/IntegrationTestTools.java | 16 ++++++++++++---- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/schema/SchemaToDomProcessor.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/schema/SchemaToDomProcessor.java index d984c11b4bf..c106903f077 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/schema/SchemaToDomProcessor.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/schema/SchemaToDomProcessor.java @@ -478,6 +478,10 @@ private void addCommonDefinitionAnnotations(Definition definition, Element appin addAnnotation(A_DISPLAY_NAME, definition.getDisplayName(), appinfoElement); } + if (definition.getDisplayOrder() != null) { + addAnnotation(A_DISPLAY_ORDER, definition.getDisplayOrder().toString(), appinfoElement); + } + if (definition.getHelp() != null) { addAnnotation(A_HELP, definition.getHelp(), appinfoElement); } diff --git a/repo/repo-test-util/src/main/java/com/evolveum/midpoint/test/DummyResourceContoller.java b/repo/repo-test-util/src/main/java/com/evolveum/midpoint/test/DummyResourceContoller.java index 3f825738387..d9fb850bc7a 100644 --- a/repo/repo-test-util/src/main/java/com/evolveum/midpoint/test/DummyResourceContoller.java +++ b/repo/repo-test-util/src/main/java/com/evolveum/midpoint/test/DummyResourceContoller.java @@ -237,6 +237,7 @@ public void assertDummyResourceSchemaSanity(ResourceSchema resourceSchema, Resou assertTrue("No fullname create", fullnameDef.canAdd()); assertTrue("No fullname update", fullnameDef.canModify()); assertTrue("No fullname read", fullnameDef.canRead()); + assertEquals("Wrong displayOrder for attribute fullName", (Integer)200, fullnameDef.getDisplayOrder()); // GROUP ObjectClassComplexTypeDefinition groupObjectClass = resourceSchema.findObjectClassDefinition(SchemaTestConstants.GROUP_OBJECT_CLASS_LOCAL_NAME); diff --git a/repo/repo-test-util/src/main/java/com/evolveum/midpoint/test/IntegrationTestTools.java b/repo/repo-test-util/src/main/java/com/evolveum/midpoint/test/IntegrationTestTools.java index 64e8e293e55..4a4dba9467d 100644 --- a/repo/repo-test-util/src/main/java/com/evolveum/midpoint/test/IntegrationTestTools.java +++ b/repo/repo-test-util/src/main/java/com/evolveum/midpoint/test/IntegrationTestTools.java @@ -757,10 +757,12 @@ public static void assertIcfResourceSchemaSanity(ResourceSchema resourceSchema, assertFalse("Empty identifiers for " + objectClassQname, identifiers.isEmpty()); - ResourceAttributeDefinition icfAttributeDefinition = accountDefinition.findAttributeDefinition(SchemaTestConstants.ICFS_UID); - assertNotNull("No definition for attribute "+SchemaTestConstants.ICFS_UID, icfAttributeDefinition); - assertTrue("Attribute "+SchemaTestConstants.ICFS_UID+" in not an identifier",icfAttributeDefinition.isIdentifier(accountDefinition)); - assertTrue("Attribute "+SchemaTestConstants.ICFS_UID+" in not in identifiers list",identifiers.contains(icfAttributeDefinition)); + ResourceAttributeDefinition uidAttributeDefinition = accountDefinition.findAttributeDefinition(SchemaTestConstants.ICFS_UID); + assertNotNull("No definition for attribute "+SchemaTestConstants.ICFS_UID, uidAttributeDefinition); + assertTrue("Attribute "+SchemaTestConstants.ICFS_UID+" in not an identifier",uidAttributeDefinition.isIdentifier(accountDefinition)); + assertTrue("Attribute "+SchemaTestConstants.ICFS_UID+" in not in identifiers list",identifiers.contains(uidAttributeDefinition)); + assertEquals("Wrong displayName for attribute "+SchemaTestConstants.ICFS_UID, "ConnId UID", uidAttributeDefinition.getDisplayName()); + assertEquals("Wrong displayOrder for attribute "+SchemaTestConstants.ICFS_UID, (Integer)100, uidAttributeDefinition.getDisplayOrder()); Collection secondaryIdentifiers = accountDefinition.getSecondaryIdentifiers(); assertNotNull("Null secondary identifiers for " + objectClassQname, secondaryIdentifiers); @@ -770,6 +772,8 @@ public static void assertIcfResourceSchemaSanity(ResourceSchema resourceSchema, assertNotNull("No definition for attribute "+SchemaTestConstants.ICFS_NAME, nameAttributeDefinition); assertTrue("Attribute "+SchemaTestConstants.ICFS_NAME+" in not an identifier",nameAttributeDefinition.isSecondaryIdentifier(accountDefinition)); assertTrue("Attribute "+SchemaTestConstants.ICFS_NAME+" in not in identifiers list",secondaryIdentifiers.contains(nameAttributeDefinition)); + assertEquals("Wrong displayName for attribute "+SchemaTestConstants.ICFS_NAME, "ConnId Name", nameAttributeDefinition.getDisplayName()); + assertEquals("Wrong displayOrder for attribute "+SchemaTestConstants.ICFS_NAME, (Integer)110, nameAttributeDefinition.getDisplayOrder()); assertNotNull("Null identifiers in account", accountDef.getIdentifiers()); assertFalse("Empty identifiers in account", accountDef.getIdentifiers().isEmpty()); @@ -787,6 +791,8 @@ public static void assertIcfResourceSchemaSanity(ResourceSchema resourceSchema, assertFalse("UID has update",uidDef.canModify()); assertTrue("No UID read",uidDef.canRead()); assertTrue("UID definition not in identifiers", accountDef.getIdentifiers().contains(uidDef)); + assertEquals("Wrong refined displayName for attribute "+SchemaTestConstants.ICFS_UID, "ConnId UID", uidDef.getDisplayName()); + assertEquals("Wrong refined displayOrder for attribute "+SchemaTestConstants.ICFS_UID, (Integer)100, uidDef.getDisplayOrder()); ResourceAttributeDefinition nameDef = accountDef .findAttributeDefinition(SchemaTestConstants.ICFS_NAME); @@ -797,6 +803,8 @@ public static void assertIcfResourceSchemaSanity(ResourceSchema resourceSchema, assertTrue("No NAME update",nameDef.canModify()); assertTrue("No NAME read",nameDef.canRead()); assertTrue("NAME definition not in identifiers", accountDef.getSecondaryIdentifiers().contains(nameDef)); + assertEquals("Wrong refined displayName for attribute "+SchemaTestConstants.ICFS_NAME, "ConnId Name", nameDef.getDisplayName()); + assertEquals("Wrong refined displayOrder for attribute "+SchemaTestConstants.ICFS_NAME, (Integer)110, nameDef.getDisplayOrder()); assertNull("The _PASSSWORD_ attribute sneaked into schema", accountDef.findAttributeDefinition(new QName(SchemaTestConstants.NS_ICFS,"password"))); } From 7c80a3cef87db05a3dbd481eb3bcb838a3bcad56 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Wed, 11 Feb 2015 16:22:56 +0100 Subject: [PATCH 157/215] MID-2175 - Manager of org. unit are displayed with different icon than classic members. --- .../admin/users/component/TreeTablePanel.java | 8 ++++- .../web/page/admin/users/dto/OrgTableDto.java | 3 +- .../security/MidPointApplication.properties | 1 + .../web/util/ObjectTypeGuiDescriptor.java | 32 +++++++++++++++++-- .../midpoint/web/util/WebMiscUtil.java | 18 +++++++++++ 5 files changed, 57 insertions(+), 5 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/TreeTablePanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/TreeTablePanel.java index c3b5081c42b..366cf3ffea7 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/TreeTablePanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/TreeTablePanel.java @@ -451,7 +451,13 @@ private List> createTableColumns() { protected IModel createIconModel(IModel rowModel) { OrgTableDto dto = rowModel.getObject(); - ObjectTypeGuiDescriptor descr = ObjectTypeGuiDescriptor.getDescriptor(dto.getType()); + ObjectTypeGuiDescriptor descr = null; + if(dto.getRelation() == null) { + descr = ObjectTypeGuiDescriptor.getDescriptor(dto.getType()); + } else { + descr = ObjectTypeGuiDescriptor.getDescriptor(dto.getRelation()); + } + String icon = descr != null ? descr.getIcon() : ObjectTypeGuiDescriptor.ERROR_ICON; return new Model(icon); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/dto/OrgTableDto.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/dto/OrgTableDto.java index 24447226dcb..7a739259d2f 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/dto/OrgTableDto.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/dto/OrgTableDto.java @@ -20,6 +20,7 @@ import com.evolveum.midpoint.prism.PrismReference; import com.evolveum.midpoint.prism.PrismReferenceValue; import com.evolveum.midpoint.prism.polystring.PolyString; +import com.evolveum.midpoint.schema.constants.SchemaConstants; import com.evolveum.midpoint.web.component.data.column.InlineMenuable; import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem; import com.evolveum.midpoint.web.component.util.Selectable; @@ -64,7 +65,7 @@ public static OrgTableDto createDto(PrismObject object) { object.getPropertyRealValue(OrgType.F_DISPLAY_NAME, PolyString.class)); dto.identifier = object.getPropertyRealValue(OrgType.F_IDENTIFIER, String.class); - //todo add relation [lazyman] + dto.relation = WebMiscUtil.isObjectOrgManager(object) ? SchemaConstants.ORG_MANAGER : null; return dto; } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/security/MidPointApplication.properties b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/security/MidPointApplication.properties index 3d0e18d9c13..faa40abc29e 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/security/MidPointApplication.properties +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/security/MidPointApplication.properties @@ -46,6 +46,7 @@ ObjectTypeGuiDescriptor.focus=Focus ObjectTypeGuiDescriptor.report=Report ObjectTypeGuiDescriptor.reportOutput=Report output ObjectTypeGuiDescriptor.securityPolicy=Security policy +ObjectTypeGuiDescriptor.orgManager=Org. manager SynchronizationPolicyDecision.ADD=Add SynchronizationPolicyDecision.DELETE=Delete diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/util/ObjectTypeGuiDescriptor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/util/ObjectTypeGuiDescriptor.java index 0451e355b6d..9b03a6a7719 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/util/ObjectTypeGuiDescriptor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/util/ObjectTypeGuiDescriptor.java @@ -17,6 +17,9 @@ package com.evolveum.midpoint.web.util; import com.evolveum.midpoint.schema.constants.ObjectTypes; +import com.evolveum.midpoint.schema.constants.SchemaConstants; + +import javax.xml.namespace.QName; /** * @author lazyman @@ -59,12 +62,15 @@ public enum ObjectTypeGuiDescriptor { REPORT_OUTPUT(ObjectTypes.REPORT_OUTPUT, "ObjectTypeGuiDescriptor.reportOutput", ""), - SECURITY_POLICY(ObjectTypes.SECURITY_POLICY, "ObjectTypeGuiDescriptor.securityPolicy", ""); + SECURITY_POLICY(ObjectTypes.SECURITY_POLICY, "ObjectTypeGuiDescriptor.securityPolicy", ""), + + USER_ORG_MANAGER(SchemaConstants.ORG_MANAGER, "ObjectTypeGuiDescriptor.orgManager", "silk-user_red"); public static final String ERROR_ICON = "silk-error"; public static final String ERROR_LOCALIZATION_KEY = "ObjectTypeGuiDescriptor.unknown"; private ObjectTypes type; + private QName relation; private String localizationKey; private String icon; @@ -74,6 +80,12 @@ private ObjectTypeGuiDescriptor(ObjectTypes type, String localizationKey, String this.type = type; } + private ObjectTypeGuiDescriptor(QName relation, String localizationKey, String icon) { + this.icon = icon; + this.localizationKey = localizationKey; + this.relation = relation; + } + public String getIcon() { return icon; } @@ -86,9 +98,13 @@ public ObjectTypes getType() { return type; } + public QName getRelation() { + return relation; + } + public static ObjectTypeGuiDescriptor getDescriptor(Class type) { for (ObjectTypeGuiDescriptor descr : ObjectTypeGuiDescriptor.values()) { - if (descr.getType().getClassDefinition().equals(type)) { + if (descr.getType() != null && descr.getType().getClassDefinition().equals(type)) { return descr; } } @@ -98,7 +114,17 @@ public static ObjectTypeGuiDescriptor getDescriptor(Class type) { public static ObjectTypeGuiDescriptor getDescriptor(ObjectTypes type) { for (ObjectTypeGuiDescriptor descr : ObjectTypeGuiDescriptor.values()) { - if (descr.getType().equals(type)) { + if (descr.getType() != null && descr.getType().equals(type)) { + return descr; + } + } + + return null; + } + + public static ObjectTypeGuiDescriptor getDescriptor(QName relation) { + for (ObjectTypeGuiDescriptor descr : ObjectTypeGuiDescriptor.values()) { + if (descr.getRelation() != null && descr.getRelation().equals(relation)) { return descr; } } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/util/WebMiscUtil.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/util/WebMiscUtil.java index 3e8998f2691..8178d5ddd06 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/util/WebMiscUtil.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/util/WebMiscUtil.java @@ -30,6 +30,7 @@ import com.evolveum.midpoint.prism.polystring.PolyString; import com.evolveum.midpoint.prism.xml.XmlTypeConverter; import com.evolveum.midpoint.schema.SchemaConstantsGenerated; +import com.evolveum.midpoint.schema.constants.SchemaConstants; import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.util.exception.SchemaException; import com.evolveum.midpoint.security.api.Authorization; @@ -676,4 +677,21 @@ public static List getMatchingRuleList(){ return list; } + + public static boolean isObjectOrgManager(PrismObject object){ + if(object == null || object.asObjectable() == null){ + return false; + } + + ObjectType objectType = object.asObjectable(); + List parentOrgRefs = objectType.getParentOrgRef(); + + for(ObjectReferenceType ref: parentOrgRefs){ + if(ref.getRelation() != null && ref.getRelation().equals(SchemaConstants.ORG_MANAGER)){ + return true; + } + } + + return false; + } } From a9032e7679f50feaa85d4491d97c62ab868b0da5 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Wed, 11 Feb 2015 17:00:10 +0100 Subject: [PATCH 158/215] isManager library function --- .../midpoint/model/api/expr/MidpointFunctions.java | 8 ++++++++ .../model/impl/expr/MidpointFunctionsImpl.java | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/model/model-api/src/main/java/com/evolveum/midpoint/model/api/expr/MidpointFunctions.java b/model/model-api/src/main/java/com/evolveum/midpoint/model/api/expr/MidpointFunctions.java index e5341d8a397..7ef15e9502c 100644 --- a/model/model-api/src/main/java/com/evolveum/midpoint/model/api/expr/MidpointFunctions.java +++ b/model/model-api/src/main/java/com/evolveum/midpoint/model/api/expr/MidpointFunctions.java @@ -877,7 +877,15 @@ int countObjects(Class type, ObjectQuery query) Collection getManagersOfOrg(String orgOid) throws SchemaException; + /** + * Returns true if user is a manager of specified organiational unit. + */ boolean isManagerOf(UserType user, String orgOid); + + /** + * Returns true if user is a manager of any organizational unit. + */ + boolean isManager(UserType user); boolean isMemberOf(UserType user, String orgOid); diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/expr/MidpointFunctionsImpl.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/expr/MidpointFunctionsImpl.java index ed82b855ac9..28d1b857905 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/expr/MidpointFunctionsImpl.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/expr/MidpointFunctionsImpl.java @@ -251,6 +251,16 @@ public boolean isManagerOf(UserType user, String orgOid) { } return false; } + + @Override + public boolean isManager(UserType user) { + for (ObjectReferenceType objectReferenceType : user.getParentOrgRef()) { + if (SchemaConstants.ORG_MANAGER.equals(objectReferenceType.getRelation())) { + return true; + } + } + return false; + } @Override public boolean isMemberOf(UserType user, String orgOid) { From b58c5a6cbb8989d8467148df794e46d00393befb Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Wed, 11 Feb 2015 18:47:06 +0100 Subject: [PATCH 159/215] *managerByOrgType library functions --- .../model/api/expr/MidpointFunctions.java | 4 +++ .../impl/expr/MidpointFunctionsImpl.java | 29 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/model/model-api/src/main/java/com/evolveum/midpoint/model/api/expr/MidpointFunctions.java b/model/model-api/src/main/java/com/evolveum/midpoint/model/api/expr/MidpointFunctions.java index 7ef15e9502c..4e72f9944bd 100644 --- a/model/model-api/src/main/java/com/evolveum/midpoint/model/api/expr/MidpointFunctions.java +++ b/model/model-api/src/main/java/com/evolveum/midpoint/model/api/expr/MidpointFunctions.java @@ -862,6 +862,8 @@ int countObjects(Class type, ObjectQuery query) Collection getManagersOidsExceptUser(UserType user) throws SchemaException, ObjectNotFoundException; Collection getManagers(UserType user) throws SchemaException, ObjectNotFoundException; + + Collection getManagersByOrgType(UserType user, String orgType) throws SchemaException, ObjectNotFoundException; UserType getUserByOid(String oid) throws ObjectNotFoundException, SchemaException; @@ -886,6 +888,8 @@ int countObjects(Class type, ObjectQuery query) * Returns true if user is a manager of any organizational unit. */ boolean isManager(UserType user); + + boolean isManagerOfOrgType(UserType user, String orgType) throws SchemaException; boolean isMemberOf(UserType user, String orgOid); diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/expr/MidpointFunctionsImpl.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/expr/MidpointFunctionsImpl.java index 28d1b857905..80ff569bd37 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/expr/MidpointFunctionsImpl.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/expr/MidpointFunctionsImpl.java @@ -165,6 +165,22 @@ public Collection getManagers(UserType user) throws SchemaException, O } return retval; } + + @Override + public Collection getManagersByOrgType(UserType user, String orgType) throws SchemaException, ObjectNotFoundException { + Set retval = new HashSet(); + Collection orgOids = getOrgUnits(user); + for (String orgOid : orgOids) { + if (orgType != null) { + OrgType org = getOrgByOid(orgOid); + if (!org.getOrgType().contains(orgType)) { + continue; + } + } + retval.addAll(getManagersOfOrg(orgOid)); + } + return retval; + } @Override public UserType getUserByOid(String oid) throws ObjectNotFoundException, SchemaException { @@ -263,6 +279,19 @@ public boolean isManager(UserType user) { } @Override + public boolean isManagerOfOrgType(UserType user, String orgType) throws SchemaException { + for (ObjectReferenceType objectReferenceType : user.getParentOrgRef()) { + if (SchemaConstants.ORG_MANAGER.equals(objectReferenceType.getRelation())) { + OrgType org = getOrgByOid(objectReferenceType.getOid()); + if (org.getOrgType().contains(orgType)) { + return true; + } + } + } + return false; + } + + @Override public boolean isMemberOf(UserType user, String orgOid) { for (ObjectReferenceType objectReferenceType : user.getParentOrgRef()) { if (orgOid.equals(objectReferenceType.getOid())) { From 14de840dcda45847a4acb79a9f8203bf45052152 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Thu, 12 Feb 2015 10:13:19 +0100 Subject: [PATCH 160/215] fix for removing inducement attributes from construction in GUI --- .../midpoint/web/component/assignment/AssignmentEditorDto.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorDto.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorDto.java index b456d0ec6e1..501490c6502 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorDto.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/assignment/AssignmentEditorDto.java @@ -19,6 +19,7 @@ import com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition; import com.evolveum.midpoint.common.refinery.RefinedResourceSchema; import com.evolveum.midpoint.prism.*; +import com.evolveum.midpoint.prism.util.ItemPathUtil; import com.evolveum.midpoint.schema.constants.SchemaConstants; import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.task.api.Task; @@ -168,7 +169,7 @@ private List prepareAssignmentAttributes(AssignmentType assignme continue; } - if(attribute.getRef().equals(propertyDef.getName())){ + if(ItemPathUtil.getOnlySegmentQName(attribute.getRef()).equals(propertyDef.getName())){ acAtrList.add(ACAttributeDto.createACAttributeDto(propertyDef, attribute, prismContext)); break; } From c11dcf6650528fe647119399a67fb9073a14272d Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Thu, 12 Feb 2015 10:44:43 +0100 Subject: [PATCH 161/215] Sample for role inducement modification + user reconciliation --- .../testing/model/client/sample/Main.java | 121 ++++++++++++++++-- .../src/main/resources/role-sea-superuser.xml | 30 +++++ 2 files changed, 139 insertions(+), 12 deletions(-) create mode 100644 samples/model-client-sample/src/main/resources/role-sea-superuser.xml diff --git a/samples/model-client-sample/src/main/java/com/evolveum/midpoint/testing/model/client/sample/Main.java b/samples/model-client-sample/src/main/java/com/evolveum/midpoint/testing/model/client/sample/Main.java index 495cce66d2d..958acdc641e 100644 --- a/samples/model-client-sample/src/main/java/com/evolveum/midpoint/testing/model/client/sample/Main.java +++ b/samples/model-client-sample/src/main/java/com/evolveum/midpoint/testing/model/client/sample/Main.java @@ -66,11 +66,13 @@ import javax.xml.bind.Unmarshaller; import javax.xml.ws.BindingProvider; import javax.xml.ws.Holder; +import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; import java.net.ProxySelector; import java.util.Collection; import java.util.HashMap; @@ -83,6 +85,10 @@ /** * @author semancik * + * Prerequisites: + * 1. OpenDJ resource, Pirate and Captain roles should exist. + * 2. Users lechuck and guybrush should NOT exist. + * */ public class Main { @@ -106,15 +112,15 @@ public static void main(String[] args) { SystemConfigurationType configurationType = getConfiguration(modelPort); System.out.println("Got system configuration"); // System.out.println(configurationType); - + UserType userAdministrator = searchUserByName(modelPort, "administrator"); System.out.println("Got administrator user: "+userAdministrator.getOid()); // System.out.println(userAdministrator); - + RoleType sailorRole = searchRoleByName(modelPort, "Sailor"); System.out.println("Got Sailor role"); // System.out.println(sailorRole); - + Collection resources = listResources(modelPort); System.out.println("Resources ("+resources.size()+")"); // dump(resources); @@ -133,35 +139,48 @@ public static void main(String[] args) { String userGuybrushoid = createUserGuybrush(modelPort, sailorRole); System.out.println("Created user guybrush, OID: "+userGuybrushoid); - + UserType userGuybrush = getUser(modelPort, userGuybrushoid); System.out.println("Fetched user guybrush:"); // System.out.println(userGuybrush); System.out.println("Users fullName: " + ModelClientUtil.getOrig(userGuybrush.getFullName())); - + String userLeChuckOid = createUserFromSystemResource(modelPort, "user-lechuck.xml"); System.out.println("Created user lechuck, OID: "+userLeChuckOid); - + changeUserPassword(modelPort, userGuybrushoid, "MIGHTYpirate"); System.out.println("Changed user password"); changeUserGivenName(modelPort, userLeChuckOid, "CHUCK"); System.out.println("Changed user given name"); - + assignRoles(modelPort, userGuybrushoid, ROLE_PIRATE_OID, ROLE_CAPTAIN_OID); System.out.println("Assigned roles"); - + unAssignRoles(modelPort, userGuybrushoid, ROLE_CAPTAIN_OID); System.out.println("Unassigned roles"); - + Collection roles = listRequestableRoles(modelPort); System.out.println("Found "+roles.size()+" requestable roles"); // System.out.println(roles); - + + String seaSuperuserRole = createRoleFromSystemResource(modelPort, "role-sea-superuser.xml"); + System.out.println("Created role Sea Superuser, OID: "+seaSuperuserRole); + + assignRoles(modelPort, userLeChuckOid, seaSuperuserRole); + System.out.println("Assigned role Sea Superuser to LeChuck"); + + modifyRoleReplaceInducement(modelPort, seaSuperuserRole, 2, ROLE_CAPTAIN_OID); + System.out.println("Modified role Sea Superuser"); + + reconcileUser(modelPort, userLeChuckOid); + System.out.println("LeChuck reconciled."); + // Uncomment the following lines if you want to see what midPoint really did // ... because deleting the user will delete also all the traces (except logs and audit of course). deleteUser(modelPort, userGuybrushoid); deleteUser(modelPort, userLeChuckOid); + deleteRole(modelPort, seaSuperuserRole); System.out.println("Deleted user(s)"); } catch (Exception e) { @@ -285,6 +304,12 @@ private static String createUserFromSystemResource(ModelPortType modelPort, Stri return createUser(modelPort, user); } + + private static String createRoleFromSystemResource(ModelPortType modelPort, String resourcePath) throws FileNotFoundException, JAXBException, FaultMessage { + RoleType role = unmarshallResource(resourcePath); + + return createRole(modelPort, role); + } private static T unmarshallFile(File file) throws JAXBException, FileNotFoundException { JAXBContext jc = ModelClientUtil.instantiateJaxbContext(); @@ -340,6 +365,18 @@ private static String createUser(ModelPortType modelPort, UserType userType) thr ObjectDeltaOperationListType operationListType = modelPort.executeChanges(deltaListType, null); return ModelClientUtil.getOidFromDeltaOperationList(operationListType, deltaType); } + + private static String createRole(ModelPortType modelPort, RoleType roleType) throws FaultMessage { + ObjectDeltaType deltaType = new ObjectDeltaType(); + deltaType.setObjectType(ModelClientUtil.getTypeQName(RoleType.class)); + deltaType.setChangeType(ChangeTypeType.ADD); + deltaType.setObjectToAdd(roleType); + + ObjectDeltaListType deltaListType = new ObjectDeltaListType(); + deltaListType.getDelta().add(deltaType); + ObjectDeltaOperationListType operationListType = modelPort.executeChanges(deltaListType, null); + return ModelClientUtil.getOidFromDeltaOperationList(operationListType, deltaType); + } private static void changeUserPassword(ModelPortType modelPort, String oid, String newPassword) throws FaultMessage { ItemDeltaType passwordDelta = new ItemDeltaType(); @@ -376,7 +413,23 @@ private static void changeUserGivenName(ModelPortType modelPort, String oid, Str modelPort.executeChanges(deltaList, null); } - private static void assignRoles(ModelPortType modelPort, String userOid, String... roleOids) throws FaultMessage { + private static void reconcileUser(ModelPortType modelPort, String oid) throws FaultMessage { + Document doc = ModelClientUtil.getDocumnent(); + + ObjectDeltaType userDelta = new ObjectDeltaType(); + userDelta.setOid(oid); + userDelta.setObjectType(ModelClientUtil.getTypeQName(UserType.class)); + userDelta.setChangeType(ChangeTypeType.MODIFY); + + ObjectDeltaListType deltaList = new ObjectDeltaListType(); + deltaList.getDelta().add(userDelta); + + ModelExecuteOptionsType optionsType = new ModelExecuteOptionsType(); + optionsType.setReconcile(true); + modelPort.executeChanges(deltaList, optionsType); + } + + private static void assignRoles(ModelPortType modelPort, String userOid, String... roleOids) throws FaultMessage { modifyRoleAssignment(modelPort, userOid, true, roleOids); } @@ -412,6 +465,36 @@ private static void modifyRoleAssignment(ModelPortType modelPort, String userOid } } + // removes inducement with a given ID and replaces it with a new one + private static void modifyRoleReplaceInducement(ModelPortType modelPort, String roleOid, int oldId, String newInducementOid) throws FaultMessage, IOException, SAXException { + + ItemDeltaType inducementDeleteDelta = new ItemDeltaType(); + inducementDeleteDelta.setModificationType(ModificationTypeType.DELETE); + inducementDeleteDelta.setPath(ModelClientUtil.createItemPathType("inducement")); + inducementDeleteDelta.getValue().add(ModelClientUtil.parseElement(""+oldId+"")); + + ItemDeltaType inducementAddDelta = new ItemDeltaType(); + inducementAddDelta.setModificationType(ModificationTypeType.ADD); + inducementAddDelta.setPath(ModelClientUtil.createItemPathType("inducement")); + inducementAddDelta.getValue().add(createRoleAssignment(newInducementOid)); + + ObjectDeltaType deltaType = new ObjectDeltaType(); + deltaType.setObjectType(ModelClientUtil.getTypeQName(RoleType.class)); + deltaType.setChangeType(ChangeTypeType.MODIFY); + deltaType.setOid(roleOid); + deltaType.getItemDelta().add(inducementDeleteDelta); + deltaType.getItemDelta().add(inducementAddDelta); + + ObjectDeltaListType deltaListType = new ObjectDeltaListType(); + deltaListType.getDelta().add(deltaType); + ObjectDeltaOperationListType objectDeltaOperationList = modelPort.executeChanges(deltaListType, null); + for (ObjectDeltaOperationType objectDeltaOperation : objectDeltaOperationList.getDeltaOperation()) { + if (!OperationResultStatusType.SUCCESS.equals(objectDeltaOperation.getExecutionResult().getStatus())) { + System.out.println("*** Operation result = " + objectDeltaOperation.getExecutionResult().getStatus() + ": " + objectDeltaOperation.getExecutionResult().getMessage()); + } + } + } + private static AssignmentType createRoleAssignment(String roleOid) { AssignmentType roleAssignment = new AssignmentType(); ObjectReferenceType roleRef = new ObjectReferenceType(); @@ -508,6 +591,20 @@ private static void deleteUser(ModelPortType modelPort, String oid) throws Fault modelPort.executeChanges(deltaListType, executeOptionsType); } + private static void deleteRole(ModelPortType modelPort, String oid) throws FaultMessage { + ObjectDeltaType deltaType = new ObjectDeltaType(); + deltaType.setObjectType(ModelClientUtil.getTypeQName(RoleType.class)); + deltaType.setChangeType(ChangeTypeType.DELETE); + deltaType.setOid(oid); + + ObjectDeltaListType deltaListType = new ObjectDeltaListType(); + deltaListType.getDelta().add(deltaType); + + ModelExecuteOptionsType executeOptionsType = new ModelExecuteOptionsType(); + executeOptionsType.setRaw(true); + modelPort.executeChanges(deltaListType, executeOptionsType); + } + private static void deleteTask(ModelPortType modelPort, String oid) throws FaultMessage { ObjectDeltaType deltaType = new ObjectDeltaType(); deltaType.setObjectType(ModelClientUtil.getTypeQName(TaskType.class)); @@ -532,7 +629,7 @@ public static ModelPortType createModelPort(String[] args) { System.out.println("Endpoint URL: "+endpointUrl); // uncomment this if you want to use Fiddler or any other proxy - //ProxySelector.setDefault(new MyProxySelector("127.0.0.1", 8888)); + ProxySelector.setDefault(new MyProxySelector("127.0.0.1", 8888)); ModelService modelService = new ModelService(); ModelPortType modelPort = modelService.getModelPort(); diff --git a/samples/model-client-sample/src/main/resources/role-sea-superuser.xml b/samples/model-client-sample/src/main/resources/role-sea-superuser.xml new file mode 100644 index 00000000000..33bb1fd0cc2 --- /dev/null +++ b/samples/model-client-sample/src/main/resources/role-sea-superuser.xml @@ -0,0 +1,30 @@ + + + + Sea Superuser + + + + + + + From 885b0deed4fb8cac1ef33591ef116cb3428222e5 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Thu, 12 Feb 2015 11:54:57 +0100 Subject: [PATCH 162/215] Sample for adding attribute construction in resource inducement --- .../testing/model/client/sample/Main.java | 38 ++++++++++++++++++- .../src/main/resources/role-sea-superuser.xml | 5 +++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/samples/model-client-sample/src/main/java/com/evolveum/midpoint/testing/model/client/sample/Main.java b/samples/model-client-sample/src/main/java/com/evolveum/midpoint/testing/model/client/sample/Main.java index 958acdc641e..4185b5c315e 100644 --- a/samples/model-client-sample/src/main/java/com/evolveum/midpoint/testing/model/client/sample/Main.java +++ b/samples/model-client-sample/src/main/java/com/evolveum/midpoint/testing/model/client/sample/Main.java @@ -165,13 +165,16 @@ public static void main(String[] args) { // System.out.println(roles); String seaSuperuserRole = createRoleFromSystemResource(modelPort, "role-sea-superuser.xml"); - System.out.println("Created role Sea Superuser, OID: "+seaSuperuserRole); + System.out.println("Created role Sea Superuser, OID: " + seaSuperuserRole); assignRoles(modelPort, userLeChuckOid, seaSuperuserRole); System.out.println("Assigned role Sea Superuser to LeChuck"); + modifyRoleModifyInducement(modelPort, seaSuperuserRole); + System.out.println("Modified role Sea Superuser - modified resource inducement"); + modifyRoleReplaceInducement(modelPort, seaSuperuserRole, 2, ROLE_CAPTAIN_OID); - System.out.println("Modified role Sea Superuser"); + System.out.println("Modified role Sea Superuser - changed role inducement"); reconcileUser(modelPort, userLeChuckOid); System.out.println("LeChuck reconciled."); @@ -465,6 +468,37 @@ private static void modifyRoleAssignment(ModelPortType modelPort, String userOid } } + private static void modifyRoleModifyInducement(ModelPortType modelPort, String roleOid) throws IOException, SAXException, FaultMessage { + ItemDeltaType inducementDelta = new ItemDeltaType(); + inducementDelta.setModificationType(ModificationTypeType.ADD); + inducementDelta.setPath(ModelClientUtil.createItemPathType("inducement[3]/construction/attribute")); + inducementDelta.getValue().add(ModelClientUtil.parseElement("\n" + + " ri:pager\n" + + " \n" + + " \n" + + " 00-000-001\n" + + " 00-000-003\n" + + " \n" + + " \n" + + " ")); + + ObjectDeltaType deltaType = new ObjectDeltaType(); + deltaType.setObjectType(ModelClientUtil.getTypeQName(RoleType.class)); + deltaType.setChangeType(ChangeTypeType.MODIFY); + deltaType.setOid(roleOid); + deltaType.getItemDelta().add(inducementDelta); + + ObjectDeltaListType deltaListType = new ObjectDeltaListType(); + deltaListType.getDelta().add(deltaType); + ObjectDeltaOperationListType objectDeltaOperationList = modelPort.executeChanges(deltaListType, null); + for (ObjectDeltaOperationType objectDeltaOperation : objectDeltaOperationList.getDeltaOperation()) { + if (!OperationResultStatusType.SUCCESS.equals(objectDeltaOperation.getExecutionResult().getStatus())) { + System.out.println("*** Operation result = " + objectDeltaOperation.getExecutionResult().getStatus() + ": " + objectDeltaOperation.getExecutionResult().getMessage()); + } + } + } + + // removes inducement with a given ID and replaces it with a new one private static void modifyRoleReplaceInducement(ModelPortType modelPort, String roleOid, int oldId, String newInducementOid) throws FaultMessage, IOException, SAXException { diff --git a/samples/model-client-sample/src/main/resources/role-sea-superuser.xml b/samples/model-client-sample/src/main/resources/role-sea-superuser.xml index 33bb1fd0cc2..7ec5fd4c3d4 100644 --- a/samples/model-client-sample/src/main/resources/role-sea-superuser.xml +++ b/samples/model-client-sample/src/main/resources/role-sea-superuser.xml @@ -27,4 +27,9 @@ + + + + + From 38aed868afa78c922d04701b611998491d3fa6aa Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Thu, 12 Feb 2015 18:22:07 +0100 Subject: [PATCH 163/215] Fix for MID-2212. --- .../midpoint/prism/PrismReferenceValue.java | 5 + .../midpoint/test/util/MidPointAsserts.java | 17 +- .../model/impl/lens/EvaluatedAssignment.java | 4 + .../lens/projector/AssignmentProcessor.java | 98 +++-- ...bstractConfiguredModelIntegrationTest.java | 1 + .../midpoint/model/intest/TestOrgStruct.java | 361 ++++++++++++++++-- .../resources/orgstruct/role-defender.xml | 22 ++ .../test/AbstractModelIntegrationTest.java | 4 + .../testing/model/client/sample/Main.java | 2 +- 9 files changed, 464 insertions(+), 50 deletions(-) create mode 100644 model/model-intest/src/test/resources/orgstruct/role-defender.xml diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismReferenceValue.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismReferenceValue.java index 2d2c857e24b..f0e572be8de 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismReferenceValue.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/PrismReferenceValue.java @@ -498,6 +498,11 @@ public String toHumanReadableString() { sb.append(DebugUtil.formatElementName(getTargetType())); sb.append(")"); } + if (getRelation() != null) { + sb.append("["); + sb.append(getRelation().getLocalPart()); + sb.append("]"); + } return sb.toString(); } diff --git a/infra/test-util/src/main/java/com/evolveum/midpoint/test/util/MidPointAsserts.java b/infra/test-util/src/main/java/com/evolveum/midpoint/test/util/MidPointAsserts.java index 61174226f81..0d48fe467e4 100644 --- a/infra/test-util/src/main/java/com/evolveum/midpoint/test/util/MidPointAsserts.java +++ b/infra/test-util/src/main/java/com/evolveum/midpoint/test/util/MidPointAsserts.java @@ -23,6 +23,7 @@ import javax.xml.namespace.QName; +import com.evolveum.midpoint.util.QNameUtil; import org.apache.commons.lang.StringUtils; import org.testng.AssertJUnit; @@ -87,7 +88,7 @@ public static void assertNotAssigned(PrismObject user, } } } - + public static void assertAssignments(PrismObject user, int expectedNumber) { F userType = user.asObjectable(); assertEquals("Unexepected number of assignments in "+user+": "+userType.getAssignment(), expectedNumber, userType.getAssignment().size()); @@ -125,6 +126,20 @@ public static void assertAssignedRole(PrismObject user, public static void assertNotAssignedRole(PrismObject user, String roleOid) { assertNotAssigned(user, roleOid, RoleType.COMPLEX_TYPE); } + + public static void assertNotAssignedOrg(PrismObject user, String orgOid, QName relation) { + F userType = user.asObjectable(); + for (AssignmentType assignmentType: userType.getAssignment()) { + ObjectReferenceType targetRef = assignmentType.getTargetRef(); + if (targetRef != null) { + if (OrgType.COMPLEX_TYPE.equals(targetRef.getType())) { + if (orgOid.equals(targetRef.getOid()) && QNameUtil.match(targetRef.getRelation(), relation)) { + AssertJUnit.fail(user + " does have assigned OrgType "+orgOid+" with relation "+relation+" while not expecting it"); + } + } + } + } + } public static void assertAssignedOrg(PrismObject user, String orgOid) { assertAssigned(user, orgOid, OrgType.COMPLEX_TYPE); diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/EvaluatedAssignment.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/EvaluatedAssignment.java index 94a1359ed79..cc227436d9d 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/EvaluatedAssignment.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/EvaluatedAssignment.java @@ -180,6 +180,10 @@ public String debugDump(int indent) { DebugUtil.debugDumpLabel(sb, "EvaluatedAssignment", indent); sb.append("\n"); DebugUtil.debugDumpWithLabel(sb, "isValid", isValid, indent + 1); + if (forceRecon) { + sb.append("\n"); + DebugUtil.debugDumpWithLabel(sb, "forceRecon", forceRecon, indent + 1); + } if (!constructions.isEmpty()) { sb.append("\n"); DebugUtil.debugDumpWithLabel(sb, "Constructions", constructions, indent+1); diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/AssignmentProcessor.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/AssignmentProcessor.java index 2ee9b063a79..b24580339b7 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/AssignmentProcessor.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/AssignmentProcessor.java @@ -19,6 +19,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; @@ -1116,32 +1117,85 @@ public void processOrgAssignments(LensContext context, return; } + LOGGER.trace("Processing org assignments into parentOrgRef delta(s)"); + Class focusClass = focusContext.getObjectTypeClass(); PrismObjectDefinition userDef = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(focusClass); PrismReferenceDefinition orgRefDef = userDef.findReferenceDefinition(FocusType.F_PARENT_ORG_REF); ItemPath orgRefPath = new ItemPath(FocusType.F_PARENT_ORG_REF); - - // Plus - for (EvaluatedAssignment assignment: evaluatedAssignmentTriple.getPlusSet()) { - Collection orgs = assignment.getOrgRefVals(); - for (PrismReferenceValue org: orgs) { - ItemDelta orgRefDelta = orgRefDef.createEmptyDelta(orgRefPath); - orgRefDelta.addValueToAdd(org.toCannonical()); - focusContext.swallowToProjectionWaveSecondaryDelta(orgRefDelta); - } - } - - // Minus - for (EvaluatedAssignment assignment: evaluatedAssignmentTriple.getMinusSet()) { - Collection orgs = assignment.getOrgRefVals(); - for (PrismReferenceValue org: orgs) { - ItemDelta orgRefDelta = orgRefDef.createEmptyDelta(orgRefPath); - orgRefDelta.addValueToDelete(org.toCannonical()); - focusContext.swallowToProjectionWaveSecondaryDelta(orgRefDelta); - } - } - - // TODO: zero set if reconciliation? + + // check if recon is needed + boolean forceRecon = false; + for (EvaluatedAssignment assignment: evaluatedAssignmentTriple.getAllValues()) { + if (assignment.isForceRecon()) { + forceRecon = true; + break; + } + } + + if (!forceRecon) { // if no recon, we simply add/delete values as needed + + LOGGER.trace("No reconciliation requested, processing plus and minus sets"); + + // A list of values that are _not_ to be removed - these are all the values from zero set, + // as well as values from plus set. + // + // Contrary to existing standard delta merge algorithm (where add+delete means "keep the current state"), + // we ignore any delete of values that should be existing or added. + + Collection notToBeDeletedCanonical = new HashSet<>(); + for (EvaluatedAssignment assignment : evaluatedAssignmentTriple.getZeroSet()) { + Collection orgs = assignment.getOrgRefVals(); + for (PrismReferenceValue org : orgs) { + notToBeDeletedCanonical.add(org.toCannonical()); + } + } + + // Plus + for (EvaluatedAssignment assignment : evaluatedAssignmentTriple.getPlusSet()) { + Collection orgs = assignment.getOrgRefVals(); + for (PrismReferenceValue org : orgs) { + ItemDelta orgRefDelta = orgRefDef.createEmptyDelta(orgRefPath); + PrismReferenceValue orgCanonical = org.toCannonical(); + orgRefDelta.addValueToAdd(orgCanonical); + focusContext.swallowToProjectionWaveSecondaryDelta(orgRefDelta); + + notToBeDeletedCanonical.add(orgCanonical); + } + } + + // Minus (except for these that are also in zero set) + for (EvaluatedAssignment assignment : evaluatedAssignmentTriple.getMinusSet()) { + Collection orgs = assignment.getOrgRefVals(); + for (PrismReferenceValue org : orgs) { + ItemDelta orgRefDelta = orgRefDef.createEmptyDelta(orgRefPath); + PrismReferenceValue orgCanonical = org.toCannonical(); + if (notToBeDeletedCanonical.contains(orgCanonical)) { + LOGGER.trace("Not removing {} because it is in the zero or plus set", orgCanonical); + } else { + orgRefDelta.addValueToDelete(orgCanonical); + focusContext.swallowToProjectionWaveSecondaryDelta(orgRefDelta); + } + } + } + + } else { // if reconciliation is requested, we recreate parentOrgRef from scratch + + LOGGER.trace("Reconciliation requested, collecting all non-negative values"); + + ItemDelta orgRefDelta = orgRefDef.createEmptyDelta(orgRefPath); + Set valuesToReplace = new HashSet<>(); + + for (EvaluatedAssignment assignment : evaluatedAssignmentTriple.getNonNegativeValues()) { + Collection orgs = assignment.getOrgRefVals(); + for (PrismReferenceValue org : orgs) { + PrismReferenceValue canonical = org.toCannonical(); + valuesToReplace.add(canonical); // if valuesToReplace would be a list, we should check for duplicates! + } + } + orgRefDelta.setValuesToReplace(valuesToReplace); + focusContext.swallowToProjectionWaveSecondaryDelta(orgRefDelta); + } } public void checkForAssignmentConflicts(LensContext context, diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractConfiguredModelIntegrationTest.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractConfiguredModelIntegrationTest.java index 9e05fb23252..b6b04cc7821 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractConfiguredModelIntegrationTest.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractConfiguredModelIntegrationTest.java @@ -296,6 +296,7 @@ public class AbstractConfiguredModelIntegrationTest extends AbstractModelIntegra protected static final String ORG_GOVERNOR_OFFICE_OID = "00000000-8888-6666-0000-100000000001"; protected static final String ORG_SCUMM_BAR_OID = "00000000-8888-6666-0000-100000000006"; protected static final String ORG_MINISTRY_OF_OFFENSE_OID = "00000000-8888-6666-0000-100000000003"; + protected static final String ORG_MINISTRY_OF_DEFENSE_OID = "00000000-8888-6666-0000-100000000002"; protected static final String ORG_MINISTRY_OF_RUM_OID = "00000000-8888-6666-0000-100000000004"; protected static final String ORG_SWASHBUCKLER_SECTION_OID = "00000000-8888-6666-0000-100000000005"; protected static final String ORG_PROJECT_ROOT_OID = "00000000-8888-6666-0000-200000000000"; diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java index a7dfca4bf9f..f24c479a4eb 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java @@ -23,8 +23,15 @@ import java.util.Collection; import java.util.List; -import javax.xml.bind.JAXBException; - +import com.evolveum.midpoint.prism.PrismReferenceDefinition; +import com.evolveum.midpoint.prism.PrismReferenceValue; +import com.evolveum.midpoint.prism.delta.ReferenceDelta; +import com.evolveum.midpoint.prism.path.IdItemPathSegment; +import com.evolveum.midpoint.prism.path.ItemPath; +import com.evolveum.midpoint.prism.path.NameItemPathSegment; +import com.evolveum.midpoint.util.DebugUtil; +import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; import org.springframework.test.context.ContextConfiguration; @@ -55,8 +62,18 @@ public class TestOrgStruct extends AbstractInitializedModelIntegrationTest { public static final File TEST_DIR = new File("src/test/resources/orgstruct"); - - @Test + + public static final File ROLE_DEFENDER_FILE = new File(TEST_DIR, "role-defender.xml"); + public static final String ROLE_DEFENDER_OID = "12345111-1111-2222-1111-121212111567"; + + @Override + public void initSystem(Task initTask, OperationResult initResult) throws Exception { + super.initSystem(initTask, initResult); + addObject(ROLE_DEFENDER_FILE); + //DebugUtil.setDetailedDebugDump(true); + } + + @Test public void test010AddOrgStruct() throws Exception { final String TEST_NAME = "test010AddOrgStruct"; TestUtil.displayTestTile(this, TEST_NAME); @@ -239,7 +256,8 @@ public void test208JackUnAssignAll() throws Exception { // Postcondition assertMonkeyIslandOrgSanity(); } - + + // besides Offense org assignment, we create also Defender role assignment (which indirectly creates Defense org assignment) @Test public void test210JackAssignMinistryOfOffenseMember() throws Exception { final String TEST_NAME = "test210JackAssignMinistryOfOffenseMember"; @@ -247,14 +265,21 @@ public void test210JackAssignMinistryOfOffenseMember() throws Exception { Task task = taskManager.createTaskInstance(TestOrgStruct.class.getName() + "." + TEST_NAME); OperationResult result = task.getResult(); - + + Collection> modifications = new ArrayList>(); + modifications.add(createAssignmentModification(ORG_MINISTRY_OF_OFFENSE_OID, OrgType.COMPLEX_TYPE, null, null, null, true)); + modifications.add(createAssignmentModification(ROLE_DEFENDER_OID, RoleType.COMPLEX_TYPE, null, null, null, true)); + ObjectDelta userDelta = ObjectDelta.createModifyDelta(USER_JACK_OID, modifications, UserType.class, prismContext); + Collection> deltas = MiscSchemaUtil.createCollection(userDelta); + // WHEN - assignOrg(USER_JACK_OID, ORG_MINISTRY_OF_OFFENSE_OID, task, result); - + modelService.executeChanges(deltas, null, task, result); + // THEN PrismObject userJack = getUser(USER_JACK_OID); display("User jack after", userJack); - assertUserOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID); + assertUserAssignedOrgs(userJack, ORG_MINISTRY_OF_OFFENSE_OID); + assertUserHasOrgs(userJack, ORG_MINISTRY_OF_OFFENSE_OID, ORG_MINISTRY_OF_DEFENSE_OID); // Postcondition assertMonkeyIslandOrgSanity(); @@ -274,10 +299,14 @@ public void test211JackAssignMinistryOfOffenseMinister() throws Exception { // THEN PrismObject userJack = getUser(USER_JACK_OID); display("User jack after", userJack); - assertUserOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID, ORG_MINISTRY_OF_OFFENSE_OID); + assertUserAssignedOrgs(userJack, ORG_MINISTRY_OF_OFFENSE_OID); + assertUserHasOrgs(userJack, ORG_MINISTRY_OF_OFFENSE_OID, ORG_MINISTRY_OF_OFFENSE_OID, ORG_MINISTRY_OF_DEFENSE_OID); assertAssignedOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID, SchemaConstants.ORG_MANAGER); assertHasOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID, SchemaConstants.ORG_MANAGER); - + assertAssignedOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID, null); + assertHasOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID, null); + assertHasOrg(userJack, ORG_MINISTRY_OF_DEFENSE_OID, null); + // Postcondition assertMonkeyIslandOrgSanity(); } @@ -296,8 +325,9 @@ public void test212JackUnassignMinistryOfOffenseMember() throws Exception { // THEN PrismObject userJack = getUser(USER_JACK_OID); display("User jack after", userJack); - assertUserOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID); + assertUserAssignedOrgs(userJack, ORG_MINISTRY_OF_OFFENSE_OID); assertAssignedOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID, SchemaConstants.ORG_MANAGER); + assertUserHasOrgs(userJack, ORG_MINISTRY_OF_OFFENSE_OID, ORG_MINISTRY_OF_DEFENSE_OID); assertHasOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID, SchemaConstants.ORG_MANAGER); // Postcondition @@ -318,14 +348,161 @@ public void test213JackUnassignMinistryOfOffenseManager() throws Exception { // THEN PrismObject userJack = getUser(USER_JACK_OID); display("User jack after", userJack); - assertUserNoOrg(userJack); + assertAssignedNoOrg(userJack); + assertUserHasOrgs(userJack, ORG_MINISTRY_OF_DEFENSE_OID); // Postcondition assertMonkeyIslandOrgSanity(); } - - /** - * Assign jack to functional orgstruct again. Make him both minister and member. + + @Test + public void test220JackAssignMinistryOfOffenseMemberAgain() throws Exception { + final String TEST_NAME = "test220JackAssignMinistryOfOffenseMemberAgain"; + TestUtil.displayTestTile(this, TEST_NAME); + + Task task = taskManager.createTaskInstance(TestOrgStruct.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + // WHEN + assignOrg(USER_JACK_OID, ORG_MINISTRY_OF_OFFENSE_OID, task, result); + + // THEN + PrismObject userJack = getUser(USER_JACK_OID); + display("User jack after", userJack); + assertUserAssignedOrgs(userJack, ORG_MINISTRY_OF_OFFENSE_OID); + assertUserHasOrgs(userJack, ORG_MINISTRY_OF_OFFENSE_OID, ORG_MINISTRY_OF_DEFENSE_OID); + assertAssignedOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID, null); + assertHasOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID, null); + + // Postcondition + assertMonkeyIslandOrgSanity(); + } + + /** + * Assign jack to both functional and project orgstruct. + * Implemented to check org struct reconciliation in test223. + */ + @Test + public void test221JackAssignScummBarAndSaveElaine() throws Exception { + final String TEST_NAME = "test221JackAssignScummBarAndSaveElaine"; + TestUtil.displayTestTile(this, TEST_NAME); + + Task task = taskManager.createTaskInstance(TestOrgStruct.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + Collection> modifications = new ArrayList>(); + modifications.add(createAssignmentModification(ORG_SCUMM_BAR_OID, OrgType.COMPLEX_TYPE, null, null, null, true)); + modifications.add(createAssignmentModification(ORG_SAVE_ELAINE_OID, OrgType.COMPLEX_TYPE, null, null, null, true)); + ObjectDelta userDelta = ObjectDelta.createModifyDelta(USER_JACK_OID, modifications, UserType.class, prismContext); + Collection> deltas = MiscSchemaUtil.createCollection(userDelta); + + // WHEN + modelService.executeChanges(deltas, null, task, result); + + // THEN + PrismObject userJack = getUser(USER_JACK_OID); + display("User jack after", userJack); + assertUserAssignedOrgs(userJack, ORG_MINISTRY_OF_OFFENSE_OID, ORG_SCUMM_BAR_OID, ORG_SAVE_ELAINE_OID); + assertUserHasOrgs(userJack, ORG_MINISTRY_OF_OFFENSE_OID, ORG_SCUMM_BAR_OID, ORG_SAVE_ELAINE_OID, ORG_MINISTRY_OF_DEFENSE_OID); + + // Postcondition + assertMonkeyIslandOrgSanity(); + } + + + @Test + public void test223JackChangeMinistryOfOffenseMemberToManager() throws Exception { + final String TEST_NAME = "test221JackChangeMinistryOfOffenseMemberToManager"; + TestUtil.displayTestTile(this, TEST_NAME); + + Task task = taskManager.createTaskInstance(TestOrgStruct.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + PrismObject jack = getUser(USER_JACK_OID); + Long id = findAssignmentIdForTarget(jack, ORG_MINISTRY_OF_OFFENSE_OID); + + Collection> modifications = new ArrayList>(); + + PrismReferenceDefinition referenceDefinition = getUserDefinition() + .findItemDefinition( + new ItemPath(UserType.F_ASSIGNMENT, AssignmentType.F_TARGET_REF), PrismReferenceDefinition.class); + ReferenceDelta referenceDelta = new ReferenceDelta( + new ItemPath( + new NameItemPathSegment(UserType.F_ASSIGNMENT), + new IdItemPathSegment(id), + new NameItemPathSegment(AssignmentType.F_TARGET_REF)), referenceDefinition, prismContext); + PrismReferenceValue oldValue = new PrismReferenceValue(ORG_MINISTRY_OF_OFFENSE_OID, OrgType.COMPLEX_TYPE); + PrismReferenceValue newValue = new PrismReferenceValue(ORG_MINISTRY_OF_OFFENSE_OID, OrgType.COMPLEX_TYPE); + newValue.setRelation(SchemaConstants.ORG_MANAGER); + + referenceDelta.addValueToDelete(oldValue); + referenceDelta.addValueToAdd(newValue); + modifications.add(referenceDelta); + + // this actually works but for completeness we leave it here +// modifications.add(createAssignmentModification(ORG_MINISTRY_OF_OFFENSE_OID, OrgType.COMPLEX_TYPE, null, null, null, false)); +// modifications.add(createAssignmentModification(ORG_MINISTRY_OF_OFFENSE_OID, OrgType.COMPLEX_TYPE, SchemaConstants.ORG_MANAGER, null, null, true)); + + ObjectDelta userDelta = ObjectDelta.createModifyDelta(USER_JACK_OID, modifications, UserType.class, prismContext); + Collection> deltas = MiscSchemaUtil.createCollection(userDelta); + + // WHEN + modelService.executeChanges(deltas, null, task, result); + + // THEN + PrismObject userJack = getUser(USER_JACK_OID); + display("User jack after", userJack); + assertUserAssignedOrgs(userJack, ORG_MINISTRY_OF_OFFENSE_OID, ORG_SCUMM_BAR_OID, ORG_SAVE_ELAINE_OID); + assertUserHasOrgs(userJack, ORG_MINISTRY_OF_OFFENSE_OID, ORG_SCUMM_BAR_OID, ORG_SAVE_ELAINE_OID, ORG_MINISTRY_OF_DEFENSE_OID); + assertAssignedOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID, SchemaConstants.ORG_MANAGER); + assertHasOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID, SchemaConstants.ORG_MANAGER); + assertAssignedOrg(userJack, ORG_SCUMM_BAR_OID, null); + assertHasOrg(userJack, ORG_SCUMM_BAR_OID, null); + assertAssignedOrg(userJack, ORG_SAVE_ELAINE_OID, null); + assertHasOrg(userJack, ORG_SAVE_ELAINE_OID, null); + + // Postcondition + assertMonkeyIslandOrgSanity(); + } + + private Long findAssignmentIdForTarget(PrismObject user, String targetOid) { + for (AssignmentType assignmentType : user.asObjectable().getAssignment()) { + if (assignmentType.getTargetRef() != null && targetOid.equals(assignmentType.getTargetRef().getOid())) { + return assignmentType.getId(); + } + } + throw new IllegalStateException("No assignment pointing to " + targetOid + " found"); + } + + @Test + public void test300JackUnassignAllOrgs() throws Exception { + final String TEST_NAME = "test300JackUnassignAllOrgs"; + TestUtil.displayTestTile(this, TEST_NAME); + + Task task = taskManager.createTaskInstance(TestOrgStruct.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + // WHEN + Collection> modifications = new ArrayList>(); + modifications.add((createAssignmentModification(ORG_MINISTRY_OF_OFFENSE_OID, OrgType.COMPLEX_TYPE, SchemaConstants.ORG_MANAGER, null, null, false))); + modifications.add((createAssignmentModification(ORG_SCUMM_BAR_OID, OrgType.COMPLEX_TYPE, null, null, null, false))); + modifications.add((createAssignmentModification(ORG_SAVE_ELAINE_OID, OrgType.COMPLEX_TYPE, null, null, null, false))); + ObjectDelta userDelta = ObjectDelta.createModifyDelta(USER_JACK_OID, modifications, UserType.class, prismContext); + Collection> deltas = MiscSchemaUtil.createCollection(userDelta); + modelService.executeChanges(deltas, null, task, result); + + // THEN + PrismObject userJack = getUser(USER_JACK_OID); + display("User jack after", userJack); + assertAssignedNoOrg(userJack); + assertHasOrg(userJack, ORG_MINISTRY_OF_DEFENSE_OID, null); + + // Postcondition + assertMonkeyIslandOrgSanity(); + } + + /** + * Assign jack to functional orgstruct again. Make him both minister and member (for Defense org i.e. for that which he already has indirect assignment) */ @Test public void test301JackAssignMinistryOfOffense() throws Exception { @@ -336,26 +513,145 @@ public void test301JackAssignMinistryOfOffense() throws Exception { OperationResult result = task.getResult(); // WHEN - assignOrg(USER_JACK_OID, ORG_MINISTRY_OF_OFFENSE_OID, SchemaConstants.ORG_MANAGER, task, result); - assignOrg(USER_JACK_OID, ORG_MINISTRY_OF_OFFENSE_OID, task, result); - + assignOrg(USER_JACK_OID, ORG_MINISTRY_OF_DEFENSE_OID, SchemaConstants.ORG_MANAGER, task, result); + assignOrg(USER_JACK_OID, ORG_MINISTRY_OF_DEFENSE_OID, task, result); + // THEN PrismObject userJack = getUser(USER_JACK_OID); display("User jack after", userJack); - assertUserOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID, ORG_MINISTRY_OF_OFFENSE_OID); - assertAssignedOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID, SchemaConstants.ORG_MANAGER); - assertHasOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID, SchemaConstants.ORG_MANAGER); + assertUserOrg(userJack, ORG_MINISTRY_OF_DEFENSE_OID, ORG_MINISTRY_OF_DEFENSE_OID); + assertAssignedOrg(userJack, ORG_MINISTRY_OF_DEFENSE_OID, SchemaConstants.ORG_MANAGER); + assertHasOrg(userJack, ORG_MINISTRY_OF_DEFENSE_OID, SchemaConstants.ORG_MANAGER); // Postcondition assertMonkeyIslandOrgSanity(); } - - /** + + /** + * Conflict: removing the role assignment (that should remove org assignment), while keeping explicit org assignment present + */ + @Test + public void test305JackConflictZeroAndMinus() throws Exception { + final String TEST_NAME = "test305JackConflictZeroAndMinus"; + TestUtil.displayTestTile(this, TEST_NAME); + + Task task = taskManager.createTaskInstance(TestOrgStruct.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + Collection> modifications = new ArrayList>(); + modifications.add((createAssignmentModification(ROLE_DEFENDER_OID, RoleType.COMPLEX_TYPE, null, null, null, false))); + ObjectDelta userDelta = ObjectDelta.createModifyDelta(USER_JACK_OID, modifications, UserType.class, prismContext); + Collection> deltas = MiscSchemaUtil.createCollection(userDelta); + + // WHEN + modelService.executeChanges(deltas, null, task, result); + + // THEN + PrismObject userJack = getUser(USER_JACK_OID); + display("User jack after", userJack); + assertUserOrg(userJack, ORG_MINISTRY_OF_DEFENSE_OID, ORG_MINISTRY_OF_DEFENSE_OID); + assertAssignedOrg(userJack, ORG_MINISTRY_OF_DEFENSE_OID, SchemaConstants.ORG_MANAGER); + assertHasOrg(userJack, ORG_MINISTRY_OF_DEFENSE_OID, SchemaConstants.ORG_MANAGER); + assertHasOrg(userJack, ORG_MINISTRY_OF_DEFENSE_OID, null); + + // Postcondition + assertMonkeyIslandOrgSanity(); + } + + /** + * Another conflict: adding the role assignment (that should add org assignment), while deleting explicit org assignment + */ + @Test + public void test307JackConflictPlusAndMinus() throws Exception { + final String TEST_NAME = "test307JackConflictPlusAndMinus"; + TestUtil.displayTestTile(this, TEST_NAME); + + executeConflictPlusAndMinus(TEST_NAME); + } + + protected void executeConflictPlusAndMinus(String TEST_NAME) throws Exception { + Task task = taskManager.createTaskInstance(TestOrgStruct.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + Collection> modifications = new ArrayList>(); + modifications.add((createAssignmentModification(ROLE_DEFENDER_OID, RoleType.COMPLEX_TYPE, null, null, null, true))); + modifications.add((createAssignmentModification(ORG_MINISTRY_OF_DEFENSE_OID, OrgType.COMPLEX_TYPE, null, null, null, false))); + ObjectDelta userDelta = ObjectDelta.createModifyDelta(USER_JACK_OID, modifications, UserType.class, prismContext); + Collection> deltas = MiscSchemaUtil.createCollection(userDelta); + + // WHEN + modelService.executeChanges(deltas, null, task, result); + + // THEN + PrismObject userJack = getUser(USER_JACK_OID); + display("User jack after", userJack); + assertUserAssignedOrgs(userJack, ORG_MINISTRY_OF_DEFENSE_OID); + assertAssignedOrg(userJack, ORG_MINISTRY_OF_DEFENSE_OID, SchemaConstants.ORG_MANAGER); + assertNotAssignedOrg(userJack, ORG_MINISTRY_OF_DEFENSE_OID, null); + + assertUserHasOrgs(userJack, ORG_MINISTRY_OF_DEFENSE_OID, ORG_MINISTRY_OF_DEFENSE_OID); + assertHasOrg(userJack, ORG_MINISTRY_OF_DEFENSE_OID, SchemaConstants.ORG_MANAGER); + assertHasOrg(userJack, ORG_MINISTRY_OF_DEFENSE_OID, null); + + // Postcondition + assertMonkeyIslandOrgSanity(); + } + + // preparation for test309 + // also tests that when removing indirectly assigned org, it disappears from parentOrgRef + @Test + public void test308JackUnassignRoleDefender() throws Exception { + final String TEST_NAME = "test308JackUnassignRoleDefender"; + TestUtil.displayTestTile(this, TEST_NAME); + + Task task = taskManager.createTaskInstance(TestOrgStruct.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + // WHEN + Collection> modifications = new ArrayList>(); + modifications.add((createAssignmentModification(ROLE_DEFENDER_OID, RoleType.COMPLEX_TYPE, null, null, null, false))); + ObjectDelta userDelta = ObjectDelta.createModifyDelta(USER_JACK_OID, modifications, UserType.class, prismContext); + Collection> deltas = MiscSchemaUtil.createCollection(userDelta); + modelService.executeChanges(deltas, null, task, result); + + // THEN + PrismObject userJack = getUser(USER_JACK_OID); + display("User jack after", userJack); + assertUserAssignedOrgs(userJack, ORG_MINISTRY_OF_DEFENSE_OID); + assertAssignedOrg(userJack, ORG_MINISTRY_OF_DEFENSE_OID, SchemaConstants.ORG_MANAGER); + assertNotAssignedOrg(userJack, ORG_MINISTRY_OF_DEFENSE_OID, null); + assertNotAssignedRole(userJack, ROLE_DEFENDER_OID); + + assertUserHasOrgs(userJack, ORG_MINISTRY_OF_DEFENSE_OID); + assertHasOrg(userJack, ORG_MINISTRY_OF_DEFENSE_OID, SchemaConstants.ORG_MANAGER); + + // Postcondition + assertMonkeyIslandOrgSanity(); + } + + /** + * Retrying last kind of conflict: adding the role assignment (that should add org assignment), + * while deleting explicit org assignment - even it is not there! + * + * So this time there is originally NO parentOrgRef to Ministry of Defense/null. + * + * This situation is a kind of abnormal, but deleting non-present value is considered to be legal. + * So we should treat a situation like this well. + */ + @Test + public void test309JackConflictPlusAndMinusAgain() throws Exception { + final String TEST_NAME = "test309JackConflictPlusAndMinusAgain"; + TestUtil.displayTestTile(this, TEST_NAME); + + executeConflictPlusAndMinus(TEST_NAME); + } + + /** * Delete jack while he is still assigned. */ @Test - public void test309DeleteJack() throws Exception { - final String TEST_NAME = "test309DeleteJack"; + public void test349DeleteJack() throws Exception { + final String TEST_NAME = "test349DeleteJack"; TestUtil.displayTestTile(this, TEST_NAME); Task task = taskManager.createTaskInstance(TestOrgStruct.class.getName() + "." + TEST_NAME); @@ -386,6 +682,19 @@ protected void assertUserOrg(PrismObject user, String... orgOids) thro } assertHasOrgs(user, orgOids.length); } + + protected void assertUserAssignedOrgs(PrismObject user, String... orgOids) throws Exception { + for (String orgOid: orgOids) { + assertAssignedOrg(user, orgOid); + } + } + + protected void assertUserHasOrgs(PrismObject user, String... orgOids) throws Exception { + for (String orgOid: orgOids) { + assertHasOrg(user, orgOid); + } + assertHasOrgs(user, orgOids.length); + } protected void assertUserNoOrg(PrismObject user) throws Exception { assertAssignedNoOrg(user); diff --git a/model/model-intest/src/test/resources/orgstruct/role-defender.xml b/model/model-intest/src/test/resources/orgstruct/role-defender.xml new file mode 100644 index 00000000000..7a8ffcad05d --- /dev/null +++ b/model/model-intest/src/test/resources/orgstruct/role-defender.xml @@ -0,0 +1,22 @@ + + + Defender + + + + diff --git a/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java b/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java index 2d039475f1a..17fbd5cbb78 100644 --- a/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java +++ b/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java @@ -1221,6 +1221,10 @@ protected void assertNotAssignedRole(PrismObject user, MidPointAsserts.assertNotAssignedRole(user, roleOid); } + protected void assertNotAssignedOrg(PrismObject user, String orgOid, QName relation) { + MidPointAsserts.assertNotAssignedOrg(user, orgOid, relation); + } + protected void assertAssignedOrg(String userOid, String orgOid, Task task, OperationResult result) throws ObjectNotFoundException, SchemaException { PrismObject user = repositoryService.getObject(UserType.class, userOid, null, result); assertAssignedOrg(user, orgOid); diff --git a/samples/model-client-sample/src/main/java/com/evolveum/midpoint/testing/model/client/sample/Main.java b/samples/model-client-sample/src/main/java/com/evolveum/midpoint/testing/model/client/sample/Main.java index 4185b5c315e..c37c3080b1f 100644 --- a/samples/model-client-sample/src/main/java/com/evolveum/midpoint/testing/model/client/sample/Main.java +++ b/samples/model-client-sample/src/main/java/com/evolveum/midpoint/testing/model/client/sample/Main.java @@ -663,7 +663,7 @@ public static ModelPortType createModelPort(String[] args) { System.out.println("Endpoint URL: "+endpointUrl); // uncomment this if you want to use Fiddler or any other proxy - ProxySelector.setDefault(new MyProxySelector("127.0.0.1", 8888)); + //ProxySelector.setDefault(new MyProxySelector("127.0.0.1", 8888)); ModelService modelService = new ModelService(); ModelPortType modelPort = modelService.getModelPort(); From b7e2f2e89ab863970d929355fcabbdf0eb466af5 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Thu, 12 Feb 2015 19:21:22 +0100 Subject: [PATCH 164/215] Limited parentOrgRef reconciliation to necessary situations --- .../model/impl/lens/projector/AssignmentProcessor.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/AssignmentProcessor.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/AssignmentProcessor.java index b24580339b7..eda72aa26e6 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/AssignmentProcessor.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/AssignmentProcessor.java @@ -27,6 +27,7 @@ import javax.xml.datatype.XMLGregorianCalendar; +import com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; @@ -1124,10 +1125,13 @@ public void processOrgAssignments(LensContext context, PrismReferenceDefinition orgRefDef = userDef.findReferenceDefinition(FocusType.F_PARENT_ORG_REF); ItemPath orgRefPath = new ItemPath(FocusType.F_PARENT_ORG_REF); - // check if recon is needed + // check if parentOrgRef recon is needed - it is when something inside OrgType assignment has changed boolean forceRecon = false; for (EvaluatedAssignment assignment: evaluatedAssignmentTriple.getAllValues()) { - if (assignment.isForceRecon()) { + if (assignment.isForceRecon() && + assignment.getAssignmentType() != null && + assignment.getAssignmentType().getTargetRef() != null && + OrgType.COMPLEX_TYPE.equals(assignment.getAssignmentType().getTargetRef().getType())) { forceRecon = true; break; } From 57b127f756c07edfe0c1c04f2663d0b6f0bfbed1 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Thu, 12 Feb 2015 19:54:13 +0100 Subject: [PATCH 165/215] Fixing getManagers lib function (+tests) --- .../model/api/expr/MidpointFunctions.java | 2 + .../impl/expr/MidpointFunctionsImpl.java | 59 +++++++-- ...bstractConfiguredModelIntegrationTest.java | 3 + .../midpoint/model/intest/TestOrgStruct.java | 121 ++++++++++++++++++ .../src/test/resources/logback-test.xml | 3 +- .../test/AbstractModelIntegrationTest.java | 4 + 6 files changed, 177 insertions(+), 15 deletions(-) diff --git a/model/model-api/src/main/java/com/evolveum/midpoint/model/api/expr/MidpointFunctions.java b/model/model-api/src/main/java/com/evolveum/midpoint/model/api/expr/MidpointFunctions.java index 4e72f9944bd..90d974f358e 100644 --- a/model/model-api/src/main/java/com/evolveum/midpoint/model/api/expr/MidpointFunctions.java +++ b/model/model-api/src/main/java/com/evolveum/midpoint/model/api/expr/MidpointFunctions.java @@ -864,6 +864,8 @@ int countObjects(Class type, ObjectQuery query) Collection getManagers(UserType user) throws SchemaException, ObjectNotFoundException; Collection getManagersByOrgType(UserType user, String orgType) throws SchemaException, ObjectNotFoundException; + + Collection getManagers(UserType user, String orgType, boolean allowSelf) throws SchemaException, ObjectNotFoundException; UserType getUserByOid(String oid) throws ObjectNotFoundException, SchemaException; diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/expr/MidpointFunctionsImpl.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/expr/MidpointFunctionsImpl.java index 80ff569bd37..864e018c53b 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/expr/MidpointFunctionsImpl.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/expr/MidpointFunctionsImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Evolveum + * Copyright (c) 2010-2015 Evolveum * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -158,26 +158,57 @@ public Collection getManagersOidsExceptUser(UserType user) throws Schema @Override public Collection getManagers(UserType user) throws SchemaException, ObjectNotFoundException { - Set retval = new HashSet(); - Collection orgOids = getOrgUnits(user); - for (String orgOid : orgOids) { - retval.addAll(getManagersOfOrg(orgOid)); - } - return retval; + return getManagers(user, null, false); } @Override public Collection getManagersByOrgType(UserType user, String orgType) throws SchemaException, ObjectNotFoundException { + return getManagers(user, orgType, false); + } + + @Override + public Collection getManagers(UserType user, String orgType, boolean allowSelf) throws SchemaException, ObjectNotFoundException { Set retval = new HashSet(); Collection orgOids = getOrgUnits(user); - for (String orgOid : orgOids) { - if (orgType != null) { - OrgType org = getOrgByOid(orgOid); - if (!org.getOrgType().contains(orgType)) { - continue; + while (!orgOids.isEmpty()) { + LOGGER.trace("orgOids: {}",orgOids); + Collection thisLevelOrgs = new ArrayList(); + for (String orgOid : orgOids) { + if (orgType != null) { + OrgType org = getOrgByOid(orgOid); + if (!org.getOrgType().contains(orgType)) { + continue; + } else { + thisLevelOrgs.add(org); + } + } + Collection managersOfOrg = getManagersOfOrg(orgOid); + for (UserType managerOfOrg: managersOfOrg) { + if (allowSelf || !managerOfOrg.getOid().equals(user.getOid())) { + retval.add(managerOfOrg); + } + } + } + LOGGER.trace("retval: {}",retval); + if (!retval.isEmpty()) { + return retval; + } + Collection nextLevelOids = new ArrayList(); + if (orgType == null) { + for (String orgOid : orgOids) { + OrgType org = getOrgByOid(orgOid); + thisLevelOrgs.add(org); + } + } + for (OrgType org: thisLevelOrgs) { + for (ObjectReferenceType parentOrgRef: org.getParentOrgRef()) { + if (!nextLevelOids.contains(parentOrgRef.getOid())) { + nextLevelOids.add(parentOrgRef.getOid()); + } } - } - retval.addAll(getManagersOfOrg(orgOid)); + } + LOGGER.trace("nextLevelOids: {}",nextLevelOids); + orgOids = nextLevelOids; } return retval; } diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractConfiguredModelIntegrationTest.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractConfiguredModelIntegrationTest.java index b6b04cc7821..87f244f5780 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractConfiguredModelIntegrationTest.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/AbstractConfiguredModelIntegrationTest.java @@ -302,6 +302,9 @@ public class AbstractConfiguredModelIntegrationTest extends AbstractModelIntegra protected static final String ORG_PROJECT_ROOT_OID = "00000000-8888-6666-0000-200000000000"; protected static final String ORG_SAVE_ELAINE_OID = "00000000-8888-6666-0000-200000000001"; + protected static final String ORG_TYPE_FUNCTIONAL = "functional"; + protected static final String ORG_TYPE_PROJECT = "project"; + protected static final String TASK_RECONCILE_DUMMY_FILENAME = COMMON_DIR + "/task-reconcile-dummy.xml"; protected static final String TASK_RECONCILE_DUMMY_OID = "10000000-0000-0000-5656-565600000004"; diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java index f24c479a4eb..5dcaf2f8411 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java @@ -32,6 +32,7 @@ import com.evolveum.midpoint.util.DebugUtil; import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType; import com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType; + import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; import org.springframework.test.context.ContextConfiguration; @@ -48,7 +49,12 @@ import com.evolveum.midpoint.schema.util.ObjectQueryUtil; import com.evolveum.midpoint.task.api.Task; import com.evolveum.midpoint.test.util.TestUtil; +import com.evolveum.midpoint.util.exception.CommunicationException; +import com.evolveum.midpoint.util.exception.ConfigurationException; import com.evolveum.midpoint.util.exception.ObjectNotFoundException; +import com.evolveum.midpoint.util.exception.SchemaException; +import com.evolveum.midpoint.util.exception.SecurityViolationException; +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.OrgType; import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; @@ -675,6 +681,96 @@ public void test349DeleteJack() throws Exception { } } + /** + * Add new user Jack with an assignments as an manager and also a member of ministry of offense. + */ + @Test + public void test400AddJackAsMinistryOfOffenseManager() throws Exception { + final String TEST_NAME = "test400AddJackAsMinistryOfOffenseManager"; + TestUtil.displayTestTile(this, TEST_NAME); + + Task task = taskManager.createTaskInstance(TestOrgStruct.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + PrismObject userJack = prismContext.parseObject(USER_JACK_FILE); + + AssignmentType assignmentType = new AssignmentType(); + ObjectReferenceType targetRef = new ObjectReferenceType(); + targetRef.setOid(ORG_MINISTRY_OF_OFFENSE_OID); + targetRef.setType(OrgType.COMPLEX_TYPE); + assignmentType.setTargetRef(targetRef); + userJack.asObjectable().getAssignment().add(assignmentType); + + assignmentType = new AssignmentType(); + targetRef = new ObjectReferenceType(); + targetRef.setOid(ORG_MINISTRY_OF_OFFENSE_OID); + targetRef.setType(OrgType.COMPLEX_TYPE); + targetRef.setRelation(SchemaConstants.ORG_MANAGER); + assignmentType.setTargetRef(targetRef); + userJack.asObjectable().getAssignment().add(assignmentType); + + Collection> deltas = MiscSchemaUtil.createCollection(userJack.createAddDelta()); + // WHEN + modelService.executeChanges(deltas, null, task, result); + + // THEN + userJack = getUser(USER_JACK_OID); + display("User jack after", userJack); + assertUserAssignedOrgs(userJack, ORG_MINISTRY_OF_OFFENSE_OID); + assertUserHasOrgs(userJack, ORG_MINISTRY_OF_OFFENSE_OID, ORG_MINISTRY_OF_OFFENSE_OID); + assertAssignedOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID, SchemaConstants.ORG_MANAGER); + assertHasOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID, SchemaConstants.ORG_MANAGER); + assertAssignedOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID, null); + assertHasOrg(userJack, ORG_MINISTRY_OF_OFFENSE_OID, null); + + assertManager(USER_JACK_OID, null, null, false); + assertManager(USER_JACK_OID, null, ORG_TYPE_FUNCTIONAL, false); + assertManager(USER_JACK_OID, null, ORG_TYPE_PROJECT, false); + assertManager(USER_JACK_OID, USER_JACK_OID, null, true); + assertManager(USER_JACK_OID, USER_JACK_OID, ORG_TYPE_FUNCTIONAL, true); + assertManager(USER_JACK_OID, null, ORG_TYPE_PROJECT, true); + + // Postcondition + assertMonkeyIslandOrgSanity(); + } + + @Test + public void test410ElaineAssignGovernor() throws Exception { + final String TEST_NAME = "test410ElaineAssignGovernor"; + TestUtil.displayTestTile(this, TEST_NAME); + + Task task = taskManager.createTaskInstance(TestOrgStruct.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + // WHEN + assignOrg(USER_ELAINE_OID, ORG_GOVERNOR_OFFICE_OID, SchemaConstants.ORG_MANAGER, task, result); + + // THEN + PrismObject userElaine = getUser(USER_ELAINE_OID); + display("User jack after", userElaine); + assertUserAssignedOrgs(userElaine, ORG_GOVERNOR_OFFICE_OID); + assertUserHasOrgs(userElaine, ORG_GOVERNOR_OFFICE_OID); + assertAssignedOrg(userElaine, ORG_GOVERNOR_OFFICE_OID, SchemaConstants.ORG_MANAGER); + assertHasOrg(userElaine, ORG_GOVERNOR_OFFICE_OID, SchemaConstants.ORG_MANAGER); + + assertManager(USER_JACK_OID, USER_ELAINE_OID, null, false); + assertManager(USER_JACK_OID, USER_ELAINE_OID, ORG_TYPE_FUNCTIONAL, false); + assertManager(USER_JACK_OID, null, ORG_TYPE_PROJECT, false); + assertManager(USER_JACK_OID, USER_JACK_OID, null, true); + assertManager(USER_JACK_OID, USER_JACK_OID, ORG_TYPE_FUNCTIONAL, true); + assertManager(USER_JACK_OID, null, ORG_TYPE_PROJECT, true); + + assertManager(USER_ELAINE_OID, null, null, false); + assertManager(USER_ELAINE_OID, null, ORG_TYPE_FUNCTIONAL, false); + assertManager(USER_ELAINE_OID, null, ORG_TYPE_PROJECT, false); + assertManager(USER_ELAINE_OID, USER_ELAINE_OID, null, true); + assertManager(USER_ELAINE_OID, USER_ELAINE_OID, ORG_TYPE_FUNCTIONAL, true); + assertManager(USER_ELAINE_OID, null, ORG_TYPE_PROJECT, true); + + // Postcondition + assertMonkeyIslandOrgSanity(); + } + protected void assertUserOrg(PrismObject user, String... orgOids) throws Exception { for (String orgOid: orgOids) { assertAssignedOrg(user, orgOid); @@ -704,4 +800,29 @@ protected void assertUserNoOrg(PrismObject user) throws Exception { } + private void assertManager(String userOid, String managerOid, String orgType, boolean allowSelf) throws ObjectNotFoundException, SchemaException, SecurityViolationException, CommunicationException, ConfigurationException { + PrismObject user = getUser(userOid); + Collection managers = libraryMidpointFunctions.getManagers(user.asObjectable(), orgType, allowSelf); + if (managerOid == null) { + if (managers == null || managers.isEmpty()) { + return; + } else { + AssertJUnit.fail("Expected no manager for "+user+", but got "+managers); + } + } else { + if (managers == null) { + AssertJUnit.fail("Expected manager for "+user+", but got no manager"); + } if (managers.size() != 1) { + AssertJUnit.fail("Expected one manager for "+user+", but got: "+managers); + } else { + UserType manager = managers.iterator().next(); + if (manager.getOid().equals(managerOid)) { + return; + } else { + AssertJUnit.fail("Expected manager with OID "+managerOid+" for "+user+", but got "+manager); + } + } + } + } + } diff --git a/model/model-intest/src/test/resources/logback-test.xml b/model/model-intest/src/test/resources/logback-test.xml index 42999ee9da1..1ba254fd295 100644 --- a/model/model-intest/src/test/resources/logback-test.xml +++ b/model/model-intest/src/test/resources/logback-test.xml @@ -70,8 +70,9 @@ - + + diff --git a/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java b/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java index 17fbd5cbb78..d311b9c3275 100644 --- a/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java +++ b/model/model-test/src/main/java/com/evolveum/midpoint/model/test/AbstractModelIntegrationTest.java @@ -29,6 +29,7 @@ import com.evolveum.midpoint.model.api.PolicyViolationException; import com.evolveum.midpoint.model.api.context.ModelContext; import com.evolveum.midpoint.model.api.context.ModelProjectionContext; +import com.evolveum.midpoint.model.api.expr.MidpointFunctions; import com.evolveum.midpoint.model.api.hooks.HookRegistry; import com.evolveum.midpoint.notifications.api.NotificationManager; import com.evolveum.midpoint.notifications.api.transports.Message; @@ -231,6 +232,9 @@ public abstract class AbstractModelIntegrationTest extends AbstractIntegrationTe @Autowired(required=true) private SecurityEnforcer securityEnforcer; + @Autowired(required=true) + protected MidpointFunctions libraryMidpointFunctions; + protected DummyAuditService dummyAuditService; protected boolean verbose = false; From 8bc1ad15453d6c7ed62d7aafd2d34b7b7b9154b8 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Fri, 13 Feb 2015 06:36:02 +0100 Subject: [PATCH 166/215] Fixed relation with TestOrgStructMeta --- .../midpoint/model/intest/TestOrgStruct.java | 46 +++++++++++++------ 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java index 5dcaf2f8411..cfb1723ac4e 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java @@ -23,6 +23,7 @@ import java.util.Collection; import java.util.List; +import com.evolveum.midpoint.model.api.PolicyViolationException; import com.evolveum.midpoint.prism.PrismReferenceDefinition; import com.evolveum.midpoint.prism.PrismReferenceValue; import com.evolveum.midpoint.prism.delta.ReferenceDelta; @@ -30,6 +31,8 @@ import com.evolveum.midpoint.prism.path.ItemPath; import com.evolveum.midpoint.prism.path.NameItemPathSegment; import com.evolveum.midpoint.util.DebugUtil; +import com.evolveum.midpoint.util.exception.ExpressionEvaluationException; +import com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException; import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType; import com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType; @@ -660,33 +663,37 @@ public void test349DeleteJack() throws Exception { final String TEST_NAME = "test349DeleteJack"; TestUtil.displayTestTile(this, TEST_NAME); + executeDeleteJack(TEST_NAME); + } + + protected void executeDeleteJack(String TEST_NAME) throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException { Task task = taskManager.createTaskInstance(TestOrgStruct.class.getName() + "." + TEST_NAME); OperationResult result = task.getResult(); - + ObjectDelta userDelta = ObjectDelta.createDeleteDelta(UserType.class, USER_JACK_OID, prismContext); Collection> deltas = MiscSchemaUtil.createCollection(userDelta); - + // WHEN modelService.executeChanges(deltas, null, task, result); - + // THEN result.computeStatus(); TestUtil.assertSuccess(result); - + try { PrismObject user = getUser(USER_JACK_OID); AssertJUnit.fail("Jack survived!"); } catch (ObjectNotFoundException e) { // This is expected } - } - - /** + } + + /** * Add new user Jack with an assignments as an manager and also a member of ministry of offense. */ @Test - public void test400AddJackAsMinistryOfOffenseManager() throws Exception { - final String TEST_NAME = "test400AddJackAsMinistryOfOffenseManager"; + public void test350AddJackAsMinistryOfOffenseManager() throws Exception { + final String TEST_NAME = "test350AddJackAsMinistryOfOffenseManager"; TestUtil.displayTestTile(this, TEST_NAME); Task task = taskManager.createTaskInstance(TestOrgStruct.class.getName() + "." + TEST_NAME); @@ -735,8 +742,8 @@ public void test400AddJackAsMinistryOfOffenseManager() throws Exception { } @Test - public void test410ElaineAssignGovernor() throws Exception { - final String TEST_NAME = "test410ElaineAssignGovernor"; + public void test360ElaineAssignGovernor() throws Exception { + final String TEST_NAME = "test360ElaineAssignGovernor"; TestUtil.displayTestTile(this, TEST_NAME); Task task = taskManager.createTaskInstance(TestOrgStruct.class.getName() + "." + TEST_NAME); @@ -770,8 +777,21 @@ public void test410ElaineAssignGovernor() throws Exception { // Postcondition assertMonkeyIslandOrgSanity(); } - - protected void assertUserOrg(PrismObject user, String... orgOids) throws Exception { + + @Test + public void test399DeleteJack() throws Exception { + final String TEST_NAME = "test399DeleteJack"; + TestUtil.displayTestTile(this, TEST_NAME); + + executeDeleteJack(TEST_NAME); + } + + + // BEWARE, tests 400+ are executed in TestOrgStructMeta, so this class has to end with test399 and no jack present + // --------------------------------------------------------------------------------------------------------------- + + + protected void assertUserOrg(PrismObject user, String... orgOids) throws Exception { for (String orgOid: orgOids) { assertAssignedOrg(user, orgOid); assertHasOrg(user, orgOid); From 0618f95878c853e2aa229b11998cb93632deb27c Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Fri, 13 Feb 2015 11:02:29 +0100 Subject: [PATCH 167/215] Fixed missing extension container in org editor --- .../web/component/prism/ObjectWrapper.java | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ObjectWrapper.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ObjectWrapper.java index b412a09c957..3b189bb2993 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ObjectWrapper.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/prism/ObjectWrapper.java @@ -430,25 +430,29 @@ private List createContainerWrapper(PrismContainer parent, Ite ItemPath newPath = createPropertyPath(parentPath, containerDef.getName()); // [med] - // The following code fails to work when parent is multivalued. + // The following code fails to work when parent is multivalued or potentially multivalued. // Therefore (as a brutal hack), for multivalued parents we simply // skip it. if (parent.size() <= 1) { - PrismContainer prismContainer = null; - prismContainer = parent.findContainer(def.getName()); - - ContainerWrapper container; - if (prismContainer != null && !prismContainer.getElementName().equals(CredentialsType.F_PASSWORD)) { - container = new ContainerWrapper(this, prismContainer, ContainerStatus.MODIFYING, newPath, pageBase); - } else { - prismContainer = containerDef.instantiate(); - container = new ContainerWrapper(this, prismContainer, ContainerStatus.ADDING, newPath, pageBase); - } - addSubresult(container.getResult()); - wrappers.add(container); - if (!AssignmentType.COMPLEX_TYPE.equals(containerDef.getTypeName()) || !ShadowType.F_ASSOCIATION.equals(parent.getElementName())) { // do not show internals of Assignments (e.g. activation) - wrappers.addAll(createContainerWrapper(prismContainer, newPath, pageBase)); + // the same check as in getValue() implementation + boolean isMultiValued = parent.getDefinition() != null && !parent.getDefinition().isDynamic() && !parent.getDefinition().isSingleValue(); + if (!isMultiValued) { + PrismContainer prismContainer = parent.findContainer(def.getName()); + + ContainerWrapper container; + if (prismContainer != null && !prismContainer.getElementName().equals(CredentialsType.F_PASSWORD)) { + container = new ContainerWrapper(this, prismContainer, ContainerStatus.MODIFYING, newPath, pageBase); + } else { + prismContainer = containerDef.instantiate(); + container = new ContainerWrapper(this, prismContainer, ContainerStatus.ADDING, newPath, pageBase); + } + addSubresult(container.getResult()); + wrappers.add(container); + + if (!AssignmentType.COMPLEX_TYPE.equals(containerDef.getTypeName()) || !ShadowType.F_ASSOCIATION.equals(parent.getElementName())) { // do not show internals of Assignments (e.g. activation) + wrappers.addAll(createContainerWrapper(prismContainer, newPath, pageBase)); + } } } } From 7cdcfb223df0604d1f39e3a175d9bd075b92ba8a Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Fri, 13 Feb 2015 11:28:16 +0100 Subject: [PATCH 168/215] Fix for saving extension attributes on PageOrgUnit --- .../midpoint/web/page/admin/users/PageOrgUnit.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageOrgUnit.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageOrgUnit.java index ad8b42db74b..ae840d27704 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageOrgUnit.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageOrgUnit.java @@ -674,8 +674,12 @@ private void savePerformed(AjaxRequestTarget target) { ObjectDelta extensionDelta = saveExtension(result); ObjectDelta extDelta = null; - if(!isEditing() && extensionDelta != null){ - extDelta = delta.getObjectToAdd().diff(extensionDelta.getObjectToAdd()); + if(extensionDelta != null){ + if(isEditing()){ + extDelta = extensionDelta; + } else { + extDelta = delta.getObjectToAdd().diff(extensionDelta.getObjectToAdd()); + } } if(delta != null){ From ffc44901781a6ae148f01524cdea59801768999e Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Fri, 13 Feb 2015 14:13:32 +0100 Subject: [PATCH 169/215] Fixing provisioning test failures --- ...esource-dummy-schemaless-static-schema.xml | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/provisioning/provisioning-impl/src/test/resources/impl/dummy-schemaless/resource-dummy-schemaless-static-schema.xml b/provisioning/provisioning-impl/src/test/resources/impl/dummy-schemaless/resource-dummy-schemaless-static-schema.xml index 8f50363a810..fb42a22196e 100644 --- a/provisioning/provisioning-impl/src/test/resources/impl/dummy-schemaless/resource-dummy-schemaless-static-schema.xml +++ b/provisioning/provisioning-impl/src/test/resources/impl/dummy-schemaless/resource-dummy-schemaless-static-schema.xml @@ -64,18 +64,26 @@ - ICF UID + ConnId UID + 100 read - + + + + 200 + + + - ICF NAME + ConnId Name + 110 @@ -96,7 +104,8 @@ - ICF UID + ConnId UID + 100 read @@ -104,7 +113,8 @@ - ICF NAME + ConnId Name + 110 From bd7ee059a32fc61279f2b1a0b09451729883666a Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Fri, 13 Feb 2015 15:08:33 +0100 Subject: [PATCH 170/215] Fix for saving extension attributes in role editor. --- .../midpoint/web/page/admin/roles/PageRole.java | 15 +++++++++++---- .../web/page/admin/users/PageOrgUnit.java | 1 - 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/roles/PageRole.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/roles/PageRole.java index 0c73ea5a4de..439d8a8c136 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/roles/PageRole.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/roles/PageRole.java @@ -476,12 +476,19 @@ private void savePerformed(AjaxRequestTarget target){ } ObjectDelta extensionDelta = saveExtension(result); + ObjectDelta extDelta = null; + + if(extensionDelta != null){ + if(isEditing()){ + extDelta = extensionDelta; + } else { + extDelta = delta.getObjectToAdd().diff(extensionDelta.getObjectToAdd()); + } + } if (delta != null) { - if(extensionDelta != null){ - for(ItemDelta itemDelta: (List)extensionDelta.getModifications()){ - delta.addModification(itemDelta); - } + if(extDelta != null){ + delta = ObjectDelta.summarize(delta, extDelta); } ExecuteChangeOptionsDto executeOptions = executeOptionsModel.getObject(); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageOrgUnit.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageOrgUnit.java index ae840d27704..eb7343e1352 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageOrgUnit.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageOrgUnit.java @@ -670,7 +670,6 @@ private void savePerformed(AjaxRequestTarget target) { inducementPanel.handleAssignmentDeltas(delta, inducementDef, OrgType.F_INDUCEMENT); } - //TODO - improve this mess with extensionDeltas ObjectDelta extensionDelta = saveExtension(result); ObjectDelta extDelta = null; From 05f80ea1cd243397abca4e11c08f25e57f42b0c7 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Mon, 16 Feb 2015 12:47:22 +0100 Subject: [PATCH 171/215] Fixing MID-2222 --- .../midpoint/provisioning/impl/EntitlementConverter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/EntitlementConverter.java b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/EntitlementConverter.java index 64386a1201b..8e0462b3873 100644 --- a/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/EntitlementConverter.java +++ b/provisioning/provisioning-impl/src/main/java/com/evolveum/midpoint/provisioning/impl/EntitlementConverter.java @@ -241,10 +241,11 @@ public boolean handle(PrismObject entitlementShadow) { } + // precondition: valueAttr has exactly one value private ObjectQuery createQuery(RefinedAssociationDefinition assocDefType, RefinedAttributeDefinition assocAttrDef, ResourceAttribute valueAttr) throws SchemaException{ MatchingRule matchingRule = matchingRuleRegistry.getMatchingRule(assocDefType.getResourceObjectAssociationType().getMatchingRule(), assocAttrDef.getTypeName()); - PrismPropertyValue converted = PrismUtil.convertPropertyValue(valueAttr.getValue(), valueAttr.getDefinition(), assocAttrDef); + PrismPropertyValue converted = PrismUtil.convertPropertyValue(valueAttr.getValue(0), valueAttr.getDefinition(), assocAttrDef); PrismPropertyValue normalized = converted; if (matchingRule != null) { TA normalizedRealValue = matchingRule.normalize(converted.getValue()); From dcea66c7db4f8c06626bcaad9ef3281eafc778f2 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Mon, 16 Feb 2015 16:22:01 +0100 Subject: [PATCH 172/215] TreeTablePanel rework - adding separate tables for child org. units, managers and members of org. --- .../web/page/admin/roles/PageRole.java | 1 - .../component/ExecuteChangeOptionsPanel.java | 2 +- .../admin/users/component/TreeTablePanel.html | 15 +- .../admin/users/component/TreeTablePanel.java | 323 ++++++++++++++---- .../users/component/TreeTablePanel.properties | 3 + .../web/page/admin/users/dto/OrgTableDto.java | 19 +- .../web/session/UserProfileStorage.java | 8 +- .../midpoint/web/util/WebModelUtils.java | 2 +- .../midpoint/prism/query/EqualFilter.java | 14 - .../midpoint/prism/query/ObjectFilter.java | 7 - .../midpoint/prism/query/OrgFilter.java | 3 - .../midpoint/prism/query/RefFilter.java | 5 +- 12 files changed, 299 insertions(+), 103 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/roles/PageRole.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/roles/PageRole.java index 439d8a8c136..4b7dc7e5d56 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/roles/PageRole.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/roles/PageRole.java @@ -18,7 +18,6 @@ import com.evolveum.midpoint.model.api.ModelExecuteOptions; import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.prism.*; -import com.evolveum.midpoint.prism.delta.ItemDelta; import com.evolveum.midpoint.prism.delta.ObjectDelta; import com.evolveum.midpoint.prism.path.ItemPath; import com.evolveum.midpoint.prism.schema.SchemaRegistry; diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/ExecuteChangeOptionsPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/ExecuteChangeOptionsPanel.java index 64f118da276..88cba4ec168 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/ExecuteChangeOptionsPanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/ExecuteChangeOptionsPanel.java @@ -25,7 +25,7 @@ import org.apache.wicket.model.PropertyModel; /** - * @lazyman + * @author lazyman */ public class ExecuteChangeOptionsPanel extends SimplePanel { diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/TreeTablePanel.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/TreeTablePanel.html index eac306cf151..ee9be792e82 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/TreeTablePanel.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/TreeTablePanel.html @@ -43,7 +43,20 @@
-
+
+ +
+
+ +
+ +
+
+ +
+ +
+
diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/TreeTablePanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/TreeTablePanel.java index 366cf3ffea7..88e56948f77 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/TreeTablePanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/TreeTablePanel.java @@ -24,6 +24,7 @@ import com.evolveum.midpoint.prism.delta.ReferenceDelta; import com.evolveum.midpoint.prism.match.PolyStringNormMatchingRule; import com.evolveum.midpoint.prism.parser.QueryConvertor; +import com.evolveum.midpoint.prism.path.ItemPath; import com.evolveum.midpoint.prism.polystring.PolyStringNormalizer; import com.evolveum.midpoint.prism.query.*; import com.evolveum.midpoint.schema.constants.ObjectTypes; @@ -49,6 +50,7 @@ import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction; import com.evolveum.midpoint.web.component.util.LoadableModel; import com.evolveum.midpoint.web.component.util.SimplePanel; +import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour; import com.evolveum.midpoint.web.page.PageBase; import com.evolveum.midpoint.web.page.admin.configuration.component.HeaderMenuAction; import com.evolveum.midpoint.web.page.admin.users.PageOrgUnit; @@ -113,11 +115,12 @@ public class TreeTablePanel extends SimplePanel { private static final String OPERATION_UPDATE_OBJECTS = DOT_CLASS + "updateObjects"; private static final String OPERATION_UPDATE_OBJECT = DOT_CLASS + "updateObject"; private static final String OPERATION_RECOMPUTE = DOT_CLASS + "recompute"; - private static final String OPERATION_LOAD_PARENTS = DOT_CLASS + "loadParents"; private static final String ID_TREE = "tree"; private static final String ID_TREE_CONTAINER = "treeContainer"; - private static final String ID_TABLE = "table"; + private static final String ID_CHILD_TABLE = "childUnitTable"; + private static final String ID_MANAGER_TABLE = "managerTable"; + private static final String ID_MEMBER_TABLE = "memberTable"; private static final String ID_FORM = "form"; private static final String ID_CONFIRM_DELETE_POPUP = "confirmDeletePopup"; private static final String ID_MOVE_POPUP = "movePopup"; @@ -258,7 +261,7 @@ protected void onClick(AjaxRequestTarget target) { @Override protected Item newRowItem(String id, int index, final IModel model) { - Item item = super.newRowItem(id, index, model); + Item item = super.newRowItem(id, index, model); item.add(AttributeModifier.append("class", new AbstractReadOnlyModel() { @Override @@ -279,58 +282,103 @@ public String getObject() { // tree.add(AttributeModifier.replace("class", "tree-midpoint")); treeContainer.add(tree); - initTable(); + initTables(); initSearch(); } - private List getOrgParentOids(String orgOid){ - List parentOids = new ArrayList<>(); - OperationResult result = new OperationResult(OPERATION_LOAD_PARENTS); - PrismObject org = WebModelUtils.loadObject(OrgType.class, orgOid, result, getPageBase()); - OrgType orgObject = org.asObjectable(); + private void initTables() { + Form form = new Form(ID_FORM); + form.setOutputMarkupId(true); + add(form); - if(orgObject.getParentOrg() != null && !orgObject.getParentOrg().isEmpty()){ - for(OrgType parentOrg: orgObject.getParentOrg()){ - parentOids.add(parentOrg.getOid()); + //Child Table Initialization + final ObjectDataProvider childTableProvider = new ObjectDataProvider(this, OrgType.class) { + + @Override + public OrgTableDto createDataObjectWrapper(PrismObject obj) { + return OrgTableDto.createDto(obj); } - } - return parentOids; - } + @Override + public ObjectQuery getQuery() { + return createOrgChildQuery(); + } + }; + childTableProvider.setOptions(WebModelUtils.createMinimalOptions()); - private void initTable() { - Form form = new Form(ID_FORM); - form.setOutputMarkupId(true); - add(form); - ObjectDataProvider tableProvider = new ObjectDataProvider(this, ObjectType.class) { + List> childTableColumns = createChildTableColumns(); + final TablePanel childTable = new TablePanel<>(ID_CHILD_TABLE, childTableProvider, childTableColumns, + UserProfileStorage.TableId.TREE_TABLE_PANEL_CHILD, UserProfileStorage.DEFAULT_PAGING_SIZE); + childTable.setOutputMarkupId(true); + childTable.getNavigatorPanel().add(new VisibleEnableBehaviour(){ + + @Override + public boolean isVisible() { + return childTableProvider.size() > childTable.getDataTable().getItemsPerPage(); + } + }); + form.add(childTable); + + //Manager Table Initialization + final ObjectDataProvider managerTableProvider = new ObjectDataProvider(this, UserType.class) { @Override - public OrgTableDto createDataObjectWrapper(PrismObject obj) { + public OrgTableDto createDataObjectWrapper(PrismObject obj) { return OrgTableDto.createDto(obj); } @Override public ObjectQuery getQuery() { - return createTableQuery(); + return createManagerTableQuery(); } }; + managerTableProvider.setOptions(WebModelUtils.createMinimalOptions()); - //TODO - fix the problem with getting itemsPerPage during layout construction - tableProvider.setOptions(WebModelUtils.createMinimalOptions()); - List> tableColumns = createTableColumns(); - TablePanel table = new TablePanel(ID_TABLE, tableProvider, tableColumns, - UserProfileStorage.TableId.TREE_TABLE_PANEL, UserProfileStorage.DEFAULT_PAGING_SIZE); - table.setOutputMarkupId(true); - form.add(table); - } + List> managerTableColumns = createUserTableColumns(); + final TablePanel managerTablePanel = new TablePanel<>(ID_MANAGER_TABLE, managerTableProvider, managerTableColumns, + UserProfileStorage.TableId.TREE_TABLE_PANEL_MANAGER, UserProfileStorage.DEFAULT_PAGING_SIZE); + managerTablePanel.setOutputMarkupId(true); + managerTablePanel.getNavigatorPanel().add(new VisibleEnableBehaviour(){ -// public long getItemsPerPage(UserProfileStorage.TableId tableId){ -// -// SessionStorage storage = getPageBase().getSessionStorage(); -// UserProfileStorage userProfile = storage.getUserProfile(); -// return userProfile.getPagingSize(tableId); -// } + @Override + public boolean isVisible() { + return managerTableProvider.size() > managerTablePanel.getDataTable().getItemsPerPage(); + } + }); + form.add(managerTablePanel); + + //Member Table Initialization + final ObjectDataProvider memberTableProvider = new ObjectDataProvider(this, UserType.class) { + + @Override + public OrgTableDto createDataObjectWrapper(PrismObject obj) { + return OrgTableDto.createDto(obj); + } + + @Override + public ObjectQuery getQuery() { + return createMemberQuery(); + } + }; + memberTableProvider.setOptions(WebModelUtils.createMinimalOptions()); + + List> memberTableColumns = createUserTableColumns(); + final TablePanel memberTablePanel = new TablePanel<>(ID_MEMBER_TABLE, memberTableProvider, memberTableColumns, + UserProfileStorage.TableId.TREE_TABLE_PANEL_MEMBER, UserProfileStorage.DEFAULT_PAGING_SIZE); + memberTablePanel.setOutputMarkupId(true); + memberTablePanel.getNavigatorPanel().add(new VisibleEnableBehaviour(){ + @Override + public boolean isVisible() { + return memberTableProvider.size() > memberTablePanel.getDataTable().getItemsPerPage(); + } + }); + form.add(memberTablePanel); + } + + /** + * TODO - test search + * */ private void initSearch() { Form form = new Form(ID_SEARCH_FORM); form.setOutputMarkupId(true); @@ -421,7 +469,7 @@ public String getObject() { switch (dialog.getConfirmType()) { case CONFIRM_DELETE: return createStringResource("TreeTablePanel.message.deleteObjectConfirm", - WebMiscUtil.getSelectedData(getTable()).size()).getString(); + WebMiscUtil.getSelectedData(getOrgChildTable()).size()).getString(); case CONFIRM_DELETE_ROOT: OrgTreeDto dto = getRootFromProvider(); @@ -441,7 +489,7 @@ private OrgTreeDto getRootFromProvider() { return iterator.hasNext() ? iterator.next() : null; } - private List> createTableColumns() { + private List> createChildTableColumns() { List> columns = new ArrayList<>(); columns.add(new CheckBoxHeaderColumn()); @@ -450,15 +498,65 @@ private List> createTableColumns() { @Override protected IModel createIconModel(IModel rowModel) { OrgTableDto dto = rowModel.getObject(); + ObjectTypeGuiDescriptor guiDescriptor = ObjectTypeGuiDescriptor.getDescriptor(dto.getType()); + + String icon = guiDescriptor != null ? guiDescriptor.getIcon() : ObjectTypeGuiDescriptor.ERROR_ICON; + + return new Model(icon); + } + }); + + columns.add(new LinkColumn(createStringResource("ObjectType.name"), OrgTableDto.F_NAME, "name") { + + @Override + public boolean isEnabled(IModel rowModel) { + OrgTableDto dto = rowModel.getObject(); + return UserType.class.equals(dto.getType()) || OrgType.class.equals(dto.getType()); + } - ObjectTypeGuiDescriptor descr = null; + @Override + public void onClick(AjaxRequestTarget target, IModel rowModel) { + OrgTableDto dto = rowModel.getObject(); + PageParameters parameters = new PageParameters(); + parameters.add(OnePageParameterEncoder.PARAMETER, dto.getOid()); + setResponsePage(PageOrgUnit.class, parameters); + } + }); + columns.add(new PropertyColumn(createStringResource("OrgType.displayName"), OrgTableDto.F_DISPLAY_NAME)); + columns.add(new PropertyColumn(createStringResource("OrgType.identifier"), OrgTableDto.F_IDENTIFIER)); + columns.add(new InlineMenuHeaderColumn(initInlineMenu())); + + return columns; + } + + private List> createUserTableColumns() { + List> columns = new ArrayList<>(); + + columns.add(new CheckBoxHeaderColumn()); + columns.add(new IconColumn(createStringResource("")) { + + @Override + protected IModel createIconModel(IModel rowModel) { + OrgTableDto dto = rowModel.getObject(); + OrgTreeDto selectedDto = selected.getObject(); + String selectedOid = dto != null ? selectedDto.getOid() : getModel().getObject(); + + ObjectTypeGuiDescriptor guiDescriptor; if(dto.getRelation() == null) { - descr = ObjectTypeGuiDescriptor.getDescriptor(dto.getType()); + guiDescriptor = ObjectTypeGuiDescriptor.getDescriptor(dto.getType()); } else { - descr = ObjectTypeGuiDescriptor.getDescriptor(dto.getRelation()); + for(ObjectReferenceType parentOrgRef: dto.getObject().getParentOrgRef()){ + if(parentOrgRef.getOid().equals(selectedOid)){ + guiDescriptor = ObjectTypeGuiDescriptor.getDescriptor(dto.getRelation()); + String icon = guiDescriptor != null ? guiDescriptor.getIcon() : ObjectTypeGuiDescriptor.ERROR_ICON; + return new Model(icon); + } + } + + guiDescriptor = ObjectTypeGuiDescriptor.getDescriptor(dto.getType()); } - String icon = descr != null ? descr.getIcon() : ObjectTypeGuiDescriptor.ERROR_ICON; + String icon = guiDescriptor != null ? guiDescriptor.getIcon() : ObjectTypeGuiDescriptor.ERROR_ICON; return new Model(icon); } @@ -475,25 +573,26 @@ public boolean isEnabled(IModel rowModel) { @Override public void onClick(AjaxRequestTarget target, IModel rowModel) { OrgTableDto dto = rowModel.getObject(); - if (UserType.class.equals(dto.getType())) { - PageParameters parameters = new PageParameters(); - parameters.add(OnePageParameterEncoder.PARAMETER, dto.getOid()); - setResponsePage(PageUser.class, parameters); - } else if (OrgType.class.equals(dto.getType())) { - PageParameters parameters = new PageParameters(); - parameters.add(OnePageParameterEncoder.PARAMETER, dto.getOid()); - setResponsePage(PageOrgUnit.class, parameters); - } + PageParameters parameters = new PageParameters(); + parameters.add(OnePageParameterEncoder.PARAMETER, dto.getOid()); + setResponsePage(PageUser.class, parameters); } }); - columns.add(new PropertyColumn(createStringResource("OrgType.displayName"), OrgTableDto.F_DISPLAY_NAME)); - //todo add relation - columns.add(new PropertyColumn(createStringResource("OrgType.identifier"), OrgTableDto.F_IDENTIFIER)); - columns.add(new InlineMenuHeaderColumn(initInlineMenu())); + columns.add(new PropertyColumn(createStringResource("UserType.givenName"), + UserType.F_GIVEN_NAME.getLocalPart(), OrgTableDto.F_OBJECT + ".givenName")); + columns.add(new PropertyColumn(createStringResource("UserType.familyName"), + UserType.F_FAMILY_NAME.getLocalPart(), OrgTableDto.F_OBJECT + ".familyName")); + columns.add(new PropertyColumn(createStringResource("UserType.fullName"), + UserType.F_FULL_NAME.getLocalPart(), OrgTableDto.F_OBJECT + ".fullName")); + columns.add(new PropertyColumn(createStringResource("UserType.emailAddress"), + null, OrgTableDto.F_OBJECT + ".emailAddress")); + +// columns.add(new InlineMenuHeaderColumn(initInlineMenu())); return columns; } + //Create separate inline menu for users private List initInlineMenu() { List headerMenuItems = new ArrayList<>(); headerMenuItems.add(new InlineMenuItem(createStringResource("TreeTablePanel.menu.addOrgUnit"), false, @@ -620,7 +719,7 @@ private PrismObject addObjectPerformed(AjaxRequestTarget target, ObjectType obje * This method check selection in table. */ private List isAnythingSelected(AjaxRequestTarget target) { - List objects = WebMiscUtil.getSelectedData(getTable()); + List objects = WebMiscUtil.getSelectedData(getOrgChildTable()); if (objects.isEmpty()) { warn(getString("TreeTablePanel.message.nothingSelected")); target.add(getPageBase().getFeedbackPanel()); @@ -763,7 +862,7 @@ private void moveConfirmedPerformed(AjaxRequestTarget target, OrgTreeDto oldPare } result.computeStatusComposite(); - ObjectDataProvider provider = (ObjectDataProvider) getTable().getDataTable().getDataProvider(); + ObjectDataProvider provider = (ObjectDataProvider) getOrgChildTable().getDataTable().getDataProvider(); provider.clearCache(); page.showResult(result); @@ -792,22 +891,36 @@ private TableTree getTree() { return (TableTree) get(createComponentPath(ID_TREE_CONTAINER, ID_TREE)); } - private TablePanel getTable() { - return (TablePanel) get(createComponentPath(ID_FORM, ID_TABLE)); + private TablePanel getOrgChildTable() { + return (TablePanel) get(createComponentPath(ID_FORM, ID_CHILD_TABLE)); + } + + private TablePanel getMemberTable() { + return (TablePanel) get(createComponentPath(ID_FORM, ID_MEMBER_TABLE)); + } + + private TablePanel getManagerTable() { + return (TablePanel) get(createComponentPath(ID_FORM, ID_MANAGER_TABLE)); } private void selectTreeItemPerformed(AjaxRequestTarget target) { BasicSearchPanel basicSearch = (BasicSearchPanel) get(createComponentPath(ID_SEARCH_FORM, ID_BASIC_SEARCH)); basicSearch.getModel().setObject(null); - TablePanel table = getTable(); - table.setCurrentPage(null); + TablePanel orgTable = getOrgChildTable(); + orgTable.setCurrentPage(null); + + TablePanel memberTable = getMemberTable(); + memberTable.setCurrentPage(null); + + TablePanel managerTable = getManagerTable(); + managerTable.setCurrentPage(null); - target.add(table); + target.add(orgTable, memberTable, managerTable); target.add(get(ID_SEARCH_FORM)); } - private ObjectQuery createTableQuery() { + private ObjectQuery createOrgChildQuery() { OrgTreeDto dto = selected.getObject(); String oid = dto != null ? dto.getOid() : getModel().getObject(); @@ -815,6 +928,7 @@ private ObjectQuery createTableQuery() { BasicSearchPanel basicSearch = (BasicSearchPanel) get(createComponentPath(ID_SEARCH_FORM, ID_BASIC_SEARCH)); String object = basicSearch.getModelObject(); + if (StringUtils.isEmpty(object)) { return ObjectQuery.createObjectQuery(org); } @@ -836,6 +950,77 @@ private ObjectQuery createTableQuery() { return ObjectQuery.createObjectQuery(and); } + private ObjectQuery createManagerTableQuery(){ + ObjectQuery query = null; + OrgTreeDto dto = selected.getObject(); + String oid = dto != null ? dto.getOid() : getModel().getObject(); + + BasicSearchPanel basicSearch = (BasicSearchPanel) get(createComponentPath(ID_SEARCH_FORM, ID_BASIC_SEARCH)); + String object = basicSearch.getModelObject(); + + SubstringFilter substring; + PolyStringNormalizer normalizer = getPageBase().getPrismContext().getDefaultPolyStringNormalizer(); + String normalizedString = normalizer.normalize(object); + + if (StringUtils.isEmpty(normalizedString)) { + substring = null; + } else { + substring = SubstringFilter.createSubstring(ObjectType.F_NAME, ObjectType.class, getPageBase().getPrismContext(), + PolyStringNormMatchingRule.NAME, normalizedString); + } + + try { + OrgFilter org = OrgFilter.createOrg(oid, OrgFilter.Scope.ONE_LEVEL); + + PrismReferenceValue v = new PrismReferenceValue(); + v.setOid(oid); + v.setRelation(SchemaConstants.ORG_MANAGER); + RefFilter relationFilter = RefFilter.createReferenceEqual(new ItemPath(FocusType.F_PARENT_ORG_REF), UserType.class, getPageBase().getPrismContext(), v); + + if(substring != null){ + query = ObjectQuery.createObjectQuery(AndFilter.createAnd(org, relationFilter, substring)); + } else { + query = ObjectQuery.createObjectQuery(AndFilter.createAnd(org, relationFilter)); + } + + + } catch (SchemaException e) { + LoggingUtils.logException(LOGGER, "Couldn't prepare query for org. managers.", e); + } + + return query; + } + + private ObjectQuery createMemberQuery(){ + ObjectQuery query = null; + OrgTreeDto dto = selected.getObject(); + String oid = dto != null ? dto.getOid() : getModel().getObject(); + + BasicSearchPanel basicSearch = (BasicSearchPanel) get(createComponentPath(ID_SEARCH_FORM, ID_BASIC_SEARCH)); + String object = basicSearch.getModelObject(); + + SubstringFilter substring; + PolyStringNormalizer normalizer = getPageBase().getPrismContext().getDefaultPolyStringNormalizer(); + String normalizedString = normalizer.normalize(object); + + if (StringUtils.isEmpty(normalizedString)) { + substring = null; + } else { + substring = SubstringFilter.createSubstring(ObjectType.F_NAME, ObjectType.class, getPageBase().getPrismContext(), + PolyStringNormMatchingRule.NAME, normalizedString); + } + + OrgFilter org = OrgFilter.createOrg(oid, OrgFilter.Scope.ONE_LEVEL); + + if(substring != null){ + query = ObjectQuery.createObjectQuery(AndFilter.createAnd(org, substring)); + } else { + query = ObjectQuery.createObjectQuery(AndFilter.createAnd(org)); + } + + return query; + } + private void collapseAllPerformed(AjaxRequestTarget target) { TableTree tree = getTree(); TreeStateModel model = (TreeStateModel) tree.getDefaultModel(); @@ -886,10 +1071,16 @@ private void updateActivationPerformed(AjaxRequestTarget target, boolean enable) } private void refreshTable(AjaxRequestTarget target) { - ObjectDataProvider provider = (ObjectDataProvider) getTable().getDataTable().getDataProvider(); - provider.clearCache(); + ObjectDataProvider orgProvider = (ObjectDataProvider) getOrgChildTable().getDataTable().getDataProvider(); + orgProvider.clearCache(); + + ObjectDataProvider memberProvider = (ObjectDataProvider) getMemberTable().getDataTable().getDataProvider(); + memberProvider.clearCache(); + + ObjectDataProvider managerProvider = (ObjectDataProvider) getManagerTable().getDataTable().getDataProvider(); + managerProvider.clearCache(); - target.add(getTable()); + target.add(getOrgChildTable(), getMemberTable(), getManagerTable()); } private void recomputeRootPerformed(AjaxRequestTarget target, OrgUnitBrowser.Operation operation){ diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/TreeTablePanel.properties b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/TreeTablePanel.properties index f99a5c0f138..db713598025 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/TreeTablePanel.properties +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/TreeTablePanel.properties @@ -15,6 +15,9 @@ # TreeTablePanel.hierarchy=Org. hierarchy +TreeTablePanel.childOrg=Children org. units +TreeTablePanel.members=Members +TreeTablePanel.managers=Managers TreeTablePanel.menu.addOrgUnit=Add org. unit TreeTablePanel.menu.addUser=Add user TreeTablePanel.menu.delete=Delete diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/dto/OrgTableDto.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/dto/OrgTableDto.java index 7a739259d2f..3b4cb10094b 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/dto/OrgTableDto.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/dto/OrgTableDto.java @@ -42,6 +42,7 @@ public class OrgTableDto extends Selectable implements OrgDto, InlineMenuable { public static final String F_DISPLAY_NAME = "displayName"; public static final String F_IDENTIFIER = "identifier"; public static final String F_DESCRIPTION = "description"; + public static final String F_OBJECT = "object"; private String oid; private Class type; @@ -51,6 +52,7 @@ public class OrgTableDto extends Selectable implements OrgDto, InlineMenuable { private QName relation; private String identifier; private String description; + private ObjectType object; public OrgTableDto(String oid, Class type) { this.oid = oid; @@ -66,6 +68,7 @@ public static OrgTableDto createDto(PrismObject object) { dto.identifier = object.getPropertyRealValue(OrgType.F_IDENTIFIER, String.class); dto.relation = WebMiscUtil.isObjectOrgManager(object) ? SchemaConstants.ORG_MANAGER : null; + dto.object = object.asObjectable(); return dto; } @@ -102,10 +105,18 @@ public String getName() { return name; } + public ObjectType getObject() { + return object; + } + + public void setObject(ObjectType object) { + this.object = object; + } + @Override public boolean equals(Object o) { if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (!(o instanceof OrgTableDto)) return false; OrgTableDto that = (OrgTableDto) o; @@ -113,9 +124,10 @@ public boolean equals(Object o) { if (displayName != null ? !displayName.equals(that.displayName) : that.displayName != null) return false; if (identifier != null ? !identifier.equals(that.identifier) : that.identifier != null) return false; if (name != null ? !name.equals(that.name) : that.name != null) return false; + if (object != null ? !object.equals(that.object) : that.object != null) return false; if (oid != null ? !oid.equals(that.oid) : that.oid != null) return false; - if (type != null ? !type.equals(that.type) : that.type != null) return false; if (relation != null ? !relation.equals(that.relation) : that.relation != null) return false; + if (type != null ? !type.equals(that.type) : that.type != null) return false; return true; } @@ -126,9 +138,10 @@ public int hashCode() { result = 31 * result + (type != null ? type.hashCode() : 0); result = 31 * result + (name != null ? name.hashCode() : 0); result = 31 * result + (displayName != null ? displayName.hashCode() : 0); + result = 31 * result + (relation != null ? relation.hashCode() : 0); result = 31 * result + (identifier != null ? identifier.hashCode() : 0); result = 31 * result + (description != null ? description.hashCode() : 0); - result = 31 * result + (relation != null ? relation.hashCode() : 0); + result = 31 * result + (object != null ? object.hashCode() : 0); return result; } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/session/UserProfileStorage.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/session/UserProfileStorage.java index 2674e626bd4..d0dd9bc9f5e 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/session/UserProfileStorage.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/session/UserProfileStorage.java @@ -33,7 +33,9 @@ public class UserProfileStorage implements Serializable{ public enum TableId{ TABLE_ROLES, TABLE_USERS, - TREE_TABLE_PANEL, + TREE_TABLE_PANEL_CHILD, + TREE_TABLE_PANEL_MEMBER, + TREE_TABLE_PANEL_MANAGER, CONF_PAGE_ACCOUNTS, CONF_DEBUG_LIST_PANEL, PAGE_CREATED_REPORTS_PANEL, @@ -49,7 +51,9 @@ public enum TableId{ private Map pagingSizeMap = new HashMap(){{ put(TableId.TABLE_ROLES, null); put(TableId.TABLE_USERS, null); - put(TableId.TREE_TABLE_PANEL, null); + put(TableId.TREE_TABLE_PANEL_CHILD, null); + put(TableId.TREE_TABLE_PANEL_MEMBER, null); + put(TableId.TREE_TABLE_PANEL_MANAGER, null); put(TableId.CONF_PAGE_ACCOUNTS, null); put(TableId.CONF_DEBUG_LIST_PANEL, null); put(TableId.PAGE_CREATED_REPORTS_PANEL, null); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/util/WebModelUtils.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/util/WebModelUtils.java index c565940dc8c..e3c790aef11 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/util/WebModelUtils.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/util/WebModelUtils.java @@ -188,7 +188,7 @@ public static Collection> createOptionsForP } public static Collection> createMinimalOptions() { - Collection> options = new ArrayList>(); + Collection> options = new ArrayList<>(); options.add(SelectorOptions.create(ItemPath.EMPTY_PATH, GetOperationOptions.createRetrieve(RetrieveOption.DEFAULT))); return options; diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/query/EqualFilter.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/query/EqualFilter.java index a2b509365ae..005bef64476 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/query/EqualFilter.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/query/EqualFilter.java @@ -16,41 +16,27 @@ package com.evolveum.midpoint.prism.query; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; import java.util.List; import javax.xml.namespace.QName; import com.evolveum.midpoint.prism.match.MatchingRule; import com.evolveum.midpoint.prism.match.MatchingRuleRegistry; -import com.evolveum.midpoint.prism.match.PolyStringOrigMatchingRule; -import com.evolveum.prism.xml.ns._public.types_3.PolyStringType; -import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.Validate; -import org.w3c.dom.Element; import com.evolveum.midpoint.prism.Containerable; import com.evolveum.midpoint.prism.Item; -import com.evolveum.midpoint.prism.ItemDefinition; import com.evolveum.midpoint.prism.Itemable; import com.evolveum.midpoint.prism.Objectable; import com.evolveum.midpoint.prism.PrismConstants; import com.evolveum.midpoint.prism.PrismContainerDefinition; import com.evolveum.midpoint.prism.PrismContext; import com.evolveum.midpoint.prism.PrismObject; -import com.evolveum.midpoint.prism.PrismObjectDefinition; import com.evolveum.midpoint.prism.PrismProperty; import com.evolveum.midpoint.prism.PrismPropertyDefinition; import com.evolveum.midpoint.prism.PrismPropertyValue; -import com.evolveum.midpoint.prism.PrismValue; import com.evolveum.midpoint.prism.path.ItemPath; -import com.evolveum.midpoint.prism.polystring.PolyString; -import com.evolveum.midpoint.prism.util.PrismUtil; -import com.evolveum.midpoint.prism.xnode.MapXNode; -import com.evolveum.midpoint.prism.xnode.XNode; import com.evolveum.midpoint.util.DebugUtil; import com.evolveum.midpoint.util.exception.SchemaException; diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/query/ObjectFilter.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/query/ObjectFilter.java index 2866bb97832..77dfe6f1b81 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/query/ObjectFilter.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/query/ObjectFilter.java @@ -18,22 +18,15 @@ import java.io.Serializable; -import org.w3c.dom.Element; - -import com.evolveum.midpoint.prism.Itemable; import com.evolveum.midpoint.prism.Objectable; import com.evolveum.midpoint.prism.PrismContext; import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.prism.Revivable; import com.evolveum.midpoint.prism.match.MatchingRuleRegistry; import com.evolveum.midpoint.prism.parser.QueryConvertor; -import com.evolveum.midpoint.prism.path.ItemPath; -import com.evolveum.midpoint.prism.xnode.XNode; import com.evolveum.midpoint.util.DebugDumpable; import com.evolveum.midpoint.util.exception.SchemaException; - - public abstract class ObjectFilter implements DebugDumpable, Serializable, Revivable { ObjectFilter() { diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/query/OrgFilter.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/query/OrgFilter.java index 4f66ed7a70b..afe3d183ef4 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/query/OrgFilter.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/query/OrgFilter.java @@ -55,7 +55,6 @@ public static OrgFilter createRootOrg() { OrgFilter filter = new OrgFilter(); filter.setRoot(true); return filter; - } public PrismReferenceValue getOrgRef() { @@ -169,6 +168,4 @@ public boolean match(PrismObject object, MatchingRuleR // TODO Auto-generated method stub return false; } - - } diff --git a/infra/prism/src/main/java/com/evolveum/midpoint/prism/query/RefFilter.java b/infra/prism/src/main/java/com/evolveum/midpoint/prism/query/RefFilter.java index 60f99921506..250b1f283f4 100644 --- a/infra/prism/src/main/java/com/evolveum/midpoint/prism/query/RefFilter.java +++ b/infra/prism/src/main/java/com/evolveum/midpoint/prism/query/RefFilter.java @@ -23,7 +23,6 @@ import javax.xml.namespace.QName; import org.apache.commons.lang.Validate; -import org.w3c.dom.Element; import com.evolveum.midpoint.prism.Item; import com.evolveum.midpoint.prism.ItemDefinition; @@ -36,8 +35,6 @@ import com.evolveum.midpoint.prism.PrismReferenceValue; import com.evolveum.midpoint.prism.match.MatchingRuleRegistry; import com.evolveum.midpoint.prism.path.ItemPath; -import com.evolveum.midpoint.prism.xnode.MapXNode; -import com.evolveum.midpoint.prism.xnode.XNode; import com.evolveum.midpoint.util.DebugUtil; import com.evolveum.midpoint.util.exception.SchemaException; @@ -79,7 +76,7 @@ public static RefFilter createReferenceEqual(ItemPath path, PrismReferenceDefini createNullRefFilter(path, referenceDefinition); } - List refValues = new ArrayList(oids.length); + List refValues = new ArrayList<>(oids.length); for (String oid : oids){ refValues.add(new PrismReferenceValue(oid)); } From 631b0db2ca5d9cca02a17b0298c799a119fbb67c Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Mon, 16 Feb 2015 19:25:35 +0100 Subject: [PATCH 173/215] Added getManagers() tests --- .../midpoint/model/intest/TestOrgStruct.java | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java index cfb1723ac4e..3b926f8f96d 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java @@ -777,6 +777,136 @@ public void test360ElaineAssignGovernor() throws Exception { // Postcondition assertMonkeyIslandOrgSanity(); } + + @Test + public void test362ElaineAssignGovernmentMember() throws Exception { + final String TEST_NAME = "test362ElaineAssignGovernmentMember"; + TestUtil.displayTestTile(this, TEST_NAME); + + Task task = taskManager.createTaskInstance(TestOrgStruct.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + // WHEN + assignOrg(USER_ELAINE_OID, ORG_GOVERNOR_OFFICE_OID, null, task, result); + + // THEN + PrismObject userElaine = getUser(USER_ELAINE_OID); + display("User jack after", userElaine); + assertUserAssignedOrgs(userElaine, ORG_GOVERNOR_OFFICE_OID, ORG_GOVERNOR_OFFICE_OID); + assertUserHasOrgs(userElaine, ORG_GOVERNOR_OFFICE_OID, ORG_GOVERNOR_OFFICE_OID); + assertAssignedOrg(userElaine, ORG_GOVERNOR_OFFICE_OID, SchemaConstants.ORG_MANAGER); + assertAssignedOrg(userElaine, ORG_GOVERNOR_OFFICE_OID); + assertHasOrg(userElaine, ORG_GOVERNOR_OFFICE_OID, SchemaConstants.ORG_MANAGER); + + assertManager(USER_JACK_OID, USER_ELAINE_OID, null, false); + assertManager(USER_JACK_OID, USER_ELAINE_OID, ORG_TYPE_FUNCTIONAL, false); + assertManager(USER_JACK_OID, null, ORG_TYPE_PROJECT, false); + assertManager(USER_JACK_OID, USER_JACK_OID, null, true); + assertManager(USER_JACK_OID, USER_JACK_OID, ORG_TYPE_FUNCTIONAL, true); + assertManager(USER_JACK_OID, null, ORG_TYPE_PROJECT, true); + + assertManager(USER_ELAINE_OID, null, null, false); + assertManager(USER_ELAINE_OID, null, ORG_TYPE_FUNCTIONAL, false); + assertManager(USER_ELAINE_OID, null, ORG_TYPE_PROJECT, false); + assertManager(USER_ELAINE_OID, USER_ELAINE_OID, null, true); + assertManager(USER_ELAINE_OID, USER_ELAINE_OID, ORG_TYPE_FUNCTIONAL, true); + assertManager(USER_ELAINE_OID, null, ORG_TYPE_PROJECT, true); + + // Postcondition + assertMonkeyIslandOrgSanity(); + } + + @Test + public void test365GuybrushAssignSwashbucklerMember() throws Exception { + final String TEST_NAME = "test365GuybrushAssignSwashbucklerMember"; + TestUtil.displayTestTile(this, TEST_NAME); + + Task task = taskManager.createTaskInstance(TestOrgStruct.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + // WHEN + assignOrg(USER_GUYBRUSH_OID, ORG_SWASHBUCKLER_SECTION_OID, null, task, result); + + // THEN + PrismObject userGuybrush = getUser(USER_GUYBRUSH_OID); + display("User jack after", userGuybrush); + assertUserAssignedOrgs(userGuybrush, ORG_SWASHBUCKLER_SECTION_OID); + assertUserHasOrgs(userGuybrush, ORG_SWASHBUCKLER_SECTION_OID); + assertAssignedOrg(userGuybrush, ORG_SWASHBUCKLER_SECTION_OID); + assertHasOrg(userGuybrush, ORG_SWASHBUCKLER_SECTION_OID); + + assertManager(USER_JACK_OID, USER_ELAINE_OID, null, false); + assertManager(USER_JACK_OID, USER_ELAINE_OID, ORG_TYPE_FUNCTIONAL, false); + assertManager(USER_JACK_OID, null, ORG_TYPE_PROJECT, false); + assertManager(USER_JACK_OID, USER_JACK_OID, null, true); + assertManager(USER_JACK_OID, USER_JACK_OID, ORG_TYPE_FUNCTIONAL, true); + assertManager(USER_JACK_OID, null, ORG_TYPE_PROJECT, true); + + assertManager(USER_ELAINE_OID, null, null, false); + assertManager(USER_ELAINE_OID, null, ORG_TYPE_FUNCTIONAL, false); + assertManager(USER_ELAINE_OID, null, ORG_TYPE_PROJECT, false); + assertManager(USER_ELAINE_OID, USER_ELAINE_OID, null, true); + assertManager(USER_ELAINE_OID, USER_ELAINE_OID, ORG_TYPE_FUNCTIONAL, true); + assertManager(USER_ELAINE_OID, null, ORG_TYPE_PROJECT, true); + + assertManager(USER_GUYBRUSH_OID, USER_JACK_OID, null, false); + assertManager(USER_GUYBRUSH_OID, USER_JACK_OID, ORG_TYPE_FUNCTIONAL, false); + assertManager(USER_GUYBRUSH_OID, null, ORG_TYPE_PROJECT, false); + assertManager(USER_GUYBRUSH_OID, USER_JACK_OID, null, true); + assertManager(USER_GUYBRUSH_OID, USER_JACK_OID, ORG_TYPE_FUNCTIONAL, true); + assertManager(USER_GUYBRUSH_OID, null, ORG_TYPE_PROJECT, true); + + // Postcondition + assertMonkeyIslandOrgSanity(); + } + + @Test + public void test368GuybrushAssignSwashbucklerManager() throws Exception { + final String TEST_NAME = "test368GuybrushAssignSwashbucklerManager"; + TestUtil.displayTestTile(this, TEST_NAME); + + Task task = taskManager.createTaskInstance(TestOrgStruct.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + // WHEN + assignOrg(USER_GUYBRUSH_OID, ORG_SWASHBUCKLER_SECTION_OID, SchemaConstants.ORG_MANAGER, task, result); + + // THEN + PrismObject userGuybrush = getUser(USER_GUYBRUSH_OID); + display("User jack after", userGuybrush); + assertUserAssignedOrgs(userGuybrush, ORG_SWASHBUCKLER_SECTION_OID, ORG_SWASHBUCKLER_SECTION_OID); + assertUserHasOrgs(userGuybrush, ORG_SWASHBUCKLER_SECTION_OID, ORG_SWASHBUCKLER_SECTION_OID); + assertAssignedOrg(userGuybrush, ORG_SWASHBUCKLER_SECTION_OID); + assertAssignedOrg(userGuybrush, ORG_SWASHBUCKLER_SECTION_OID, SchemaConstants.ORG_MANAGER); + assertHasOrg(userGuybrush, ORG_SWASHBUCKLER_SECTION_OID); + assertHasOrg(userGuybrush, ORG_SWASHBUCKLER_SECTION_OID, SchemaConstants.ORG_MANAGER); + + assertManager(USER_JACK_OID, USER_ELAINE_OID, null, false); + assertManager(USER_JACK_OID, USER_ELAINE_OID, ORG_TYPE_FUNCTIONAL, false); + assertManager(USER_JACK_OID, null, ORG_TYPE_PROJECT, false); + assertManager(USER_JACK_OID, USER_JACK_OID, null, true); + assertManager(USER_JACK_OID, USER_JACK_OID, ORG_TYPE_FUNCTIONAL, true); + assertManager(USER_JACK_OID, null, ORG_TYPE_PROJECT, true); + + assertManager(USER_ELAINE_OID, null, null, false); + assertManager(USER_ELAINE_OID, null, ORG_TYPE_FUNCTIONAL, false); + assertManager(USER_ELAINE_OID, null, ORG_TYPE_PROJECT, false); + assertManager(USER_ELAINE_OID, USER_ELAINE_OID, null, true); + assertManager(USER_ELAINE_OID, USER_ELAINE_OID, ORG_TYPE_FUNCTIONAL, true); + assertManager(USER_ELAINE_OID, null, ORG_TYPE_PROJECT, true); + + assertManager(USER_GUYBRUSH_OID, USER_JACK_OID, null, false); + assertManager(USER_GUYBRUSH_OID, USER_JACK_OID, ORG_TYPE_FUNCTIONAL, false); + assertManager(USER_GUYBRUSH_OID, null, ORG_TYPE_PROJECT, false); + assertManager(USER_GUYBRUSH_OID, USER_GUYBRUSH_OID, null, true); + assertManager(USER_GUYBRUSH_OID, USER_GUYBRUSH_OID, ORG_TYPE_FUNCTIONAL, true); + assertManager(USER_GUYBRUSH_OID, null, ORG_TYPE_PROJECT, true); + + // Postcondition + assertMonkeyIslandOrgSanity(); + } + + @Test public void test399DeleteJack() throws Exception { From c1a1542b282f818afa00e34f080c9f15d1ec2bc6 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Tue, 17 Feb 2015 09:21:24 +0100 Subject: [PATCH 174/215] Reworked from orgFilter to refFilter --- .../model/impl/expr/MidpointFunctionsImpl.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/expr/MidpointFunctionsImpl.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/expr/MidpointFunctionsImpl.java index 864e018c53b..fb2eea95d4b 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/expr/MidpointFunctionsImpl.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/expr/MidpointFunctionsImpl.java @@ -276,7 +276,18 @@ public OrgType getParentOrgByOrgType(ObjectType object, String orgType) throws S public Collection getManagersOfOrg(String orgOid) throws SchemaException { Set retval = new HashSet(); OperationResult result = new OperationResult("getManagerOfOrg"); - ObjectQuery objectQuery = ObjectQuery.createObjectQuery(OrgFilter.createOrg(orgOid, OrgFilter.Scope.ONE_LEVEL)); + + PrismObjectDefinition userDef = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(UserType.class); + PrismReferenceDefinition parentOrgRefDef = userDef.findReferenceDefinition(ObjectType.F_PARENT_ORG_REF); + PrismReference parentOrgRef = parentOrgRefDef.instantiate(); + PrismReferenceValue parentOrgRefVal = new PrismReferenceValue(orgOid, OrgType.COMPLEX_TYPE); + parentOrgRefVal.setRelation(SchemaConstants.ORG_MANAGER); + parentOrgRef.add(parentOrgRefVal); + ObjectQuery objectQuery = ObjectQuery.createObjectQuery(RefFilter.createReferenceEqual( + new ItemPath(ObjectType.F_PARENT_ORG_REF), parentOrgRef)); + + // ObjectQuery objectQuery = ObjectQuery.createObjectQuery(OrgFilter.createOrg(orgOid, OrgFilter.Scope.ONE_LEVEL)); + List> members = repositoryService.searchObjects(ObjectType.class, objectQuery, null, result); for (PrismObject member : members) { if (member.asObjectable() instanceof UserType) { From fc57cf39f228279a1220818063bb8e4546ad6c77 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Tue, 17 Feb 2015 09:51:41 +0100 Subject: [PATCH 175/215] More tests for getManagersOfOrg, small optimization --- .../impl/expr/MidpointFunctionsImpl.java | 4 +- .../midpoint/model/intest/TestOrgStruct.java | 110 ++++++++++++++++++ 2 files changed, 112 insertions(+), 2 deletions(-) diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/expr/MidpointFunctionsImpl.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/expr/MidpointFunctionsImpl.java index fb2eea95d4b..41fd9f8348c 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/expr/MidpointFunctionsImpl.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/expr/MidpointFunctionsImpl.java @@ -292,9 +292,9 @@ public Collection getManagersOfOrg(String orgOid) throws SchemaExcepti for (PrismObject member : members) { if (member.asObjectable() instanceof UserType) { UserType user = (UserType) member.asObjectable(); - if (isManagerOf(user, orgOid)) { +// if (isManagerOf(user, orgOid)) { retval.add(user); - } +// } } } return retval; diff --git a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java index 3b926f8f96d..e0e3f56ffd4 100644 --- a/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java +++ b/model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/TestOrgStruct.java @@ -79,6 +79,7 @@ public class TestOrgStruct extends AbstractInitializedModelIntegrationTest { public void initSystem(Task initTask, OperationResult initResult) throws Exception { super.initSystem(initTask, initResult); addObject(ROLE_DEFENDER_FILE); + addObject(USER_HERMAN_FILE); //DebugUtil.setDetailedDebugDump(true); } @@ -906,7 +907,116 @@ public void test368GuybrushAssignSwashbucklerManager() throws Exception { assertMonkeyIslandOrgSanity(); } + @Test + public void test370BarbossaAssignOffenseMember() throws Exception { + final String TEST_NAME = "test370BarbossaAssignOffenseMember"; + TestUtil.displayTestTile(this, TEST_NAME); + + Task task = taskManager.createTaskInstance(TestOrgStruct.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + + // WHEN + assignOrg(USER_BARBOSSA_OID, ORG_MINISTRY_OF_OFFENSE_OID, null, task, result); + + // THEN + PrismObject userBarbossa = getUser(USER_BARBOSSA_OID); + display("User jack after", userBarbossa); + assertUserAssignedOrgs(userBarbossa, ORG_MINISTRY_OF_OFFENSE_OID); + assertUserHasOrgs(userBarbossa, ORG_MINISTRY_OF_OFFENSE_OID); + assertAssignedOrg(userBarbossa, ORG_MINISTRY_OF_OFFENSE_OID); + assertHasOrg(userBarbossa, ORG_MINISTRY_OF_OFFENSE_OID); + + assertManager(USER_JACK_OID, USER_ELAINE_OID, null, false); + assertManager(USER_JACK_OID, USER_ELAINE_OID, ORG_TYPE_FUNCTIONAL, false); + assertManager(USER_JACK_OID, null, ORG_TYPE_PROJECT, false); + assertManager(USER_JACK_OID, USER_JACK_OID, null, true); + assertManager(USER_JACK_OID, USER_JACK_OID, ORG_TYPE_FUNCTIONAL, true); + assertManager(USER_JACK_OID, null, ORG_TYPE_PROJECT, true); + + assertManager(USER_ELAINE_OID, null, null, false); + assertManager(USER_ELAINE_OID, null, ORG_TYPE_FUNCTIONAL, false); + assertManager(USER_ELAINE_OID, null, ORG_TYPE_PROJECT, false); + assertManager(USER_ELAINE_OID, USER_ELAINE_OID, null, true); + assertManager(USER_ELAINE_OID, USER_ELAINE_OID, ORG_TYPE_FUNCTIONAL, true); + assertManager(USER_ELAINE_OID, null, ORG_TYPE_PROJECT, true); + + assertManager(USER_GUYBRUSH_OID, USER_JACK_OID, null, false); + assertManager(USER_GUYBRUSH_OID, USER_JACK_OID, ORG_TYPE_FUNCTIONAL, false); + assertManager(USER_GUYBRUSH_OID, null, ORG_TYPE_PROJECT, false); + assertManager(USER_GUYBRUSH_OID, USER_GUYBRUSH_OID, null, true); + assertManager(USER_GUYBRUSH_OID, USER_GUYBRUSH_OID, ORG_TYPE_FUNCTIONAL, true); + assertManager(USER_GUYBRUSH_OID, null, ORG_TYPE_PROJECT, true); + + assertManager(USER_BARBOSSA_OID, USER_JACK_OID, null, false); + assertManager(USER_BARBOSSA_OID, USER_JACK_OID, ORG_TYPE_FUNCTIONAL, false); + assertManager(USER_BARBOSSA_OID, null, ORG_TYPE_PROJECT, false); + assertManager(USER_BARBOSSA_OID, USER_JACK_OID, null, true); + assertManager(USER_BARBOSSA_OID, USER_JACK_OID, ORG_TYPE_FUNCTIONAL, true); + assertManager(USER_BARBOSSA_OID, null, ORG_TYPE_PROJECT, true); + + // Postcondition + assertMonkeyIslandOrgSanity(); + } + @Test + public void test372HermanAssignSwashbucklerMember() throws Exception { + final String TEST_NAME = "test365GuybrushAssignSwashbucklerMember"; + TestUtil.displayTestTile(this, TEST_NAME); + + Task task = taskManager.createTaskInstance(TestOrgStruct.class.getName() + "." + TEST_NAME); + OperationResult result = task.getResult(); + PrismObject userHerman = getUser(USER_HERMAN_OID); + assertHasNoOrg(userHerman); + + // WHEN + assignOrg(USER_HERMAN_OID, ORG_SWASHBUCKLER_SECTION_OID, null, task, result); + + // THEN + userHerman = getUser(USER_HERMAN_OID); + display("User jack after", userHerman); + assertUserAssignedOrgs(userHerman, ORG_SWASHBUCKLER_SECTION_OID); + assertUserHasOrgs(userHerman, ORG_SWASHBUCKLER_SECTION_OID); + assertAssignedOrg(userHerman, ORG_SWASHBUCKLER_SECTION_OID); + assertHasOrg(userHerman, ORG_SWASHBUCKLER_SECTION_OID); + + assertManager(USER_JACK_OID, USER_ELAINE_OID, null, false); + assertManager(USER_JACK_OID, USER_ELAINE_OID, ORG_TYPE_FUNCTIONAL, false); + assertManager(USER_JACK_OID, null, ORG_TYPE_PROJECT, false); + assertManager(USER_JACK_OID, USER_JACK_OID, null, true); + assertManager(USER_JACK_OID, USER_JACK_OID, ORG_TYPE_FUNCTIONAL, true); + assertManager(USER_JACK_OID, null, ORG_TYPE_PROJECT, true); + + assertManager(USER_ELAINE_OID, null, null, false); + assertManager(USER_ELAINE_OID, null, ORG_TYPE_FUNCTIONAL, false); + assertManager(USER_ELAINE_OID, null, ORG_TYPE_PROJECT, false); + assertManager(USER_ELAINE_OID, USER_ELAINE_OID, null, true); + assertManager(USER_ELAINE_OID, USER_ELAINE_OID, ORG_TYPE_FUNCTIONAL, true); + assertManager(USER_ELAINE_OID, null, ORG_TYPE_PROJECT, true); + + assertManager(USER_GUYBRUSH_OID, USER_JACK_OID, null, false); + assertManager(USER_GUYBRUSH_OID, USER_JACK_OID, ORG_TYPE_FUNCTIONAL, false); + assertManager(USER_GUYBRUSH_OID, null, ORG_TYPE_PROJECT, false); + assertManager(USER_GUYBRUSH_OID, USER_GUYBRUSH_OID, null, true); + assertManager(USER_GUYBRUSH_OID, USER_GUYBRUSH_OID, ORG_TYPE_FUNCTIONAL, true); + assertManager(USER_GUYBRUSH_OID, null, ORG_TYPE_PROJECT, true); + + assertManager(USER_BARBOSSA_OID, USER_JACK_OID, null, false); + assertManager(USER_BARBOSSA_OID, USER_JACK_OID, ORG_TYPE_FUNCTIONAL, false); + assertManager(USER_BARBOSSA_OID, null, ORG_TYPE_PROJECT, false); + assertManager(USER_BARBOSSA_OID, USER_JACK_OID, null, true); + assertManager(USER_BARBOSSA_OID, USER_JACK_OID, ORG_TYPE_FUNCTIONAL, true); + assertManager(USER_BARBOSSA_OID, null, ORG_TYPE_PROJECT, true); + + assertManager(USER_HERMAN_OID, USER_GUYBRUSH_OID, null, false); + assertManager(USER_HERMAN_OID, USER_GUYBRUSH_OID, ORG_TYPE_FUNCTIONAL, false); + assertManager(USER_HERMAN_OID, null, ORG_TYPE_PROJECT, false); + assertManager(USER_HERMAN_OID, USER_GUYBRUSH_OID, null, true); + assertManager(USER_HERMAN_OID, USER_GUYBRUSH_OID, ORG_TYPE_FUNCTIONAL, true); + assertManager(USER_HERMAN_OID, null, ORG_TYPE_PROJECT, true); + + // Postcondition + assertMonkeyIslandOrgSanity(); + } @Test public void test399DeleteJack() throws Exception { From 566b670e8eb48aaf9bb3156d1fdbe8744dcb14cd Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Tue, 17 Feb 2015 11:23:24 +0100 Subject: [PATCH 176/215] Fixing trafo story --- .../test/resources/common/user-administrator.xml | 12 ++---------- .../src/test/resources/trafo/role-employee.xml | 14 +++++--------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/testing/story/src/test/resources/common/user-administrator.xml b/testing/story/src/test/resources/common/user-administrator.xml index b3087e7747b..b9745683c0e 100644 --- a/testing/story/src/test/resources/common/user-administrator.xml +++ b/testing/story/src/test/resources/common/user-administrator.xml @@ -1,6 +1,6 @@ - - - - - - - - diff --git a/testing/story/src/test/resources/trafo/role-employee.xml b/testing/story/src/test/resources/trafo/role-employee.xml index 8022e2f2820..9038774c6ef 100644 --- a/testing/story/src/test/resources/trafo/role-employee.xml +++ b/testing/story/src/test/resources/trafo/role-employee.xml @@ -1,5 +1,5 @@ - - - - From 97ad913903426ca0bca22f2c41b30d04a684536e Mon Sep 17 00:00:00 2001 From: Viliam Repan Date: Tue, 17 Feb 2015 11:31:11 +0100 Subject: [PATCH 177/215] fix for reference storing, metadata with the same createApproverRef and modifyApproverRef couldn't be stored. --- repo/repo-sql-impl-test/STATS | 4 - .../midpoint/repo/sql/ModifyUser.java | 2 +- .../repo/sql/QueryInterpreterTest.java | 15 +--- .../sql/closure/AbstractOrgClosureTest.java | 6 +- .../midpoint/repo/sql/OrgClosureManager.java | 6 +- .../repo/sql/data/common/RAbstractRole.java | 7 +- .../midpoint/repo/sql/data/common/RFocus.java | 5 +- .../repo/sql/data/common/RLookupTable.java | 6 +- .../repo/sql/data/common/RObject.java | 10 +-- .../sql/data/common/RObjectReference.java | 21 +++-- .../repo/sql/data/common/RObjectTemplate.java | 7 +- .../repo/sql/data/common/RResource.java | 9 +- .../data/common/container/RAssignment.java | 16 ++-- .../container/RAssignmentReference.java | 19 ++-- .../data/common/id/RCObjectReferenceId.java | 17 +++- .../data/common/id/RObjectReferenceId.java | 15 +++- .../data/common/other/RCReferenceOwner.java | 51 +---------- .../data/common/other/RLookupTableRow.java | 10 +-- .../data/common/other/RReferenceOwner.java | 87 +++---------------- .../data/common/type/RACreateApproverRef.java | 32 ------- .../data/common/type/RAModifyApproverRef.java | 32 ------- .../data/common/type/RCreateApproverRef.java | 32 ------- .../sql/data/common/type/RIncludeRef.java | 32 ------- .../repo/sql/data/common/type/RLinkRef.java | 32 ------- .../data/common/type/RModifyApproverRef.java | 32 ------- .../sql/data/common/type/RParentOrgRef.java | 32 ------- .../common/type/RResourceApproverRef.java | 32 ------- .../data/common/type/RRoleApproverRef.java | 32 ------- .../sql/data/factory/MetadataFactory.java | 3 +- .../repo/sql/query/custom/OrgFilterQuery.java | 2 +- .../sql/query/restriction/OrgRestriction.java | 19 ++-- .../midpoint/repo/sql/util/RUtil.java | 10 +-- 32 files changed, 118 insertions(+), 517 deletions(-) delete mode 100644 repo/repo-sql-impl-test/STATS delete mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RACreateApproverRef.java delete mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RAModifyApproverRef.java delete mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RCreateApproverRef.java delete mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RIncludeRef.java delete mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RLinkRef.java delete mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RModifyApproverRef.java delete mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RParentOrgRef.java delete mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RResourceApproverRef.java delete mode 100644 repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RRoleApproverRef.java diff --git a/repo/repo-sql-impl-test/STATS b/repo/repo-sql-impl-test/STATS deleted file mode 100644 index 2e3a3acf2e0..00000000000 --- a/repo/repo-sql-impl-test/STATS +++ /dev/null @@ -1,4 +0,0 @@ -find . -name "test.log" -exec cat {} \; | grep org.hibernate.SQL | grep -v ": $" | wc -l -long(default,aspectj,extratest) - TestLdapUniversity (4k entries): -646563 => - diff --git a/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/ModifyUser.java b/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/ModifyUser.java index 75480ed9bf5..42abb95b820 100644 --- a/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/ModifyUser.java +++ b/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/ModifyUser.java @@ -129,7 +129,7 @@ public void test070ModifyBigUser() throws Exception { repositoryService.modifyObject(UserType.class, userBigOid, delta.getModifications(), new OperationResult("asdf")); } - @Test(enabled = false) + @Test public void test100ModifyUserApproverMetadata() throws Exception { PrismObjectDefinition userDefinition = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(UserType.class); ReferenceDelta delta1 = ReferenceDelta.createModificationAdd( diff --git a/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/QueryInterpreterTest.java b/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/QueryInterpreterTest.java index be92632d6be..b557ef7b984 100644 --- a/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/QueryInterpreterTest.java +++ b/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/QueryInterpreterTest.java @@ -19,7 +19,6 @@ import com.evolveum.midpoint.prism.Objectable; import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.prism.PrismObjectDefinition; -import com.evolveum.midpoint.prism.PrismPropertyDefinition; import com.evolveum.midpoint.prism.match.PolyStringNormMatchingRule; import com.evolveum.midpoint.prism.match.PolyStringOrigMatchingRule; import com.evolveum.midpoint.prism.path.ItemPath; @@ -35,18 +34,12 @@ import com.evolveum.midpoint.repo.sql.data.common.other.RObjectType; import com.evolveum.midpoint.repo.sql.data.common.type.RAssignmentExtensionType; import com.evolveum.midpoint.repo.sql.data.common.type.RObjectExtensionType; -import com.evolveum.midpoint.repo.sql.data.common.type.RParentOrgRef; -import com.evolveum.midpoint.repo.sql.query.QueryEngine; import com.evolveum.midpoint.repo.sql.query.QueryException; -import com.evolveum.midpoint.repo.sql.query.RQuery; -import com.evolveum.midpoint.repo.sql.query.RQueryCriteriaImpl; import com.evolveum.midpoint.repo.sql.type.XMLGregorianCalendarType; import com.evolveum.midpoint.repo.sql.util.HibernateToSqlTranslator; import com.evolveum.midpoint.schema.MidPointPrismContextFactory; -import com.evolveum.midpoint.schema.SchemaConstantsGenerated; import com.evolveum.midpoint.schema.constants.MidPointConstants; import com.evolveum.midpoint.schema.result.OperationResult; -import com.evolveum.midpoint.util.DOMUtil; import com.evolveum.midpoint.util.PrettyPrinter; import com.evolveum.midpoint.util.QNameUtil; import com.evolveum.midpoint.util.exception.SchemaException; @@ -54,8 +47,6 @@ import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; import org.hibernate.Criteria; -import org.hibernate.FetchMode; -import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.criterion.*; import org.hibernate.sql.JoinType; @@ -945,7 +936,8 @@ public void queryOrgTreeFindOrgs() throws Exception { addFullObjectProjectionList("o", projections, false); main.setProjection(projections); - DetachedCriteria detached = DetachedCriteria.forClass(RParentOrgRef.class, "p"); + DetachedCriteria detached = DetachedCriteria.forClass(RObjectReference.class, "p"); + detached.add(Restrictions.eq("referenceType", 0)); detached.setProjection(Projections.distinct(Projections.property("p.ownerOid"))); detached.add(Restrictions.eq("p.targetOid", "some oid")); @@ -1140,7 +1132,8 @@ public void test310QueryNameAndOrg() throws Exception { Session session = open(); try { - DetachedCriteria detached = DetachedCriteria.forClass(RParentOrgRef.class, "p"); + DetachedCriteria detached = DetachedCriteria.forClass(RObjectReference.class, "p"); + detached.add(Restrictions.eq("referenceType", 0)); detached.setProjection(Projections.distinct(Projections.property("p.ownerOid"))); detached.add(Property.forName("targetOid").in( DetachedCriteria.forClass(ROrgClosure.class, "cl") diff --git a/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/closure/AbstractOrgClosureTest.java b/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/closure/AbstractOrgClosureTest.java index bc48abce4d7..5e14007dfb6 100644 --- a/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/closure/AbstractOrgClosureTest.java +++ b/repo/repo-sql-impl-test/src/test/java/com/evolveum/midpoint/repo/sql/closure/AbstractOrgClosureTest.java @@ -619,14 +619,14 @@ private void registerVertexIfNeeded(String oid) { } protected List getChildren(String oid) { - Query childrenQuery = getSession().createQuery("select distinct ownerOid from RParentOrgRef where targetOid=:oid"); + Query childrenQuery = getSession().createQuery("select distinct ownerOid from RObjectReference where targetOid=:oid and referenceType=0"); childrenQuery.setString("oid", oid); return childrenQuery.list(); } private List getOrgChildren(String oid) { - Query childrenQuery = getSession().createQuery("select distinct parentRef.ownerOid from RParentOrgRef as parentRef" + - " join parentRef.owner as owner where parentRef.targetOid=:oid" + + Query childrenQuery = getSession().createQuery("select distinct parentRef.ownerOid from RObjectReference as parentRef" + + " join parentRef.owner as owner where parentRef.targetOid=:oid and parentRef.referenceType=0" + " and owner.objectTypeClass = :orgType"); childrenQuery.setParameter("orgType", RObjectType.ORG); // TODO eliminate use of parameter here childrenQuery.setString("oid", oid); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/OrgClosureManager.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/OrgClosureManager.java index 62b7ff53709..ba13991c5f8 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/OrgClosureManager.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/OrgClosureManager.java @@ -1275,14 +1275,14 @@ private boolean isTypeNonLeaf(Class type) { } private List getParents(String oid, Session session) { - Query parentsQuery = session.createQuery("select distinct targetOid from RParentOrgRef where ownerOid=:oid"); + Query parentsQuery = session.createQuery("select distinct targetOid from RObjectReference where ownerOid=:oid and referenceType=0"); parentsQuery.setString("oid", oid); return parentsQuery.list(); } private List getChildren(String oid, Session session) { - Query childrenQuery = session.createQuery("select distinct parentRef.ownerOid from RParentOrgRef as parentRef" + - " join parentRef.owner as owner where parentRef.targetOid=:oid" + + Query childrenQuery = session.createQuery("select distinct parentRef.ownerOid from RObjectReference as parentRef" + + " join parentRef.owner as owner where parentRef.targetOid=:oid and parentRef.referenceType=0" + " and owner.objectTypeClass = :orgType"); childrenQuery.setParameter("orgType", RObjectType.ORG); // TODO eliminate use of parameter here childrenQuery.setString("oid", oid); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RAbstractRole.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RAbstractRole.java index b89d3b38a1d..51f1c57c7ff 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RAbstractRole.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RAbstractRole.java @@ -22,7 +22,6 @@ import com.evolveum.midpoint.repo.sql.data.common.container.RExclusion; import com.evolveum.midpoint.repo.sql.data.common.other.RAssignmentOwner; import com.evolveum.midpoint.repo.sql.data.common.other.RReferenceOwner; -import com.evolveum.midpoint.repo.sql.data.common.type.RRoleApproverRef; import com.evolveum.midpoint.repo.sql.query.definition.JaxbName; import com.evolveum.midpoint.repo.sql.query.definition.QueryEntity; import com.evolveum.midpoint.repo.sql.query.definition.VirtualCollection; @@ -34,7 +33,6 @@ import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ExclusionType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType; - import org.hibernate.annotations.Cascade; import org.hibernate.annotations.ForeignKey; import org.hibernate.annotations.Index; @@ -44,7 +42,6 @@ import javax.persistence.Entity; import javax.persistence.OneToMany; import javax.persistence.Transient; - import java.util.HashSet; import java.util.Set; @@ -92,7 +89,7 @@ public Set getExclusion() { return exclusion; } - @Where(clause = RObjectReference.REFERENCE_TYPE + "=" + RRoleApproverRef.DISCRIMINATOR) + @Where(clause = RObjectReference.REFERENCE_TYPE + "= 3") @OneToMany(mappedBy = "owner", orphanRemoval = true) @ForeignKey(name = "none") @Cascade({org.hibernate.annotations.CascadeType.ALL}) @@ -177,7 +174,7 @@ public static void copyFromJAXB(AbstractRoleType ja repo.getApproverRef().add(ref); } } - + PrismObjectDefinition roleDefinition = jaxb.asPrismObject().getDefinition(); repo.setApprovalProcess(jaxb.getApprovalProcess()); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RFocus.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RFocus.java index 46f8d8d8da3..4c89a645a4d 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RFocus.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RFocus.java @@ -21,7 +21,6 @@ import com.evolveum.midpoint.repo.sql.data.common.embedded.RActivation; import com.evolveum.midpoint.repo.sql.data.common.other.RAssignmentOwner; import com.evolveum.midpoint.repo.sql.data.common.other.RReferenceOwner; -import com.evolveum.midpoint.repo.sql.data.common.type.RLinkRef; import com.evolveum.midpoint.repo.sql.query.definition.JaxbName; import com.evolveum.midpoint.repo.sql.query.definition.QueryEntity; import com.evolveum.midpoint.repo.sql.query.definition.VirtualCollection; @@ -31,7 +30,6 @@ import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType; import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType; - import org.hibernate.annotations.Cascade; import org.hibernate.annotations.ForeignKey; import org.hibernate.annotations.Index; @@ -41,7 +39,6 @@ import javax.persistence.Entity; import javax.persistence.OneToMany; import javax.persistence.Transient; - import java.util.HashSet; import java.util.Iterator; import java.util.Set; @@ -65,7 +62,7 @@ public abstract class RFocus extends RObject { private Set assignments; private RActivation activation; - @Where(clause = RObjectReference.REFERENCE_TYPE + "=" + RLinkRef.DISCRIMINATOR) + @Where(clause = RObjectReference.REFERENCE_TYPE + "= 1") @OneToMany(mappedBy = "owner", orphanRemoval = true) @ForeignKey(name = "none") @Cascade({org.hibernate.annotations.CascadeType.ALL}) diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RLookupTable.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RLookupTable.java index 070e27b260a..88dc505e0d0 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RLookupTable.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RLookupTable.java @@ -23,9 +23,9 @@ /** * @author Viliam Repan (lazyman) */ -//@Entity -//@ForeignKey(name = "fk_lookup_table") -//@Table(uniqueConstraints = @UniqueConstraint(name = "uc_lookup_name", columnNames = {"name_norm"})) +@Entity +@ForeignKey(name = "fk_lookup_table") +@Table(uniqueConstraints = @UniqueConstraint(name = "uc_lookup_name", columnNames = {"name_norm"})) public class RLookupTable extends RObject { private RPolyString name; diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObject.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObject.java index 64868c46596..07c14491da3 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObject.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObject.java @@ -25,10 +25,7 @@ import com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString; import com.evolveum.midpoint.repo.sql.data.common.other.RObjectType; import com.evolveum.midpoint.repo.sql.data.common.other.RReferenceOwner; -import com.evolveum.midpoint.repo.sql.data.common.type.RCreateApproverRef; -import com.evolveum.midpoint.repo.sql.data.common.type.RModifyApproverRef; import com.evolveum.midpoint.repo.sql.data.common.type.RObjectExtensionType; -import com.evolveum.midpoint.repo.sql.data.common.type.RParentOrgRef; import com.evolveum.midpoint.repo.sql.data.factory.MetadataFactory; import com.evolveum.midpoint.repo.sql.util.*; import com.evolveum.midpoint.schema.GetOperationOptions; @@ -43,7 +40,6 @@ import javax.persistence.*; import javax.persistence.Entity; -import javax.persistence.ForeignKey; import javax.persistence.Index; import javax.persistence.Table; import javax.xml.datatype.XMLGregorianCalendar; @@ -146,7 +142,7 @@ public Set getTrigger() { return trigger; } - @Where(clause = RObjectReference.REFERENCE_TYPE + "=" + RParentOrgRef.DISCRIMINATOR) + @Where(clause = RObjectReference.REFERENCE_TYPE + "= 0") @OneToMany(mappedBy = RObjectReference.F_OWNER, orphanRemoval = true) @Cascade({org.hibernate.annotations.CascadeType.ALL}) public Set getParentOrgRef() { @@ -182,7 +178,7 @@ public byte[] getFullObject() { return fullObject; } - @Where(clause = RObjectReference.REFERENCE_TYPE + "=" + RCreateApproverRef.DISCRIMINATOR) + @Where(clause = RObjectReference.REFERENCE_TYPE + "= 5") @OneToMany(mappedBy = RObjectReference.F_OWNER, orphanRemoval = true) // @JoinTable(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT)) @Cascade({org.hibernate.annotations.CascadeType.ALL}) @@ -211,7 +207,7 @@ public REmbeddedReference getModifierRef() { return modifierRef; } - @Where(clause = RObjectReference.REFERENCE_TYPE + "=" + RModifyApproverRef.DISCRIMINATOR) + @Where(clause = RObjectReference.REFERENCE_TYPE + "= 6") @OneToMany(mappedBy = RObjectReference.F_OWNER, orphanRemoval = true) // @JoinTable(foreignKey = @ForeignKey(name = "none")) @Cascade({org.hibernate.annotations.CascadeType.ALL}) diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObjectReference.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObjectReference.java index ba11b06f478..c35a2753bb8 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObjectReference.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObjectReference.java @@ -19,6 +19,7 @@ import com.evolveum.midpoint.prism.PrismContext; import com.evolveum.midpoint.repo.sql.data.common.id.RObjectReferenceId; import com.evolveum.midpoint.repo.sql.data.common.other.RObjectType; +import com.evolveum.midpoint.repo.sql.data.common.other.RReferenceOwner; import com.evolveum.midpoint.repo.sql.query.definition.JaxbType; import com.evolveum.midpoint.repo.sql.util.ClassMapper; import com.evolveum.midpoint.repo.sql.util.RUtil; @@ -36,17 +37,17 @@ @JaxbType(type = ObjectReferenceType.class) @Entity @IdClass(RObjectReferenceId.class) -@Table(name = "m_reference") -@org.hibernate.annotations.Table(appliesTo = "m_reference", - indexes = {@Index(name = "iReferenceTargetOid", columnNames = "targetOid")}) -@Inheritance(strategy = InheritanceType.SINGLE_TABLE) -@DiscriminatorColumn(name = RObjectReference.REFERENCE_TYPE, discriminatorType = DiscriminatorType.INTEGER) +@Table(name = "m_reference", indexes = { + @javax.persistence.Index(name = "iReferenceTargetOid", columnList = "targetOid") +}) public class RObjectReference implements ObjectReference { public static final String REFERENCE_TYPE = "reference_type"; public static final String F_OWNER = "owner"; + private RReferenceOwner referenceType; + //owner private RObject owner; private String ownerOid; @@ -87,6 +88,16 @@ public String getRelation() { return relation; } + @Id + @Column(name = REFERENCE_TYPE, nullable = false) + public RReferenceOwner getReferenceType() { + return referenceType; + } + + public void setReferenceType(RReferenceOwner referenceType) { + this.referenceType = referenceType; + } + /** * Represents {@link javax.xml.namespace.QName} type attribute in reference e.g. * {@link com.evolveum.midpoint.xml.ns._public.common.common_3.UserType} represented diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObjectTemplate.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObjectTemplate.java index 73bdbb399ac..ee7abeb2487 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObjectTemplate.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RObjectTemplate.java @@ -17,25 +17,20 @@ package com.evolveum.midpoint.repo.sql.data.common; import com.evolveum.midpoint.prism.PrismContext; -import com.evolveum.midpoint.prism.PrismObjectDefinition; import com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString; import com.evolveum.midpoint.repo.sql.data.common.enums.RObjectTemplateType; import com.evolveum.midpoint.repo.sql.data.common.other.RReferenceOwner; -import com.evolveum.midpoint.repo.sql.data.common.type.RIncludeRef; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; import com.evolveum.midpoint.schema.GetOperationOptions; import com.evolveum.midpoint.schema.SelectorOptions; -import com.evolveum.midpoint.xml.ns._public.common.common_3.MappingType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectTemplateType; - import org.hibernate.annotations.Cascade; import org.hibernate.annotations.ForeignKey; import org.hibernate.annotations.Where; import javax.persistence.*; - import java.util.Collection; import java.util.HashSet; import java.util.Set; @@ -52,7 +47,7 @@ public class RObjectTemplate extends RObject { private RObjectTemplateType type; private Set includeRef; - @Where(clause = RObjectReference.REFERENCE_TYPE + "=" + RIncludeRef.DISCRIMINATOR) + @Where(clause = RObjectReference.REFERENCE_TYPE + "= 7") @OneToMany(mappedBy = RObjectReference.F_OWNER, orphanRemoval = true) @ForeignKey(name = "none") @Cascade({org.hibernate.annotations.CascadeType.ALL}) diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RResource.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RResource.java index dd100b28ba7..a81cace0d06 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RResource.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/RResource.java @@ -16,17 +16,12 @@ package com.evolveum.midpoint.repo.sql.data.common; -import com.evolveum.midpoint.prism.ItemDefinition; -import com.evolveum.midpoint.prism.PrismContainerDefinition; import com.evolveum.midpoint.prism.PrismContext; -import com.evolveum.midpoint.prism.PrismObject; -import com.evolveum.midpoint.prism.PrismObjectDefinition; import com.evolveum.midpoint.repo.sql.data.common.embedded.REmbeddedReference; import com.evolveum.midpoint.repo.sql.data.common.embedded.ROperationalState; import com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString; import com.evolveum.midpoint.repo.sql.data.common.enums.RResourceAdministrativeState; import com.evolveum.midpoint.repo.sql.data.common.other.RReferenceOwner; -import com.evolveum.midpoint.repo.sql.data.common.type.RResourceApproverRef; import com.evolveum.midpoint.repo.sql.util.DtoTranslationException; import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult; import com.evolveum.midpoint.repo.sql.util.RUtil; @@ -36,13 +31,11 @@ import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceBusinessConfigurationType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; - import org.hibernate.annotations.Cascade; import org.hibernate.annotations.ForeignKey; import org.hibernate.annotations.Where; import javax.persistence.*; - import java.util.Collection; import java.util.HashSet; import java.util.Set; @@ -71,7 +64,7 @@ public RResourceAdministrativeState getAdministrativeState() { return administrativeState; } - @Where(clause = RObjectReference.REFERENCE_TYPE + "=" + RResourceApproverRef.DISCRIMINATOR) + @Where(clause = RObjectReference.REFERENCE_TYPE + "= 2") @OneToMany(mappedBy = "owner", orphanRemoval = true) @ForeignKey(name = "none") @Cascade({org.hibernate.annotations.CascadeType.ALL}) diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RAssignment.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RAssignment.java index 73ae9fd5648..68c9819d14d 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RAssignment.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RAssignment.java @@ -24,8 +24,6 @@ import com.evolveum.midpoint.repo.sql.data.common.embedded.REmbeddedReference; import com.evolveum.midpoint.repo.sql.data.common.id.RContainerId; import com.evolveum.midpoint.repo.sql.data.common.other.RAssignmentOwner; -import com.evolveum.midpoint.repo.sql.data.common.type.RACreateApproverRef; -import com.evolveum.midpoint.repo.sql.data.common.type.RAModifyApproverRef; import com.evolveum.midpoint.repo.sql.data.common.type.RAssignmentExtensionType; import com.evolveum.midpoint.repo.sql.data.factory.MetadataFactory; import com.evolveum.midpoint.repo.sql.query.definition.JaxbType; @@ -36,17 +34,13 @@ import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; - import org.apache.commons.lang.Validate; -import org.hibernate.annotations.*; +import org.hibernate.annotations.Cascade; +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Where; import javax.persistence.*; -import javax.persistence.Entity; -import javax.persistence.ForeignKey; -import javax.persistence.Index; -import javax.persistence.Table; import javax.xml.datatype.XMLGregorianCalendar; - import java.util.HashSet; import java.util.Set; @@ -165,7 +159,7 @@ public Integer getOrder() { return order; } - @Where(clause = RAssignmentReference.REFERENCE_TYPE + "=" + RACreateApproverRef.DISCRIMINATOR) + @Where(clause = RAssignmentReference.REFERENCE_TYPE + "= 0") @OneToMany(mappedBy = RAssignmentReference.F_OWNER, orphanRemoval = true) @org.hibernate.annotations.ForeignKey(name = "none") @Cascade({org.hibernate.annotations.CascadeType.ALL}) @@ -195,7 +189,7 @@ public REmbeddedReference getModifierRef() { return modifierRef; } - @Where(clause = RAssignmentReference.REFERENCE_TYPE + "=" + RAModifyApproverRef.DISCRIMINATOR) + @Where(clause = RAssignmentReference.REFERENCE_TYPE + "= 1") @OneToMany(mappedBy = RAssignmentReference.F_OWNER, orphanRemoval = true) // @JoinTable(foreignKey = @ForeignKey(name = "none")) @Cascade({org.hibernate.annotations.CascadeType.ALL}) diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RAssignmentReference.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RAssignmentReference.java index d630d4a294a..913a79f4ba7 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RAssignmentReference.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/container/RAssignmentReference.java @@ -20,6 +20,7 @@ import com.evolveum.midpoint.repo.sql.data.common.ObjectReference; import com.evolveum.midpoint.repo.sql.data.common.RObjectReference; import com.evolveum.midpoint.repo.sql.data.common.id.RCObjectReferenceId; +import com.evolveum.midpoint.repo.sql.data.common.other.RCReferenceOwner; import com.evolveum.midpoint.repo.sql.data.common.other.RObjectType; import com.evolveum.midpoint.repo.sql.query.definition.JaxbType; import com.evolveum.midpoint.repo.sql.util.ClassMapper; @@ -38,17 +39,17 @@ @JaxbType(type = ObjectReferenceType.class) @Entity @IdClass(RCObjectReferenceId.class) -@Table(name = "m_assignment_reference") -@org.hibernate.annotations.Table(appliesTo = "m_assignment_reference", - indexes = {@Index(name = "iAssignmentReferenceTargetOid", columnNames = "targetOid")}) -@Inheritance(strategy = InheritanceType.SINGLE_TABLE) -@DiscriminatorColumn(name = RObjectReference.REFERENCE_TYPE, discriminatorType = DiscriminatorType.INTEGER) +@Table(name = "m_assignment_reference", indexes = { + @javax.persistence.Index(name = "iAssignmentReferenceTargetOid", columnList = "targetOid") +}) public class RAssignmentReference implements ObjectReference { public static final String REFERENCE_TYPE = "reference_type"; public static final String F_OWNER = "owner"; + private RCReferenceOwner referenceType; + //owner private RAssignment owner; private String ownerOid; @@ -114,6 +115,14 @@ public RObjectType getType() { return type; } + @Id + @Column(name = REFERENCE_TYPE, nullable = false) + public RCReferenceOwner getReferenceType() { + return referenceType; + } + + public void setReferenceType(RCReferenceOwner referenceType) { this.referenceType = referenceType; } + public void setOwner(RAssignment owner) { this.owner = owner; } diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/id/RCObjectReferenceId.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/id/RCObjectReferenceId.java index 572b11bdf20..2f5cba3d799 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/id/RCObjectReferenceId.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/id/RCObjectReferenceId.java @@ -16,6 +16,8 @@ package com.evolveum.midpoint.repo.sql.data.common.id; +import com.evolveum.midpoint.repo.sql.data.common.other.RCReferenceOwner; + import java.io.Serializable; /** @@ -27,6 +29,7 @@ public class RCObjectReferenceId implements Serializable { private Short ownerId; private String targetOid; private String relation; + private RCReferenceOwner referenceType; public RCObjectReferenceId() { } @@ -63,6 +66,14 @@ public void setRelation(String relation) { this.relation = relation; } + public RCReferenceOwner getReferenceType() { + return referenceType; + } + + public void setReferenceType(RCReferenceOwner referenceType) { + this.referenceType = referenceType; + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -74,6 +85,8 @@ public boolean equals(Object o) { if (ownerId != null ? !ownerId.equals(that.ownerId) : that.ownerId != null) return false; if (targetOid != null ? !targetOid.equals(that.targetOid) : that.targetOid != null) return false; if (relation != null ? !relation.equals(that.relation) : that.relation != null) return false; + if (referenceType != null ? !referenceType.equals(that.referenceType) : that.referenceType != null) + return false; return true; } @@ -85,12 +98,14 @@ public int hashCode() { result = 31 * result + (ownerId != null ? ownerId.hashCode() : 0); result = 31 * result + (targetOid != null ? targetOid.hashCode() : 0); result = 31 * result + (relation != null ? relation.hashCode() : 0); + result = 31 * result + (referenceType != null ? referenceType.hashCode() : 0); return result; } @Override public String toString() { - return "RObjectReferenceId[" + ownerOid + "," + ownerId + "," + targetOid + "," + relation + ']'; + return "RObjectReferenceId[" + ownerOid + "," + ownerId + "," + + targetOid + "," + relation + "," + referenceType + ']'; } } diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/id/RObjectReferenceId.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/id/RObjectReferenceId.java index 6bd9a9cd989..e8adbbc16ac 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/id/RObjectReferenceId.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/id/RObjectReferenceId.java @@ -16,6 +16,8 @@ package com.evolveum.midpoint.repo.sql.data.common.id; +import com.evolveum.midpoint.repo.sql.data.common.other.RReferenceOwner; + import java.io.Serializable; /** @@ -26,6 +28,7 @@ public class RObjectReferenceId implements Serializable { private String ownerOid; private String targetOid; private String relation; + private RReferenceOwner referenceType; public RObjectReferenceId() { } @@ -54,6 +57,14 @@ public void setRelation(String relation) { this.relation = relation; } + public RReferenceOwner getReferenceType() { + return referenceType; + } + + public void setReferenceType(RReferenceOwner referenceType) { + this.referenceType = referenceType; + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -64,6 +75,7 @@ public boolean equals(Object o) { if (ownerOid != null ? !ownerOid.equals(that.ownerOid) : that.ownerOid != null) return false; if (targetOid != null ? !targetOid.equals(that.targetOid) : that.targetOid != null) return false; if (relation != null ? !relation.equals(that.relation) : that.relation != null) return false; + if (referenceType != null ? !referenceType.equals(that.referenceType) : that.referenceType != null) return false; return true; } @@ -74,12 +86,13 @@ public int hashCode() { int result = ownerOid != null ? ownerOid.hashCode() : 0; result = 31 * result + (targetOid != null ? targetOid.hashCode() : 0); result = 31 * result + (relation != null ? relation.hashCode() : 0); + result = 31 * result + (referenceType != null ? referenceType.hashCode() : 0); return result; } @Override public String toString() { - return "RObjectReferenceId[" + ownerOid + "," + targetOid + "," + relation + ']'; + return "RObjectReferenceId[" + ownerOid + "," + targetOid + "," + relation + "," + referenceType + ']'; } } diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RCReferenceOwner.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RCReferenceOwner.java index 4eeeffaec15..7e729445a71 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RCReferenceOwner.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RCReferenceOwner.java @@ -16,11 +16,6 @@ package com.evolveum.midpoint.repo.sql.data.common.other; -import com.evolveum.midpoint.repo.sql.data.common.container.RAssignmentReference; -import com.evolveum.midpoint.repo.sql.data.common.type.RACreateApproverRef; -import com.evolveum.midpoint.repo.sql.data.common.type.RAModifyApproverRef; -import org.apache.commons.lang.Validate; - /** * This is just helper enumeration for different types of reference entities * used in many relationships. @@ -29,49 +24,7 @@ */ public enum RCReferenceOwner { - /** - * this constant also have to be changed in - * {@link com.evolveum.midpoint.repo.sql.data.common.type.RCreateApproverRef} - */ - CREATE_APPROVER(RACreateApproverRef.class, RACreateApproverRef.DISCRIMINATOR), - /** - * this constant also have to be changed in - * {@link com.evolveum.midpoint.repo.sql.data.common.type.RModifyApproverRef} - */ - MODIFY_APPROVER(RAModifyApproverRef.class, RAModifyApproverRef.DISCRIMINATOR); - - private String discriminator; - private Class clazz; - - private RCReferenceOwner(Class clazz, String discriminator) { - this.discriminator = discriminator; - this.clazz = clazz; - } - - /** - * This is used for {@link org.hibernate.SessionFactory} fix in - * {@link com.evolveum.midpoint.repo.sql.util.RUtil#fixCompositeIDHandling(org.hibernate.SessionFactory)} - * - * @return class based on reference type - */ - public Class getClazz() { - return clazz; - } - - public String getDiscriminator() { - return discriminator; - } - - public static RAssignmentReference createObjectReference(RCReferenceOwner owner) { - Validate.notNull(owner, "Reference owner must not be null."); + CREATE_APPROVER, - switch (owner) { - case CREATE_APPROVER: - return new RACreateApproverRef(); - case MODIFY_APPROVER: - return new RAModifyApproverRef(); - default: - throw new IllegalArgumentException("This is unknown reference owner: " + owner); - } - } + MODIFY_APPROVER; } diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RLookupTableRow.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RLookupTableRow.java index a50da27db6a..4382521da94 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RLookupTableRow.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RLookupTableRow.java @@ -14,14 +14,14 @@ /** * @author Viliam Repan (lazyman) */ -//@Entity -//@Table(indexes = { +@Entity +@Table(indexes = { //todo create indexes after lookup api is created (when we know how we will search through lookup table [lazyman] // @Index(name = "i_row_key", columnList = "key"), // @Index(name = "i_row_label_orig", columnList = "label.orig"), // @Index(name = "i_row_label_norm", columnList = "label.norm") -//}) -//@IdClass(RLookupTableRowId.class) +}) +@IdClass(RLookupTableRowId.class) public class RLookupTableRow { private RLookupTable owner; @@ -33,7 +33,7 @@ public class RLookupTableRow { private XMLGregorianCalendar lastChangeTimestamp; @Id - @ForeignKey(name = "fk_lookup_table") + @ForeignKey(name = "fk_lookup_table_owner") @MapsId("owner") @ManyToOne(fetch = FetchType.LAZY) public RLookupTable getOwner() { diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RReferenceOwner.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RReferenceOwner.java index e22b46a414f..3c20e1a127e 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RReferenceOwner.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/other/RReferenceOwner.java @@ -16,10 +16,6 @@ package com.evolveum.midpoint.repo.sql.data.common.other; -import com.evolveum.midpoint.repo.sql.data.common.RObjectReference; -import com.evolveum.midpoint.repo.sql.data.common.type.*; -import org.apache.commons.lang.Validate; - /** * This is just helper enumeration for different types of reference entities * used in many relationships. @@ -28,84 +24,23 @@ */ public enum RReferenceOwner { - /** - * this constant also have to be changed in - * {@link com.evolveum.midpoint.repo.sql.data.common.type.RParentOrgRef} - */ - OBJECT_PARENT_ORG(RParentOrgRef.class, RParentOrgRef.DISCRIMINATOR), - /** - * this constant also have to be changed in - * {@link com.evolveum.midpoint.repo.sql.data.common.type.RLinkRef} - */ - USER_ACCOUNT(RLinkRef.class, RLinkRef.DISCRIMINATOR), - /** - * this constant also have to be changed in - * {@link com.evolveum.midpoint.repo.sql.data.common.type.RResourceApproverRef} - */ - RESOURCE_BUSINESS_CONFIGURATON_APPROVER(RResourceApproverRef.class, RResourceApproverRef.DISCRIMINATOR), - /** - * this constant also have to be changed in - * {@link com.evolveum.midpoint.repo.sql.data.common.type.RRoleApproverRef} - */ - ROLE_APPROVER(RRoleApproverRef.class, RRoleApproverRef.DISCRIMINATOR), - /** - * this constant also have to be changed in - * {@link com.evolveum.midpoint.repo.sql.data.common.type.RCreateApproverRef} - */ - CREATE_APPROVER(RCreateApproverRef.class, RCreateApproverRef.DISCRIMINATOR), - /** - * this constant also have to be changed in - * {@link com.evolveum.midpoint.repo.sql.data.common.type.RModifyApproverRef} - */ - MODIFY_APPROVER(RModifyApproverRef.class, RModifyApproverRef.DISCRIMINATOR), - /** - * this constant also have to be changed in - * {@link com.evolveum.midpoint.repo.sql.data.common.type.RIncludeRef} - */ - INCLUDE(RIncludeRef.class, RIncludeRef.DISCRIMINATOR); + OBJECT_PARENT_ORG, + + USER_ACCOUNT, - private String discriminator; - private Class clazz; + RESOURCE_BUSINESS_CONFIGURATON_APPROVER, - private RReferenceOwner(Class clazz, String discriminator) { - this.discriminator = discriminator; - this.clazz = clazz; - } + ROLE_APPROVER, /** - * This is used for {@link org.hibernate.SessionFactory} fix in - * {@link com.evolveum.midpoint.repo.sql.util.RUtil#fixCompositeIDHandling(org.hibernate.SessionFactory)} - * - * @return class based on reference type + * @deprecated */ - public Class getClazz() { - return clazz; - } + @Deprecated + SYSTEM_CONFIGURATION_ORG_ROOT, - public String getDiscriminator() { - return discriminator; - } + CREATE_APPROVER, - public static RObjectReference createObjectReference(RReferenceOwner owner) { - Validate.notNull(owner, "Reference owner must not be null."); + MODIFY_APPROVER, - switch (owner) { - case OBJECT_PARENT_ORG: - return new RParentOrgRef(); - case ROLE_APPROVER: - return new RRoleApproverRef(); - case USER_ACCOUNT: - return new RLinkRef(); - case RESOURCE_BUSINESS_CONFIGURATON_APPROVER: - return new RResourceApproverRef(); - case CREATE_APPROVER: - return new RCreateApproverRef(); - case MODIFY_APPROVER: - return new RModifyApproverRef(); - case INCLUDE: - return new RIncludeRef(); - default: - throw new IllegalArgumentException("This is unknown reference owner: " + owner); - } - } + INCLUDE; } diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RACreateApproverRef.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RACreateApproverRef.java deleted file mode 100644 index 035c1d14db0..00000000000 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RACreateApproverRef.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2010-2013 Evolveum - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.evolveum.midpoint.repo.sql.data.common.type; - -import com.evolveum.midpoint.repo.sql.data.common.container.RAssignmentReference; - -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; - -/** - * @author lazyman - */ -@Entity -@DiscriminatorValue(RACreateApproverRef.DISCRIMINATOR) -public class RACreateApproverRef extends RAssignmentReference { - - public static final String DISCRIMINATOR = "0"; -} diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RAModifyApproverRef.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RAModifyApproverRef.java deleted file mode 100644 index ddc68235921..00000000000 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RAModifyApproverRef.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2010-2013 Evolveum - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.evolveum.midpoint.repo.sql.data.common.type; - -import com.evolveum.midpoint.repo.sql.data.common.container.RAssignmentReference; - -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; - -/** - * @author lazyman - */ -@Entity -@DiscriminatorValue(RAModifyApproverRef.DISCRIMINATOR) -public class RAModifyApproverRef extends RAssignmentReference { - - public static final String DISCRIMINATOR = "1"; -} diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RCreateApproverRef.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RCreateApproverRef.java deleted file mode 100644 index 1a34052d063..00000000000 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RCreateApproverRef.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2010-2013 Evolveum - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.evolveum.midpoint.repo.sql.data.common.type; - -import com.evolveum.midpoint.repo.sql.data.common.RObjectReference; - -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; - -/** - * @author lazyman - */ -@Entity -@DiscriminatorValue(RCreateApproverRef.DISCRIMINATOR) -public class RCreateApproverRef extends RObjectReference { - - public static final String DISCRIMINATOR = "5"; -} diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RIncludeRef.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RIncludeRef.java deleted file mode 100644 index 2ea42423722..00000000000 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RIncludeRef.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2010-2013 Evolveum - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.evolveum.midpoint.repo.sql.data.common.type; - -import com.evolveum.midpoint.repo.sql.data.common.RObjectReference; - -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; - -/** - * @author lazyman - */ -@Entity -@DiscriminatorValue(RIncludeRef.DISCRIMINATOR) -public class RIncludeRef extends RObjectReference { - - public static final String DISCRIMINATOR = "7"; -} diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RLinkRef.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RLinkRef.java deleted file mode 100644 index 4236ff44917..00000000000 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RLinkRef.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2010-2013 Evolveum - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.evolveum.midpoint.repo.sql.data.common.type; - -import com.evolveum.midpoint.repo.sql.data.common.RObjectReference; - -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; - -/** - * @author lazyman - */ -@Entity -@DiscriminatorValue(RLinkRef.DISCRIMINATOR) -public class RLinkRef extends RObjectReference { - - public static final String DISCRIMINATOR = "1"; -} diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RModifyApproverRef.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RModifyApproverRef.java deleted file mode 100644 index 7b21ec380fb..00000000000 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RModifyApproverRef.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2010-2013 Evolveum - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.evolveum.midpoint.repo.sql.data.common.type; - -import com.evolveum.midpoint.repo.sql.data.common.RObjectReference; - -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; - -/** - * @author lazyman - */ -@Entity -@DiscriminatorValue(RModifyApproverRef.DISCRIMINATOR) -public class RModifyApproverRef extends RObjectReference { - - public static final String DISCRIMINATOR = "6"; -} diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RParentOrgRef.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RParentOrgRef.java deleted file mode 100644 index d9c77c73eb5..00000000000 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RParentOrgRef.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2010-2013 Evolveum - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.evolveum.midpoint.repo.sql.data.common.type; - -import com.evolveum.midpoint.repo.sql.data.common.RObjectReference; - -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; - -/** - * @author lazyman - */ -@Entity -@DiscriminatorValue(RParentOrgRef.DISCRIMINATOR) -public class RParentOrgRef extends RObjectReference { - - public static final String DISCRIMINATOR = "0"; -} diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RResourceApproverRef.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RResourceApproverRef.java deleted file mode 100644 index 161c6333c0b..00000000000 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RResourceApproverRef.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2010-2013 Evolveum - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.evolveum.midpoint.repo.sql.data.common.type; - -import com.evolveum.midpoint.repo.sql.data.common.RObjectReference; - -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; - -/** - * @author lazyman - */ -@Entity -@DiscriminatorValue(RResourceApproverRef.DISCRIMINATOR) -public class RResourceApproverRef extends RObjectReference { - - public static final String DISCRIMINATOR = "2"; -} diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RRoleApproverRef.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RRoleApproverRef.java deleted file mode 100644 index a8c26ebe436..00000000000 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/type/RRoleApproverRef.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2010-2013 Evolveum - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.evolveum.midpoint.repo.sql.data.common.type; - -import com.evolveum.midpoint.repo.sql.data.common.RObjectReference; - -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; - -/** - * @author lazyman - */ -@Entity -@DiscriminatorValue(RRoleApproverRef.DISCRIMINATOR) -public class RRoleApproverRef extends RObjectReference { - - public static final String DISCRIMINATOR = "3"; -} diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/factory/MetadataFactory.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/factory/MetadataFactory.java index 6585efd48d4..7fa9a11594b 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/factory/MetadataFactory.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/factory/MetadataFactory.java @@ -145,7 +145,8 @@ public static RAssignmentReference jaxbRefToRepo(ObjectReferenceType reference, Validate.notNull(refOwner, "Reference owner of reference must not be null."); Validate.notEmpty(reference.getOid(), "Target oid reference must not be null."); - RAssignmentReference repoRef = RCReferenceOwner.createObjectReference(refOwner); + RAssignmentReference repoRef = new RAssignmentReference(); + repoRef.setReferenceType(refOwner); repoRef.setOwner(owner); RAssignmentReference.copyFromJAXB(reference, repoRef, prismContext); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/query/custom/OrgFilterQuery.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/query/custom/OrgFilterQuery.java index e70469f19cc..2ef6cd0de59 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/query/custom/OrgFilterQuery.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/query/custom/OrgFilterQuery.java @@ -74,7 +74,7 @@ public RQuery createQuery(ObjectQuery objectQuery, Class t StringBuilder sb = new StringBuilder(); if (OrgFilter.Scope.ONE_LEVEL.equals(filter.getScope())) { sb.append("select o.fullObject,o.stringsCount,o.longsCount,o.datesCount,o.referencesCount,o.polysCount from "); - sb.append(ClassMapper.getHQLType(type)).append(" as o where o.oid in (select distinct p.ownerOid from RParentOrgRef p where p.targetOid=:oid)"); + sb.append(ClassMapper.getHQLType(type)).append(" as o where o.oid in (select distinct p.ownerOid from RObjectReference p where p.targetOid=:oid and p.referenceType=0)"); } else { sb.append("select o.fullObject,o.stringsCount,o.longsCount,o.datesCount,o.referencesCount,o.polysCount from "); sb.append(ClassMapper.getHQLType(type)).append(" as o where o.oid in ("); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/query/restriction/OrgRestriction.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/query/restriction/OrgRestriction.java index a4e8b819ab7..77ea38dd4f9 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/query/restriction/OrgRestriction.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/query/restriction/OrgRestriction.java @@ -19,18 +19,13 @@ import com.evolveum.midpoint.prism.path.ItemPath; import com.evolveum.midpoint.prism.query.ObjectFilter; import com.evolveum.midpoint.prism.query.OrgFilter; -import com.evolveum.midpoint.repo.api.query.Query; -import com.evolveum.midpoint.repo.sql.SqlRepositoryConfiguration; +import com.evolveum.midpoint.repo.sql.data.common.RObjectReference; import com.evolveum.midpoint.repo.sql.data.common.ROrgClosure; -import com.evolveum.midpoint.repo.sql.data.common.type.RParentOrgRef; +import com.evolveum.midpoint.repo.sql.data.common.other.RReferenceOwner; import com.evolveum.midpoint.repo.sql.query.QueryContext; import com.evolveum.midpoint.repo.sql.query.QueryException; -import com.evolveum.midpoint.repo.sql.util.ClassMapper; import com.evolveum.midpoint.repo.sql.util.RUtil; -import org.apache.commons.lang.ObjectUtils; -import org.hibernate.Criteria; import org.hibernate.criterion.*; -import org.hibernate.sql.JoinType; import org.hibernate.type.StringType; import org.hibernate.type.Type; @@ -81,18 +76,20 @@ public Criterion interpret(OrgFilter filter) throws QueryException { DetachedCriteria detached; switch (filter.getScope()) { case ONE_LEVEL: - detached = DetachedCriteria.forClass(RParentOrgRef.class, "p"); + detached = DetachedCriteria.forClass(RObjectReference.class, "p"); + detached.add(Restrictions.eq("referenceType", RReferenceOwner.OBJECT_PARENT_ORG)); detached.setProjection(Projections.distinct(Projections.property("p.ownerOid"))); detached.add(Restrictions.eq("p.targetOid", filter.getOrgRef().getOid())); break; case SUBTREE: default: - detached = DetachedCriteria.forClass(RParentOrgRef.class, "p"); + detached = DetachedCriteria.forClass(RObjectReference.class, "p"); + detached.add(Restrictions.eq("referenceType", RReferenceOwner.OBJECT_PARENT_ORG)); detached.setProjection(Projections.distinct(Projections.property("p.ownerOid"))); detached.add(Property.forName("targetOid").in( DetachedCriteria.forClass(ROrgClosure.class, "cl") - .setProjection(Projections.property("cl.descendantOid")) - .add(Restrictions.eq("cl.ancestorOid", filter.getOrgRef().getOid())))); + .setProjection(Projections.property("cl.descendantOid")) + .add(Restrictions.eq("cl.ancestorOid", filter.getOrgRef().getOid())))); } String mainAlias = getContext().getAlias(null); return Subqueries.propertyIn(mainAlias + ".oid", detached); diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/RUtil.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/RUtil.java index 1ae45b374c1..f339182fafa 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/RUtil.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/util/RUtil.java @@ -208,7 +208,8 @@ public static RObjectReference jaxbRefToRepo(ObjectReferenceType reference, Pris Validate.notNull(refOwner, "Reference owner of reference must not be null."); Validate.notEmpty(reference.getOid(), "Target oid reference must not be null."); - RObjectReference repoRef = RReferenceOwner.createObjectReference(refOwner); + RObjectReference repoRef = new RObjectReference(); + repoRef.setReferenceType(refOwner); repoRef.setOwner(owner); RObjectReference.copyFromJAXB(reference, repoRef, prismContext); @@ -260,14 +261,7 @@ public static void fixCompositeIDHandling(SessionFactory sessionFactory) { fixCompositeIdentifierInMetaModel(sessionFactory, RAExtLong.class); fixCompositeIdentifierInMetaModel(sessionFactory, RObjectReference.class); - for (RReferenceOwner owner : RReferenceOwner.values()) { - fixCompositeIdentifierInMetaModel(sessionFactory, owner.getClazz()); - } - fixCompositeIdentifierInMetaModel(sessionFactory, RAssignmentReference.class); - for (RCReferenceOwner owner : RCReferenceOwner.values()) { - fixCompositeIdentifierInMetaModel(sessionFactory, owner.getClazz()); - } fixCompositeIdentifierInMetaModel(sessionFactory, RAssignment.class); fixCompositeIdentifierInMetaModel(sessionFactory, RExclusion.class); From f000c9900ff67c233d79372f6ef3a666d77a7617 Mon Sep 17 00:00:00 2001 From: Radovan Semancik Date: Tue, 17 Feb 2015 11:57:18 +0100 Subject: [PATCH 178/215] General edit schema mostly complete. --- .../refinery/RefinedAttributeDefinition.java | 32 +++--------------- .../midpoint/schema/util/MiscSchemaUtil.java | 32 +++++++++++++++++- .../impl/controller/ModelController.java | 33 ++++++++++++++++--- 3 files changed, 63 insertions(+), 34 deletions(-) diff --git a/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedAttributeDefinition.java b/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedAttributeDefinition.java index abc7eb28e2f..edd5d0d1bf8 100644 --- a/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedAttributeDefinition.java +++ b/infra/common/src/main/java/com/evolveum/midpoint/common/refinery/RefinedAttributeDefinition.java @@ -27,6 +27,7 @@ import com.evolveum.midpoint.prism.schema.SchemaProcessorUtil; import com.evolveum.midpoint.schema.processor.ObjectClassComplexTypeDefinition; import com.evolveum.midpoint.schema.processor.ResourceAttributeDefinition; +import com.evolveum.midpoint.schema.util.MiscSchemaUtil; import com.evolveum.midpoint.util.DebugDumpable; import com.evolveum.midpoint.util.DebugUtil; import com.evolveum.midpoint.util.exception.SchemaException; @@ -399,12 +400,12 @@ static RefinedAttributeDefinition parse(ResourceAttributeDefinition schemaAttrDe if (schemaHandlingAttrDefType != null) { if (layer != LayerType.SCHEMA) { // SCHEMA is a pseudo-layer. It cannot be overriden ... unless specified explicitly - PropertyLimitationsType genericLimitationsType = getLimitationsType(schemaHandlingAttrDefType.getLimitations(), null); + PropertyLimitationsType genericLimitationsType = MiscSchemaUtil.getLimitationsType(schemaHandlingAttrDefType.getLimitations(), null); if (genericLimitationsType != null) { applyLimitationsType(limitations, genericLimitationsType); } } - PropertyLimitationsType layerLimitationsType = getLimitationsType(schemaHandlingAttrDefType.getLimitations(), layer); + PropertyLimitationsType layerLimitationsType = MiscSchemaUtil.getLimitationsType(schemaHandlingAttrDefType.getLimitations(), layer); if (layerLimitationsType != null) { applyLimitationsType(limitations, layerLimitationsType); } @@ -440,31 +441,6 @@ private static void applyLimitationsType(PropertyLimitations limitations, Proper } - private static PropertyLimitationsType getLimitationsType(List limitationsTypes, LayerType layer) throws SchemaException { - PropertyLimitationsType found = null; - for (PropertyLimitationsType limitType: limitationsTypes) { - if (contains(limitType.getLayer(),layer)) { - if (found == null) { - found = limitType; - } else { - throw new SchemaException("Duplicate definition of limitations for layer '"+layer+"'"); - } - } - } - return found; - } - - private static boolean contains(List layers, LayerType layer) { - if (layers == null || layers.isEmpty()) { - if (layer == null) { - return true; - } else { - return false; - } - } - return layers.contains(layer); - } - private static PropertyLimitations getOrCreateLimitations(Map limitationsMap, LayerType layer) { PropertyLimitations limitations = limitationsMap.get(layer); @@ -480,7 +456,7 @@ static boolean isIgnored(ResourceAttributeDefinitionType attrDefType) throws Sch if (limitations == null) { return false; } - PropertyLimitationsType limitationsType = getLimitationsType(limitations, DEFAULT_LAYER); + PropertyLimitationsType limitationsType = MiscSchemaUtil.getLimitationsType(limitations, DEFAULT_LAYER); if (limitationsType == null) { return false; } diff --git a/infra/schema/src/main/java/com/evolveum/midpoint/schema/util/MiscSchemaUtil.java b/infra/schema/src/main/java/com/evolveum/midpoint/schema/util/MiscSchemaUtil.java index 171e313c508..4eb5f8724b6 100644 --- a/infra/schema/src/main/java/com/evolveum/midpoint/schema/util/MiscSchemaUtil.java +++ b/infra/schema/src/main/java/com/evolveum/midpoint/schema/util/MiscSchemaUtil.java @@ -40,6 +40,7 @@ import com.evolveum.midpoint.schema.ObjectSelector; import com.evolveum.midpoint.schema.constants.SchemaConstants; import com.evolveum.midpoint.util.MiscUtil; +import com.evolveum.midpoint.util.exception.SchemaException; import com.evolveum.midpoint.xml.ns._public.common.api_types_3.GetOperationOptionsType; import com.evolveum.midpoint.xml.ns._public.common.api_types_3.ImportOptionsType; import com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectListType; @@ -50,10 +51,12 @@ import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentPolicyEnforcementType; import com.evolveum.midpoint.xml.ns._public.common.common_3.CachingMetadataType; import com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.LayerType; 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.PasswordType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ProjectionPolicyType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.PropertyLimitationsType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType; import com.evolveum.prism.xml.ns._public.types_3.ItemPathType; import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType; @@ -277,7 +280,34 @@ public static PrismReferenceValue objectReferenceTypeToReferenceValue(ObjectRefe rval.setRelation(refType.getRelation()); rval.setTargetType(refType.getType()); return rval; - + } + + public static PropertyLimitationsType getLimitationsType(List limitationsTypes, LayerType layer) throws SchemaException { + if (limitationsTypes == null) { + return null; + } + PropertyLimitationsType found = null; + for (PropertyLimitationsType limitType: limitationsTypes) { + if (contains(limitType.getLayer(),layer)) { + if (found == null) { + found = limitType; + } else { + throw new SchemaException("Duplicate definition of limitations for layer '"+layer+"'"); + } + } + } + return found; + } + + private static boolean contains(List layers, LayerType layer) { + if (layers == null || layers.isEmpty()) { + if (layer == null) { + return true; + } else { + return false; + } + } + return layers.contains(layer); } } diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java index 112088059e8..daf3030357e 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/controller/ModelController.java @@ -99,6 +99,8 @@ import com.evolveum.midpoint.prism.query.ObjectFilter; import com.evolveum.midpoint.prism.query.ObjectPaging; import com.evolveum.midpoint.prism.query.ObjectQuery; +import com.evolveum.midpoint.prism.util.PrismUtil; +import com.evolveum.midpoint.prism.xml.XsdTypeMapper; import com.evolveum.midpoint.provisioning.api.ProvisioningOperationOptions; import com.evolveum.midpoint.provisioning.api.ProvisioningService; import com.evolveum.midpoint.repo.api.RepoAddOptions; @@ -149,6 +151,7 @@ import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType; import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.PropertyAccessType; import com.evolveum.midpoint.xml.ns._public.common.common_3.PropertyLimitationsType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType; import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; @@ -886,17 +889,37 @@ private void applyObjectTemplateToDefinition(PrismObjectD List limitations = templateItemDefType.getLimitations(); if (limitations != null) { - // TODO + PropertyLimitationsType limitationsType = MiscSchemaUtil.getLimitationsType(limitations, LayerType.PRESENTATION); + if (limitationsType != null) { + if (limitationsType.getMinOccurs() != null) { + itemDef.setMinOccurs(XsdTypeMapper.multiplicityToInteger(limitationsType.getMinOccurs())); + } + if (limitationsType.getMaxOccurs() != null) { + itemDef.setMaxOccurs(XsdTypeMapper.multiplicityToInteger(limitationsType.getMaxOccurs())); + } + if (limitationsType.isIgnore() != null) { + itemDef.setIgnored(limitationsType.isIgnore()); + } + PropertyAccessType accessType = limitationsType.getAccess(); + if (accessType != null) { + if (accessType.isAdd() != null) { + itemDef.setCanAdd(accessType.isAdd()); + } + if (accessType.isModify() != null) { + itemDef.setCanModify(accessType.isModify()); + } + if (accessType.isRead() != null) { + itemDef.setCanRead(accessType.isRead()); + } + } + } } ObjectReferenceType valueEnumerationRef = templateItemDefType.getValueEnumerationRef(); if (valueEnumerationRef != null) { PrismReferenceValue valueEnumerationRVal = MiscSchemaUtil.objectReferenceTypeToReferenceValue(valueEnumerationRef); itemDef.setValueEnumerationRef(valueEnumerationRVal); - } - - // TODO - + } } } From 38630b4ee3ac4f12028e4a382e305789bda69e27 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Wed, 18 Feb 2015 12:14:34 +0100 Subject: [PATCH 179/215] "Reconcile affected objects" option implemented for roles --- .../web/page/admin/roles/PageRole.java | 2 +- .../web/page/admin/users/PageOrgUnit.java | 2 +- .../web/page/admin/users/PageUser.java | 2 +- .../web/page/admin/users/PageUsers.java | 2 +- .../component/ExecuteChangeOptionsDto.java | 12 ++ .../component/ExecuteChangeOptionsPanel.html | 4 + .../component/ExecuteChangeOptionsPanel.java | 24 +++- .../ExecuteChangeOptionsPanel.properties | 1 + .../midpoint/prism/query/RefFilter.java | 9 +- .../xml/ns/public/common/common-3.xsd | 16 +++ .../model/api/ModelExecuteOptions.java | 47 ++++++- .../impl/controller/ModelController.java | 10 +- .../midpoint/model/impl/lens/Clockwork.java | 122 +++++++++++++----- .../model/impl/sync/RecomputeTaskHandler.java | 2 +- 14 files changed, 209 insertions(+), 46 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/roles/PageRole.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/roles/PageRole.java index 4b7dc7e5d56..6d8d9d24ca6 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/roles/PageRole.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/roles/PageRole.java @@ -430,7 +430,7 @@ protected void onSubmit(AjaxRequestTarget target, Form form){ }; form.add(back); - form.add(new ExecuteChangeOptionsPanel(ID_EXECUTE_OPTIONS, executeOptionsModel, true)); + form.add(new ExecuteChangeOptionsPanel(ID_EXECUTE_OPTIONS, executeOptionsModel, true, true)); } private void savePerformed(AjaxRequestTarget target){ diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageOrgUnit.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageOrgUnit.java index eb7343e1352..5a741d7ebda 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageOrgUnit.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageOrgUnit.java @@ -530,7 +530,7 @@ public void onClick(AjaxRequestTarget target) { }; form.add(back); - form.add(new ExecuteChangeOptionsPanel(ID_EXECUTE_OPTIONS, executeOptionsModel, true)); + form.add(new ExecuteChangeOptionsPanel(ID_EXECUTE_OPTIONS, executeOptionsModel, true, false)); // TODO add "show reconcile affected" when implemented for Orgs } private boolean isEditing() { diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUser.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUser.java index 44bfd109b64..806700de479 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUser.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUser.java @@ -960,7 +960,7 @@ public void onClick(AjaxRequestTarget target) { }; mainForm.add(back); - mainForm.add(new ExecuteChangeOptionsPanel(ID_EXECUTE_OPTIONS, executeOptionsModel, true)); + mainForm.add(new ExecuteChangeOptionsPanel(ID_EXECUTE_OPTIONS, executeOptionsModel, true, false)); } private void showAssignablePopup(AjaxRequestTarget target, Class type) { diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUsers.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUsers.java index b8a9263906b..3de709466f5 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUsers.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/PageUsers.java @@ -161,7 +161,7 @@ public void yesPerformed(AjaxRequestTarget target) { initSearch(); initTable(mainForm); - mainForm.add(new ExecuteChangeOptionsPanel(ID_EXECUTE_OPTIONS, executeOptionsModel, false, false)); + mainForm.add(new ExecuteChangeOptionsPanel(ID_EXECUTE_OPTIONS, executeOptionsModel, false, false, false)); } private IModel createDeleteConfirmString() { diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/ExecuteChangeOptionsDto.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/ExecuteChangeOptionsDto.java index 9df14f5f83e..ce29ede7c6f 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/ExecuteChangeOptionsDto.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/ExecuteChangeOptionsDto.java @@ -27,11 +27,13 @@ public class ExecuteChangeOptionsDto implements Serializable { public static final String F_FORCE = "force"; public static final String F_RECONCILE = "reconcile"; + public static final String F_RECONCILE_AFFECTED = "reconcileAffected"; public static final String F_EXECUTE_AFTER_ALL_APPROVALS = "executeAfterAllApprovals"; public static final String F_KEEP_DISPLAYING_RESULTS = "keepDisplayingResults"; private boolean force; private boolean reconcile; + private boolean reconcileAffected; private boolean executeAfterAllApprovals = true; private boolean keepDisplayingResults; @@ -51,6 +53,14 @@ public void setReconcile(boolean reconcile) { this.reconcile = reconcile; } + public boolean isReconcileAffected() { + return reconcileAffected; + } + + public void setReconcileAffected(boolean reconcileAffected) { + this.reconcileAffected = reconcileAffected; + } + public boolean isExecuteAfterAllApprovals() { return executeAfterAllApprovals; } @@ -71,6 +81,7 @@ public ModelExecuteOptions createOptions() { ModelExecuteOptions options = new ModelExecuteOptions(); options.setForce(isForce()); options.setReconcile(isReconcile()); + options.setReconcileAffected(isReconcileAffected()); options.setExecuteImmediatelyAfterApproval(!isExecuteAfterAllApprovals()); return options; @@ -81,6 +92,7 @@ public String toString() { StringBuilder builder = new StringBuilder(); builder.append("Options{force=").append(isForce()); builder.append(",reconcile=").append(isReconcile()); + builder.append(",reconcileAffected=").append(isReconcileAffected()); builder.append(",keepDisplayingResults=").append(isKeepDisplayingResults()); builder.append('}'); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/ExecuteChangeOptionsPanel.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/ExecuteChangeOptionsPanel.html index e0ebb8d4610..cb334883e13 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/ExecuteChangeOptionsPanel.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/users/component/ExecuteChangeOptionsPanel.html @@ -29,6 +29,10 @@ +
diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/WizardSteps.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/WizardSteps.java index 18f348da56a..454cf888ade 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/WizardSteps.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/WizardSteps.java @@ -20,12 +20,13 @@ import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour; import com.evolveum.midpoint.web.component.wizard.resource.component.WizardHelpDialog; import org.apache.wicket.AttributeModifier; -import org.apache.wicket.ajax.AjaxEventBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.AjaxLink; +import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink; import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; import org.apache.wicket.extensions.wizard.IWizardStep; import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.list.ListItem; import org.apache.wicket.markup.html.list.ListView; import org.apache.wicket.model.AbstractReadOnlyModel; @@ -39,6 +40,7 @@ */ public class WizardSteps extends SimplePanel> { + private static final String ID_LINK_REPEATER = "linkRepeater"; private static final String ID_LINK = "link"; private static final String ID_LABEL = "label"; private static final String ID_BUTTON_HELP = "help"; @@ -50,15 +52,23 @@ public WizardSteps(String id, IModel> model) { @Override protected void initLayout() { - ListView link = new ListView(ID_LINK, getModel()) { + ListView linkContainer = new ListView(ID_LINK_REPEATER, getModel()) { @Override protected void populateItem(ListItem item) { final WizardStepDto dto = item.getModelObject(); - Label label = new Label(ID_LABEL, createLabelModel(dto.getName())); - item.add(label); + item.setRenderBodyOnly(true); - item.add(new VisibleEnableBehaviour() { + AjaxSubmitLink button = new AjaxSubmitLink(ID_LINK) { + + @Override + protected void onSubmit(AjaxRequestTarget target, Form form) { + changeStepPerformed(target, dto); + } + }; + item.add(button); + + button.add(new VisibleEnableBehaviour() { @Override public boolean isEnabled() { @@ -71,8 +81,7 @@ public boolean isVisible() { } }); - - item.add(AttributeModifier.replace("class", new AbstractReadOnlyModel() { + button.add(AttributeModifier.replace("class", new AbstractReadOnlyModel() { @Override public String getObject() { @@ -80,16 +89,11 @@ public String getObject() { } })); - item.add(new AjaxEventBehavior("onclick") { - - @Override - protected void onEvent(AjaxRequestTarget target) { - changeStepPerformed(target, dto); - } - }); + Label label = new Label(ID_LABEL, createLabelModel(dto.getName())); + button.add(label); } }; - add(link); + add(linkContainer); AjaxLink help = new AjaxLink(ID_BUTTON_HELP) { diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/SchemaListPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/SchemaListPanel.java index 7b76b78892c..3f3290ee081 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/SchemaListPanel.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/SchemaListPanel.java @@ -354,7 +354,7 @@ private RefinedResourceSchema loadResourceSchema() { return null; } - return RefinedResourceSchema.getRefinedSchema(getModel().getObject(), getPageBase().getPrismContext()); + return RefinedResourceSchema.getRefinedSchema(resource, getPageBase().getPrismContext()); } catch (Exception ex) { LoggingUtils.logException(LOGGER, "Couldn't parse resource schema.", ex); getSession().error(getString("SchemaListPanel.message.couldntParseSchema") + " " + ex.getMessage()); From 5b785098d6f628362f224aca3f9b7d163734b1ac Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Mon, 26 Jan 2015 13:24:17 +0100 Subject: [PATCH 056/215] fix for MID-2159 with associations --- .../wizard/resource/SchemaHandlingStep.java | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java index 15f3d97fcfe..6071590f355 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java @@ -150,11 +150,11 @@ private SchemaHandlingDto lodObjectTypes(){ // temporary fix - think about better solution if(objectType.getAttribute().isEmpty()){ - objectType.getAttribute().add(new ResourceAttributeDefinitionType()); + objectType.getAttribute().add(createEmptyAttributeObject()); } if(objectType.getAssociation().isEmpty()){ - objectType.getAssociation().add(new ResourceObjectAssociationType()); + objectType.getAssociation().add(createEmptyAssociationObject()); } obj = new ResourceObjectTypeDefinitionTypeDto(objectType); @@ -172,8 +172,8 @@ private SchemaHandlingDto lodObjectTypes(){ private ResourceObjectTypeDefinitionType createPlaceholderObjectType(){ //TODO temporary fix - think about better solution ResourceObjectTypeDefinitionType placeholder = new ResourceObjectTypeDefinitionType(); - placeholder.getAttribute().add(new ResourceAttributeDefinitionType()); - placeholder.getAssociation().add(new ResourceObjectAssociationType()); + placeholder.getAttribute().add(createEmptyAttributeObject()); + placeholder.getAssociation().add(createEmptyAssociationObject()); return placeholder; } @@ -394,9 +394,7 @@ public String getObject() { @Override protected ResourceAttributeDefinitionType createNewEmptyItem(){ - ResourceAttributeDefinitionType attribute = new ResourceAttributeDefinitionType(); - attribute.setTolerant(true); - return attribute; + return createEmptyAttributeObject(); } @Override @@ -447,7 +445,7 @@ public String getObject() { @Override protected ResourceObjectAssociationType createNewEmptyItem(){ - return new ResourceObjectAssociationType(); + return createEmptyAssociationObject(); } @Override @@ -752,11 +750,11 @@ private void editObjectTypePerformed(AjaxRequestTarget target, ResourceObjectTyp objectType.setSelected(true); if(objectType.getObjectType().getAssociation().isEmpty()){ - objectType.getObjectType().getAssociation().add(new ResourceObjectAssociationType()); + objectType.getObjectType().getAssociation().add(createEmptyAssociationObject()); } if(objectType.getObjectType().getAttribute().isEmpty()){ - objectType.getObjectType().getAttribute().add(new ResourceAttributeDefinitionType()); + objectType.getObjectType().getAttribute().add(createEmptyAttributeObject()); } model.getObject().setSelected(objectType.getObjectType()); @@ -789,8 +787,8 @@ private void deleteObjectTypePerformed(AjaxRequestTarget target, ResourceObjectT private void addObjectTypePerformed(AjaxRequestTarget target){ ResourceObjectTypeDefinitionType objectType = new ResourceObjectTypeDefinitionType(); - objectType.getAttribute().add(new ResourceAttributeDefinitionType()); - objectType.getAssociation().add(new ResourceObjectAssociationType()); + objectType.getAttribute().add(createEmptyAttributeObject()); + objectType.getAssociation().add(createEmptyAssociationObject()); objectType.setDisplayName(getString("SchemaHandlingStep.label.newObjectType")); ResourceObjectTypeDefinitionTypeDto dto = new ResourceObjectTypeDefinitionTypeDto(objectType); @@ -990,4 +988,16 @@ private boolean compareItemPath(ItemPathType itemPath, String comparePath){ return false; } + + private ResourceObjectAssociationType createEmptyAssociationObject(){ + ResourceObjectAssociationType association = new ResourceObjectAssociationType(); + association.setTolerant(true); + return association; + } + + private ResourceAttributeDefinitionType createEmptyAttributeObject(){ + ResourceAttributeDefinitionType attribute = new ResourceAttributeDefinitionType(); + attribute.setTolerant(true); + return attribute; + } } From 64973a1354cde34df8b77b97b7572254aeb6ecb1 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Mon, 26 Jan 2015 15:48:32 +0100 Subject: [PATCH 057/215] fix for MID-2161 --- .../wizard/resource/SchemaHandlingStep.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java index 6071590f355..08976dde723 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java @@ -824,6 +824,12 @@ private void removeEmptyContainers(PrismObject resourcePrism){ objectType.getAttribute().clear(); objectType.getAttribute().addAll(newAttributeList); + for(ResourceAttributeDefinitionType attr: objectType.getAttribute()){ + List newInbounds = clearEmptyMappings(attr.getInbound()); + attr.getInbound().clear(); + attr.getInbound().addAll(newInbounds); + } + //Clear obsolete containers from associations List newAssociationList = new ArrayList<>(); newAssociationList.addAll(objectType.getAssociation()); @@ -835,11 +841,29 @@ private void removeEmptyContainers(PrismObject resourcePrism){ objectType.getAssociation().clear(); objectType.getAssociation().addAll(newAssociationList); + for(ResourceObjectAssociationType association: objectType.getAssociation()){ + List newInbounds = clearEmptyMappings(association.getInbound()); + association.getInbound().clear(); + association.getInbound().addAll(newInbounds); + } + prepareActivation(objectType.getActivation()); } } } + private List clearEmptyMappings(List list){ + List newList = new ArrayList<>(); + + for(MappingType mapping: list){ + if(!WizardUtil.isEmptyMapping(mapping)){ + newList.add(mapping); + } + } + + return newList; + } + private void prepareActivation(ResourceActivationDefinitionType activation){ if(activation == null){ return; From 4e18d683b8d1ee8d1f92668928bad25d584ec478 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Mon, 26 Jan 2015 16:10:18 +0100 Subject: [PATCH 058/215] fix for MID-2033, issue 17 --- .../wizard/resource/SchemaHandlingStep.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java index 08976dde723..f92f49bfa86 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java @@ -769,17 +769,13 @@ private void deleteObjectTypePerformed(AjaxRequestTarget target, ResourceObjectT list.remove(objectType); if(objectType.isSelected()){ - model.getObject().setSelected(createPlaceholderObjectType()); insertEmptyThirdRow(); target.add(getThirdRowContainer()); } if(list.isEmpty()){ - ResourceObjectTypeDefinitionType newObj = new ResourceObjectTypeDefinitionType(); - newObj.setDisplayName(getString("SchemaHandlingStep.label.newObjectType")); - ResourceObjectTypeDefinitionTypeDto dto = new ResourceObjectTypeDefinitionTypeDto(newObj); - dto.setSelected(true); - list.add(dto); + insertEmptyThirdRow(); + target.add(getThirdRowContainer()); } target.add(getObjectTypeEditor(), getObjectListTable(), getNavigator()); @@ -792,6 +788,10 @@ private void addObjectTypePerformed(AjaxRequestTarget target){ objectType.setDisplayName(getString("SchemaHandlingStep.label.newObjectType")); ResourceObjectTypeDefinitionTypeDto dto = new ResourceObjectTypeDefinitionTypeDto(objectType); + if(model.getObject().getObjectTypeList().isEmpty()){ + objectType.setDefault(true); + } + resetSelected(); dto.setSelected(true); model.getObject().setSelected(dto.getObjectType()); From aebcb37e0afe730fa0600c88e85786a350ac7cd7 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Mon, 26 Jan 2015 19:15:36 +0100 Subject: [PATCH 059/215] Ability to reset artificially set midPoint time in Internals config --- .../admin/configuration/PageInternals.html | 1 + .../admin/configuration/PageInternals.java | 26 ++++++++++++++++++- .../configuration/PageInternals.properties | 1 + .../security/MidPointApplication.properties | 1 + 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.html index 3013b88d867..101fb093bc0 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/admin/configuration/PageInternals.html @@ -32,6 +32,7 @@