#1673 - ENH: Support ProfileLocation on DtoQuery including via orm query.asDto()

This commit is contained in:
rob bygrave
2019-04-12 02:01:01 +12:00
parent 46c66b7169
commit 2639e799c5
14 changed files with 117 additions and 35 deletions
@@ -1,6 +1,7 @@
package io.ebeaninternal.server.querydefn;
import io.ebean.DtoQuery;
import io.ebean.ProfileLocation;
import io.ebeaninternal.api.BindParams;
import io.ebeaninternal.api.SpiDtoQuery;
import io.ebeaninternal.api.SpiEbeanServer;
@@ -39,6 +40,8 @@ public class DefaultDtoQuery<T> implements SpiDtoQuery<T> {
private String label;
private ProfileLocation profileLocation;
/**
* Bind parameters when using the query language.
*/
@@ -52,6 +55,7 @@ public class DefaultDtoQuery<T> implements SpiDtoQuery<T> {
this.descriptor = descriptor;
this.ormQuery = ormQuery;
this.label = ormQuery.getLabel();
this.profileLocation = ormQuery.getProfileLocation();
}
/**
@@ -166,6 +170,35 @@ public class DefaultDtoQuery<T> implements SpiDtoQuery<T> {
return label;
}
@Override
public String getPlanLabel() {
if (label != null) {
return label;
}
if (profileLocation != null) {
return profileLocation.label();
}
return null;
}
@Override
public void obtainLocation() {
if (profileLocation != null) {
profileLocation.obtain();
}
}
@Override
public DtoQuery<T> setProfileLocation(ProfileLocation profileLocation) {
this.profileLocation = profileLocation;
return this;
}
@Override
public ProfileLocation getProfileLocation() {
return profileLocation;
}
@Override
public int getFirstRow() {
return firstRow;