Skip to content

Commit

Permalink
repo-sql-impl: query2 merged to query, no more 2 suffix
Browse files Browse the repository at this point in the history
Still fighting with generics on some types, e.g. whole JpaLinkDefinition
hierarchy and related JpaDataNodeDefinition hierarchy.
  • Loading branch information
virgo47 committed Jun 19, 2020
1 parent 8ae6376 commit a3d0c5a
Show file tree
Hide file tree
Showing 109 changed files with 673 additions and 722 deletions.
Expand Up @@ -54,9 +54,9 @@
import com.evolveum.midpoint.repo.sql.data.common.any.RExtItem;
import com.evolveum.midpoint.repo.sql.query.QueryException;
import com.evolveum.midpoint.repo.sql.query.RQuery;
import com.evolveum.midpoint.repo.sql.query2.QueryEngine2;
import com.evolveum.midpoint.repo.sql.query2.RQueryImpl;
import com.evolveum.midpoint.repo.sql.query2.hqm.RootHibernateQuery;
import com.evolveum.midpoint.repo.sql.query.QueryEngine;
import com.evolveum.midpoint.repo.sql.query.RQueryImpl;
import com.evolveum.midpoint.repo.sql.query.hqm.RootHibernateQuery;
import com.evolveum.midpoint.repo.sql.type.XMLGregorianCalendarType;
import com.evolveum.midpoint.repo.sql.util.RUtil;
import com.evolveum.midpoint.schema.GetOperationOptions;
Expand All @@ -80,7 +80,7 @@
*/
@ContextConfiguration(locations = { "../../../../../ctx-test.xml" })
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
public class QueryInterpreter2Test extends BaseSQLRepoTest {
public class QueryInterpreterTest extends BaseSQLRepoTest {

private static final File TEST_DIR = new File("./src/test/resources/query");

Expand Down Expand Up @@ -4621,7 +4621,7 @@ private <T extends Containerable> RQuery getInterpretedQuery2Whole(Session sessi
logger.info("QUERY TYPE TO CONVERT :\n{}", (query.getFilter() != null ? query.getFilter().debugDump(3) : null));
}

QueryEngine2 engine = new QueryEngine2(baseHelper.getConfiguration(), extItemDictionary, prismContext, relationRegistry);
QueryEngine engine = new QueryEngine(baseHelper.getConfiguration(), extItemDictionary, prismContext, relationRegistry);
RQuery rQuery = engine.interpret(query, type, options, interpretCount, session);
//just test if DB will handle it or throws some exception
if (interpretCount) {
Expand Down
2 changes: 1 addition & 1 deletion repo/repo-sql-impl-test/testng-integration.xml
Expand Up @@ -18,7 +18,7 @@
</test>
<test name="Query Add Tests" parallel="false" preserve-order="true" verbose="10" enabled="true">
<classes>
<class name="com.evolveum.midpoint.repo.sql.QueryInterpreter2Test"/>
<class name="com.evolveum.midpoint.repo.sql.QueryInterpreterTest"/>
<class name="com.evolveum.midpoint.repo.sql.DeleteTest"/>
<class name="com.evolveum.midpoint.repo.sql.DeleteTestSimple"/>
<class name="com.evolveum.midpoint.repo.sql.AddGetObjectTest"/>
Expand Down
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2010-2014 Evolveum and contributors
* Copyright (c) 2010-2020 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.repo.sql.data.common;

import java.io.Serializable;
import javax.persistence.*;

import org.hibernate.annotations.ForeignKey;

import com.evolveum.midpoint.repo.sql.data.common.id.RFocusPhotoId;
import com.evolveum.midpoint.repo.sql.helpers.modify.Ignore;
import com.evolveum.midpoint.repo.sql.query2.definition.NotQueryable;
import com.evolveum.midpoint.repo.sql.query.definition.NotQueryable;
import com.evolveum.midpoint.repo.sql.util.EntityState;
import com.evolveum.midpoint.repo.sql.util.RUtil;
import org.hibernate.annotations.ForeignKey;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Arrays;

/**
* @author lazyman
Expand Down Expand Up @@ -81,8 +81,8 @@ public void setPhoto(byte[] photo) {

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (this == o) { return true; }
if (o == null || getClass() != o.getClass()) { return false; }

RFocusPhoto photo = (RFocusPhoto) o;

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2015 Evolveum and contributors
* Copyright (c) 2010-2020 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
Expand Down Expand Up @@ -39,12 +39,7 @@
import com.evolveum.midpoint.repo.sql.data.common.other.RReferenceType;
import com.evolveum.midpoint.repo.sql.data.common.type.RObjectExtensionType;
import com.evolveum.midpoint.repo.sql.data.factory.MetadataFactory;
import com.evolveum.midpoint.repo.sql.query.definition.JaxbName;
import com.evolveum.midpoint.repo.sql.query.definition.JaxbPath;
import com.evolveum.midpoint.repo.sql.query.definition.QueryEntity;
import com.evolveum.midpoint.repo.sql.query.definition.VirtualAny;
import com.evolveum.midpoint.repo.sql.query2.definition.IdQueryProperty;
import com.evolveum.midpoint.repo.sql.query2.definition.NotQueryable;
import com.evolveum.midpoint.repo.sql.query.definition.*;
import com.evolveum.midpoint.repo.sql.util.*;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

Expand Down
Expand Up @@ -22,7 +22,7 @@
import com.evolveum.midpoint.repo.sql.data.common.other.RObjectType;
import com.evolveum.midpoint.repo.sql.data.common.other.RReferenceType;
import com.evolveum.midpoint.repo.sql.query.definition.JaxbType;
import com.evolveum.midpoint.repo.sql.query2.definition.NotQueryable;
import com.evolveum.midpoint.repo.sql.query.definition.NotQueryable;
import com.evolveum.midpoint.repo.sql.util.ClassMapper;
import com.evolveum.midpoint.repo.sql.util.EntityState;
import com.evolveum.midpoint.repo.sql.util.MidPointSingleTablePersister;
Expand Down
@@ -1,12 +1,22 @@
/*
* Copyright (c) 2010-2013 Evolveum and contributors
* Copyright (c) 2010-2020 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.repo.sql.data.common;

import static com.evolveum.midpoint.repo.sql.data.common.RObjectTextInfo.TABLE_NAME;

import java.io.Serializable;
import java.util.*;
import javax.persistence.*;

import org.apache.commons.lang3.StringUtils;
import org.hibernate.annotations.ForeignKey;
import org.jetbrains.annotations.NotNull;

import com.evolveum.midpoint.prism.Item;
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.PrismPropertyValue;
Expand All @@ -16,22 +26,13 @@
import com.evolveum.midpoint.repo.sql.data.RepositoryContext;
import com.evolveum.midpoint.repo.sql.data.common.id.RObjectTextInfoId;
import com.evolveum.midpoint.repo.sql.helpers.modify.Ignore;
import com.evolveum.midpoint.repo.sql.query2.definition.NotQueryable;
import com.evolveum.midpoint.repo.sql.query.definition.NotQueryable;
import com.evolveum.midpoint.repo.sql.util.RUtil;
import com.evolveum.midpoint.schema.util.FullTextSearchConfigurationUtil;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.annotations.ForeignKey;
import org.jetbrains.annotations.NotNull;

import javax.persistence.*;
import java.io.Serializable;
import java.util.*;
import java.util.Objects;

import static com.evolveum.midpoint.repo.sql.data.common.RObjectTextInfo.TABLE_NAME;
import com.evolveum.midpoint.xml.ns._public.common.common_3.FullTextSearchConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;

/**
* @author mederly
Expand Down Expand Up @@ -102,10 +103,8 @@ public void setText(String text) {

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (!(o instanceof RObjectTextInfo))
return false;
if (this == o) { return true; }
if (!(o instanceof RObjectTextInfo)) { return false; }
RObjectTextInfo that = (RObjectTextInfo) o;
return Objects.equals(getOwnerOid(), that.getOwnerOid()) &&
Objects.equals(getText(), that.getText());
Expand Down Expand Up @@ -216,7 +215,7 @@ private static void append(List<String> allWords, PolyString text, PrismContext
@Override
public String toString() {
return "RObjectTextInfo{" +
"ownerOid='" + getOwnerOid()+ '\'' +
"ownerOid='" + getOwnerOid() + '\'' +
", text='" + text + '\'' +
'}';
}
Expand Down
@@ -1,20 +1,21 @@
/*
* Copyright (c) 2010-2013 Evolveum and contributors
* Copyright (c) 2010-2020 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.repo.sql.data.common;

import java.io.Serializable;
import javax.persistence.*;

import org.hibernate.annotations.ForeignKey;

import com.evolveum.midpoint.repo.sql.data.common.id.ROrgClosureId;
import com.evolveum.midpoint.repo.sql.helpers.modify.Ignore;
import com.evolveum.midpoint.repo.sql.query2.definition.NotQueryable;
import com.evolveum.midpoint.repo.sql.query.definition.NotQueryable;
import com.evolveum.midpoint.repo.sql.util.RUtil;
import org.hibernate.annotations.ForeignKey;

import javax.persistence.*;
import java.io.Serializable;

/**
* @author lazyman
Expand Down Expand Up @@ -60,7 +61,7 @@ public ROrgClosure(RObject ancestor, RObject descendant, int val) {

@MapsId("ancestorOid")
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumns({@JoinColumn(name = "ancestor_oid", referencedColumnName = "oid")})
@JoinColumns({ @JoinColumn(name = "ancestor_oid", referencedColumnName = "oid") })
@ForeignKey(name = "fk_ancestor")
@NotQueryable
public RObject getAncestor() {
Expand All @@ -83,7 +84,7 @@ public void setAncestor(RObject ancestor) {

@MapsId("descendantOid")
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumns({@JoinColumn(name = "descendant_oid", referencedColumnName = "oid")})
@JoinColumns({ @JoinColumn(name = "descendant_oid", referencedColumnName = "oid") })
@ForeignKey(name = "fk_descendant")
@NotQueryable
public RObject getDescendant() {
Expand Down Expand Up @@ -129,17 +130,13 @@ public int hashCode() {

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null || getClass() != obj.getClass())
return false;
if (this == obj) { return true; }
if (obj == null || getClass() != obj.getClass()) { return false; }

ROrgClosure that = (ROrgClosure) obj;

if (ancestor != null ? !ancestor.equals(that.ancestor) : that.ancestor != null)
return false;
if (descendant != null ? !descendant.equals(that.descendant) : that.descendant != null)
return false;
if (ancestor != null ? !ancestor.equals(that.ancestor) : that.ancestor != null) { return false; }
if (descendant != null ? !descendant.equals(that.descendant) : that.descendant != null) { return false; }

return true;
}
Expand Down
Expand Up @@ -23,7 +23,7 @@
import com.evolveum.midpoint.repo.sql.data.common.enums.*;
import com.evolveum.midpoint.repo.sql.query.definition.JaxbName;
import com.evolveum.midpoint.repo.sql.query.definition.NeverNull;
import com.evolveum.midpoint.repo.sql.query2.definition.NotQueryable;
import com.evolveum.midpoint.repo.sql.query.definition.NotQueryable;
import com.evolveum.midpoint.repo.sql.util.DtoTranslationException;
import com.evolveum.midpoint.repo.sql.util.IdGeneratorResult;
import com.evolveum.midpoint.repo.sql.util.MidPointJoinedPersister;
Expand Down Expand Up @@ -83,7 +83,7 @@ public String getCategory() {
}

@Enumerated(EnumType.ORDINAL)
@Column(nullable = true)
@Column
public RThreadStopAction getThreadStopAction() {
return threadStopAction;
}
Expand Down Expand Up @@ -111,7 +111,7 @@ public String getParent() {
}

@Enumerated(EnumType.ORDINAL)
@Column(nullable = true)
@Column
public RTaskBinding getBinding() {
return binding;
}
Expand Down Expand Up @@ -177,27 +177,27 @@ public String getHandlerUri() {
return handlerUri;
}

@Column(nullable = true)
@Column
public XMLGregorianCalendar getLastRunFinishTimestamp() {
return lastRunFinishTimestamp;
}

@Column(nullable = true)
@Column
public XMLGregorianCalendar getCompletionTimestamp() {
return completionTimestamp;
}

@Column(nullable = true)
@Column
public XMLGregorianCalendar getLastRunStartTimestamp() {
return lastRunStartTimestamp;
}

@Column(nullable = true)
@Column
public String getNode() {
return node;
}

@Column(nullable = true)
@Column
public String getTaskIdentifier() {
return taskIdentifier;
}
Expand Down
@@ -1,20 +1,21 @@
/*
* Copyright (c) 2010-2013 Evolveum and contributors
* Copyright (c) 2010-2020 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.repo.sql.data.common.any;

import java.util.Objects;
import javax.persistence.*;

import org.hibernate.annotations.ForeignKey;

import com.evolveum.midpoint.repo.sql.data.common.id.RAExtBooleanId;
import com.evolveum.midpoint.repo.sql.helpers.modify.Ignore;
import com.evolveum.midpoint.repo.sql.query2.definition.NotQueryable;
import com.evolveum.midpoint.repo.sql.query.definition.NotQueryable;
import com.evolveum.midpoint.repo.sql.util.RUtil;
import org.hibernate.annotations.ForeignKey;

import javax.persistence.*;
import java.util.Objects;

/**
* @author lazyman
Expand Down Expand Up @@ -80,9 +81,9 @@ public void setValue(Boolean value) {

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
if (this == o) { return true; }
if (o == null || getClass() != o.getClass()) { return false; }
if (!super.equals(o)) { return false; }
RAExtBoolean that = (RAExtBoolean) o;
return Objects.equals(value, that.value);
}
Expand Down
@@ -1,21 +1,22 @@
/*
* Copyright (c) 2010-2013 Evolveum and contributors
* Copyright (c) 2010-2020 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.repo.sql.data.common.any;

import java.sql.Timestamp;
import java.util.Objects;
import javax.persistence.*;

import org.hibernate.annotations.ForeignKey;

import com.evolveum.midpoint.repo.sql.data.common.id.RAExtDateId;
import com.evolveum.midpoint.repo.sql.helpers.modify.Ignore;
import com.evolveum.midpoint.repo.sql.query2.definition.NotQueryable;
import com.evolveum.midpoint.repo.sql.query.definition.NotQueryable;
import com.evolveum.midpoint.repo.sql.util.RUtil;
import org.hibernate.annotations.ForeignKey;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

/**
* @author lazyman
Expand Down Expand Up @@ -80,9 +81,9 @@ public void setValue(Timestamp value) {

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
if (this == o) { return true; }
if (o == null || getClass() != o.getClass()) { return false; }
if (!super.equals(o)) { return false; }
RAExtDate raExtDate = (RAExtDate) o;
return Objects.equals(value, raExtDate.value);
}
Expand Down

0 comments on commit a3d0c5a

Please sign in to comment.