mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
no effective change - format only
This commit is contained in:
@@ -7,40 +7,40 @@ import java.util.List;
|
||||
*/
|
||||
public class BeanIdList {
|
||||
|
||||
private final List<Object> idList;
|
||||
private final List<Object> idList;
|
||||
|
||||
private boolean hasMore;
|
||||
|
||||
public BeanIdList(List<Object> idList) {
|
||||
this.idList = idList;
|
||||
}
|
||||
public BeanIdList(List<Object> idList) {
|
||||
this.idList = idList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an Id to the list.
|
||||
*/
|
||||
public void add(Object id){
|
||||
idList.add(id);
|
||||
}
|
||||
/**
|
||||
* Add an Id to the list.
|
||||
*/
|
||||
public void add(Object id) {
|
||||
idList.add(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of Id's.
|
||||
*/
|
||||
public List<Object> getIdList() {
|
||||
return idList;
|
||||
}
|
||||
/**
|
||||
* Return the list of Id's.
|
||||
*/
|
||||
public List<Object> getIdList() {
|
||||
return idList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if max rows was hit and there is more rows to fetch.
|
||||
*/
|
||||
public boolean isHasMore() {
|
||||
return hasMore;
|
||||
}
|
||||
/**
|
||||
* Return true if max rows was hit and there is more rows to fetch.
|
||||
*/
|
||||
public boolean isHasMore() {
|
||||
return hasMore;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set to true when max rows is hit and there are more rows to fetch.
|
||||
*/
|
||||
public void setHasMore(boolean hasMore) {
|
||||
this.hasMore = hasMore;
|
||||
}
|
||||
/**
|
||||
* Set to true when max rows is hit and there are more rows to fetch.
|
||||
*/
|
||||
public void setHasMore(boolean hasMore) {
|
||||
this.hasMore = hasMore;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.avaje.ebeaninternal.api;
|
||||
|
||||
import com.avaje.ebeaninternal.server.querydefn.NaturalKeyBindParam;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -8,8 +10,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.avaje.ebeaninternal.server.querydefn.NaturalKeyBindParam;
|
||||
|
||||
/**
|
||||
* Parameters used for binding to a statement.
|
||||
* <p>
|
||||
@@ -18,18 +18,18 @@ import com.avaje.ebeaninternal.server.querydefn.NaturalKeyBindParam;
|
||||
*/
|
||||
public class BindParams implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 4541081933302086285L;
|
||||
private static final long serialVersionUID = 4541081933302086285L;
|
||||
|
||||
private final List<Param> positionedParameters = new ArrayList<>();
|
||||
private final List<Param> positionedParameters = new ArrayList<>();
|
||||
|
||||
private final Map<String, Param> namedParameters = new LinkedHashMap<>();
|
||||
private final Map<String, Param> namedParameters = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* This is the sql. For named parameters this is the sql after the named
|
||||
* parameters have been replaced with question mark place holders and the
|
||||
* parameters have been ordered by addNamedParamInOrder().
|
||||
*/
|
||||
private String preparedSql;
|
||||
/**
|
||||
* This is the sql. For named parameters this is the sql after the named
|
||||
* parameters have been replaced with question mark place holders and the
|
||||
* parameters have been ordered by addNamedParamInOrder().
|
||||
*/
|
||||
private String preparedSql;
|
||||
|
||||
/**
|
||||
* Bind hash and count used to detect when the bind values have changed such
|
||||
@@ -37,16 +37,16 @@ public class BindParams implements Serializable {
|
||||
*/
|
||||
private int[] bindHash;
|
||||
|
||||
public BindParams() {
|
||||
}
|
||||
public BindParams() {
|
||||
}
|
||||
|
||||
public int queryBindHash() {
|
||||
int hc = namedParameters.hashCode();
|
||||
int hc = namedParameters.hashCode();
|
||||
for (Param positionedParameter : positionedParameters) {
|
||||
hc = hc * 31 + positionedParameter.hashCode();
|
||||
}
|
||||
return hc;
|
||||
}
|
||||
return hc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the hash that should be included with the query plan.
|
||||
@@ -84,136 +84,136 @@ public class BindParams implements Serializable {
|
||||
return new int[]{hc, bc};
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a deep copy of the BindParams.
|
||||
*/
|
||||
public BindParams copy() {
|
||||
BindParams copy = new BindParams();
|
||||
for (Param p : positionedParameters) {
|
||||
copy.positionedParameters.add(p.copy());
|
||||
}
|
||||
for (Entry<String, Param> entry : namedParameters.entrySet()) {
|
||||
/**
|
||||
* Return a deep copy of the BindParams.
|
||||
*/
|
||||
public BindParams copy() {
|
||||
BindParams copy = new BindParams();
|
||||
for (Param p : positionedParameters) {
|
||||
copy.positionedParameters.add(p.copy());
|
||||
}
|
||||
for (Entry<String, Param> entry : namedParameters.entrySet()) {
|
||||
copy.namedParameters.put(entry.getKey(), entry.getValue().copy());
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if there are no bind parameters.
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return positionedParameters.isEmpty() && namedParameters.isEmpty();
|
||||
}
|
||||
/**
|
||||
* Return true if there are no bind parameters.
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return positionedParameters.isEmpty() && namedParameters.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a Natural Key bind param if supported.
|
||||
*/
|
||||
public NaturalKeyBindParam getNaturalKeyBindParam() {
|
||||
if (positionedParameters != null){
|
||||
return null;
|
||||
}
|
||||
if (namedParameters != null && namedParameters.size() == 1){
|
||||
Entry<String, Param> e = namedParameters.entrySet().iterator().next();
|
||||
return new NaturalKeyBindParam(e.getKey(), e.getValue().getInValue());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Return a Natural Key bind param if supported.
|
||||
*/
|
||||
public NaturalKeyBindParam getNaturalKeyBindParam() {
|
||||
if (positionedParameters != null) {
|
||||
return null;
|
||||
}
|
||||
if (namedParameters != null && namedParameters.size() == 1) {
|
||||
Entry<String, Param> e = namedParameters.entrySet().iterator().next();
|
||||
return new NaturalKeyBindParam(e.getKey(), e.getValue().getInValue());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return positionedParameters.size();
|
||||
}
|
||||
public int size() {
|
||||
return positionedParameters.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if named parameters are being used and they have not yet been
|
||||
* ordered. The sql needs to be prepared (named replaced with ?) and the
|
||||
* parameters ordered.
|
||||
*/
|
||||
public boolean requiresNamedParamsPrepare() {
|
||||
return !namedParameters.isEmpty();
|
||||
}
|
||||
/**
|
||||
* Return true if named parameters are being used and they have not yet been
|
||||
* ordered. The sql needs to be prepared (named replaced with ?) and the
|
||||
* parameters ordered.
|
||||
*/
|
||||
public boolean requiresNamedParamsPrepare() {
|
||||
return !namedParameters.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a null parameter using position.
|
||||
*/
|
||||
public void setNullParameter(int position, int jdbcType) {
|
||||
Param p = getParam(position);
|
||||
p.setInNullType(jdbcType);
|
||||
}
|
||||
/**
|
||||
* Set a null parameter using position.
|
||||
*/
|
||||
public void setNullParameter(int position, int jdbcType) {
|
||||
Param p = getParam(position);
|
||||
p.setInNullType(jdbcType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an In Out parameter using position.
|
||||
*/
|
||||
public void setParameter(int position, Object value, int outType) {
|
||||
/**
|
||||
* Set an In Out parameter using position.
|
||||
*/
|
||||
public void setParameter(int position, Object value, int outType) {
|
||||
|
||||
Param p = getParam(position);
|
||||
p.setInValue(value);
|
||||
p.setOutType(outType);
|
||||
}
|
||||
Param p = getParam(position);
|
||||
p.setInValue(value);
|
||||
p.setOutType(outType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Using position set the In value of a parameter. Note that for nulls you
|
||||
* must use setNullParameter.
|
||||
*/
|
||||
public void setParameter(int position, Object value) {
|
||||
/**
|
||||
* Using position set the In value of a parameter. Note that for nulls you
|
||||
* must use setNullParameter.
|
||||
*/
|
||||
public void setParameter(int position, Object value) {
|
||||
|
||||
Param p = getParam(position);
|
||||
p.setInValue(value);
|
||||
}
|
||||
Param p = getParam(position);
|
||||
p.setInValue(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the parameter as an Out parameter using position.
|
||||
*/
|
||||
public void registerOut(int position, int outType) {
|
||||
Param p = getParam(position);
|
||||
p.setOutType(outType);
|
||||
}
|
||||
/**
|
||||
* Register the parameter as an Out parameter using position.
|
||||
*/
|
||||
public void registerOut(int position, int outType) {
|
||||
Param p = getParam(position);
|
||||
p.setOutType(outType);
|
||||
}
|
||||
|
||||
private Param getParam(String name) {
|
||||
Param p = namedParameters.get(name);
|
||||
if (p == null) {
|
||||
p = new Param();
|
||||
namedParameters.put(name, p);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
private Param getParam(String name) {
|
||||
Param p = namedParameters.get(name);
|
||||
if (p == null) {
|
||||
p = new Param();
|
||||
namedParameters.put(name, p);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
private Param getParam(int position) {
|
||||
int more = position - positionedParameters.size();
|
||||
if (more > 0) {
|
||||
for (int i = 0; i < more; i++) {
|
||||
positionedParameters.add(new Param());
|
||||
}
|
||||
}
|
||||
return positionedParameters.get(position - 1);
|
||||
}
|
||||
private Param getParam(int position) {
|
||||
int more = position - positionedParameters.size();
|
||||
if (more > 0) {
|
||||
for (int i = 0; i < more; i++) {
|
||||
positionedParameters.add(new Param());
|
||||
}
|
||||
}
|
||||
return positionedParameters.get(position - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a named In Out parameter.
|
||||
*/
|
||||
public void setParameter(String name, Object value, int outType) {
|
||||
/**
|
||||
* Set a named In Out parameter.
|
||||
*/
|
||||
public void setParameter(String name, Object value, int outType) {
|
||||
|
||||
Param p = getParam(name);
|
||||
p.setInValue(value);
|
||||
p.setOutType(outType);
|
||||
}
|
||||
p.setInValue(value);
|
||||
p.setOutType(outType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a named In parameter that is null.
|
||||
*/
|
||||
public void setNullParameter(String name, int jdbcType) {
|
||||
Param p = getParam(name);
|
||||
p.setInNullType(jdbcType);
|
||||
}
|
||||
/**
|
||||
* Set a named In parameter that is null.
|
||||
*/
|
||||
public void setNullParameter(String name, int jdbcType) {
|
||||
Param p = getParam(name);
|
||||
p.setInNullType(jdbcType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a named In parameter that is not null.
|
||||
*/
|
||||
public Param setParameter(String name, Object value) {
|
||||
/**
|
||||
* Set a named In parameter that is not null.
|
||||
*/
|
||||
public Param setParameter(String name, Object value) {
|
||||
|
||||
Param p = getParam(name);
|
||||
p.setInValue(value);
|
||||
return p;
|
||||
}
|
||||
Param p = getParam(name);
|
||||
p.setInValue(value);
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an encryption key as a bind value.
|
||||
@@ -227,50 +227,50 @@ public class BindParams implements Serializable {
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the named parameter as an Out parameter.
|
||||
*/
|
||||
public void registerOut(String name, int outType) {
|
||||
Param p = getParam(name);
|
||||
p.setOutType(outType);
|
||||
}
|
||||
/**
|
||||
* Register the named parameter as an Out parameter.
|
||||
*/
|
||||
public void registerOut(String name, int outType) {
|
||||
Param p = getParam(name);
|
||||
p.setOutType(outType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Parameter for a given position.
|
||||
*/
|
||||
public Param getParameter(int position) {
|
||||
// Used to read Out value by CallableSql
|
||||
return getParam(position);
|
||||
}
|
||||
/**
|
||||
* Return the Parameter for a given position.
|
||||
*/
|
||||
public Param getParameter(int position) {
|
||||
// Used to read Out value by CallableSql
|
||||
return getParam(position);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the named parameter.
|
||||
*/
|
||||
public Param getParameter(String name) {
|
||||
return getParam(name);
|
||||
}
|
||||
/**
|
||||
* Return the named parameter.
|
||||
*/
|
||||
public Param getParameter(String name) {
|
||||
return getParam(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the values of ordered parameters.
|
||||
*/
|
||||
public List<Param> positionedParameters() {
|
||||
return positionedParameters;
|
||||
}
|
||||
/**
|
||||
* Return the values of ordered parameters.
|
||||
*/
|
||||
public List<Param> positionedParameters() {
|
||||
return positionedParameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the sql with named parameters replaced with place holder ?.
|
||||
*/
|
||||
public void setPreparedSql(String preparedSql) {
|
||||
this.preparedSql = preparedSql;
|
||||
}
|
||||
/**
|
||||
* Set the sql with named parameters replaced with place holder ?.
|
||||
*/
|
||||
public void setPreparedSql(String preparedSql) {
|
||||
this.preparedSql = preparedSql;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the sql with ? place holders (named parameters have been processed
|
||||
* and ordered).
|
||||
*/
|
||||
public String getPreparedSql() {
|
||||
return preparedSql;
|
||||
}
|
||||
/**
|
||||
* Return the sql with ? place holders (named parameters have been processed
|
||||
* and ordered).
|
||||
*/
|
||||
public String getPreparedSql() {
|
||||
return preparedSql;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the bind hash and count has not changed.
|
||||
@@ -295,160 +295,160 @@ public class BindParams implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* The bind parameters in the correct binding order.
|
||||
* <p>
|
||||
* This is the result of converting sql with named parameters
|
||||
* into sql with ? and ordered parameters.
|
||||
* </p>
|
||||
*/
|
||||
public static final class OrderedList {
|
||||
* The bind parameters in the correct binding order.
|
||||
* <p>
|
||||
* This is the result of converting sql with named parameters
|
||||
* into sql with ? and ordered parameters.
|
||||
* </p>
|
||||
*/
|
||||
public static final class OrderedList {
|
||||
|
||||
private final List<Param> paramList;
|
||||
private final List<Param> paramList;
|
||||
|
||||
private final StringBuilder preparedSql;
|
||||
private final StringBuilder preparedSql;
|
||||
|
||||
public OrderedList() {
|
||||
this(new ArrayList<>());
|
||||
}
|
||||
public OrderedList() {
|
||||
this(new ArrayList<>());
|
||||
}
|
||||
|
||||
public OrderedList(List<Param> paramList) {
|
||||
this.paramList = paramList;
|
||||
this.preparedSql = new StringBuilder();
|
||||
}
|
||||
public OrderedList(List<Param> paramList) {
|
||||
this.paramList = paramList;
|
||||
this.preparedSql = new StringBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a parameter in the correct binding order.
|
||||
*/
|
||||
public void add(Param param) {
|
||||
paramList.add(param);
|
||||
}
|
||||
/**
|
||||
* Add a parameter in the correct binding order.
|
||||
*/
|
||||
public void add(Param param) {
|
||||
paramList.add(param);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of bind parameters in this list.
|
||||
*/
|
||||
public int size() {
|
||||
return paramList.size();
|
||||
}
|
||||
/**
|
||||
* Return the number of bind parameters in this list.
|
||||
*/
|
||||
public int size() {
|
||||
return paramList.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ordered list of bind parameters.
|
||||
*/
|
||||
public List<Param> list() {
|
||||
return paramList;
|
||||
}
|
||||
/**
|
||||
* Returns the ordered list of bind parameters.
|
||||
*/
|
||||
public List<Param> list() {
|
||||
return paramList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append parsedSql that has named parameters converted into ?.
|
||||
*/
|
||||
public void appendSql(String parsedSql) {
|
||||
preparedSql.append(parsedSql);
|
||||
}
|
||||
/**
|
||||
* Append parsedSql that has named parameters converted into ?.
|
||||
*/
|
||||
public void appendSql(String parsedSql) {
|
||||
preparedSql.append(parsedSql);
|
||||
}
|
||||
|
||||
public String getPreparedSql() {
|
||||
return preparedSql.toString();
|
||||
}
|
||||
}
|
||||
public String getPreparedSql() {
|
||||
return preparedSql.toString();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A In Out capable parameter for the CallableStatement.
|
||||
*/
|
||||
public static final class Param implements Serializable {
|
||||
/**
|
||||
* A In Out capable parameter for the CallableStatement.
|
||||
*/
|
||||
public static final class Param implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private boolean encryptionKey;
|
||||
|
||||
private boolean isInParam;
|
||||
private boolean isInParam;
|
||||
|
||||
private boolean isOutParam;
|
||||
private boolean isOutParam;
|
||||
|
||||
private int type;
|
||||
private int type;
|
||||
|
||||
private Object inValue;
|
||||
private Object inValue;
|
||||
|
||||
private Object outValue;
|
||||
private Object outValue;
|
||||
|
||||
/**
|
||||
* Construct a Parameter.
|
||||
*/
|
||||
public Param() {
|
||||
}
|
||||
/**
|
||||
* Construct a Parameter.
|
||||
*/
|
||||
public Param() {
|
||||
}
|
||||
|
||||
public int queryBindCount() {
|
||||
if (inValue == null) {
|
||||
return 0;
|
||||
}
|
||||
if (inValue instanceof Collection<?>){
|
||||
return ((Collection<?>)inValue).size();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
public int queryBindCount() {
|
||||
if (inValue == null) {
|
||||
return 0;
|
||||
}
|
||||
if (inValue instanceof Collection<?>) {
|
||||
return ((Collection<?>) inValue).size();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a deep copy of the Param.
|
||||
*/
|
||||
public Param copy() {
|
||||
Param copy = new Param();
|
||||
copy.isInParam = isInParam;
|
||||
copy.isOutParam = isOutParam;
|
||||
copy.type = type;
|
||||
copy.inValue = inValue;
|
||||
copy.outValue = outValue;
|
||||
return copy;
|
||||
}
|
||||
/**
|
||||
* Create a deep copy of the Param.
|
||||
*/
|
||||
public Param copy() {
|
||||
Param copy = new Param();
|
||||
copy.isInParam = isInParam;
|
||||
copy.isOutParam = isOutParam;
|
||||
copy.type = type;
|
||||
copy.inValue = inValue;
|
||||
copy.outValue = outValue;
|
||||
return copy;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int hc = getClass().hashCode();
|
||||
hc = hc * 31 + (isInParam ? 0 : 1);
|
||||
hc = hc * 31 + (isOutParam ? 0 : 1);
|
||||
hc = hc * 31 + (type);
|
||||
hc = hc * 31 + (inValue == null ? 0 : inValue.hashCode());
|
||||
return hc;
|
||||
}
|
||||
public int hashCode() {
|
||||
int hc = getClass().hashCode();
|
||||
hc = hc * 31 + (isInParam ? 0 : 1);
|
||||
hc = hc * 31 + (isOutParam ? 0 : 1);
|
||||
hc = hc * 31 + (type);
|
||||
hc = hc * 31 + (inValue == null ? 0 : inValue.hashCode());
|
||||
return hc;
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
public boolean equals(Object o) {
|
||||
return o != null && (o == this || (o instanceof Param) && hashCode() == o.hashCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this is an In parameter that needs to be bound before
|
||||
* execution.
|
||||
*/
|
||||
public boolean isInParam() {
|
||||
return isInParam;
|
||||
}
|
||||
/**
|
||||
* Return true if this is an In parameter that needs to be bound before
|
||||
* execution.
|
||||
*/
|
||||
public boolean isInParam() {
|
||||
return isInParam;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this is an out parameter that needs to be registered
|
||||
* before execution.
|
||||
*/
|
||||
public boolean isOutParam() {
|
||||
return isOutParam;
|
||||
}
|
||||
/**
|
||||
* Return true if this is an out parameter that needs to be registered
|
||||
* before execution.
|
||||
*/
|
||||
public boolean isOutParam() {
|
||||
return isOutParam;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the jdbc type of this parameter. Used for registering Out
|
||||
* parameters and setting NULL In parameters.
|
||||
*/
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
/**
|
||||
* Return the jdbc type of this parameter. Used for registering Out
|
||||
* parameters and setting NULL In parameters.
|
||||
*/
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Out parameter type.
|
||||
*/
|
||||
public void setOutType(int type) {
|
||||
this.type = type;
|
||||
this.isOutParam = true;
|
||||
}
|
||||
/**
|
||||
* Set the Out parameter type.
|
||||
*/
|
||||
public void setOutType(int type) {
|
||||
this.type = type;
|
||||
this.isOutParam = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the In value.
|
||||
*/
|
||||
public void setInValue(Object in) {
|
||||
this.inValue = in;
|
||||
this.isInParam = true;
|
||||
}
|
||||
/**
|
||||
* Set the In value.
|
||||
*/
|
||||
public void setInValue(Object in) {
|
||||
this.inValue = in;
|
||||
this.isInParam = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an encryption key (which can not be logged).
|
||||
@@ -459,39 +459,39 @@ public class BindParams implements Serializable {
|
||||
this.encryptionKey = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify that the In parameter is NULL and the specific type that it
|
||||
* is.
|
||||
*/
|
||||
public void setInNullType(int type) {
|
||||
this.type = type;
|
||||
this.inValue = null;
|
||||
this.isInParam = true;
|
||||
}
|
||||
/**
|
||||
* Specify that the In parameter is NULL and the specific type that it
|
||||
* is.
|
||||
*/
|
||||
public void setInNullType(int type) {
|
||||
this.type = type;
|
||||
this.inValue = null;
|
||||
this.isInParam = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the OUT value that was retrieved. This value is set after
|
||||
* CallableStatement was executed.
|
||||
*/
|
||||
public Object getOutValue() {
|
||||
return outValue;
|
||||
}
|
||||
/**
|
||||
* Return the OUT value that was retrieved. This value is set after
|
||||
* CallableStatement was executed.
|
||||
*/
|
||||
public Object getOutValue() {
|
||||
return outValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the In value. If this is null, then the type should be used to
|
||||
* specify the type of the null.
|
||||
*/
|
||||
public Object getInValue() {
|
||||
return inValue;
|
||||
}
|
||||
/**
|
||||
* Return the In value. If this is null, then the type should be used to
|
||||
* specify the type of the null.
|
||||
*/
|
||||
public Object getInValue() {
|
||||
return inValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the OUT value returned by a CallableStatement after it has
|
||||
* executed.
|
||||
*/
|
||||
public void setOutValue(Object out) {
|
||||
this.outValue = out;
|
||||
}
|
||||
/**
|
||||
* Set the OUT value returned by a CallableStatement after it has
|
||||
* executed.
|
||||
*/
|
||||
public void setOutValue(Object out) {
|
||||
this.outValue = out;
|
||||
}
|
||||
|
||||
/**
|
||||
* If true do not include this value in a transaction log.
|
||||
@@ -500,5 +500,5 @@ public class BindParams implements Serializable {
|
||||
return encryptionKey;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class ClassUtil {
|
||||
|
||||
ClassLoader contextLoader() {
|
||||
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||
return (loader != null) ? loader: callerLoader;
|
||||
return (loader != null) ? loader : callerLoader;
|
||||
}
|
||||
|
||||
public Class<?> forName(String name) throws ClassNotFoundException {
|
||||
|
||||
@@ -5,13 +5,13 @@ package com.avaje.ebeaninternal.api;
|
||||
*/
|
||||
public enum ConcurrencyMode {
|
||||
|
||||
/**
|
||||
* No concurrency checking.
|
||||
*/
|
||||
NONE,
|
||||
|
||||
/**
|
||||
* Use a version column.
|
||||
*/
|
||||
VERSION
|
||||
/**
|
||||
* No concurrency checking.
|
||||
*/
|
||||
NONE,
|
||||
|
||||
/**
|
||||
* Use a version column.
|
||||
*/
|
||||
VERSION
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ package com.avaje.ebeaninternal.api;
|
||||
public class HashQuery {
|
||||
|
||||
private final CQueryPlanKey planHash;
|
||||
|
||||
|
||||
private final int bindHash;
|
||||
|
||||
/**
|
||||
@@ -26,7 +26,7 @@ public class HashQuery {
|
||||
hc = 31 * hc + bindHash;
|
||||
return hc;
|
||||
}
|
||||
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
@@ -34,7 +34,7 @@ public class HashQuery {
|
||||
if (!(obj instanceof HashQuery)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
HashQuery e = (HashQuery) obj;
|
||||
return e.bindHash == bindHash && e.planHash.equals(planHash);
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ package com.avaje.ebeaninternal.api;
|
||||
public class HashQueryPlan {
|
||||
|
||||
private final String rawSql;
|
||||
|
||||
|
||||
private final int planHash;
|
||||
|
||||
|
||||
private final int bindCount;
|
||||
|
||||
public HashQueryPlan(String rawSql, int planHash, int bindCount) {
|
||||
@@ -18,7 +18,7 @@ public class HashQueryPlan {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return planHash+":"+bindCount+(rawSql != null ? ":r" : "");
|
||||
return planHash + ":" + bindCount + (rawSql != null ? ":r" : "");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -27,7 +27,7 @@ public class HashQueryPlan {
|
||||
* can be used as a shot form proxy for the actual sql.
|
||||
*/
|
||||
public String getPartialKey() {
|
||||
return planHash+"_"+bindCount;
|
||||
return planHash + "_" + bindCount;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
@@ -36,7 +36,7 @@ public class HashQueryPlan {
|
||||
hc = hc * 31 + (rawSql == null ? 0 : rawSql.hashCode());
|
||||
return hc;
|
||||
}
|
||||
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
@@ -44,11 +44,11 @@ public class HashQueryPlan {
|
||||
if (!(obj instanceof HashQueryPlan)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
HashQueryPlan e = (HashQueryPlan) obj;
|
||||
//noinspection StringEquality
|
||||
return e.planHash == planHash
|
||||
&& e.bindCount == bindCount
|
||||
&& ((e.rawSql == rawSql) || (e.rawSql != null && e.rawSql.equals(rawSql)));
|
||||
&& e.bindCount == bindCount
|
||||
&& ((e.rawSql == rawSql) || (e.rawSql != null && e.rawSql.equals(rawSql)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.Set;
|
||||
public class HashQueryPlanBuilder {
|
||||
|
||||
private int planHash;
|
||||
|
||||
|
||||
private int bindCount;
|
||||
|
||||
public HashQueryPlanBuilder() {
|
||||
@@ -16,9 +16,9 @@ public class HashQueryPlanBuilder {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return planHash+":"+bindCount;
|
||||
return planHash + ":" + bindCount;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a class to the hash calculation.
|
||||
*/
|
||||
@@ -57,7 +57,7 @@ public class HashQueryPlanBuilder {
|
||||
planHash = planHash * 92821 + (hashValue);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a boolean to the hash calculation.
|
||||
*/
|
||||
@@ -65,7 +65,7 @@ public class HashQueryPlanBuilder {
|
||||
planHash = planHash * 92821 + (booleanValue ? 92821 : 0);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a number to the bind count for the hash.
|
||||
*/
|
||||
@@ -83,7 +83,7 @@ public class HashQueryPlanBuilder {
|
||||
* Build and return the calculated HashQueryPlan.
|
||||
*/
|
||||
public String build() {
|
||||
return planHash+"_"+bindCount;
|
||||
return planHash + "_" + bindCount;
|
||||
}
|
||||
|
||||
public int getPlanHash() {
|
||||
|
||||
@@ -9,28 +9,29 @@ import com.avaje.ebean.TxScope;
|
||||
*/
|
||||
public class HelpScopeTrans {
|
||||
|
||||
/**
|
||||
* Create a ScopeTrans for a given methods TxScope.
|
||||
*/
|
||||
public static ScopeTrans createScopeTrans(TxScope txScope) {
|
||||
|
||||
EbeanServer server = Ebean.getServer(txScope.getServerName());
|
||||
SpiEbeanServer iserver = (SpiEbeanServer)server;
|
||||
return iserver.createScopeTrans(txScope);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exiting the method in an expected fashion.
|
||||
* <p>
|
||||
* That is returning successfully or via a caught exception.
|
||||
* Unexpected exceptions are caught via the Thread uncaughtExceptionHandler.
|
||||
* </p>
|
||||
* @param returnOrThrowable the return or throwable object
|
||||
* @param opCode the opcode for ATHROW or ARETURN etc
|
||||
* @param scopeTrans the scoped transaction the method was run with.
|
||||
*/
|
||||
public static void onExitScopeTrans(Object returnOrThrowable, int opCode, ScopeTrans scopeTrans){
|
||||
|
||||
scopeTrans.onExit(returnOrThrowable, opCode);
|
||||
}
|
||||
/**
|
||||
* Create a ScopeTrans for a given methods TxScope.
|
||||
*/
|
||||
public static ScopeTrans createScopeTrans(TxScope txScope) {
|
||||
|
||||
EbeanServer server = Ebean.getServer(txScope.getServerName());
|
||||
SpiEbeanServer iserver = (SpiEbeanServer) server;
|
||||
return iserver.createScopeTrans(txScope);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exiting the method in an expected fashion.
|
||||
* <p>
|
||||
* That is returning successfully or via a caught exception.
|
||||
* Unexpected exceptions are caught via the Thread uncaughtExceptionHandler.
|
||||
* </p>
|
||||
*
|
||||
* @param returnOrThrowable the return or throwable object
|
||||
* @param opCode the opcode for ATHROW or ARETURN etc
|
||||
* @param scopeTrans the scoped transaction the method was run with.
|
||||
*/
|
||||
public static void onExitScopeTrans(Object returnOrThrowable, int opCode, ScopeTrans scopeTrans) {
|
||||
|
||||
scopeTrans.onExit(returnOrThrowable, opCode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.avaje.ebeaninternal.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.avaje.ebean.bean.EntityBeanIntercept;
|
||||
import com.avaje.ebean.bean.PersistenceContext;
|
||||
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A buffer of beans for batch lazy loading and secondary query loading.
|
||||
*/
|
||||
@@ -14,7 +14,7 @@ public interface LoadBeanBuffer {
|
||||
int getBatchSize();
|
||||
|
||||
List<EntityBeanIntercept> getBatch();
|
||||
|
||||
|
||||
BeanDescriptor<?> getBeanDescriptor();
|
||||
|
||||
PersistenceContext getPersistenceContext();
|
||||
@@ -23,4 +23,4 @@ public interface LoadBeanBuffer {
|
||||
|
||||
void configureQuery(SpiQuery<?> query, String lazyLoadProperty);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,5 @@ package com.avaje.ebeaninternal.api;
|
||||
* Controls the loading of ManyToOne and OneToOne relationships.
|
||||
*/
|
||||
public interface LoadBeanContext extends LoadSecondaryQuery {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.avaje.ebeaninternal.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.avaje.ebean.bean.BeanCollection;
|
||||
import com.avaje.ebean.bean.ObjectGraphNode;
|
||||
import com.avaje.ebean.bean.PersistenceContext;
|
||||
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import com.avaje.ebeaninternal.server.deploy.BeanPropertyAssocMany;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A buffer of bean collections for batch lazy loading and secondary query loading.
|
||||
*/
|
||||
@@ -16,7 +16,7 @@ public interface LoadManyBuffer {
|
||||
int getBatchSize();
|
||||
|
||||
List<BeanCollection<?>> getBatch();
|
||||
|
||||
|
||||
BeanPropertyAssocMany<?> getBeanProperty();
|
||||
|
||||
ObjectGraphNode getObjectGraphNode();
|
||||
@@ -30,4 +30,4 @@ public interface LoadManyBuffer {
|
||||
void configureQuery(SpiQuery<?> query);
|
||||
|
||||
boolean isUseDocStore();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ package com.avaje.ebeaninternal.api;
|
||||
* Controls the loading of OneToMany and ManyToMany relationships.
|
||||
*/
|
||||
public interface LoadManyContext extends LoadSecondaryQuery {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class LoadManyRequest extends LoadRequest {
|
||||
this(loadContext, parentRequest, false, false, false);
|
||||
}
|
||||
|
||||
private LoadManyRequest(LoadManyBuffer loadContext, OrmQueryRequest<?> parentRequest, boolean lazy, boolean onlyIds, boolean loadCache) {
|
||||
private LoadManyRequest(LoadManyBuffer loadContext, OrmQueryRequest<?> parentRequest, boolean lazy, boolean onlyIds, boolean loadCache) {
|
||||
super(parentRequest, lazy);
|
||||
this.loadContext = loadContext;
|
||||
this.batch = loadContext.getBatch();
|
||||
|
||||
@@ -14,12 +14,12 @@ public abstract class LoadRequest {
|
||||
|
||||
protected final boolean lazy;
|
||||
|
||||
public LoadRequest(OrmQueryRequest<?> parentRequest, boolean lazy) {
|
||||
public LoadRequest(OrmQueryRequest<?> parentRequest, boolean lazy) {
|
||||
|
||||
this.parentRequest = parentRequest;
|
||||
this.transaction = parentRequest == null ? null : parentRequest.getTransaction();
|
||||
this.lazy = lazy;
|
||||
}
|
||||
this.parentRequest = parentRequest;
|
||||
this.transaction = parentRequest == null ? null : parentRequest.getTransaction();
|
||||
this.lazy = lazy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the associated bean type for this load request.
|
||||
@@ -35,29 +35,29 @@ public abstract class LoadRequest {
|
||||
parentRequest.getQuery().logSecondaryQuery(query);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this is a lazy load and false if it is a secondary query.
|
||||
*/
|
||||
public boolean isLazy() {
|
||||
return lazy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the transaction to use if this is a secondary query.
|
||||
* <p>
|
||||
* Lazy loading queries run in their own transaction.
|
||||
* </p>
|
||||
*/
|
||||
public Transaction getTransaction() {
|
||||
return transaction;
|
||||
}
|
||||
/**
|
||||
* Return true if this is a lazy load and false if it is a secondary query.
|
||||
*/
|
||||
public boolean isLazy() {
|
||||
return lazy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the parent query is a findIterate() type query.
|
||||
* So one of - findIterate(), findEach(), findEachWhile() or findVisit().
|
||||
*/
|
||||
public boolean isParentFindIterate() {
|
||||
return parentRequest != null && parentRequest.getQuery().getType() == SpiQuery.Type.ITERATE;
|
||||
}
|
||||
/**
|
||||
* Return the transaction to use if this is a secondary query.
|
||||
* <p>
|
||||
* Lazy loading queries run in their own transaction.
|
||||
* </p>
|
||||
*/
|
||||
public Transaction getTransaction() {
|
||||
return transaction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the parent query is a findIterate() type query.
|
||||
* So one of - findIterate(), findEach(), findEachWhile() or findVisit().
|
||||
*/
|
||||
public boolean isParentFindIterate() {
|
||||
return parentRequest != null && parentRequest.getQuery().getType() == SpiQuery.Type.ITERATE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ import com.avaje.ebeaninternal.server.core.OrmQueryRequest;
|
||||
*/
|
||||
public interface LoadSecondaryQuery {
|
||||
|
||||
/**
|
||||
* Execute the secondary query with a given batch size.
|
||||
*/
|
||||
void loadSecondaryQuery(OrmQueryRequest<?> parentRequest, boolean forEach);
|
||||
/**
|
||||
* Execute the secondary query with a given batch size.
|
||||
*/
|
||||
void loadSecondaryQuery(OrmQueryRequest<?> parentRequest, boolean forEach);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@ import java.io.Serializable;
|
||||
*/
|
||||
public class Monitor implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -2741687226680981940L;
|
||||
|
||||
private static final long serialVersionUID = -2741687226680981940L;
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public class PropertyJoin {
|
||||
* The property name.
|
||||
*/
|
||||
private final String property;
|
||||
|
||||
|
||||
/**
|
||||
* Set to true if the property needs to be an outer join.
|
||||
*/
|
||||
@@ -35,5 +35,5 @@ public class PropertyJoin {
|
||||
public SqlJoinType getSqlJoinType() {
|
||||
return joinType;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.avaje.ebeaninternal.server.core.PersistDeferredRelationship;
|
||||
import com.avaje.ebeaninternal.server.core.PersistRequest;
|
||||
import com.avaje.ebeaninternal.server.core.PersistRequestBean;
|
||||
import com.avaje.ebeaninternal.server.persist.BatchControl;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.persistence.RollbackException;
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -7,8 +7,8 @@ import com.avaje.ebean.BackgroundExecutor;
|
||||
*/
|
||||
public interface SpiBackgroundExecutor extends BackgroundExecutor {
|
||||
|
||||
/**
|
||||
* Shutdown any associated thread pools.
|
||||
*/
|
||||
void shutdown();
|
||||
/**
|
||||
* Shutdown any associated thread pools.
|
||||
*/
|
||||
void shutdown();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.avaje.ebean.CallableSql;
|
||||
|
||||
public interface SpiCallableSql extends CallableSql {
|
||||
|
||||
BindParams getBindParams();
|
||||
|
||||
TransactionEventTable getTransactionEventTable();
|
||||
BindParams getBindParams();
|
||||
|
||||
TransactionEventTable getTransactionEventTable();
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@ import com.avaje.ebean.config.ServerConfig;
|
||||
import com.avaje.ebean.config.dbplatform.DatabasePlatform;
|
||||
import com.avaje.ebean.event.readaudit.ReadAuditLogger;
|
||||
import com.avaje.ebean.event.readaudit.ReadAuditPrepare;
|
||||
import com.avaje.ebeaninternal.server.core.timezone.DataTimeZone;
|
||||
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import com.avaje.ebeaninternal.server.query.CQuery;
|
||||
import com.avaje.ebeaninternal.server.transaction.RemoteTransactionEvent;
|
||||
import com.avaje.ebeaninternal.server.core.timezone.DataTimeZone;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -13,28 +13,28 @@ import java.io.IOException;
|
||||
*/
|
||||
public interface SpiExpression extends Expression {
|
||||
|
||||
/**
|
||||
* Simplify nested expressions if possible.
|
||||
*/
|
||||
void simplify();
|
||||
/**
|
||||
* Simplify nested expressions if possible.
|
||||
*/
|
||||
void simplify();
|
||||
|
||||
/**
|
||||
/**
|
||||
* Write the expression as an elastic search expression.
|
||||
*/
|
||||
void writeDocQuery(DocQueryContext context) throws IOException;
|
||||
|
||||
/**
|
||||
* Return the nested path for this expression.
|
||||
*/
|
||||
String nestedPath(BeanDescriptor<?> desc);
|
||||
/**
|
||||
* Return the nested path for this expression.
|
||||
*/
|
||||
String nestedPath(BeanDescriptor<?> desc);
|
||||
|
||||
/**
|
||||
* Process "Many" properties populating ManyWhereJoins.
|
||||
/**
|
||||
* Process "Many" properties populating ManyWhereJoins.
|
||||
* <p>
|
||||
* Predicates on Many properties require an extra independent join clause.
|
||||
* </p>
|
||||
*/
|
||||
void containsMany(BeanDescriptor<?> desc, ManyWhereJoins whereManyJoins);
|
||||
void containsMany(BeanDescriptor<?> desc, ManyWhereJoins whereManyJoins);
|
||||
|
||||
/**
|
||||
* Prepare the expression. For example, compile sub-query expressions etc.
|
||||
@@ -42,18 +42,18 @@ public interface SpiExpression extends Expression {
|
||||
void prepareExpression(BeanQueryRequest<?> request);
|
||||
|
||||
/**
|
||||
* Calculate a hash value used to identify a query for AutoTune tuning.
|
||||
* <p>
|
||||
* That is, if the hash changes then the query will be considered different
|
||||
* from an AutoTune perspective and get different tuning.
|
||||
* </p>
|
||||
*/
|
||||
void queryPlanHash(HashQueryPlanBuilder builder);
|
||||
* Calculate a hash value used to identify a query for AutoTune tuning.
|
||||
* <p>
|
||||
* That is, if the hash changes then the query will be considered different
|
||||
* from an AutoTune perspective and get different tuning.
|
||||
* </p>
|
||||
*/
|
||||
void queryPlanHash(HashQueryPlanBuilder builder);
|
||||
|
||||
/**
|
||||
* Return the hash value for the values that will be bound.
|
||||
*/
|
||||
int queryBindHash();
|
||||
/**
|
||||
* Return the hash value for the values that will be bound.
|
||||
*/
|
||||
int queryBindHash();
|
||||
|
||||
/**
|
||||
* Return true if the expression is the same without taking into account bind values.
|
||||
@@ -65,29 +65,28 @@ public interface SpiExpression extends Expression {
|
||||
*/
|
||||
boolean isSameByBind(SpiExpression other);
|
||||
|
||||
/**
|
||||
* Add some sql to the query.
|
||||
* <p>
|
||||
* This will contain ? as a place holder for each associated bind values.
|
||||
* </p>
|
||||
* <p>
|
||||
* The 'sql' added to the query can contain object property names rather
|
||||
* than db tables and columns. This 'sql' is later parsed converting the
|
||||
* logical property names to their full database column names.
|
||||
* </p>
|
||||
* @param request
|
||||
* the associated request.
|
||||
*/
|
||||
void addSql(SpiExpressionRequest request);
|
||||
/**
|
||||
* Add some sql to the query.
|
||||
* <p>
|
||||
* This will contain ? as a place holder for each associated bind values.
|
||||
* </p>
|
||||
* <p>
|
||||
* The 'sql' added to the query can contain object property names rather
|
||||
* than db tables and columns. This 'sql' is later parsed converting the
|
||||
* logical property names to their full database column names.
|
||||
* </p>
|
||||
*
|
||||
* @param request the associated request.
|
||||
*/
|
||||
void addSql(SpiExpressionRequest request);
|
||||
|
||||
/**
|
||||
* Add the parameter values to be set against query. For each ? place holder
|
||||
* there should be a corresponding value that is added to the bindList.
|
||||
*
|
||||
* @param request
|
||||
* the associated request.
|
||||
*/
|
||||
void addBindValues(SpiExpressionRequest request);
|
||||
/**
|
||||
* Add the parameter values to be set against query. For each ? place holder
|
||||
* there should be a corresponding value that is added to the bindList.
|
||||
*
|
||||
* @param request the associated request.
|
||||
*/
|
||||
void addBindValues(SpiExpressionRequest request);
|
||||
|
||||
/**
|
||||
* Validate all the properties/paths associated with this expression.
|
||||
@@ -99,8 +98,8 @@ public interface SpiExpression extends Expression {
|
||||
*/
|
||||
SpiExpression copyForPlanKey();
|
||||
|
||||
/**
|
||||
* Return the bind Id value if this is a "equal to" expression for the id property.
|
||||
/**
|
||||
* Return the bind Id value if this is a "equal to" expression for the id property.
|
||||
*/
|
||||
Object getIdEqualTo(String idName);
|
||||
Object getIdEqualTo(String idName);
|
||||
}
|
||||
|
||||
@@ -27,10 +27,10 @@ public interface SpiExpressionList<T> extends ExpressionList<T>, SpiExpression {
|
||||
*/
|
||||
SpiExpressionList<?> trimPath(int prefixTrim);
|
||||
|
||||
/**
|
||||
* Return true if this list is empty.
|
||||
*/
|
||||
boolean isEmpty();
|
||||
/**
|
||||
* Return true if this list is empty.
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Write the top level where expressions taking into account possible extra idEquals expression.
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.avaje.ebeaninternal.api;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
|
||||
import com.avaje.ebean.SqlQuery;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.avaje.ebean.SqlUpdate;
|
||||
|
||||
public interface SpiSqlUpdate extends SqlUpdate {
|
||||
|
||||
BindParams getBindParams();
|
||||
BindParams getBindParams();
|
||||
|
||||
void setGeneratedSql(String sql);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.avaje.ebeaninternal.server.core.PersistDeferredRelationship;
|
||||
import com.avaje.ebeaninternal.server.core.PersistRequest;
|
||||
import com.avaje.ebeaninternal.server.core.PersistRequestBean;
|
||||
import com.avaje.ebeaninternal.server.persist.BatchControl;
|
||||
|
||||
import java.sql.Connection;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,5 +2,5 @@ package com.avaje.ebeaninternal.api;
|
||||
|
||||
public interface SpiTransactionScopeManager {
|
||||
|
||||
void replace(SpiTransaction t);
|
||||
void replace(SpiTransaction t);
|
||||
}
|
||||
|
||||
@@ -7,70 +7,70 @@ import com.avaje.ebean.Update;
|
||||
*/
|
||||
public interface SpiUpdate<T> extends Update<T> {
|
||||
|
||||
/**
|
||||
* The type of the update request.
|
||||
*/
|
||||
enum OrmUpdateType {
|
||||
INSERT {
|
||||
public String toString() {
|
||||
return "Insert";
|
||||
}
|
||||
},
|
||||
UPDATE {
|
||||
public String toString() {
|
||||
return "Update";
|
||||
}
|
||||
},
|
||||
DELETE {
|
||||
public String toString() {
|
||||
return "Delete";
|
||||
}
|
||||
},
|
||||
UNKNOWN {
|
||||
public String toString() {
|
||||
return "Unknown";
|
||||
}
|
||||
/**
|
||||
* The type of the update request.
|
||||
*/
|
||||
enum OrmUpdateType {
|
||||
INSERT {
|
||||
public String toString() {
|
||||
return "Insert";
|
||||
}
|
||||
},
|
||||
UPDATE {
|
||||
public String toString() {
|
||||
return "Update";
|
||||
}
|
||||
},
|
||||
DELETE {
|
||||
public String toString() {
|
||||
return "Delete";
|
||||
}
|
||||
},
|
||||
UNKNOWN {
|
||||
public String toString() {
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the type of bean being updated.
|
||||
*/
|
||||
Class<?> getBeanType();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the type of this - insert, update or delete.
|
||||
*/
|
||||
OrmUpdateType getOrmUpdateType();
|
||||
|
||||
/**
|
||||
* Return the name of the table being modified.
|
||||
*/
|
||||
String getBaseTable();
|
||||
|
||||
/**
|
||||
* Return the update statement. This could be either sql or an orm update with bean types and property names.
|
||||
*/
|
||||
String getUpdateStatement();
|
||||
|
||||
/**
|
||||
* Return the timeout in seconds.
|
||||
*/
|
||||
int getTimeout();
|
||||
|
||||
/**
|
||||
* Return true if the cache should be notified to invalidate objects.
|
||||
*/
|
||||
boolean isNotifyCache();
|
||||
|
||||
/**
|
||||
* Return the bind parameters.
|
||||
*/
|
||||
BindParams getBindParams();
|
||||
|
||||
/**
|
||||
* Set the generated sql used.
|
||||
*/
|
||||
void setGeneratedSql(String sql);
|
||||
/**
|
||||
* Return the type of bean being updated.
|
||||
*/
|
||||
Class<?> getBeanType();
|
||||
|
||||
/**
|
||||
* Return the type of this - insert, update or delete.
|
||||
*/
|
||||
OrmUpdateType getOrmUpdateType();
|
||||
|
||||
/**
|
||||
* Return the name of the table being modified.
|
||||
*/
|
||||
String getBaseTable();
|
||||
|
||||
/**
|
||||
* Return the update statement. This could be either sql or an orm update with bean types and property names.
|
||||
*/
|
||||
String getUpdateStatement();
|
||||
|
||||
/**
|
||||
* Return the timeout in seconds.
|
||||
*/
|
||||
int getTimeout();
|
||||
|
||||
/**
|
||||
* Return true if the cache should be notified to invalidate objects.
|
||||
*/
|
||||
boolean isNotifyCache();
|
||||
|
||||
/**
|
||||
* Return the bind parameters.
|
||||
*/
|
||||
BindParams getBindParams();
|
||||
|
||||
/**
|
||||
* Set the generated sql used.
|
||||
*/
|
||||
void setGeneratedSql(String sql);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.avaje.ebeaninternal.api;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import com.avaje.ebean.bean.EntityBean;
|
||||
import com.avaje.ebeaninternal.server.persist.dml.DmlHandler;
|
||||
import com.avaje.ebeaninternal.server.persist.dmlbind.Bindable;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* A plan for executing bean updates for a given set of changed properties.
|
||||
* <p>
|
||||
@@ -26,41 +26,41 @@ public interface SpiUpdatePlan {
|
||||
* </p>
|
||||
*/
|
||||
boolean isEmptySetClause();
|
||||
|
||||
/**
|
||||
* Bind given the request and bean. The bean could be the oldValues bean
|
||||
* when binding a update or delete where clause with ALL concurrency mode.
|
||||
*/
|
||||
void bindSet(DmlHandler bind, EntityBean bean) throws SQLException;
|
||||
|
||||
/**
|
||||
* Return the time this plan was created.
|
||||
*/
|
||||
long getTimeCreated();
|
||||
/**
|
||||
* Bind given the request and bean. The bean could be the oldValues bean
|
||||
* when binding a update or delete where clause with ALL concurrency mode.
|
||||
*/
|
||||
void bindSet(DmlHandler bind, EntityBean bean) throws SQLException;
|
||||
|
||||
/**
|
||||
* Return the time this plan was last used.
|
||||
*/
|
||||
Long getTimeLastUsed();
|
||||
/**
|
||||
* Return the time this plan was created.
|
||||
*/
|
||||
long getTimeCreated();
|
||||
|
||||
/**
|
||||
* Return the hash key for this plan.
|
||||
*/
|
||||
Integer getKey();
|
||||
/**
|
||||
* Return the time this plan was last used.
|
||||
*/
|
||||
Long getTimeLastUsed();
|
||||
|
||||
/**
|
||||
* Return the concurrency mode for this plan.
|
||||
*/
|
||||
ConcurrencyMode getMode();
|
||||
/**
|
||||
* Return the hash key for this plan.
|
||||
*/
|
||||
Integer getKey();
|
||||
|
||||
/**
|
||||
* Return the update SQL statement.
|
||||
*/
|
||||
String getSql();
|
||||
/**
|
||||
* Return the concurrency mode for this plan.
|
||||
*/
|
||||
ConcurrencyMode getMode();
|
||||
|
||||
/**
|
||||
* Return the set of bindable update properties.
|
||||
*/
|
||||
Bindable getSet();
|
||||
/**
|
||||
* Return the update SQL statement.
|
||||
*/
|
||||
String getSql();
|
||||
|
||||
}
|
||||
/**
|
||||
* Return the set of bindable update properties.
|
||||
*/
|
||||
Bindable getSet();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.avaje.ebeaninternal.api;
|
||||
|
||||
import com.avaje.ebeaninternal.server.cache.CacheChangeSet;
|
||||
import com.avaje.ebeanservice.docstore.api.DocStoreUpdates;
|
||||
import com.avaje.ebeaninternal.server.core.PersistRequestBean;
|
||||
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import com.avaje.ebeaninternal.server.transaction.DeleteByIdMap;
|
||||
import com.avaje.ebeanservice.docstore.api.DocStoreUpdates;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.avaje.ebeaninternal.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.avaje.ebeaninternal.server.cache.CacheChangeSet;
|
||||
import com.avaje.ebeaninternal.server.core.PersistRequestBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Lists of inserted updated and deleted beans that have a BeanPersistListener.
|
||||
* <p>
|
||||
@@ -17,28 +17,28 @@ public class TransactionEventBeans {
|
||||
|
||||
final ArrayList<PersistRequestBean<?>> requests = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Return the list of PersistRequests that BeanListeners are interested in.
|
||||
*/
|
||||
public List<PersistRequestBean<?>> getRequests() {
|
||||
return requests;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a bean for BeanListener notification.
|
||||
*/
|
||||
public void add(PersistRequestBean<?> request) {
|
||||
|
||||
requests.add(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect the cache changes.
|
||||
/**
|
||||
* Return the list of PersistRequests that BeanListeners are interested in.
|
||||
*/
|
||||
public void notifyCache(CacheChangeSet changeSet) {
|
||||
public List<PersistRequestBean<?>> getRequests() {
|
||||
return requests;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a bean for BeanListener notification.
|
||||
*/
|
||||
public void add(PersistRequestBean<?> request) {
|
||||
|
||||
requests.add(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect the cache changes.
|
||||
*/
|
||||
public void notifyCache(CacheChangeSet changeSet) {
|
||||
for (PersistRequestBean<?> request : requests) {
|
||||
request.notifyCache(changeSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package com.avaje.ebeaninternal.api;
|
||||
|
||||
import com.avaje.ebean.event.BulkTableEvent;
|
||||
import com.avaje.ebeaninternal.server.cluster.BinaryMessage;
|
||||
import com.avaje.ebeaninternal.server.cluster.BinaryMessageList;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -8,136 +12,133 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.avaje.ebean.event.BulkTableEvent;
|
||||
import com.avaje.ebeaninternal.server.cluster.BinaryMessage;
|
||||
import com.avaje.ebeaninternal.server.cluster.BinaryMessageList;
|
||||
|
||||
public final class TransactionEventTable implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 2236555729767483264L;
|
||||
|
||||
private final Map<String, TableIUD> map = new HashMap<>();
|
||||
|
||||
public String toString() {
|
||||
return "TransactionEventTable " + map.values();
|
||||
private static final long serialVersionUID = 2236555729767483264L;
|
||||
|
||||
private final Map<String, TableIUD> map = new HashMap<>();
|
||||
|
||||
public String toString() {
|
||||
return "TransactionEventTable " + map.values();
|
||||
}
|
||||
|
||||
public void writeBinaryMessage(BinaryMessageList msgList) throws IOException {
|
||||
|
||||
for (TableIUD tableIud : map.values()) {
|
||||
tableIud.writeBinaryMessage(msgList);
|
||||
}
|
||||
}
|
||||
|
||||
public void readBinaryMessage(DataInput dataInput) throws IOException {
|
||||
|
||||
TableIUD tableIud = TableIUD.readBinaryMessage(dataInput);
|
||||
map.put(tableIud.getTableName(), tableIud);
|
||||
}
|
||||
|
||||
|
||||
public void add(TransactionEventTable table) {
|
||||
|
||||
for (TableIUD iud : table.values()) {
|
||||
add(iud);
|
||||
}
|
||||
}
|
||||
|
||||
public void add(String table, boolean insert, boolean update, boolean delete) {
|
||||
|
||||
table = table.toUpperCase();
|
||||
|
||||
add(new TableIUD(table, insert, update, delete));
|
||||
}
|
||||
|
||||
public void add(TableIUD newTableIUD) {
|
||||
|
||||
TableIUD existingTableIUD = map.put(newTableIUD.getTableName(), newTableIUD);
|
||||
if (existingTableIUD != null) {
|
||||
newTableIUD.add(existingTableIUD);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return map.isEmpty();
|
||||
}
|
||||
|
||||
public Collection<TableIUD> values() {
|
||||
return map.values();
|
||||
}
|
||||
|
||||
public static class TableIUD implements Serializable, BulkTableEvent {
|
||||
|
||||
private static final long serialVersionUID = -1958317571064162089L;
|
||||
|
||||
private final String table;
|
||||
private boolean insert;
|
||||
private boolean update;
|
||||
private boolean delete;
|
||||
|
||||
public TableIUD(String table, boolean insert, boolean update, boolean delete) {
|
||||
this.table = table;
|
||||
this.insert = insert;
|
||||
this.update = update;
|
||||
this.delete = delete;
|
||||
}
|
||||
|
||||
public static TableIUD readBinaryMessage(DataInput dataInput) throws IOException {
|
||||
|
||||
String table = dataInput.readUTF();
|
||||
boolean insert = dataInput.readBoolean();
|
||||
boolean update = dataInput.readBoolean();
|
||||
boolean delete = dataInput.readBoolean();
|
||||
|
||||
return new TableIUD(table, insert, update, delete);
|
||||
}
|
||||
|
||||
public void writeBinaryMessage(BinaryMessageList msgList) throws IOException {
|
||||
|
||||
for (TableIUD tableIud : map.values()) {
|
||||
tableIud.writeBinaryMessage(msgList);
|
||||
}
|
||||
}
|
||||
|
||||
public void readBinaryMessage(DataInput dataInput) throws IOException {
|
||||
|
||||
TableIUD tableIud = TableIUD.readBinaryMessage(dataInput);
|
||||
map.put(tableIud.getTableName(), tableIud);
|
||||
BinaryMessage msg = new BinaryMessage(table.length() + 10);
|
||||
DataOutputStream os = msg.getOs();
|
||||
os.writeInt(BinaryMessage.TYPE_TABLEIUD);
|
||||
os.writeUTF(table);
|
||||
os.writeBoolean(insert);
|
||||
os.writeBoolean(update);
|
||||
os.writeBoolean(delete);
|
||||
|
||||
msgList.add(msg);
|
||||
}
|
||||
|
||||
|
||||
public void add(TransactionEventTable table){
|
||||
|
||||
for (TableIUD iud : table.values()) {
|
||||
add(iud);
|
||||
}
|
||||
}
|
||||
public String toString() {
|
||||
return "TableIUD " + table + " i:" + insert + " u:" + update + " d:" + delete;
|
||||
}
|
||||
|
||||
public void add(String table, boolean insert, boolean update, boolean delete){
|
||||
private void add(TableIUD other) {
|
||||
if (other.insert) {
|
||||
insert = true;
|
||||
}
|
||||
if (other.update) {
|
||||
update = true;
|
||||
}
|
||||
if (other.delete) {
|
||||
delete = true;
|
||||
}
|
||||
}
|
||||
|
||||
table = table.toUpperCase();
|
||||
|
||||
add(new TableIUD(table, insert, update, delete));
|
||||
}
|
||||
|
||||
public void add(TableIUD newTableIUD){
|
||||
public String getTableName() {
|
||||
return table;
|
||||
}
|
||||
|
||||
TableIUD existingTableIUD = map.put(newTableIUD.getTableName(), newTableIUD);
|
||||
if (existingTableIUD != null){
|
||||
newTableIUD.add(existingTableIUD);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return map.isEmpty();
|
||||
}
|
||||
|
||||
public Collection<TableIUD> values() {
|
||||
return map.values();
|
||||
}
|
||||
|
||||
public static class TableIUD implements Serializable, BulkTableEvent {
|
||||
|
||||
private static final long serialVersionUID = -1958317571064162089L;
|
||||
|
||||
private final String table;
|
||||
private boolean insert;
|
||||
private boolean update;
|
||||
private boolean delete;
|
||||
|
||||
public TableIUD(String table, boolean insert, boolean update, boolean delete){
|
||||
this.table = table;
|
||||
this.insert = insert;
|
||||
this.update = update;
|
||||
this.delete = delete;
|
||||
}
|
||||
|
||||
public static TableIUD readBinaryMessage(DataInput dataInput) throws IOException {
|
||||
|
||||
String table = dataInput.readUTF();
|
||||
boolean insert = dataInput.readBoolean();
|
||||
boolean update = dataInput.readBoolean();
|
||||
boolean delete = dataInput.readBoolean();
|
||||
|
||||
return new TableIUD(table, insert, update, delete);
|
||||
}
|
||||
|
||||
public void writeBinaryMessage(BinaryMessageList msgList) throws IOException {
|
||||
|
||||
BinaryMessage msg = new BinaryMessage(table.length()+10);
|
||||
DataOutputStream os = msg.getOs();
|
||||
os.writeInt(BinaryMessage.TYPE_TABLEIUD);
|
||||
os.writeUTF(table);
|
||||
os.writeBoolean(insert);
|
||||
os.writeBoolean(update);
|
||||
os.writeBoolean(delete);
|
||||
|
||||
msgList.add(msg);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "TableIUD "+table+" i:"+insert+" u:"+update+" d:"+delete;
|
||||
}
|
||||
|
||||
private void add(TableIUD other) {
|
||||
if (other.insert){
|
||||
insert = true;
|
||||
}
|
||||
if (other.update){
|
||||
update = true;
|
||||
}
|
||||
if (other.delete){
|
||||
delete = true;
|
||||
}
|
||||
}
|
||||
public String getTableName() {
|
||||
return table;
|
||||
}
|
||||
public boolean isInsert() {
|
||||
return insert;
|
||||
}
|
||||
|
||||
public boolean isInsert() {
|
||||
return insert;
|
||||
}
|
||||
public boolean isUpdate() {
|
||||
return update;
|
||||
}
|
||||
|
||||
public boolean isUpdate() {
|
||||
return update;
|
||||
}
|
||||
public boolean isDelete() {
|
||||
return delete;
|
||||
}
|
||||
|
||||
public boolean isDelete() {
|
||||
return delete;
|
||||
}
|
||||
|
||||
public boolean isUpdateOrDelete() {
|
||||
return update || delete;
|
||||
}
|
||||
}
|
||||
public boolean isUpdateOrDelete() {
|
||||
return update || delete;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.avaje.ebeaninternal.extraddl.model;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
@@ -11,9 +10,9 @@ import javax.xml.bind.annotation.XmlValue;
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <p>
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <simpleContent>
|
||||
@@ -24,93 +23,79 @@ import javax.xml.bind.annotation.XmlValue;
|
||||
* </simpleContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = {
|
||||
"value"
|
||||
"value"
|
||||
})
|
||||
@XmlRootElement(name = "ddl-script")
|
||||
public class DdlScript {
|
||||
|
||||
@XmlValue
|
||||
protected String value;
|
||||
@XmlAttribute(name = "name", required = true)
|
||||
protected String name;
|
||||
@XmlAttribute(name = "platforms")
|
||||
protected String platforms;
|
||||
@XmlValue
|
||||
protected String value;
|
||||
@XmlAttribute(name = "name", required = true)
|
||||
protected String name;
|
||||
@XmlAttribute(name = "platforms")
|
||||
protected String platforms;
|
||||
|
||||
/**
|
||||
* Gets the value of the value property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
* Gets the value of the value property.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the value property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
/**
|
||||
* Sets the value of the value property.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the name property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* Gets the value of the name property.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the name property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
/**
|
||||
* Sets the value of the name property.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setName(String value) {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the platforms property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getPlatforms() {
|
||||
return platforms;
|
||||
}
|
||||
/**
|
||||
* Gets the value of the platforms property.
|
||||
*
|
||||
* @return possible object is
|
||||
* {@link String }
|
||||
*/
|
||||
public String getPlatforms() {
|
||||
return platforms;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the platforms property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setPlatforms(String value) {
|
||||
this.platforms = value;
|
||||
}
|
||||
/**
|
||||
* Sets the value of the platforms property.
|
||||
*
|
||||
* @param value allowed object is
|
||||
* {@link String }
|
||||
*/
|
||||
public void setPlatforms(String value) {
|
||||
this.platforms = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
|
||||
package com.avaje.ebeaninternal.extraddl.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Java class for anonymous complex type.
|
||||
*
|
||||
* <p>
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <p>
|
||||
* <pre>
|
||||
* <complexType>
|
||||
* <complexContent>
|
||||
@@ -26,46 +25,42 @@ import javax.xml.bind.annotation.XmlType;
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "", propOrder = {
|
||||
"ddlScript"
|
||||
"ddlScript"
|
||||
})
|
||||
@XmlRootElement(name = "extra-ddl")
|
||||
public class ExtraDdl {
|
||||
|
||||
@XmlElement(name = "ddl-script", required = true)
|
||||
protected List<DdlScript> ddlScript;
|
||||
@XmlElement(name = "ddl-script", required = true)
|
||||
protected List<DdlScript> ddlScript;
|
||||
|
||||
/**
|
||||
* Gets the value of the ddlScript property.
|
||||
*
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the ddlScript property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getDdlScript().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link DdlScript }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<DdlScript> getDdlScript() {
|
||||
if (ddlScript == null) {
|
||||
ddlScript = new ArrayList<>();
|
||||
}
|
||||
return this.ddlScript;
|
||||
/**
|
||||
* Gets the value of the ddlScript property.
|
||||
* <p>
|
||||
* <p>
|
||||
* This accessor method returns a reference to the live list,
|
||||
* not a snapshot. Therefore any modification you make to the
|
||||
* returned list will be present inside the JAXB object.
|
||||
* This is why there is not a <CODE>set</CODE> method for the ddlScript property.
|
||||
* <p>
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getDdlScript().add(newItem);
|
||||
* </pre>
|
||||
* <p>
|
||||
* <p>
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link DdlScript }
|
||||
*/
|
||||
public List<DdlScript> getDdlScript() {
|
||||
if (ddlScript == null) {
|
||||
ddlScript = new ArrayList<>();
|
||||
}
|
||||
return this.ddlScript;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,8 +36,9 @@ public class ExtraDdlXmlReader {
|
||||
|
||||
/**
|
||||
* Return true if the script platforms is a match/supported for the given platform.
|
||||
*
|
||||
* @param platformName The database platform we are generating/running DDL for
|
||||
* @param platforms The platforms (comma delimited) this script should run for
|
||||
* @param platforms The platforms (comma delimited) this script should run for
|
||||
*/
|
||||
public static boolean matchPlatform(String platformName, String platforms) {
|
||||
if (platforms == null || platforms.trim().isEmpty()) {
|
||||
|
||||
@@ -1,48 +1,43 @@
|
||||
|
||||
package com.avaje.ebeaninternal.extraddl.model;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRegistry;
|
||||
|
||||
|
||||
/**
|
||||
* This object contains factory methods for each
|
||||
* Java content interface and Java element interface
|
||||
* generated in the com.avaje.ebeaninternal.extraddl.model package.
|
||||
* <p>An ObjectFactory allows you to programatically
|
||||
* construct new instances of the Java representation
|
||||
* for XML content. The Java representation of XML
|
||||
* content can consist of schema derived interfaces
|
||||
* and classes representing the binding of schema
|
||||
* type definitions, element declarations and model
|
||||
* groups. Factory methods for each of these are
|
||||
* This object contains factory methods for each
|
||||
* Java content interface and Java element interface
|
||||
* generated in the com.avaje.ebeaninternal.extraddl.model package.
|
||||
* <p>An ObjectFactory allows you to programatically
|
||||
* construct new instances of the Java representation
|
||||
* for XML content. The Java representation of XML
|
||||
* content can consist of schema derived interfaces
|
||||
* and classes representing the binding of schema
|
||||
* type definitions, element declarations and model
|
||||
* groups. Factory methods for each of these are
|
||||
* provided in this class.
|
||||
*
|
||||
*/
|
||||
@XmlRegistry
|
||||
public class ObjectFactory {
|
||||
|
||||
|
||||
/**
|
||||
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.avaje.ebeaninternal.extraddl.model
|
||||
*
|
||||
*/
|
||||
public ObjectFactory() {
|
||||
}
|
||||
/**
|
||||
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.avaje.ebeaninternal.extraddl.model
|
||||
*/
|
||||
public ObjectFactory() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link DdlScript }
|
||||
*
|
||||
*/
|
||||
public DdlScript createDdlScript() {
|
||||
return new DdlScript();
|
||||
}
|
||||
/**
|
||||
* Create an instance of {@link DdlScript }
|
||||
*/
|
||||
public DdlScript createDdlScript() {
|
||||
return new DdlScript();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of {@link ExtraDdl }
|
||||
*
|
||||
*/
|
||||
public ExtraDdl createExtraDdl() {
|
||||
return new ExtraDdl();
|
||||
}
|
||||
/**
|
||||
* Create an instance of {@link ExtraDdl }
|
||||
*/
|
||||
public ExtraDdl createExtraDdl() {
|
||||
return new ExtraDdl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user