Skip to content

Commit

Permalink
repo-sqale: removed MReport, there are no columns beyond MObject now
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed Jun 17, 2021
1 parent 990a497 commit f43d6b0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 51 deletions.
5 changes: 1 addition & 4 deletions repo/repo-sqale/sql/pgnew-repo.sql
Original file line number Diff line number Diff line change
Expand Up @@ -962,9 +962,7 @@ CREATE INDEX m_value_policy_policySituation_idx
CREATE TABLE m_report (
oid UUID NOT NULL PRIMARY KEY REFERENCES m_object_oid(oid),
objectType ObjectType GENERATED ALWAYS AS ('REPORT') STORED
CHECK (objectType = 'REPORT'),
orientation OrientationType,
parent BOOLEAN
CHECK (objectType = 'REPORT')
)
INHERITS (m_assignment_holder);

Expand All @@ -979,7 +977,6 @@ CREATE INDEX m_report_nameOrig_idx ON m_report (nameOrig);
ALTER TABLE m_report ADD CONSTRAINT m_report_nameNorm_key UNIQUE (nameNorm);
CREATE INDEX m_report_subtypes_idx ON m_report USING gin(subtypes);
CREATE INDEX m_report_policySituation_idx ON m_report USING GIN(policysituations gin__int_ops);
-- TODO old repo had index on parent (boolean), does it make sense? if so, which value is sparse?

-- Represents ReportDataType, see also m_report above
CREATE TABLE m_report_data (
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,26 @@
*/
package com.evolveum.midpoint.repo.sqale.qmodel.report;

import java.sql.Types;

import com.querydsl.core.types.dsl.BooleanPath;
import com.querydsl.core.types.dsl.EnumPath;
import com.querydsl.sql.ColumnMetadata;

import com.evolveum.midpoint.repo.sqale.qmodel.object.MObject;
import com.evolveum.midpoint.repo.sqale.qmodel.object.QAssignmentHolder;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OrientationType;

/**
* Querydsl query type for {@value #TABLE_NAME} table.
*/
@SuppressWarnings("unused")
public class QReport extends QAssignmentHolder<MReport> {
public class QReport extends QAssignmentHolder<MObject> {

private static final long serialVersionUID = -5738006878845987541L;

public static final String TABLE_NAME = "m_report";

public static final ColumnMetadata ORIENTATION =
ColumnMetadata.named("orientation").ofType(Types.OTHER);
public static final ColumnMetadata PARENT =
ColumnMetadata.named("parent").ofType(Types.BOOLEAN);

public final EnumPath<OrientationType> orientation =
createEnum("orientation", OrientationType.class, ORIENTATION);
public final BooleanPath parent = createBoolean("parent", PARENT);
// no additional columns and relations

public QReport(String variable) {
this(variable, DEFAULT_SCHEMA_NAME, TABLE_NAME);
}

public QReport(String variable, String schema, String table) {
super(MReport.class, variable, schema, table);
super(MObject.class, variable, schema, table);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
import org.jetbrains.annotations.NotNull;

import com.evolveum.midpoint.repo.sqale.SqaleRepoContext;
import com.evolveum.midpoint.repo.sqale.qmodel.object.MObject;
import com.evolveum.midpoint.repo.sqale.qmodel.object.QAssignmentHolderMapping;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType;

/**
* Mapping between {@link QReport} and {@link ReportType}.
*/
public class QReportMapping
extends QAssignmentHolderMapping<ReportType, QReport, MReport> {
extends QAssignmentHolderMapping<ReportType, QReport, MObject> {

public static final String DEFAULT_ALIAS_NAME = "rep";

Expand All @@ -33,9 +34,4 @@ private QReportMapping(@NotNull SqaleRepoContext repositoryContext) {
protected QReport newAliasInstance(String alias) {
return new QReport(alias);
}

@Override
public MReport newRowObject() {
return new MReport();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import com.evolveum.midpoint.repo.sqale.qmodel.lookuptable.QLookupTableRow;
import com.evolveum.midpoint.repo.sqale.qmodel.object.*;
import com.evolveum.midpoint.repo.sqale.qmodel.ref.*;
import com.evolveum.midpoint.repo.sqale.qmodel.report.MReport;
import com.evolveum.midpoint.repo.sqale.qmodel.report.MReportData;
import com.evolveum.midpoint.repo.sqale.qmodel.report.QReport;
import com.evolveum.midpoint.repo.sqale.qmodel.report.QReportData;
Expand Down Expand Up @@ -1358,12 +1357,10 @@ public void test813Report() throws Exception {
when("adding it to the repository");
repositoryService.addObject(report.asPrismObject(), null, result);

then("it is stored and relevant attributes are in columns");
then("report is stored");
assertThatOperationResult(result).isSuccess();

MReport row = selectObjectByOid(QReport.class, report.getOid());
assertThat(row.orientation).isEqualTo(OrientationType.LANDSCAPE);
assertThat(row.parent).isTrue();
selectObjectByOid(QReport.class, report.getOid());
}

@Test
Expand Down

0 comments on commit f43d6b0

Please sign in to comment.