mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#2359 - Rename internal methods - BeanDescriptor
This commit is contained in:
+4
-4
@@ -43,14 +43,14 @@ public class ProfileOriginNodeUsage {
|
||||
try {
|
||||
BeanDescriptor<?> desc = rootDesc;
|
||||
if (path != null) {
|
||||
ElPropertyValue elGetValue = rootDesc.getElGetValue(path);
|
||||
ElPropertyValue elGetValue = rootDesc.elGetValue(path);
|
||||
if (elGetValue == null) {
|
||||
logger.warn("AutoTune: Can't find join for path[" + path + "] for " + rootDesc.name());
|
||||
return;
|
||||
} else {
|
||||
BeanProperty beanProperty = elGetValue.beanProperty();
|
||||
if (beanProperty instanceof BeanPropertyAssoc<?>) {
|
||||
desc = ((BeanPropertyAssoc<?>) beanProperty).getTargetDescriptor();
|
||||
desc = ((BeanPropertyAssoc<?>) beanProperty).targetDescriptor();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class ProfileOriginNodeUsage {
|
||||
}
|
||||
|
||||
if ((modified || addVersionProperty) && desc != null) {
|
||||
BeanProperty versionProp = desc.getVersionProperty();
|
||||
BeanProperty versionProp = desc.versionProperty();
|
||||
if (versionProp != null) {
|
||||
addedToPath = true;
|
||||
pathProps.addToPath(path, versionProp.name());
|
||||
@@ -92,7 +92,7 @@ public class ProfileOriginNodeUsage {
|
||||
|
||||
if (toOneIdProperty != null && !addedToPath) {
|
||||
// add ToOne property to parent path
|
||||
ElPropertyValue assocOne = rootDesc.getElGetValue(path);
|
||||
ElPropertyValue assocOne = rootDesc.elGetValue(path);
|
||||
pathProps.addToPath(SplitName.parent(path), assocOne.name());
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -60,10 +60,10 @@ public final class LoadManyRequest extends LoadRequest {
|
||||
List<Object> idList = new ArrayList<>();
|
||||
BeanPropertyAssocMany<?> many = many();
|
||||
for (BeanCollection<?> bc : batch) {
|
||||
idList.add(many.getParentId(bc.getOwnerBean()));
|
||||
idList.add(many.parentId(bc.getOwnerBean()));
|
||||
bc.setLoader(server); // don't use the load buffer again
|
||||
}
|
||||
if (many.getTargetDescriptor().isPadInExpression()) {
|
||||
if (many.targetDescriptor().isPadInExpression()) {
|
||||
BindPadding.padIds(idList);
|
||||
}
|
||||
return idList;
|
||||
@@ -76,11 +76,11 @@ public final class LoadManyRequest extends LoadRequest {
|
||||
public SpiQuery<?> createQuery(SpiEbeanServer server) {
|
||||
BeanPropertyAssocMany<?> many = many();
|
||||
SpiQuery<?> query = many.newQuery(server);
|
||||
String orderBy = many.getLazyFetchOrderBy();
|
||||
String orderBy = many.lazyFetchOrderBy();
|
||||
if (orderBy != null) {
|
||||
query.order(orderBy);
|
||||
}
|
||||
String extraWhere = many.getExtraWhere();
|
||||
String extraWhere = many.extraWhere();
|
||||
if (extraWhere != null) {
|
||||
// replace special ${ta} placeholder with the base table alias
|
||||
// which is always t0 and add the extra where clause
|
||||
@@ -99,7 +99,7 @@ public final class LoadManyRequest extends LoadRequest {
|
||||
loadContext.configureQuery(query);
|
||||
if (onlyIds) {
|
||||
// lazy loading invoked via clear() and removeAll()
|
||||
query.select(many.getTargetIdProperty());
|
||||
query.select(many.targetIdProperty());
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public final class ManyWhereJoins implements Serializable {
|
||||
if (join != null) {
|
||||
addJoin(join);
|
||||
if (p != null) {
|
||||
String secondaryTableJoinPrefix = p.getSecondaryTableJoinPrefix();
|
||||
String secondaryTableJoinPrefix = p.secondaryTableJoinPrefix();
|
||||
if (secondaryTableJoinPrefix != null) {
|
||||
addJoin(join + "." + secondaryTableJoinPrefix);
|
||||
}
|
||||
|
||||
+4
-4
@@ -17,7 +17,7 @@ public final class CachedBeanDataFromBean {
|
||||
|
||||
BeanProperty idProperty = desc.idProperty();
|
||||
if (idProperty != null) {
|
||||
int propertyIndex = idProperty.getPropertyIndex();
|
||||
int propertyIndex = idProperty.propertyIndex();
|
||||
if (ebi.isLoadedProperty(propertyIndex)) {
|
||||
data.put(idProperty.name(), idProperty.getCacheDataValue(bean));
|
||||
}
|
||||
@@ -26,9 +26,9 @@ public final class CachedBeanDataFromBean {
|
||||
// extract all the non-many properties
|
||||
final boolean dirty = ebi.isDirty();
|
||||
for (BeanProperty prop : desc.propertiesNonMany()) {
|
||||
if (dirty && ebi.isDirtyProperty(prop.getPropertyIndex())) {
|
||||
if (dirty && ebi.isDirtyProperty(prop.propertyIndex())) {
|
||||
data.put(prop.name(), prop.getCacheDataValueOrig(ebi));
|
||||
} else if (ebi.isLoadedProperty(prop.getPropertyIndex())) {
|
||||
} else if (ebi.isLoadedProperty(prop.propertyIndex())) {
|
||||
data.put(prop.name(), prop.getCacheDataValue(bean));
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public final class CachedBeanDataFromBean {
|
||||
|
||||
long version = desc.getVersion(bean);
|
||||
EntityBean sharableBean = createSharableBean(desc, bean, ebi);
|
||||
return new CachedBeanData(sharableBean, desc.getDiscValue(), data, version);
|
||||
return new CachedBeanData(sharableBean, desc.discValue(), data, version);
|
||||
}
|
||||
|
||||
private static EntityBean createSharableBean(BeanDescriptor<?> desc, EntityBean bean, EntityBeanIntercept beanEbi) {
|
||||
|
||||
+3
-3
@@ -14,8 +14,8 @@ public final class CachedBeanDataToBean {
|
||||
// any future lazy loading skips L2 bean cache
|
||||
ebi.setLoadedFromCache(true);
|
||||
BeanProperty idProperty = desc.idProperty();
|
||||
if (desc.getInheritInfo() != null) {
|
||||
desc = desc.getInheritInfo().readType(bean.getClass()).desc();
|
||||
if (desc.inheritInfo() != null) {
|
||||
desc = desc.inheritInfo().readType(bean.getClass()).desc();
|
||||
}
|
||||
if (idProperty != null) {
|
||||
// load the id property
|
||||
@@ -37,7 +37,7 @@ public final class CachedBeanDataToBean {
|
||||
|
||||
private static void loadProperty(EntityBean bean, CachedBeanData cacheBeanData, EntityBeanIntercept ebi, BeanProperty prop, PersistenceContext context) {
|
||||
if (cacheBeanData.isLoaded(prop.name())) {
|
||||
if (!ebi.isLoadedProperty(prop.getPropertyIndex())) {
|
||||
if (!ebi.isLoadedProperty(prop.propertyIndex())) {
|
||||
Object value = cacheBeanData.getData(prop.name());
|
||||
prop.setCacheDataValue(bean, value, context);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ final class DefaultBeanLoader {
|
||||
EntityBeanIntercept ebi = parentBean._ebean_getIntercept();
|
||||
PersistenceContext pc = ebi.getPersistenceContext();
|
||||
BeanDescriptor<?> parentDesc = server.getBeanDescriptor(parentBean.getClass());
|
||||
BeanPropertyAssocMany<?> many = (BeanPropertyAssocMany<?>) parentDesc.getBeanProperty(propertyName);
|
||||
BeanPropertyAssocMany<?> many = (BeanPropertyAssocMany<?>) parentDesc.beanProperty(propertyName);
|
||||
BeanCollection<?> beanCollection = null;
|
||||
ExpressionList<?> filterMany = null;
|
||||
|
||||
@@ -91,9 +91,9 @@ final class DefaultBeanLoader {
|
||||
query.setLoadDescription("+lazy", null);
|
||||
}
|
||||
|
||||
query.select(parentDesc.getIdBinder().getIdProperty());
|
||||
query.select(parentDesc.idBinder().getIdProperty());
|
||||
if (onlyIds) {
|
||||
query.fetch(many.name(), many.getTargetIdProperty());
|
||||
query.fetch(many.name(), many.targetIdProperty());
|
||||
} else {
|
||||
query.fetch(many.name());
|
||||
}
|
||||
@@ -177,7 +177,7 @@ final class DefaultBeanLoader {
|
||||
}
|
||||
|
||||
BeanDescriptor<?> desc = server.getBeanDescriptor(bean.getClass());
|
||||
if (EntityType.EMBEDDED == desc.getEntityType()) {
|
||||
if (EntityType.EMBEDDED == desc.entityType()) {
|
||||
// lazy loading on an embedded bean property
|
||||
EntityBean embeddedOwner = (EntityBean) ebi.getEmbeddedOwner();
|
||||
refreshBeanInternal(embeddedOwner, mode, ebi.getEmbeddedOwnerIndex());
|
||||
|
||||
@@ -703,7 +703,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
}
|
||||
}
|
||||
|
||||
InheritInfo inheritInfo = desc.getInheritInfo();
|
||||
InheritInfo inheritInfo = desc.inheritInfo();
|
||||
if (inheritInfo == null || inheritInfo.isConcrete()) {
|
||||
return (T) desc.contextRef(pc, null, false, id);
|
||||
}
|
||||
@@ -952,11 +952,11 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
if (desc == null) {
|
||||
throw new PersistenceException(beanType.getName() + " is NOT an Entity Bean registered with this server?");
|
||||
}
|
||||
String named = desc.getNamedQuery(namedQuery);
|
||||
String named = desc.namedQuery(namedQuery);
|
||||
if (named != null) {
|
||||
return createQuery(beanType, named);
|
||||
}
|
||||
SpiRawSql rawSql = desc.getNamedRawSql(namedQuery);
|
||||
SpiRawSql rawSql = desc.namedRawSql(namedQuery);
|
||||
if (rawSql != null) {
|
||||
DefaultOrmQuery<T> query = createQuery(beanType);
|
||||
query.setRawSql(rawSql);
|
||||
@@ -2293,7 +2293,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
return Collections.singleton(idProperty);
|
||||
}
|
||||
}
|
||||
for (BeanProperty[] props : beanDesc.getUniqueProps()) {
|
||||
for (BeanProperty[] props : beanDesc.uniqueProps()) {
|
||||
Set<Property> ret = checkUniqueness(entityBean, beanDesc, props, transaction);
|
||||
if (ret != null) {
|
||||
return ret;
|
||||
|
||||
@@ -78,7 +78,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
public OrmQueryRequest(SpiEbeanServer server, OrmQueryEngine queryEngine, SpiQuery<T> query, SpiTransaction t) {
|
||||
super(server, t);
|
||||
this.beanDescriptor = query.getBeanDescriptor();
|
||||
this.finder = beanDescriptor.getBeanFinder();
|
||||
this.finder = beanDescriptor.beanFinder();
|
||||
this.queryEngine = queryEngine;
|
||||
this.query = query;
|
||||
this.readOnly = query.isReadOnly();
|
||||
@@ -499,7 +499,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
* Determine and return the ToMany property that is included in the query.
|
||||
*/
|
||||
public BeanPropertyAssocMany<?> determineMany() {
|
||||
manyProperty = beanDescriptor.getManyProperty(query);
|
||||
manyProperty = beanDescriptor.manyProperty(query);
|
||||
return manyProperty;
|
||||
}
|
||||
|
||||
@@ -515,7 +515,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
* query plan for this query exists.
|
||||
*/
|
||||
public CQueryPlan queryPlan() {
|
||||
return beanDescriptor.getQueryPlan(queryPlanKey);
|
||||
return beanDescriptor.queryPlan(queryPlanKey);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -533,7 +533,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
* Put the QueryPlan into the cache.
|
||||
*/
|
||||
public void putQueryPlan(CQueryPlan queryPlan) {
|
||||
beanDescriptor.putQueryPlan(queryPlanKey, queryPlan);
|
||||
beanDescriptor.queryPlan(queryPlanKey, queryPlan);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -617,7 +617,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
}
|
||||
|
||||
private ElPropertyValue mapProperty() {
|
||||
ElPropertyValue property = beanDescriptor.getElGetValue(query.getMapKey());
|
||||
ElPropertyValue property = beanDescriptor.elGetValue(query.getMapKey());
|
||||
if (property == null) {
|
||||
throw new IllegalStateException("Unknown map key property "+query.getMapKey());
|
||||
}
|
||||
@@ -684,7 +684,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
Collection<T> actualDetails = ((BeanCollection<T>)cached).getActualDetails();
|
||||
List<Object> ids = new ArrayList<>(actualDetails.size());
|
||||
for (T bean : actualDetails) {
|
||||
ids.add(beanDescriptor.getIdForJson(bean));
|
||||
ids.add(beanDescriptor.idForJson(bean));
|
||||
}
|
||||
beanDescriptor.readAuditMany(queryPlanKey.getPartialKey(), "l2-query-cache", ids);
|
||||
}
|
||||
@@ -761,7 +761,7 @@ public final class OrmQueryRequest<T> extends BeanRequest implements SpiOrmQuery
|
||||
* Return the base table alias for this query.
|
||||
*/
|
||||
public String baseTableAlias() {
|
||||
return query.getAlias(beanDescriptor.getBaseTableAlias());
|
||||
return query.getAlias(beanDescriptor.baseTableAlias());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -35,13 +35,13 @@ public final class PersistDeferredRelationship {
|
||||
*/
|
||||
public void execute(SpiTransaction transaction) {
|
||||
|
||||
String sql = beanDescriptor.getUpdateImportedIdSql(importedId);
|
||||
String sql = beanDescriptor.updateImportedIdSql(importedId);
|
||||
SqlUpdate sqlUpdate = ebeanServer.sqlUpdate(sql);
|
||||
|
||||
// bind the set clause for the importedId
|
||||
int pos = importedId.bind(1, sqlUpdate, assocBean);
|
||||
// bind the where clause for the bean
|
||||
Object[] idValues = beanDescriptor.getIdBinder().getIdValues(bean);
|
||||
Object[] idValues = beanDescriptor.idBinder().getIdValues(bean);
|
||||
for (int j = 0; j < idValues.length; j++) {
|
||||
sqlUpdate.setParameter(pos + j, idValues[j]);
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
// Mark Mutable scalar properties (like Hstore) as dirty where necessary
|
||||
beanDescriptor.checkMutableProperties(intercept);
|
||||
}
|
||||
this.concurrencyMode = beanDescriptor.getConcurrencyMode(intercept);
|
||||
this.concurrencyMode = beanDescriptor.concurrencyMode(intercept);
|
||||
this.publish = Flags.isPublish(flags);
|
||||
if (isMarkDraftDirty(publish)) {
|
||||
beanDescriptor.setDraftDirty(entityBean, true);
|
||||
@@ -210,7 +210,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
*/
|
||||
private DocStoreMode calcDocStoreMode(SpiTransaction txn, Type type) {
|
||||
DocStoreMode txnMode = (txn == null) ? null : txn.getDocStoreMode();
|
||||
return beanDescriptor.getDocStoreMode(type, txnMode);
|
||||
return beanDescriptor.docStoreMode(type, txnMode);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -272,28 +272,28 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
|
||||
private void onUpdateGeneratedProperties() {
|
||||
for (BeanProperty prop : beanDescriptor.propertiesGenUpdate()) {
|
||||
GeneratedProperty generatedProperty = prop.getGeneratedProperty();
|
||||
GeneratedProperty generatedProperty = prop.generatedProperty();
|
||||
if (prop.isVersion()) {
|
||||
if (isLoadedProperty(prop)) {
|
||||
// @Version property must be loaded to be involved
|
||||
Object value = generatedProperty.getUpdateValue(prop, entityBean, now());
|
||||
Object oldVal = prop.getValue(entityBean);
|
||||
setVersionValue(value);
|
||||
intercept.setOldValue(prop.getPropertyIndex(), oldVal);
|
||||
intercept.setOldValue(prop.propertyIndex(), oldVal);
|
||||
}
|
||||
} else {
|
||||
// @WhenModified set without invoking interception
|
||||
Object oldVal = prop.getValue(entityBean);
|
||||
Object value = generatedProperty.getUpdateValue(prop, entityBean, now());
|
||||
prop.setValueChanged(entityBean, value);
|
||||
intercept.setOldValue(prop.getPropertyIndex(), oldVal);
|
||||
intercept.setOldValue(prop.propertyIndex(), oldVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void onInsertGeneratedProperties() {
|
||||
for (BeanProperty prop : beanDescriptor.propertiesGenInsert()) {
|
||||
Object value = prop.getGeneratedProperty().getInsertValue(prop, entityBean, now());
|
||||
Object value = prop.generatedProperty().getInsertValue(prop, entityBean, now());
|
||||
prop.setValueChanged(entityBean, value);
|
||||
}
|
||||
}
|
||||
@@ -704,21 +704,21 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
* Return true if this property is loaded (full bean or included in partial bean).
|
||||
*/
|
||||
public boolean isLoadedProperty(BeanProperty prop) {
|
||||
return intercept.isLoadedProperty(prop.getPropertyIndex());
|
||||
return intercept.isLoadedProperty(prop.propertyIndex());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the property is dirty.
|
||||
*/
|
||||
public boolean isDirtyProperty(BeanProperty prop) {
|
||||
return intercept.isDirtyProperty(prop.getPropertyIndex());
|
||||
return intercept.isDirtyProperty(prop.propertyIndex());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the original / old value for the given property.
|
||||
*/
|
||||
public Object getOrigValue(BeanProperty prop) {
|
||||
return intercept.getOrigValue(prop.getPropertyIndex());
|
||||
return intercept.getOrigValue(prop.propertyIndex());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -752,7 +752,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
* Soft delete is executed as update so we want to set deleted=true property.
|
||||
*/
|
||||
private void prepareForSoftDelete() {
|
||||
beanDescriptor.setSoftDeleteValue(entityBean);
|
||||
beanDescriptor.softDeleteValue(entityBean);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -855,7 +855,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
}
|
||||
|
||||
private void changeLog() {
|
||||
BeanChange changeLogBean = beanDescriptor.getChangeLogBean(this);
|
||||
BeanChange changeLogBean = beanDescriptor.changeLogBean(this);
|
||||
if (changeLogBean != null) {
|
||||
transaction.addBeanChange(changeLogBean);
|
||||
}
|
||||
@@ -971,9 +971,9 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
*/
|
||||
public boolean isAddToUpdate(BeanProperty prop) {
|
||||
if (requestUpdateAllLoadedProps) {
|
||||
return intercept.isLoadedProperty(prop.getPropertyIndex());
|
||||
return intercept.isLoadedProperty(prop.propertyIndex());
|
||||
} else {
|
||||
return intercept.isDirtyProperty(prop.getPropertyIndex());
|
||||
return intercept.isDirtyProperty(prop.propertyIndex());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1154,9 +1154,9 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
} else {
|
||||
key = intercept.getDirtyPropertyKey();
|
||||
}
|
||||
BeanProperty versionProperty = beanDescriptor.getVersionProperty();
|
||||
BeanProperty versionProperty = beanDescriptor.versionProperty();
|
||||
if (versionProperty != null) {
|
||||
if (intercept.isLoadedProperty(versionProperty.getPropertyIndex())) {
|
||||
if (intercept.isLoadedProperty(versionProperty.propertyIndex())) {
|
||||
key.append('v');
|
||||
}
|
||||
}
|
||||
@@ -1170,7 +1170,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
* Return the table to update depending if the request is a 'publish' one or normal.
|
||||
*/
|
||||
public String updateTable() {
|
||||
return publish ? beanDescriptor.baseTable() : beanDescriptor.getDraftTable();
|
||||
return publish ? beanDescriptor.baseTable() : beanDescriptor.draftTable();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1377,7 +1377,7 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
* Return the SQL used to fetch the last inserted id value.
|
||||
*/
|
||||
public String getSelectLastInsertedId() {
|
||||
return beanDescriptor.getSelectLastInsertedId(publish);
|
||||
return beanDescriptor.selectLastInsertedId(publish);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ final class AssocOneHelpRefExported extends AssocOneHelp {
|
||||
AssocOneHelpRefExported(BeanPropertyAssocOne<?> property) {
|
||||
super(property);
|
||||
this.softDelete = property.targetDescriptor.isSoftDelete();
|
||||
this.softDeletePredicate = (softDelete) ? property.targetDescriptor.getSoftDeletePredicate("") : null;
|
||||
this.softDeletePredicate = (softDelete) ? property.targetDescriptor.softDeletePredicate("") : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@ abstract class BaseCollectionHelp<T> implements BeanCollectionHelp<T> {
|
||||
|
||||
BaseCollectionHelp(BeanPropertyAssocMany<T> many) {
|
||||
this.many = many;
|
||||
this.targetDescriptor = many.getTargetDescriptor();
|
||||
this.targetDescriptor = many.targetDescriptor();
|
||||
this.propertyName = many.name();
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ final class BeanChangeJson implements BeanDiffVisitor {
|
||||
public void visitPush(int position) {
|
||||
stack.push(descriptor);
|
||||
BeanPropertyAssocOne<?> embedded = (BeanPropertyAssocOne<?>)descriptor.propertiesIndex[position];
|
||||
descriptor = embedded.getTargetDescriptor();
|
||||
descriptor = embedded.targetDescriptor();
|
||||
newJson.writeStartObject(embedded.name());
|
||||
if (oldJson != null) {
|
||||
oldJson.writeStartObject(embedded.name());
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ public final class BeanCollectionHelpFactory {
|
||||
*/
|
||||
public static <T> BeanCollectionHelp<T> create(BeanPropertyAssocMany<T> many) {
|
||||
boolean elementCollection = many.isElementCollection();
|
||||
ManyType manyType = many.getManyType();
|
||||
ManyType manyType = many.manyType();
|
||||
switch (manyType) {
|
||||
case LIST:
|
||||
return elementCollection ? new BeanListHelpElement<>(many) : new BeanListHelp<>(many);
|
||||
@@ -45,7 +45,7 @@ public final class BeanCollectionHelpFactory {
|
||||
|
||||
} else if (manyType == SpiQuery.Type.MAP) {
|
||||
BeanDescriptor<T> target = request.descriptor();
|
||||
ElPropertyValue elProperty = target.getElGetValue(request.query().getMapKey());
|
||||
ElPropertyValue elProperty = target.elGetValue(request.query().getMapKey());
|
||||
return new BeanMapQueryHelp<>(elProperty);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -452,7 +452,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the DatabaseConfig.
|
||||
*/
|
||||
public DatabaseConfig getConfig() {
|
||||
public DatabaseConfig config() {
|
||||
return owner.getConfig();
|
||||
}
|
||||
|
||||
@@ -470,7 +470,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the EbeanServer instance that owns this BeanDescriptor.
|
||||
*/
|
||||
public SpiEbeanServer getEbeanServer() {
|
||||
public SpiEbeanServer ebeanServer() {
|
||||
return ebeanServer;
|
||||
}
|
||||
|
||||
@@ -492,11 +492,11 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the type of this domain object.
|
||||
*/
|
||||
public EntityType getEntityType() {
|
||||
public EntityType entityType() {
|
||||
return entityType;
|
||||
}
|
||||
|
||||
private String[] getProperties() {
|
||||
private String[] properties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
@@ -545,7 +545,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
for (BeanPropertyAssocMany<?> manyToMany : propertiesManyToMany) {
|
||||
// register associated history table for M2M intersection
|
||||
if (!manyToMany.isExcludedFromHistory()) {
|
||||
TableJoin intersectionTableJoin = manyToMany.getIntersectionTableJoin();
|
||||
TableJoin intersectionTableJoin = manyToMany.intersectionTableJoin();
|
||||
initContext.addHistoryIntersection(intersectionTableJoin.getTable());
|
||||
}
|
||||
}
|
||||
@@ -570,8 +570,8 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
whereIdInSql = " where " + idBinderInLHSSqlNoAlias + " ";
|
||||
deleteByIdInSql = "delete from " + baseTable + whereIdInSql;
|
||||
if (softDelete) {
|
||||
softDeleteByIdSql = "update " + baseTable + " set " + getSoftDeleteDbSet() + " where " + idEqualsSql;
|
||||
softDeleteByIdInSql = "update " + baseTable + " set " + getSoftDeleteDbSet() + " where " + idBinderInLHSSqlNoAlias + " ";
|
||||
softDeleteByIdSql = "update " + baseTable + " set " + softDeleteDbSet() + " where " + idEqualsSql;
|
||||
softDeleteByIdInSql = "update " + baseTable + " set " + softDeleteDbSet() + " where " + idBinderInLHSSqlNoAlias + " ";
|
||||
} else {
|
||||
softDeleteByIdSql = null;
|
||||
softDeleteByIdInSql = null;
|
||||
@@ -584,7 +584,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
if (naturalKey != null && naturalKey.length != 0) {
|
||||
BeanProperty[] props = new BeanProperty[naturalKey.length];
|
||||
for (int i = 0; i < naturalKey.length; i++) {
|
||||
props[i] = getBeanProperty(naturalKey[i]);
|
||||
props[i] = beanProperty(naturalKey[i]);
|
||||
}
|
||||
this.beanNaturalKey = new BeanNaturalKey(naturalKey, props);
|
||||
}
|
||||
@@ -601,7 +601,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
|
||||
boolean hasCircularImportedIdTo(BeanDescriptor<?> sourceDesc) {
|
||||
for (BeanPropertyAssocOne<?> assocOne : propertiesOneImportedSave) {
|
||||
if (assocOne.getTargetDescriptor() == sourceDesc) {
|
||||
if (assocOne.targetDescriptor() == sourceDesc) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -731,10 +731,10 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
EntityBeanIntercept fromEbi = bean._ebean_getIntercept();
|
||||
EntityBeanIntercept toEbi = existing._ebean_getIntercept();
|
||||
int propertyLength = toEbi.getPropertyLength();
|
||||
String[] names = getProperties();
|
||||
String[] names = properties();
|
||||
for (int i = 0; i < propertyLength; i++) {
|
||||
if (fromEbi.isLoadedProperty(i)) {
|
||||
BeanProperty property = getBeanProperty(names[i]);
|
||||
BeanProperty property = beanProperty(names[i]);
|
||||
if (!toEbi.isLoadedProperty(i)) {
|
||||
Object val = property.getValue(bean);
|
||||
property.setValue(existing, val);
|
||||
@@ -758,14 +758,14 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the ReadAuditLogger for logging read audit events.
|
||||
*/
|
||||
public ReadAuditLogger getReadAuditLogger() {
|
||||
public ReadAuditLogger readAuditLogger() {
|
||||
return ebeanServer.getReadAuditLogger();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the ReadAuditPrepare for preparing read audit events prior to logging.
|
||||
*/
|
||||
private ReadAuditPrepare getReadAuditPrepare() {
|
||||
private ReadAuditPrepare readAuditPrepare() {
|
||||
return ebeanServer.getReadAuditPrepare();
|
||||
}
|
||||
|
||||
@@ -776,7 +776,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return true if this request should be included in the change log.
|
||||
*/
|
||||
public BeanChange getChangeLogBean(PersistRequestBean<T> request) {
|
||||
public BeanChange changeLogBean(PersistRequestBean<T> request) {
|
||||
switch (request.type()) {
|
||||
case INSERT:
|
||||
return changeLogFilter.includeInsert(request) ? insertBeanChange(request) : null;
|
||||
@@ -869,14 +869,14 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the "where id in" sql (for use with UpdateQuery).
|
||||
*/
|
||||
public String getWhereIdInSql() {
|
||||
public String whereIdInSql() {
|
||||
return whereIdInSql;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the "delete by id" sql.
|
||||
*/
|
||||
public String getDeleteByIdInSql() {
|
||||
public String deleteByIdInSql() {
|
||||
return deleteByIdInSql;
|
||||
}
|
||||
|
||||
@@ -927,32 +927,32 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the cache options.
|
||||
*/
|
||||
public CacheOptions getCacheOptions() {
|
||||
public CacheOptions cacheOptions() {
|
||||
return cacheHelp.getCacheOptions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Encrypt key given the BeanProperty.
|
||||
*/
|
||||
public EncryptKey getEncryptKey(BeanProperty p) {
|
||||
public EncryptKey encryptKey(BeanProperty p) {
|
||||
return owner.getEncryptKey(baseTable, p.dbColumn());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Encrypt key given the table and column name.
|
||||
*/
|
||||
public EncryptKey getEncryptKey(String tableName, String columnName) {
|
||||
public EncryptKey encryptKey(String tableName, String columnName) {
|
||||
return owner.getEncryptKey(tableName, columnName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Scalar type for the given JDBC type.
|
||||
*/
|
||||
public ScalarType<?> getScalarType(int jdbcType) {
|
||||
public ScalarType<?> scalarType(int jdbcType) {
|
||||
return owner.getScalarType(jdbcType);
|
||||
}
|
||||
|
||||
public ScalarType<?> getScalarType(String cast) {
|
||||
public ScalarType<?> scalarType(String cast) {
|
||||
return owner.getScalarType(cast);
|
||||
}
|
||||
|
||||
@@ -967,7 +967,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the default select clause.
|
||||
*/
|
||||
public String getDefaultSelectClause() {
|
||||
public String defaultSelectClause() {
|
||||
return defaultSelectClause;
|
||||
}
|
||||
|
||||
@@ -1075,14 +1075,14 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the named ORM query.
|
||||
*/
|
||||
public String getNamedQuery(String name) {
|
||||
public String namedQuery(String name) {
|
||||
return namedQuery.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the named RawSql query.
|
||||
*/
|
||||
public SpiRawSql getNamedRawSql(String named) {
|
||||
public SpiRawSql namedRawSql(String named) {
|
||||
return namedRawSql.get(named);
|
||||
}
|
||||
|
||||
@@ -1090,7 +1090,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
* Return the type of DocStoreMode that should occur for this type of persist request
|
||||
* given the transactions requested mode.
|
||||
*/
|
||||
public DocStoreMode getDocStoreMode(PersistRequest.Type persistType, DocStoreMode txnMode) {
|
||||
public DocStoreMode docStoreMode(PersistRequest.Type persistType, DocStoreMode txnMode) {
|
||||
return docStoreAdapter.getMode(persistType, txnMode);
|
||||
}
|
||||
|
||||
@@ -1127,7 +1127,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the draft dirty boolean property or null if there is not one assigned to this bean type.
|
||||
*/
|
||||
BeanProperty getDraftDirty() {
|
||||
BeanProperty draftDirty() {
|
||||
return draftDirty;
|
||||
}
|
||||
|
||||
@@ -1149,7 +1149,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the natural key.
|
||||
*/
|
||||
public BeanNaturalKey getNaturalKey() {
|
||||
public BeanNaturalKey naturalKey() {
|
||||
return beanNaturalKey;
|
||||
}
|
||||
|
||||
@@ -1421,13 +1421,13 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
* Write a bean read to the read audit log.
|
||||
*/
|
||||
public void readAuditBean(String queryKey, String bindLog, Object bean) {
|
||||
ReadEvent event = new ReadEvent(fullName, queryKey, bindLog, getIdForJson(bean));
|
||||
ReadEvent event = new ReadEvent(fullName, queryKey, bindLog, idForJson(bean));
|
||||
readAuditPrepare(event);
|
||||
getReadAuditLogger().auditBean(event);
|
||||
readAuditLogger().auditBean(event);
|
||||
}
|
||||
|
||||
private void readAuditPrepare(ReadEvent event) {
|
||||
ReadAuditPrepare prepare = getReadAuditPrepare();
|
||||
ReadAuditPrepare prepare = readAuditPrepare();
|
||||
if (prepare != null) {
|
||||
prepare.prepare(event);
|
||||
}
|
||||
@@ -1439,7 +1439,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
public void readAuditMany(String queryKey, String bindLog, List<Object> ids) {
|
||||
ReadEvent event = new ReadEvent(fullName, queryKey, bindLog, ids);
|
||||
readAuditPrepare(event);
|
||||
getReadAuditLogger().auditMany(event);
|
||||
readAuditLogger().auditMany(event);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1447,13 +1447,13 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
*/
|
||||
public void readAuditFutureMany(ReadEvent event) {
|
||||
// this has already been prepared (in foreground thread)
|
||||
getReadAuditLogger().auditMany(event);
|
||||
readAuditLogger().auditMany(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the base table alias. This is always the first letter of the bean name.
|
||||
*/
|
||||
public String getBaseTableAlias() {
|
||||
public String baseTableAlias() {
|
||||
return baseTableAlias;
|
||||
}
|
||||
|
||||
@@ -1530,32 +1530,32 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
}
|
||||
}
|
||||
|
||||
public CQueryPlan getQueryPlan(CQueryPlanKey key) {
|
||||
public CQueryPlan queryPlan(CQueryPlanKey key) {
|
||||
return queryPlanCache.get(key);
|
||||
}
|
||||
|
||||
public void putQueryPlan(CQueryPlanKey key, CQueryPlan plan) {
|
||||
public void queryPlan(CQueryPlanKey key, CQueryPlan plan) {
|
||||
queryPlanCache.put(key, plan);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a UpdatePlan for a given hash.
|
||||
*/
|
||||
public SpiUpdatePlan getUpdatePlan(String key) {
|
||||
public SpiUpdatePlan updatePlan(String key) {
|
||||
return updatePlanCache.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a UpdatePlan to the cache with a given hash.
|
||||
*/
|
||||
public void putUpdatePlan(String key, SpiUpdatePlan plan) {
|
||||
public void updatePlan(String key, SpiUpdatePlan plan) {
|
||||
updatePlanCache.put(key, plan);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a Sql update statement to set the importedId value (deferred execution).
|
||||
*/
|
||||
public String getUpdateImportedIdSql(ImportedId prop) {
|
||||
public String updateImportedIdSql(ImportedId prop) {
|
||||
return "update " + baseTable + " set " + prop.importedIdClause() + " where " + idBinder.getBindIdSql(null);
|
||||
}
|
||||
|
||||
@@ -1636,7 +1636,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the many property included in the query or null if one is not.
|
||||
*/
|
||||
public BeanPropertyAssocMany<?> getManyProperty(SpiQuery<?> query) {
|
||||
public BeanPropertyAssocMany<?> manyProperty(SpiQuery<?> query) {
|
||||
OrmQueryDetail detail = query.getDetail();
|
||||
for (BeanPropertyAssocMany<?> many : propertiesMany) {
|
||||
if (detail.includesPath(many.name())) {
|
||||
@@ -1649,7 +1649,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return a raw expression for 'where parent id in ...' clause.
|
||||
*/
|
||||
String getParentIdInExpr(int parentIdSize, String rawWhere) {
|
||||
String parentIdInExpr(int parentIdSize, String rawWhere) {
|
||||
String inClause = idBinder.getIdInValueExpr(false, parentIdSize);
|
||||
return idBinder.isIdInExpandedForm() ? inClause : rawWhere + inClause;
|
||||
}
|
||||
@@ -1658,7 +1658,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
* Return the IdBinder which is helpful for handling the various types of Id.
|
||||
*/
|
||||
@Override
|
||||
public IdBinder getIdBinder() {
|
||||
public IdBinder idBinder() {
|
||||
return idBinder;
|
||||
}
|
||||
|
||||
@@ -1699,7 +1699,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
* Return the sql for binding an id. This is the columns with table alias that
|
||||
* make up the id.
|
||||
*/
|
||||
public String getIdBinderIdSql(String alias) {
|
||||
public String idBinderIdSql(String alias) {
|
||||
if (alias == null) {
|
||||
return idBinderIdSql;
|
||||
} else {
|
||||
@@ -1710,7 +1710,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the sql for binding id's using an IN clause.
|
||||
*/
|
||||
public String getIdBinderInLHSSql() {
|
||||
public String idBinderInLHSSql() {
|
||||
return idBinderInLHSSql;
|
||||
}
|
||||
|
||||
@@ -1728,7 +1728,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
* <p>
|
||||
* This 'flattens' any EmbeddedId or multiple Id property cases.
|
||||
*/
|
||||
public Object[] getBindIdValues(Object idValue) {
|
||||
public Object[] bindIdValues(Object idValue) {
|
||||
return idBinder.getBindValues(idValue);
|
||||
}
|
||||
|
||||
@@ -1904,7 +1904,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
if (assocProp == null) {
|
||||
throw new IllegalStateException("Unknown property path [" + split[0] + "] from[" + path + "]");
|
||||
}
|
||||
BeanDescriptor<?> targetDesc = assocProp.getTargetDescriptor();
|
||||
BeanDescriptor<?> targetDesc = assocProp.targetDescriptor();
|
||||
path = split[1];
|
||||
other = targetDesc;
|
||||
}
|
||||
@@ -1912,13 +1912,13 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
|
||||
@Override
|
||||
public BeanType<?> beanTypeAtPath(String path) {
|
||||
return getBeanDescriptor(path);
|
||||
return descriptor(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the BeanDescriptor for a given path of Associated One or Many beans.
|
||||
*/
|
||||
public BeanDescriptor<?> getBeanDescriptor(String path) {
|
||||
public BeanDescriptor<?> descriptor(String path) {
|
||||
BeanDescriptor<?> result = this;
|
||||
while (true) {
|
||||
if (path == null) {
|
||||
@@ -1929,7 +1929,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
if (beanProperty instanceof BeanPropertyAssoc<?>) {
|
||||
BeanPropertyAssoc<?> assocProp = (BeanPropertyAssoc<?>) beanProperty;
|
||||
path = splitBegin[1];
|
||||
result = assocProp.getTargetDescriptor();
|
||||
result = assocProp.targetDescriptor();
|
||||
} else {
|
||||
throw new PersistenceException("Invalid path " + path + " from " + result.fullName());
|
||||
}
|
||||
@@ -1939,7 +1939,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the BeanDescriptor of another bean type.
|
||||
*/
|
||||
public <U> BeanDescriptor<U> getBeanDescriptor(Class<U> otherType) {
|
||||
public <U> BeanDescriptor<U> descriptor(Class<U> otherType) {
|
||||
return owner.getBeanDescriptor(otherType);
|
||||
}
|
||||
|
||||
@@ -1953,7 +1953,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the order column property.
|
||||
*/
|
||||
public BeanProperty getOrderColumn() {
|
||||
public BeanProperty orderColumn() {
|
||||
return orderColumn;
|
||||
}
|
||||
|
||||
@@ -1964,7 +1964,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
* relationships we have this 'shadow' property which is not externally
|
||||
* visible.
|
||||
*/
|
||||
public BeanPropertyAssocOne<?> getUnidirectional() {
|
||||
public BeanPropertyAssocOne<?> unidirectional() {
|
||||
BeanDescriptor<?> other = this;
|
||||
while (true) {
|
||||
if (other.unidirectional != null) {
|
||||
@@ -1991,7 +1991,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return bean class name.
|
||||
*/
|
||||
public String getDescriptorId() {
|
||||
public String descriptorId() {
|
||||
return fullName;
|
||||
}
|
||||
|
||||
@@ -2028,7 +2028,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the simple name of the entity bean.
|
||||
*/
|
||||
public String getSimpleName() {
|
||||
public String simpleName() {
|
||||
return beanType.getSimpleName();
|
||||
}
|
||||
|
||||
@@ -2093,7 +2093,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the Id property name or null if no Id property exists.
|
||||
*/
|
||||
public String getIdName() {
|
||||
public String idName() {
|
||||
return (idProperty == null) ? null : idProperty.name();
|
||||
}
|
||||
|
||||
@@ -2136,7 +2136,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
* <p>
|
||||
* The usage is to provide simple id types for JSON processing (for embeddedId's).
|
||||
*/
|
||||
public Object getIdForJson(Object bean) {
|
||||
public Object idForJson(Object bean) {
|
||||
return idBinder.getIdForJson((EntityBean) bean);
|
||||
}
|
||||
|
||||
@@ -2153,7 +2153,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
* Return the default order by that may need to be added if a many property is
|
||||
* included in the query.
|
||||
*/
|
||||
public String getDefaultOrderBy() {
|
||||
public String defaultOrderBy() {
|
||||
return idBinder.getDefaultOrderBy();
|
||||
}
|
||||
|
||||
@@ -2197,15 +2197,15 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Get a BeanProperty by its name.
|
||||
*/
|
||||
public BeanProperty getBeanProperty(String propName) {
|
||||
public BeanProperty beanProperty(String propName) {
|
||||
return propMap.get(propName);
|
||||
}
|
||||
|
||||
public void sort(List<T> list, String sortByClause) {
|
||||
list.sort(getElComparator(sortByClause));
|
||||
list.sort(elComparator(sortByClause));
|
||||
}
|
||||
|
||||
public ElComparator<T> getElComparator(String propNameOrSortBy) {
|
||||
public ElComparator<T> elComparator(String propNameOrSortBy) {
|
||||
return comparatorCache.computeIfAbsent(propNameOrSortBy, this::createComparator);
|
||||
}
|
||||
|
||||
@@ -2217,7 +2217,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
public void lazyLoadRegister(String prefix, EntityBeanIntercept ebi, EntityBean bean, LoadContext loadContext) {
|
||||
// load the List/Set/Map proxy objects (deferred fetching of lists)
|
||||
for (BeanPropertyAssocMany<?> many : propertiesMany()) {
|
||||
if (!ebi.isLoadedProperty(many.getPropertyIndex())) {
|
||||
if (!ebi.isLoadedProperty(many.propertyIndex())) {
|
||||
BeanCollection<?> ref = many.createReferenceIfNull(bean);
|
||||
if (ref != null && !ref.isRegisteredWithLoadContext()) {
|
||||
String path = SplitName.add(prefix, many.name());
|
||||
@@ -2301,7 +2301,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
}
|
||||
|
||||
private ElComparator<T> createPropertyComparator(SortByClause.Property sortProp) {
|
||||
ElPropertyValue elGetValue = getElGetValue(sortProp.getName());
|
||||
ElPropertyValue elGetValue = elGetValue(sortProp.getName());
|
||||
if (elGetValue == null) {
|
||||
logger.error("Sort property [" + sortProp + "] not found in " + beanType + ". Cannot sort.");
|
||||
return new ElComparatorNoop<>();
|
||||
@@ -2320,7 +2320,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
@Override
|
||||
public boolean isValidExpression(String propertyName) {
|
||||
try {
|
||||
return (getElGetValue(propertyName) != null);
|
||||
return (elGetValue(propertyName) != null);
|
||||
} catch (PersistenceException e) {
|
||||
return false;
|
||||
}
|
||||
@@ -2329,7 +2329,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Get an Expression language Value object.
|
||||
*/
|
||||
public ElPropertyValue getElGetValue(String propName) {
|
||||
public ElPropertyValue elGetValue(String propName) {
|
||||
ElPropertyValue elGetValue = elCache.get(propName);
|
||||
if (elGetValue != null) {
|
||||
return elGetValue;
|
||||
@@ -2343,7 +2343,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
|
||||
@Override
|
||||
public ExpressionPath expressionPath(String path) {
|
||||
return getElGetValue(path);
|
||||
return elGetValue(path);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2351,7 +2351,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
* <p>
|
||||
* The foreign key shortcuts means we can avoid unnecessary joins.
|
||||
*/
|
||||
public ElPropertyDeploy getElPropertyDeploy(String propName) {
|
||||
public ElPropertyDeploy elPropertyDeploy(String propName) {
|
||||
ElPropertyDeploy elProp = elDeployCache.get(propName);
|
||||
if (elProp != null) {
|
||||
return elProp;
|
||||
@@ -2359,7 +2359,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
if (!propName.contains(".")) {
|
||||
// No period means simple property and no need to look for
|
||||
// foreign key properties (in order to avoid an extra join)
|
||||
elProp = getElGetValue(propName);
|
||||
elProp = elGetValue(propName);
|
||||
} else {
|
||||
elProp = buildElGetValue(propName, null, true);
|
||||
}
|
||||
@@ -2414,7 +2414,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
assocProperty = tablePath.get(schemaName + "." + tableName);
|
||||
}
|
||||
if (assocProperty != null) {
|
||||
String relativePath = assocProperty.getTargetDescriptor().findBeanPath(schemaName, tableName, columnName);
|
||||
String relativePath = assocProperty.targetDescriptor().findBeanPath(schemaName, tableName, columnName);
|
||||
if (relativePath != null) {
|
||||
return SplitName.add(assocProperty.name(), relativePath);
|
||||
}
|
||||
@@ -2510,7 +2510,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
* of bean is not involved in any ORM inheritance mapping.
|
||||
*/
|
||||
@Override
|
||||
public InheritInfo getInheritInfo() {
|
||||
public InheritInfo inheritInfo() {
|
||||
return inheritInfo;
|
||||
}
|
||||
|
||||
@@ -2527,7 +2527,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the discriminator value for this bean type (or null when there is no inheritance).
|
||||
*/
|
||||
public String getDiscValue() {
|
||||
public String discValue() {
|
||||
return inheritInfo == null ? null : inheritInfo.getDiscriminatorStringValue();
|
||||
}
|
||||
|
||||
@@ -2554,7 +2554,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the compound unique constraints.
|
||||
*/
|
||||
public IndexDefinition[] getIndexDefinitions() {
|
||||
public IndexDefinition[] indexDefinitions() {
|
||||
return indexDefinitions;
|
||||
}
|
||||
|
||||
@@ -2569,7 +2569,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the beanFinder (Migrate over to getFindController).
|
||||
*/
|
||||
public BeanFindController getBeanFinder() {
|
||||
public BeanFindController beanFinder() {
|
||||
return beanFinder;
|
||||
}
|
||||
|
||||
@@ -2676,7 +2676,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the DB comment for the base table.
|
||||
*/
|
||||
public String getDbComment() {
|
||||
public String dbComment() {
|
||||
return dbComment;
|
||||
}
|
||||
|
||||
@@ -2690,21 +2690,21 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the partition details of the bean.
|
||||
*/
|
||||
public PartitionMeta getPartitionMeta() {
|
||||
public PartitionMeta partitionMeta() {
|
||||
return partitionMeta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the storage engine.
|
||||
*/
|
||||
public String getStorageEngine() {
|
||||
public String storageEngine() {
|
||||
return storageEngine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the dependent tables for a view based entity.
|
||||
*/
|
||||
public String[] getDependentTables() {
|
||||
public String[] dependentTables() {
|
||||
return dependentTables;
|
||||
}
|
||||
|
||||
@@ -2727,7 +2727,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
* Return the base table to use given the query temporal mode.
|
||||
*/
|
||||
@Override
|
||||
public String getBaseTable(SpiQuery.TemporalMode mode) {
|
||||
public String baseTable(SpiQuery.TemporalMode mode) {
|
||||
switch (mode) {
|
||||
case DRAFT:
|
||||
return draftTable;
|
||||
@@ -2743,7 +2743,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the associated draft table.
|
||||
*/
|
||||
public String getDraftTable() {
|
||||
public String draftTable() {
|
||||
return draftTable;
|
||||
}
|
||||
|
||||
@@ -2759,17 +2759,17 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
return softDelete;
|
||||
}
|
||||
|
||||
public void setSoftDeleteValue(EntityBean bean) {
|
||||
public void softDeleteValue(EntityBean bean) {
|
||||
softDeleteProperty.setSoftDeleteValue(bean);
|
||||
}
|
||||
|
||||
String getSoftDeleteDbSet() {
|
||||
return softDeleteProperty.getSoftDeleteDbSet();
|
||||
String softDeleteDbSet() {
|
||||
return softDeleteProperty.softDeleteDbSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSoftDeletePredicate(String tableAlias) {
|
||||
return softDeleteProperty.getSoftDeleteDbPredicate(tableAlias);
|
||||
public String softDeletePredicate(String tableAlias) {
|
||||
return softDeleteProperty.softDeleteDbPredicate(tableAlias);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2779,7 +2779,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
logger.info("(Lazy) loading unsuccessful for type:{} id:{} - expecting when bean has been deleted", name(), id);
|
||||
bean._ebean_getIntercept().setLazyLoadFailure(id);
|
||||
} else {
|
||||
setSoftDeleteValue(bean);
|
||||
softDeleteValue(bean);
|
||||
bean._ebean_getIntercept().setLoaded();
|
||||
setAllLoaded(bean);
|
||||
}
|
||||
@@ -2801,7 +2801,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
|
||||
@Override
|
||||
public boolean isEmbeddedPath(String propertyPath) {
|
||||
ElPropertyDeploy elProp = getElPropertyDeploy(propertyPath);
|
||||
ElPropertyDeploy elProp = elPropertyDeploy(propertyPath);
|
||||
if (elProp == null) {
|
||||
throw new PersistenceException("Invalid path " + propertyPath + " from " + fullName());
|
||||
}
|
||||
@@ -2810,7 +2810,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
|
||||
@Override
|
||||
public ExtraJoin extraJoin(String propertyPath) {
|
||||
ElPropertyValue elGetValue = getElGetValue(propertyPath);
|
||||
ElPropertyValue elGetValue = elGetValue(propertyPath);
|
||||
if (elGetValue != null) {
|
||||
BeanProperty beanProperty = elGetValue.beanProperty();
|
||||
if (beanProperty instanceof BeanPropertyAssoc<?>) {
|
||||
@@ -2825,7 +2825,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
|
||||
@Override
|
||||
public void inheritanceLoad(SqlBeanLoad sqlBeanLoad, STreeProperty property, DbReadContext ctx) {
|
||||
BeanProperty p = getBeanProperty(property.name());
|
||||
BeanProperty p = beanProperty(property.name());
|
||||
if (p != null) {
|
||||
p.load(sqlBeanLoad);
|
||||
} else {
|
||||
@@ -2874,7 +2874,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
public boolean isToManyDirty(EntityBean bean) {
|
||||
final EntityBeanIntercept ebi = bean._ebean_getIntercept();
|
||||
for (BeanPropertyAssocMany<?> many : propertiesManySave) {
|
||||
if (ebi.isLoadedProperty(many.getPropertyIndex())) {
|
||||
if (ebi.isLoadedProperty(many.propertyIndex())) {
|
||||
final BeanCollection<?> value = (BeanCollection<?>) many.getValue(bean);
|
||||
if (value != null && value.hasModifications()) {
|
||||
return true;
|
||||
@@ -2902,7 +2902,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
if (draftDirty != null) {
|
||||
// check to see if the dirty property has already
|
||||
// been set and if so do not set the value
|
||||
if (!entityBean._ebean_getIntercept().isChangedProperty(draftDirty.getPropertyIndex())) {
|
||||
if (!entityBean._ebean_getIntercept().isChangedProperty(draftDirty.propertyIndex())) {
|
||||
draftDirty.setValueIntercept(entityBean, value);
|
||||
}
|
||||
}
|
||||
@@ -2952,7 +2952,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
return idGeneratedValue;
|
||||
}
|
||||
|
||||
public IdentityMode getIdentityMode() {
|
||||
public IdentityMode identityMode() {
|
||||
return identityMode;
|
||||
}
|
||||
|
||||
@@ -2962,7 +2962,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
* This is only used with Identity columns and getGeneratedKeys is not
|
||||
* supported.
|
||||
*/
|
||||
public String getSelectLastInsertedId(boolean publish) {
|
||||
public String selectLastInsertedId(boolean publish) {
|
||||
return publish ? selectLastInsertedId : selectLastInsertedIdDraft;
|
||||
}
|
||||
|
||||
@@ -3045,7 +3045,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
}
|
||||
}
|
||||
|
||||
public TableJoin getPrimaryKeyJoin() {
|
||||
public TableJoin primaryKeyJoin() {
|
||||
return primaryKeyJoin;
|
||||
}
|
||||
|
||||
@@ -3124,7 +3124,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
*/
|
||||
public void checkMutableProperties(EntityBeanIntercept ebi) {
|
||||
for (BeanProperty beanProperty : propertiesMutable) {
|
||||
int propertyIndex = beanProperty.getPropertyIndex();
|
||||
int propertyIndex = beanProperty.propertyIndex();
|
||||
if (ebi.isLoadedProperty(propertyIndex)) {
|
||||
Object value = beanProperty.getValue(ebi.getOwner());
|
||||
if (beanProperty.checkMutable(value, ebi.isDirtyProperty(propertyIndex), ebi)) {
|
||||
@@ -3136,7 +3136,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
}
|
||||
}
|
||||
|
||||
public ConcurrencyMode getConcurrencyMode(EntityBeanIntercept ebi) {
|
||||
public ConcurrencyMode concurrencyMode(EntityBeanIntercept ebi) {
|
||||
if (!hasVersionProperty(ebi)) {
|
||||
return ConcurrencyMode.NONE;
|
||||
} else {
|
||||
@@ -3287,7 +3287,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
* <p>
|
||||
* Note that this DOES NOT find a version property on an embedded bean.
|
||||
*/
|
||||
public BeanProperty getVersionProperty() {
|
||||
public BeanProperty versionProperty() {
|
||||
return versionProperty;
|
||||
}
|
||||
|
||||
@@ -3301,7 +3301,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
/**
|
||||
* Return the tenant property when multi-tenant partitioning support is used.
|
||||
*/
|
||||
public BeanProperty getTenantProperty() {
|
||||
public BeanProperty tenantProperty() {
|
||||
return tenant;
|
||||
}
|
||||
|
||||
@@ -3377,14 +3377,14 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
return jsonHelp.jsonRead(jsonRead, path, false);
|
||||
}
|
||||
|
||||
public List<BeanProperty[]> getUniqueProps() {
|
||||
public List<BeanProperty[]> uniqueProps() {
|
||||
return propertiesUnique;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BeanType<?>> inheritanceChildren() {
|
||||
if (hasInheritance()) {
|
||||
return getInheritInfo().getChildren()
|
||||
return inheritInfo().getChildren()
|
||||
.stream()
|
||||
.map(InheritInfo::desc)
|
||||
.collect(Collectors.toList());
|
||||
@@ -3395,13 +3395,13 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
|
||||
|
||||
@Override
|
||||
public BeanType<?> inheritanceParent() {
|
||||
return getInheritInfo() == null ? null : getInheritInfo().getParent().desc();
|
||||
return inheritInfo() == null ? null : inheritInfo().getParent().desc();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitAllInheritanceChildren(Consumer<BeanType<?>> visitor) {
|
||||
if (hasInheritance()) {
|
||||
getInheritInfo().visitChildren(info -> visitor.accept(info.desc()));
|
||||
inheritInfo().visitChildren(info -> visitor.accept(info.desc()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -290,7 +290,7 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
EntityBean ownerBean = bc.getOwnerBean();
|
||||
EntityBeanIntercept ebi = ownerBean._ebean_getIntercept();
|
||||
PersistenceContext persistenceContext = ebi.getPersistenceContext();
|
||||
BeanDescriptor<?> targetDescriptor = many.getTargetDescriptor();
|
||||
BeanDescriptor<?> targetDescriptor = many.targetDescriptor();
|
||||
|
||||
List<Object> idList = entry.getIdList();
|
||||
bc.checkEmptyLazyLoad();
|
||||
@@ -349,7 +349,7 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
return null;
|
||||
}
|
||||
|
||||
BeanDescriptor<?> targetDescriptor = many.getTargetDescriptor();
|
||||
BeanDescriptor<?> targetDescriptor = many.targetDescriptor();
|
||||
List<Object> idList = new ArrayList<>(actualDetails.size());
|
||||
for (Object bean : actualDetails) {
|
||||
idList.add(targetDescriptor.id(bean));
|
||||
|
||||
+4
-4
@@ -19,7 +19,7 @@ final class BeanDescriptorDraftHelp<T> {
|
||||
|
||||
BeanDescriptorDraftHelp(BeanDescriptor<T> desc) {
|
||||
this.desc = desc;
|
||||
this.draftDirty = desc.getDraftDirty();
|
||||
this.draftDirty = desc.draftDirty();
|
||||
this.resetProperties = resetProperties();
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ final class BeanDescriptorDraftHelp<T> {
|
||||
prop.publish(draft, live);
|
||||
}
|
||||
for (BeanPropertyAssocMany<?> many : desc.propertiesMany()) {
|
||||
if (many.getTargetDescriptor().isDraftable()) {
|
||||
if (many.targetDescriptor().isDraftable()) {
|
||||
many.publishMany(draft, live);
|
||||
}
|
||||
}
|
||||
@@ -86,12 +86,12 @@ final class BeanDescriptorDraftHelp<T> {
|
||||
*/
|
||||
void draftQueryOptimise(Query<T> query) {
|
||||
for (BeanPropertyAssocOne<?> anOne : desc.propertiesOne()) {
|
||||
if (anOne.getTargetDescriptor().isDraftableElement()) {
|
||||
if (anOne.targetDescriptor().isDraftableElement()) {
|
||||
query.fetch(anOne.name());
|
||||
}
|
||||
}
|
||||
for (BeanPropertyAssocMany<?> aMany : desc.propertiesMany()) {
|
||||
if (aMany.getTargetDescriptor().isDraftableElement()) {
|
||||
if (aMany.targetDescriptor().isDraftableElement()) {
|
||||
query.fetch(aMany.name());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ abstract class BeanDescriptorElement<T> extends BeanDescriptor<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSimpleName() {
|
||||
public String simpleName() {
|
||||
return simpleName;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ class BeanDescriptorElementEmbedded<T> extends BeanDescriptorElement<T> {
|
||||
@Override
|
||||
public void initialiseOther(BeanDescriptorInitContext initContext) {
|
||||
super.initialiseOther(initContext);
|
||||
this.targetDescriptor = embeddedProperty.getTargetDescriptor();
|
||||
this.targetDescriptor = embeddedProperty.targetDescriptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -57,7 +57,7 @@ final class BeanDescriptorJsonHelp<T> {
|
||||
// render the dirty properties
|
||||
BeanProperty[] props = desc.propertiesNonTransient();
|
||||
for (BeanProperty prop : props) {
|
||||
if (dirtyProps[prop.getPropertyIndex()]) {
|
||||
if (dirtyProps[prop.propertyIndex()]) {
|
||||
prop.jsonWrite(writeJson, bean);
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ final class BeanDescriptorJsonHelp<T> {
|
||||
JsonToken event = parser.nextToken();
|
||||
if (JsonToken.FIELD_NAME == event) {
|
||||
String key = parser.getCurrentName();
|
||||
BeanProperty p = desc.getBeanProperty(key);
|
||||
BeanProperty p = desc.beanProperty(key);
|
||||
if (p != null) {
|
||||
p.jsonRead(readJson, bean);
|
||||
} else {
|
||||
|
||||
@@ -439,10 +439,10 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
List<BeanDescriptor<?>> list = tableToDescMap.computeIfAbsent(baseTable, k -> new ArrayList<>(1));
|
||||
list.add(desc);
|
||||
}
|
||||
if (desc.getEntityType() == EntityType.VIEW && desc.isQueryCaching()) {
|
||||
if (desc.entityType() == EntityType.VIEW && desc.isQueryCaching()) {
|
||||
// build map of tables to view entities dependent on those tables
|
||||
// for the purpose of invalidating appropriate query caches
|
||||
String[] dependentTables = desc.getDependentTables();
|
||||
String[] dependentTables = desc.dependentTables();
|
||||
if (dependentTables != null && dependentTables.length > 0) {
|
||||
for (String depTable : dependentTables) {
|
||||
depTable = depTable.toLowerCase();
|
||||
@@ -515,7 +515,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
}
|
||||
|
||||
private void checkForValidEmbeddedId(BeanDescriptor<?> d) {
|
||||
IdBinder idBinder = d.getIdBinder();
|
||||
IdBinder idBinder = d.idBinder();
|
||||
if (idBinder instanceof IdBinderEmbedded) {
|
||||
IdBinderEmbedded embId = (IdBinderEmbedded) idBinder;
|
||||
BeanDescriptor<?> idBeanDescriptor = embId.getIdBeanDescriptor();
|
||||
@@ -603,7 +603,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
}
|
||||
for (BeanPropertyAssocMany<?> many : desc.propertiesMany()) {
|
||||
if (many.isElementCollection()) {
|
||||
elementDescriptors.add(many.getElementDescriptor());
|
||||
elementDescriptors.add(many.elementDescriptor());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -58,15 +58,15 @@ final class BeanEmbeddedMetaFactory {
|
||||
}
|
||||
|
||||
private static int dbLength(Column override, BeanProperty source) {
|
||||
return (override != null && (override.length() != 255)) ? override.length() : source.getDbLength();
|
||||
return (override != null && (override.length() != 255)) ? override.length() : source.dbLength();
|
||||
}
|
||||
|
||||
private static int dbScale(Column override, BeanProperty source) {
|
||||
return (override != null && (override.scale() != 0)) ? override.scale() : source.getDbScale();
|
||||
return (override != null && (override.scale() != 0)) ? override.scale() : source.dbScale();
|
||||
}
|
||||
|
||||
private static String getDbColumnDefn(Column override, BeanProperty source) {
|
||||
return (override != null && !override.columnDefinition().isEmpty()) ? override.columnDefinition() : source.getDbColumnDefn();
|
||||
return (override != null && !override.columnDefinition().isEmpty()) ? override.columnDefinition() : source.dbColumnDefn();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class BeanListHelp<T> extends BaseCollectionHelp<T> {
|
||||
public BeanCollection<T> createEmpty(EntityBean parentBean) {
|
||||
BeanList<T> beanList = new BeanList<>(loader, parentBean, propertyName);
|
||||
if (many != null) {
|
||||
beanList.setModifyListening(many.getModifyListenMode());
|
||||
beanList.setModifyListening(many.modifyListenMode());
|
||||
}
|
||||
return beanList;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class BeanListHelp<T> extends BaseCollectionHelp<T> {
|
||||
public BeanCollection<T> createReference(EntityBean parentBean) {
|
||||
|
||||
BeanList<T> beanList = new BeanList<>(loader, parentBean, propertyName);
|
||||
beanList.setModifyListening(many.getModifyListenMode());
|
||||
beanList.setModifyListening(many.modifyListenMode());
|
||||
return beanList;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class BeanListHelp<T> extends BaseCollectionHelp<T> {
|
||||
|
||||
List<?> currentList = (List<?>) many.getValue(parentBean);
|
||||
|
||||
newBeanList.setModifyListening(many.getModifyListenMode());
|
||||
newBeanList.setModifyListening(many.modifyListenMode());
|
||||
|
||||
if (currentList == null) {
|
||||
// the currentList is null? Not really expecting this...
|
||||
@@ -87,7 +87,7 @@ public class BeanListHelp<T> extends BaseCollectionHelp<T> {
|
||||
// normally this case, replace just the underlying list
|
||||
BeanList<?> currentBeanList = (BeanList<?>) currentList;
|
||||
currentBeanList.setActualList(newBeanList.getActualList());
|
||||
currentBeanList.setModifyListening(many.getModifyListenMode());
|
||||
currentBeanList.setModifyListening(many.modifyListenMode());
|
||||
|
||||
} else {
|
||||
// replace the entire list with the BeanList
|
||||
|
||||
@@ -29,9 +29,9 @@ public class BeanMapHelp<T> extends BaseCollectionHelp<T> {
|
||||
*/
|
||||
BeanMapHelp(BeanPropertyAssocMany<T> many) {
|
||||
this.many = many;
|
||||
this.targetDescriptor = many.getTargetDescriptor();
|
||||
this.targetDescriptor = many.targetDescriptor();
|
||||
this.propertyName = many.name();
|
||||
this.beanProperty = targetDescriptor.getBeanProperty(many.getMapKey());
|
||||
this.beanProperty = targetDescriptor.beanProperty(many.mapKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -39,9 +39,9 @@ public class BeanMapHelp<T> extends BaseCollectionHelp<T> {
|
||||
public BeanCollectionAdd getBeanCollectionAdd(Object bc, String mapKey) {
|
||||
|
||||
if (mapKey == null) {
|
||||
mapKey = many.getMapKey();
|
||||
mapKey = many.mapKey();
|
||||
}
|
||||
BeanProperty beanProp = targetDescriptor.getBeanProperty(mapKey);
|
||||
BeanProperty beanProp = targetDescriptor.beanProperty(mapKey);
|
||||
|
||||
if (bc instanceof BeanMap<?, ?>) {
|
||||
BeanMap<Object, Object> bm = (BeanMap<Object, Object>) bc;
|
||||
@@ -85,7 +85,7 @@ public class BeanMapHelp<T> extends BaseCollectionHelp<T> {
|
||||
|
||||
BeanMap<?, T> beanMap = new BeanMap<>(loader, ownerBean, propertyName);
|
||||
if (many != null) {
|
||||
beanMap.setModifyListening(many.getModifyListenMode());
|
||||
beanMap.setModifyListening(many.modifyListenMode());
|
||||
}
|
||||
return beanMap;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ public class BeanMapHelp<T> extends BaseCollectionHelp<T> {
|
||||
|
||||
BeanMap beanMap = new BeanMap(loader, parentBean, propertyName);
|
||||
if (many != null) {
|
||||
beanMap.setModifyListening(many.getModifyListenMode());
|
||||
beanMap.setModifyListening(many.modifyListenMode());
|
||||
}
|
||||
return beanMap;
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public class BeanMapHelp<T> extends BaseCollectionHelp<T> {
|
||||
BeanMap<?, ?> newBeanMap = (BeanMap<?, ?>) bc;
|
||||
Map<?, ?> current = (Map<?, ?>) many.getValue(parentBean);
|
||||
|
||||
newBeanMap.setModifyListening(many.getModifyListenMode());
|
||||
newBeanMap.setModifyListening(many.modifyListenMode());
|
||||
if (current == null) {
|
||||
// the currentMap is null? Not really expecting this...
|
||||
many.setValue(parentBean, newBeanMap);
|
||||
@@ -134,7 +134,7 @@ public class BeanMapHelp<T> extends BaseCollectionHelp<T> {
|
||||
// normally this case, replace just the underlying list
|
||||
BeanMap<?, ?> currentBeanMap = (BeanMap<?, ?>) current;
|
||||
currentBeanMap.setActualMap(newBeanMap.getActualMap());
|
||||
currentBeanMap.setModifyListening(many.getModifyListenMode());
|
||||
currentBeanMap.setModifyListening(many.modifyListenMode());
|
||||
|
||||
} else {
|
||||
// replace the entire set
|
||||
|
||||
@@ -314,9 +314,9 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
this.secondaryTableJoin = source.secondaryTableJoin;
|
||||
this.secondaryTableJoinPrefix = source.secondaryTableJoinPrefix;
|
||||
this.dbComment = source.dbComment;
|
||||
this.dbBind = source.getDbBind();
|
||||
this.dbBind = source.dbBind();
|
||||
this.dbEncrypted = source.isDbEncrypted();
|
||||
this.dbEncryptedType = source.getDbEncryptedType();
|
||||
this.dbEncryptedType = source.dbEncryptedType();
|
||||
this.dbEncryptFunction = source.dbEncryptFunction;
|
||||
this.dbRead = source.isDbRead();
|
||||
this.dbInsertable = source.isDbInsertable();
|
||||
@@ -331,14 +331,14 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
this.version = source.isVersion();
|
||||
this.embedded = source.isEmbedded();
|
||||
this.id = source.isId();
|
||||
this.generatedProperty = source.getGeneratedProperty();
|
||||
this.generatedProperty = source.generatedProperty();
|
||||
this.getter = source.getter;
|
||||
this.setter = source.setter;
|
||||
this.dbType = source.getDbType(true);
|
||||
this.dbType = source.dbType(true);
|
||||
this.scalarType = source.scalarType;
|
||||
this.lob = isLobType(dbType);
|
||||
this.propertyType = source.type();
|
||||
this.field = source.getField();
|
||||
this.field = source.field();
|
||||
this.docOptions = source.docOptions;
|
||||
this.unmappedJson = source.unmappedJson;
|
||||
this.elPrefix = override.replace(source.elPrefix, source.dbColumn);
|
||||
@@ -363,7 +363,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
/**
|
||||
* Return the order this property appears in the bean.
|
||||
*/
|
||||
public int getDeployOrder() {
|
||||
public int deployOrder() {
|
||||
return deployOrder;
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
/**
|
||||
* Return the BeanDescriptor that owns this property.
|
||||
*/
|
||||
public BeanDescriptor<?> getBeanDescriptor() {
|
||||
public BeanDescriptor<?> descriptor() {
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
@@ -424,23 +424,23 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
/**
|
||||
* Return the encrypt key for the column matching this property.
|
||||
*/
|
||||
public EncryptKey getEncryptKey() {
|
||||
return descriptor.getEncryptKey(this);
|
||||
public EncryptKey encryptKey() {
|
||||
return descriptor.encryptKey(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String encryptKeyAsString() {
|
||||
return getEncryptKey().getStringValue();
|
||||
return encryptKey().getStringValue();
|
||||
}
|
||||
|
||||
public String getDecryptProperty(String propertyName) {
|
||||
public String decryptProperty(String propertyName) {
|
||||
return dbEncryptFunction.getDecryptSql(propertyName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the SQL for the column including decryption function and column alias.
|
||||
*/
|
||||
private String getDecryptSqlWithColumnAlias(String tableAlias) {
|
||||
private String decryptSqlWithColumnAlias(String tableAlias) {
|
||||
return dbEncryptFunction.getDecryptSql(tableAlias + "." + this.dbColumn()) + ENC_PREFIX + tableAlias + "_" + this.dbColumn();
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
* Returns null unless this property is using a secondary table. In that
|
||||
* case this returns the logical property prefix.
|
||||
*/
|
||||
public String getSecondaryTableJoinPrefix() {
|
||||
public String secondaryTableJoinPrefix() {
|
||||
return secondaryTableJoinPrefix;
|
||||
}
|
||||
|
||||
@@ -488,7 +488,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
ctx.pushTableAlias(ctx.getRelativePrefix(secondaryTableJoinPrefix));
|
||||
}
|
||||
if (dbEncrypted) {
|
||||
ctx.appendRawColumn(getDecryptSqlWithColumnAlias(ctx.peekTableAlias()));
|
||||
ctx.appendRawColumn(decryptSqlWithColumnAlias(ctx.peekTableAlias()));
|
||||
ctx.addEncryptedProp(this);
|
||||
} else {
|
||||
ctx.appendColumn(dbColumn);
|
||||
@@ -604,14 +604,14 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
/**
|
||||
* Return the DB literal expression to set the deleted state to true.
|
||||
*/
|
||||
String getSoftDeleteDbSet() {
|
||||
String softDeleteDbSet() {
|
||||
return softDeleteDbSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the DB literal predicate used to filter out soft deleted rows from a query.
|
||||
*/
|
||||
String getSoftDeleteDbPredicate(String tableAlias) {
|
||||
String softDeleteDbPredicate(String tableAlias) {
|
||||
return tableAlias + softDeleteDbPredicate;
|
||||
}
|
||||
|
||||
@@ -824,7 +824,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
/**
|
||||
* Return the position of this property in the enhanced bean.
|
||||
*/
|
||||
public int getPropertyIndex() {
|
||||
public int propertyIndex() {
|
||||
return propertyIndex;
|
||||
}
|
||||
|
||||
@@ -961,21 +961,21 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
/**
|
||||
* Return the DB max length (varchar) or precision (decimal).
|
||||
*/
|
||||
public int getDbLength() {
|
||||
public int dbLength() {
|
||||
return dbLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the DB scale for numeric columns.
|
||||
*/
|
||||
public int getDbScale() {
|
||||
public int dbScale() {
|
||||
return dbScale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a specific column DDL definition if specified (otherwise null).
|
||||
*/
|
||||
public String getDbColumnDefn() {
|
||||
public String dbColumnDefn() {
|
||||
return dbColumnDefn;
|
||||
}
|
||||
|
||||
@@ -985,7 +985,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
* For an Enum returns IN expression for the set of Enum values.
|
||||
* </p>
|
||||
*/
|
||||
public Set<String> getDbCheckConstraintValues() {
|
||||
public Set<String> dbCheckConstraintValues() {
|
||||
if (scalarType instanceof ScalarTypeEnum) {
|
||||
return ((ScalarTypeEnum<?>) scalarType).getDbCheckConstraintValues();
|
||||
}
|
||||
@@ -1005,28 +1005,28 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
/**
|
||||
* Return the DB column default to use for DDL.
|
||||
*/
|
||||
public String getDbColumnDefault() {
|
||||
public String dbColumnDefault() {
|
||||
return dbColumnDefn != null ? null : dbColumnDefault;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the DDL-Migration Infos
|
||||
*/
|
||||
public List<DbMigrationInfo> getDbMigrationInfos() {
|
||||
public List<DbMigrationInfo> dbMigrationInfos() {
|
||||
return dbMigrationInfos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the bean Field associated with this property.
|
||||
*/
|
||||
private Field getField() {
|
||||
private Field field() {
|
||||
return field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the GeneratedValue. Used to generate update timestamp etc.
|
||||
*/
|
||||
public GeneratedProperty getGeneratedProperty() {
|
||||
public GeneratedProperty generatedProperty() {
|
||||
return generatedProperty;
|
||||
}
|
||||
|
||||
@@ -1124,7 +1124,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
/**
|
||||
* Return the comment for the associated DB column.
|
||||
*/
|
||||
public String getDbComment() {
|
||||
public String dbComment() {
|
||||
return dbComment;
|
||||
}
|
||||
|
||||
@@ -1133,7 +1133,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
*
|
||||
* @param platformTypes Set as false when we want logical platform agnostic types.
|
||||
*/
|
||||
public int getDbType(boolean platformTypes) {
|
||||
public int dbType(boolean platformTypes) {
|
||||
if (platformTypes || !(scalarType instanceof ScalarTypeLogicalType)) {
|
||||
return dbType;
|
||||
}
|
||||
@@ -1182,7 +1182,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
* Return the DB bind parameter. Typically is "?" but different for
|
||||
* encrypted bind.
|
||||
*/
|
||||
public String getDbBind() {
|
||||
public String dbBind() {
|
||||
return dbBind;
|
||||
}
|
||||
|
||||
@@ -1207,7 +1207,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
return dbEncrypted;
|
||||
}
|
||||
|
||||
public int getDbEncryptedType() {
|
||||
public int dbEncryptedType() {
|
||||
return dbEncryptedType;
|
||||
}
|
||||
|
||||
|
||||
@@ -117,10 +117,10 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
}
|
||||
|
||||
void initialiseTargetDescriptor(BeanDescriptorInitContext initContext) {
|
||||
targetDescriptor = descriptor.getBeanDescriptor(targetType);
|
||||
targetDescriptor = descriptor.descriptor(targetType);
|
||||
if (!isTransient) {
|
||||
targetIdBinder = targetDescriptor.getIdBinder();
|
||||
targetInheritInfo = targetDescriptor.getInheritInfo();
|
||||
targetIdBinder = targetDescriptor.idBinder();
|
||||
targetInheritInfo = targetDescriptor.inheritInfo();
|
||||
saveRecurseSkippable = targetDescriptor.isSaveRecurseSkippable();
|
||||
if (!targetIdBinder.isComplexId()) {
|
||||
targetIdProperty = targetIdBinder.getIdProperty();
|
||||
@@ -136,7 +136,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
/**
|
||||
* Return the extra configuration for the foreign key.
|
||||
*/
|
||||
public PropertyForeignKey getForeignKey() {
|
||||
public PropertyForeignKey foreignKey() {
|
||||
return foreignKey;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
*/
|
||||
ElPropertyValue createElPropertyValue(String propName, String remainder, ElPropertyChainBuilder chain, boolean propertyDeploy) {
|
||||
// associated or embedded bean
|
||||
BeanDescriptor<?> embDesc = getTargetDescriptor();
|
||||
BeanDescriptor<?> embDesc = targetDescriptor();
|
||||
if (chain == null) {
|
||||
chain = new ElPropertyChainBuilder(isEmbedded(), propName);
|
||||
}
|
||||
@@ -198,7 +198,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
* Return the mappedBy property.
|
||||
* This will be null on the owning side.
|
||||
*/
|
||||
public String getMappedBy() {
|
||||
public String mappedBy() {
|
||||
return mappedBy;
|
||||
}
|
||||
|
||||
@@ -208,19 +208,19 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
* This will return null for multiple Id properties.
|
||||
* </p>
|
||||
*/
|
||||
public String getTargetIdProperty() {
|
||||
public String targetIdProperty() {
|
||||
return targetIdProperty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the BeanDescriptor of the target.
|
||||
*/
|
||||
public BeanDescriptor<T> getTargetDescriptor() {
|
||||
public BeanDescriptor<T> targetDescriptor() {
|
||||
return targetDescriptor;
|
||||
}
|
||||
|
||||
SpiEbeanServer server() {
|
||||
return descriptor.getEbeanServer();
|
||||
return descriptor.ebeanServer();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -233,8 +233,8 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
}
|
||||
|
||||
@Override
|
||||
public IdBinder getIdBinder() {
|
||||
return descriptor.getIdBinder();
|
||||
public IdBinder idBinder() {
|
||||
return descriptor.idBinder();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -251,8 +251,8 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSoftDeletePredicate(String tableAlias) {
|
||||
return targetDescriptor.getSoftDeletePredicate(tableAlias);
|
||||
public String softDeletePredicate(String tableAlias) {
|
||||
return targetDescriptor.softDeletePredicate(tableAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -283,7 +283,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
* Return true if the unique id properties are all not null for this bean.
|
||||
*/
|
||||
public boolean hasId(EntityBean bean) {
|
||||
BeanDescriptor<?> targetDesc = getTargetDescriptor();
|
||||
BeanDescriptor<?> targetDesc = targetDescriptor();
|
||||
BeanProperty idProp = targetDesc.idProperty();
|
||||
// all the unique properties are non-null
|
||||
return idProp == null || idProp.getValue(bean) != null;
|
||||
@@ -296,7 +296,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
* set or map.
|
||||
* </p>
|
||||
*/
|
||||
public Class<?> getTargetType() {
|
||||
public Class<?> targetType() {
|
||||
return targetType;
|
||||
}
|
||||
|
||||
@@ -305,14 +305,14 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
* to this bean type.
|
||||
*/
|
||||
@Override
|
||||
public String getExtraWhere() {
|
||||
public String extraWhere() {
|
||||
return extraWhere;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the elastic search doc for this embedded property.
|
||||
*/
|
||||
private String getDocStoreDoc() {
|
||||
private String docStoreDoc() {
|
||||
return docStoreDoc;
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
*/
|
||||
@Override
|
||||
public void docStoreInclude(boolean includeByDefault, DocStructure docStructure) {
|
||||
String embeddedDoc = getDocStoreDoc();
|
||||
String embeddedDoc = docStoreDoc();
|
||||
if (embeddedDoc == null) {
|
||||
// not annotated so use include by default
|
||||
// which is *ToOne included and *ToMany excluded
|
||||
@@ -399,21 +399,21 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
/**
|
||||
* Return the underlying BeanTable for this property.
|
||||
*/
|
||||
public BeanTable getBeanTable() {
|
||||
public BeanTable beanTable() {
|
||||
return beanTable;
|
||||
}
|
||||
|
||||
/**
|
||||
* return the join to use for the bean.
|
||||
*/
|
||||
public TableJoin getTableJoin() {
|
||||
public TableJoin tableJoin() {
|
||||
return tableJoin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the persist info.
|
||||
*/
|
||||
public BeanCascadeInfo getCascadeInfo() {
|
||||
public BeanCascadeInfo cascadeInfo() {
|
||||
return cascadeInfo;
|
||||
}
|
||||
|
||||
@@ -445,7 +445,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
|
||||
} else {
|
||||
// embedded id
|
||||
BeanPropertyAssocOne<?> embProp = (BeanPropertyAssocOne<?>) idProp;
|
||||
BeanProperty[] embBaseProps = embProp.getTargetDescriptor().propertiesBaseScalar();
|
||||
BeanProperty[] embBaseProps = embProp.targetDescriptor().propertiesBaseScalar();
|
||||
ImportedIdSimple[] scalars = createImportedList(owner, cols, embBaseProps, others);
|
||||
return new ImportedIdEmbedded(owner, embProp, scalars);
|
||||
}
|
||||
|
||||
+29
-29
@@ -175,7 +175,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
*/
|
||||
void initialisePostTarget() {
|
||||
if (childMasterProperty != null) {
|
||||
BeanProperty masterId = childMasterProperty.getTargetDescriptor().idProperty();
|
||||
BeanProperty masterId = childMasterProperty.targetDescriptor().idProperty();
|
||||
if (masterId != null) { // in docstore only, the master-id may be not available
|
||||
childMasterIdProperty = childMasterProperty.name() + "." + masterId.name();
|
||||
}
|
||||
@@ -208,7 +208,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
* Return the underlying collection of beans.
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Collection getRawCollection(EntityBean bean) {
|
||||
public Collection rawCollection(EntityBean bean) {
|
||||
return help.underlying(value(bean));
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
/**
|
||||
* Return the mode for listening to modifications to collections for this association.
|
||||
*/
|
||||
public ModifyListenMode getModifyListenMode() {
|
||||
public ModifyListenMode modifyListenMode() {
|
||||
return modifyListenMode;
|
||||
}
|
||||
|
||||
@@ -412,17 +412,17 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
@Override
|
||||
public String assocIsEmpty(SpiExpressionRequest request, String path) {
|
||||
boolean softDelete = targetDescriptor.isSoftDelete();
|
||||
boolean needsX2Table = softDelete || getExtraWhere() != null;
|
||||
boolean needsX2Table = softDelete || extraWhere() != null;
|
||||
StringBuilder sb = new StringBuilder(50);
|
||||
SpiQuery<?> query = request.getQueryRequest().query();
|
||||
if (hasJoinTable()) {
|
||||
sb.append(query.isAsDraft() ? intersectionDraftTable : intersectionPublishTable);
|
||||
} else {
|
||||
sb.append(targetDescriptor.getBaseTable(query.getTemporalMode()));
|
||||
sb.append(targetDescriptor.baseTable(query.getTemporalMode()));
|
||||
}
|
||||
if (needsX2Table && hasJoinTable()) {
|
||||
sb.append(" x join ");
|
||||
sb.append(targetDescriptor.getBaseTable(query.getTemporalMode()));
|
||||
sb.append(targetDescriptor.baseTable(query.getTemporalMode()));
|
||||
sb.append(" x2 on ");
|
||||
inverseJoin.addJoin("x2", "x", sb);
|
||||
} else {
|
||||
@@ -435,17 +435,17 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
}
|
||||
exportedProperties[i].appendWhere(sb, "x.", path);
|
||||
}
|
||||
if (getExtraWhere() != null) {
|
||||
if (extraWhere() != null) {
|
||||
sb.append(" and ");
|
||||
if (hasJoinTable()) {
|
||||
sb.append(getExtraWhere().replace("${ta}", "x2").replace("${mta}", "x"));
|
||||
sb.append(extraWhere().replace("${ta}", "x2").replace("${mta}", "x"));
|
||||
} else {
|
||||
sb.append(getExtraWhere().replace("${ta}", "x"));
|
||||
sb.append(extraWhere().replace("${ta}", "x"));
|
||||
}
|
||||
}
|
||||
if (softDelete) {
|
||||
String alias = hasJoinTable() ? "x2" : "x";
|
||||
sb.append(" and ").append(targetDescriptor.getSoftDeletePredicate(alias));
|
||||
sb.append(" and ").append(targetDescriptor.softDeletePredicate(alias));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
@@ -455,7 +455,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
*/
|
||||
@Override
|
||||
public Object[] assocIdValues(EntityBean bean) {
|
||||
return targetDescriptor.getIdBinder().getIdValues(bean);
|
||||
return targetDescriptor.idBinder().getIdValues(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -463,7 +463,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
*/
|
||||
@Override
|
||||
public String assocIdExpression(String prefix, String operator) {
|
||||
return targetDescriptor.getIdBinder().getAssocOneIdExpr(prefix, operator);
|
||||
return targetDescriptor.idBinder().getAssocOneIdExpr(prefix, operator);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -471,7 +471,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
*/
|
||||
@Override
|
||||
public String assocIdInValueExpr(boolean not, int size) {
|
||||
return targetDescriptor.getIdBinder().getIdInValueExpr(not, size);
|
||||
return targetDescriptor.idBinder().getIdInValueExpr(not, size);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -479,7 +479,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
*/
|
||||
@Override
|
||||
public String assocIdInExpr(String prefix) {
|
||||
return targetDescriptor.getIdBinder().getAssocIdInExpr(prefix);
|
||||
return targetDescriptor.idBinder().getAssocIdInExpr(prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -521,7 +521,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
/**
|
||||
* Return the many type.
|
||||
*/
|
||||
public ManyType getManyType() {
|
||||
public ManyType manyType() {
|
||||
return manyType;
|
||||
}
|
||||
|
||||
@@ -554,7 +554,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
/**
|
||||
* Return the element bean descriptor (for an element collection only).
|
||||
*/
|
||||
public BeanDescriptor<T> getElementDescriptor() {
|
||||
public BeanDescriptor<T> elementDescriptor() {
|
||||
return elementDescriptor;
|
||||
}
|
||||
|
||||
@@ -562,7 +562,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
* ManyToMany only, join from local table to intersection table.
|
||||
*/
|
||||
@Override
|
||||
public TableJoin getIntersectionTableJoin() {
|
||||
public TableJoin intersectionTableJoin() {
|
||||
return intersectionJoin;
|
||||
}
|
||||
|
||||
@@ -585,21 +585,21 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
* Return the order by clause used to order the fetching of the data for
|
||||
* this list, set or map.
|
||||
*/
|
||||
public String getFetchOrderBy() {
|
||||
public String fetchOrderBy() {
|
||||
return fetchOrderBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the order by for use when lazy loading the associated collection.
|
||||
*/
|
||||
public String getLazyFetchOrderBy() {
|
||||
public String lazyFetchOrderBy() {
|
||||
return lazyFetchOrderBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the default mapKey when returning a Map.
|
||||
*/
|
||||
public String getMapKey() {
|
||||
public String mapKey() {
|
||||
return mapKey;
|
||||
}
|
||||
|
||||
@@ -631,11 +631,11 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
return help.createEmpty(parentBean);
|
||||
}
|
||||
|
||||
private BeanCollectionAdd getBeanCollectionAdd(Object bc) {
|
||||
private BeanCollectionAdd beanCollectionAdd(Object bc) {
|
||||
return help.getBeanCollectionAdd(bc, null);
|
||||
}
|
||||
|
||||
public Object getParentId(EntityBean parentBean) {
|
||||
public Object parentId(EntityBean parentBean) {
|
||||
return descriptor.getId(parentBean);
|
||||
}
|
||||
|
||||
@@ -659,7 +659,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
if (idProp != null && idProp.isEmbedded()) {
|
||||
BeanPropertyAssocOne<?> one = (BeanPropertyAssocOne<?>) idProp;
|
||||
try {
|
||||
for (BeanProperty emId : one.getTargetDescriptor().propertiesBaseScalar()) {
|
||||
for (BeanProperty emId : one.targetDescriptor().propertiesBaseScalar()) {
|
||||
list.add(findMatch(true, emId));
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
@@ -698,7 +698,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
}
|
||||
// search for the property, to see if it exists
|
||||
Class<?> beanType = descriptor.type();
|
||||
BeanDescriptor<?> targetDesc = getTargetDescriptor();
|
||||
BeanDescriptor<?> targetDesc = targetDescriptor();
|
||||
for (BeanPropertyAssocOne<?> prop : targetDesc.propertiesOne()) {
|
||||
if (mappedBy != null) {
|
||||
// match using mappedBy as property name
|
||||
@@ -707,7 +707,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
}
|
||||
} else {
|
||||
// assume only one property that matches parent object type
|
||||
if (prop.getTargetType().equals(beanType)) {
|
||||
if (prop.targetType().equals(beanType)) {
|
||||
// found it, stop search
|
||||
return prop;
|
||||
}
|
||||
@@ -721,7 +721,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
*/
|
||||
private BeanProperty initMapKeyProperty() {
|
||||
// search for the property
|
||||
BeanDescriptor<?> targetDesc = getTargetDescriptor();
|
||||
BeanDescriptor<?> targetDesc = targetDescriptor();
|
||||
for (BeanProperty prop : targetDesc.propertiesAll()) {
|
||||
if (mapKey.equalsIgnoreCase(prop.name())) {
|
||||
return prop;
|
||||
@@ -735,7 +735,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
public IntersectionRow buildManyDeleteChildren(EntityBean parentBean, List<Object> excludeDetailIds) {
|
||||
IntersectionRow row = new IntersectionRow(tableJoin.getTable(), targetDescriptor);
|
||||
if (excludeDetailIds != null && !excludeDetailIds.isEmpty()) {
|
||||
row.setExcludeIds(excludeDetailIds, getTargetDescriptor());
|
||||
row.setExcludeIds(excludeDetailIds, targetDescriptor());
|
||||
}
|
||||
buildExport(row, parentBean);
|
||||
return row;
|
||||
@@ -1016,7 +1016,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
return elementDescriptor.jsonReadCollection(readJson, parentBean);
|
||||
}
|
||||
BeanCollection<?> collection = createEmpty(parentBean);
|
||||
BeanCollectionAdd add = getBeanCollectionAdd(collection);
|
||||
BeanCollectionAdd add = beanCollectionAdd(collection);
|
||||
do {
|
||||
EntityBean detailBean = (EntityBean) targetDescriptor.jsonRead(readJson, name);
|
||||
if (detailBean == null) {
|
||||
@@ -1044,7 +1044,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> implements ST
|
||||
* Returns true, if we must create a m2m join table.
|
||||
*/
|
||||
public boolean createJoinTable() {
|
||||
if (hasJoinTable() && getMappedBy() == null) {
|
||||
if (hasJoinTable() && mappedBy() == null) {
|
||||
// only create on other 'owning' side
|
||||
return !descriptor.isTableManaged(intersectionJoin.getTable());
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ class BeanPropertyAssocManyJsonHelp {
|
||||
*/
|
||||
BeanPropertyAssocManyJsonHelp(BeanPropertyAssocMany<?> many) {
|
||||
this.many = many;
|
||||
boolean objectMapperPresent = many.getBeanDescriptor().getConfig().getClassLoadConfig().isJacksonObjectMapperPresent();
|
||||
boolean objectMapperPresent = many.descriptor().config().getClassLoadConfig().isJacksonObjectMapperPresent();
|
||||
this.jsonTransient = !objectMapperPresent ? null : new BeanPropertyAssocManyJsonTransient();
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -21,18 +21,18 @@ class BeanPropertyAssocManyJsonTransient {
|
||||
*/
|
||||
void jsonReadUsingObjectMapper(BeanPropertyAssocMany<?> many, SpiJsonReader readJson, EntityBean parentBean) throws IOException {
|
||||
ObjectMapper mapper = readJson.getObjectMapper();
|
||||
ManyType manyType = many.getManyType();
|
||||
ManyType manyType = many.manyType();
|
||||
|
||||
Object value;
|
||||
if (manyType.isMap()) {
|
||||
// read map using Jackson object mapper with unknown key type
|
||||
TypeFactory typeFactory = mapper.getTypeFactory();
|
||||
JavaType target = typeFactory.constructType(many.getTargetType());
|
||||
JavaType target = typeFactory.constructType(many.targetType());
|
||||
MapType jacksonType = typeFactory.constructMapType(LinkedHashMap.class, TypeFactory.unknownType(), target);
|
||||
value = mapper.readValue(readJson.getParser(), jacksonType);
|
||||
} else {
|
||||
// read list or set using Jackson object mapper
|
||||
CollectionType jacksonType = mapper.getTypeFactory().constructCollectionType(manyType.getCollectionType(), many.getTargetType());
|
||||
CollectionType jacksonType = mapper.getTypeFactory().constructCollectionType(manyType.getCollectionType(), many.targetType());
|
||||
value = mapper.readValue(readJson.getParser(), jacksonType);
|
||||
}
|
||||
many.setValue(parentBean, value);
|
||||
|
||||
+5
-5
@@ -26,7 +26,7 @@ class BeanPropertyAssocManySqlHelp<T> {
|
||||
this.many = many;
|
||||
this.exportedProperties = exportedProperties;
|
||||
this.hasJoinTable = many.hasJoinTable();
|
||||
this.descriptor = many.getBeanDescriptor();
|
||||
this.descriptor = many.descriptor();
|
||||
this.exportedPropertyBindProto = deriveExportedPropertyBindProto();
|
||||
|
||||
String delStmt;
|
||||
@@ -118,13 +118,13 @@ class BeanPropertyAssocManySqlHelp<T> {
|
||||
query.setM2MIncludeJoin(many.inverseJoin);
|
||||
}
|
||||
String rawWhere = deriveWhereParentIdSql(true, tableAlias);
|
||||
String expr = descriptor.getParentIdInExpr(parentIds.size(), rawWhere);
|
||||
String expr = descriptor.parentIdInExpr(parentIds.size(), rawWhere);
|
||||
many.bindParentIdsIn(expr, parentIds, query);
|
||||
}
|
||||
|
||||
List<Object> findIdsByParentId(Object parentId, Transaction t, List<Object> excludeDetailIds, boolean hard) {
|
||||
String rawWhere = deriveWhereParentIdSql(false, "");
|
||||
SpiEbeanServer server = descriptor.getEbeanServer();
|
||||
SpiEbeanServer server = descriptor.ebeanServer();
|
||||
SpiQuery<?> q = many.newQuery(server);
|
||||
many.bindParentIdEq(rawWhere, parentId, q);
|
||||
if (hard) {
|
||||
@@ -141,7 +141,7 @@ class BeanPropertyAssocManySqlHelp<T> {
|
||||
String inClause = buildInClauseBinding(parentIds.size(), exportedPropertyBindProto);
|
||||
String expr = rawWhere + inClause;
|
||||
|
||||
SpiEbeanServer server = descriptor.getEbeanServer();
|
||||
SpiEbeanServer server = descriptor.ebeanServer();
|
||||
SpiQuery<?> q = many.newQuery(server);
|
||||
//Query<?> q = server.find(propertyType);
|
||||
many.bindParentIdsIn(expr, parentIds, q);
|
||||
@@ -209,7 +209,7 @@ class BeanPropertyAssocManySqlHelp<T> {
|
||||
|
||||
private String buildInClauseBinding(int size, String bindProto) {
|
||||
if (descriptor.isSimpleId()) {
|
||||
return descriptor.getIdBinder().getIdInValueExpr(false, size);
|
||||
return descriptor.idBinder().getIdInValueExpr(false, size);
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(10 + (size * (bindProto.length() + 1)));
|
||||
sb.append(" in");
|
||||
|
||||
@@ -275,7 +275,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
|
||||
private List<Object> findIdsByParentIdList(List<Object> parentIds, Transaction t) {
|
||||
String rawWhere = deriveWhereParentIdSql(true);
|
||||
String inClause = getIdBinder().getIdInValueExpr(false, parentIds.size());
|
||||
String inClause = idBinder().getIdInValueExpr(false, parentIds.size());
|
||||
String expr = rawWhere + inClause;
|
||||
SpiEbeanServer server = server();
|
||||
Query<?> q = server.find(type());
|
||||
@@ -297,7 +297,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
}
|
||||
} else {
|
||||
if (targetIdProperty != null) {
|
||||
BeanDescriptor<T> target = getTargetDescriptor();
|
||||
BeanDescriptor<T> target = targetDescriptor();
|
||||
String basePath = SplitName.add(prefix, name);
|
||||
if (dbColumn != null) {
|
||||
BeanProperty idProperty = target.idProperty();
|
||||
@@ -312,7 +312,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
* Return meta data for the deployment of the embedded bean specific to this
|
||||
* property.
|
||||
*/
|
||||
public BeanProperty[] getProperties() {
|
||||
public BeanProperty[] properties() {
|
||||
return embeddedProps;
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
public void buildRawSqlSelectChain(String prefix, List<String> selectChain) {
|
||||
prefix = SplitName.add(prefix, name);
|
||||
if (!embedded) {
|
||||
InheritInfo inheritInfo = targetDescriptor.getInheritInfo();
|
||||
InheritInfo inheritInfo = targetDescriptor.inheritInfo();
|
||||
if (inheritInfo != null) {
|
||||
// expect the discriminator column to be included in order
|
||||
// to determine the inheritance type so we add it to the
|
||||
@@ -374,7 +374,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
|
||||
String nextPrefix = (prefix == null) ? name : prefix + "." + name;
|
||||
if (embedded) {
|
||||
BeanDescriptor<T> targetDescriptor = getTargetDescriptor();
|
||||
BeanDescriptor<T> targetDescriptor = targetDescriptor();
|
||||
targetDescriptor.diff(nextPrefix, map, (EntityBean) newEmb, (EntityBean) oldEmb);
|
||||
|
||||
} else {
|
||||
@@ -382,7 +382,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
newBean = (EntityBean) newEmb;
|
||||
oldBean = (EntityBean) oldEmb;
|
||||
|
||||
BeanDescriptor<T> targetDescriptor = getTargetDescriptor();
|
||||
BeanDescriptor<T> targetDescriptor = targetDescriptor();
|
||||
BeanProperty idProperty = targetDescriptor.idProperty();
|
||||
|
||||
Object newId = (newBean == null) ? null : idProperty.getValue(newBean);
|
||||
@@ -398,7 +398,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
* represents.
|
||||
*/
|
||||
@Override
|
||||
public Class<?> getTargetType() {
|
||||
public Class<?> targetType() {
|
||||
return type();
|
||||
}
|
||||
|
||||
@@ -431,12 +431,12 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
private Object createCacheBeanId(Object bean) {
|
||||
final BeanDescriptor<?> desc = targetDescriptor.descOf(bean.getClass());
|
||||
final Object id = desc.idProperty().getCacheDataValue((EntityBean) bean);
|
||||
return new CachedBeanId(desc.getDiscValue(), id);
|
||||
return new CachedBeanId(desc.discValue(), id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String format(Object value) {
|
||||
return targetDescriptor.getIdBinder().cacheKey(value);
|
||||
return targetDescriptor.idBinder().cacheKey(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -473,11 +473,11 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScalarDataReader<?> getIdReader() {
|
||||
public ScalarDataReader<?> idReader() {
|
||||
return targetDescriptor.idProperty();
|
||||
}
|
||||
|
||||
ScalarType<?> getIdScalarType() {
|
||||
ScalarType<?> idScalarType() {
|
||||
return targetDescriptor.idProperty().scalarType;
|
||||
}
|
||||
|
||||
@@ -486,7 +486,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
*/
|
||||
@Override
|
||||
public Object[] assocIdValues(EntityBean bean) {
|
||||
return targetDescriptor.getIdBinder().getIdValues(bean);
|
||||
return targetDescriptor.idBinder().getIdValues(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -494,7 +494,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
*/
|
||||
@Override
|
||||
public String assocIdExpression(String prefix, String operator) {
|
||||
return targetDescriptor.getIdBinder().getAssocOneIdExpr(prefix, operator);
|
||||
return targetDescriptor.idBinder().getAssocOneIdExpr(prefix, operator);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -502,7 +502,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
*/
|
||||
@Override
|
||||
public String assocIdInValueExpr(boolean not, int size) {
|
||||
return targetDescriptor.getIdBinder().getIdInValueExpr(not, size);
|
||||
return targetDescriptor.idBinder().getIdInValueExpr(not, size);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -510,7 +510,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
*/
|
||||
@Override
|
||||
public String assocIdInExpr(String prefix) {
|
||||
return targetDescriptor.getIdBinder().getAssocIdInExpr(prefix);
|
||||
return targetDescriptor.idBinder().getAssocIdInExpr(prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -528,7 +528,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
* value.
|
||||
*/
|
||||
public Object createEmbeddedId() {
|
||||
return getTargetDescriptor().createEntityBean();
|
||||
return targetDescriptor().createEntityBean();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -541,7 +541,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
return value;
|
||||
}
|
||||
|
||||
public ImportedId getImportedId() {
|
||||
public ImportedId importedId() {
|
||||
return importedId;
|
||||
}
|
||||
|
||||
@@ -569,7 +569,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
ArrayList<ExportedProperty> list = new ArrayList<>();
|
||||
if (idProp != null && idProp.isEmbedded()) {
|
||||
BeanPropertyAssocOne<?> one = (BeanPropertyAssocOne<?>) idProp;
|
||||
BeanDescriptor<?> targetDesc = one.getTargetDescriptor();
|
||||
BeanDescriptor<?> targetDesc = one.targetDescriptor();
|
||||
BeanProperty[] emIds = targetDesc.propertiesBaseScalar();
|
||||
try {
|
||||
for (BeanProperty emId : emIds) {
|
||||
@@ -732,7 +732,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
if (value instanceof EntityBean) {
|
||||
if (embedded) {
|
||||
writeJson.writeFieldName(name);
|
||||
BeanDescriptor<?> refDesc = descriptor.getBeanDescriptor(value.getClass());
|
||||
BeanDescriptor<?> refDesc = descriptor.descriptor(value.getClass());
|
||||
refDesc.jsonWriteForInsert(writeJson, (EntityBean) value);
|
||||
} else {
|
||||
jsonWriteTargetId(writeJson, (EntityBean) value);
|
||||
@@ -765,7 +765,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
// Hmmm, not writing complex non-entity bean
|
||||
if (value instanceof EntityBean) {
|
||||
writeJson.beginAssocOne(name, bean);
|
||||
BeanDescriptor<?> refDesc = descriptor.getBeanDescriptor(value.getClass());
|
||||
BeanDescriptor<?> refDesc = descriptor.descriptor(value.getClass());
|
||||
refDesc.jsonWrite(writeJson, (EntityBean) value, name);
|
||||
writeJson.endAssocOne();
|
||||
}
|
||||
@@ -795,7 +795,7 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
|
||||
targetDescriptor.convertSetId(parentId, child);
|
||||
}
|
||||
if (mappedBy != null) {
|
||||
BeanProperty beanProperty = targetDescriptor.getBeanProperty(mappedBy);
|
||||
BeanProperty beanProperty = targetDescriptor.beanProperty(mappedBy);
|
||||
if (beanProperty != null && beanProperty.getValue(child) == null) {
|
||||
// set the 'parent' bean to the 'child' bean
|
||||
beanProperty.setValue(child, parent);
|
||||
|
||||
@@ -54,7 +54,7 @@ public class BeanSetHelp<T> extends BaseCollectionHelp<T> {
|
||||
public BeanCollection<T> createEmpty(EntityBean ownerBean) {
|
||||
BeanSet<T> beanSet = new BeanSet<>(loader, ownerBean, propertyName);
|
||||
if (many != null) {
|
||||
beanSet.setModifyListening(many.getModifyListenMode());
|
||||
beanSet.setModifyListening(many.modifyListenMode());
|
||||
}
|
||||
return beanSet;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class BeanSetHelp<T> extends BaseCollectionHelp<T> {
|
||||
@Override
|
||||
public BeanCollection<T> createReference(EntityBean parentBean) {
|
||||
BeanSet<T> beanSet = new BeanSet<>(loader, parentBean, propertyName);
|
||||
beanSet.setModifyListening(many.getModifyListenMode());
|
||||
beanSet.setModifyListening(many.modifyListenMode());
|
||||
return beanSet;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class BeanSetHelp<T> extends BaseCollectionHelp<T> {
|
||||
public void refresh(BeanCollection<?> bc, EntityBean parentBean) {
|
||||
BeanSet<?> newBeanSet = (BeanSet<?>) bc;
|
||||
Set<?> current = (Set<?>) many.getValue(parentBean);
|
||||
newBeanSet.setModifyListening(many.getModifyListenMode());
|
||||
newBeanSet.setModifyListening(many.modifyListenMode());
|
||||
if (current == null) {
|
||||
// the currentList is null? Not really expecting this...
|
||||
many.setValue(parentBean, newBeanSet);
|
||||
@@ -85,7 +85,7 @@ public class BeanSetHelp<T> extends BaseCollectionHelp<T> {
|
||||
// normally this case, replace just the underlying list
|
||||
BeanSet<?> currentBeanSet = (BeanSet<?>) current;
|
||||
currentBeanSet.setActualSet(newBeanSet.getActualSet());
|
||||
currentBeanSet.setModifyListening(many.getModifyListenMode());
|
||||
currentBeanSet.setModifyListening(many.modifyListenMode());
|
||||
|
||||
} else {
|
||||
// replace the entire set
|
||||
|
||||
@@ -90,7 +90,7 @@ public final class BeanTable {
|
||||
}
|
||||
if (idProperty instanceof BeanPropertyAssocOne<?>) {
|
||||
BeanPropertyAssocOne<?> assocOne = (BeanPropertyAssocOne<?>) idProperty;
|
||||
BeanProperty[] props = assocOne.getProperties();
|
||||
BeanProperty[] props = assocOne.properties();
|
||||
for (BeanProperty prop : props) {
|
||||
addToJoin(foreignKeyPrefix, join, reverse, sqlFormulaSelect, true, prop);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public final class DeployPropertyParser extends DeployParser {
|
||||
|
||||
@Override
|
||||
public String getDeployWord(String expression) {
|
||||
ElPropertyDeploy elProp = beanDescriptor.getElPropertyDeploy(expression);
|
||||
ElPropertyDeploy elProp = beanDescriptor.elPropertyDeploy(expression);
|
||||
if (elProp == null) {
|
||||
return null;
|
||||
} else {
|
||||
|
||||
@@ -76,7 +76,7 @@ public final class DeployUpdateParser extends DeployParser {
|
||||
if (expression.equalsIgnoreCase(beanDescriptor.name())) {
|
||||
return beanDescriptor.baseTable();
|
||||
}
|
||||
ElPropertyDeploy elProp = beanDescriptor.getElPropertyDeploy(expression);
|
||||
ElPropertyDeploy elProp = beanDescriptor.elPropertyDeploy(expression);
|
||||
return elProp != null ? elProp.dbColumn() : null;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ public final class DynamicPropertyAggregationFormulaMTO extends DynamicPropertyA
|
||||
private final BeanPropertyAssocOne prop;
|
||||
|
||||
DynamicPropertyAggregationFormulaMTO(BeanPropertyAssocOne prop, String name, String parsedFormula, boolean aggregate, BeanProperty asTarget, String alias) {
|
||||
super(name, prop.getIdScalarType(), parsedFormula, aggregate, asTarget, alias);
|
||||
super(name, prop.idScalarType(), parsedFormula, aggregate, asTarget, alias);
|
||||
this.prop = prop;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,17 +97,17 @@ final class FormulaPropertyPath {
|
||||
|
||||
STreeProperty build() {
|
||||
if (cast != null) {
|
||||
ScalarType<?> scalarType = descriptor.getScalarType(cast);
|
||||
ScalarType<?> scalarType = descriptor.scalarType(cast);
|
||||
if (scalarType == null) {
|
||||
throw new IllegalStateException("Unable to find scalarType for cast of [" + cast + "] on formula [" + formula + "] for type " + descriptor);
|
||||
}
|
||||
return create(scalarType);
|
||||
}
|
||||
if (isCount()) {
|
||||
return create(descriptor.getScalarType(Types.BIGINT));
|
||||
return create(descriptor.scalarType(Types.BIGINT));
|
||||
}
|
||||
if (isConcat()) {
|
||||
return create(descriptor.getScalarType(Types.VARCHAR));
|
||||
return create(descriptor.scalarType(Types.VARCHAR));
|
||||
}
|
||||
if (firstProp == null) {
|
||||
throw new IllegalStateException("unable to determine scalarType of formula [" + formula + "] for type " + descriptor + " - maybe use a cast like ::String ?");
|
||||
|
||||
@@ -80,9 +80,9 @@ public final class InheritInfo {
|
||||
*/
|
||||
public void appendCheckConstraintValues(final String propertyName, final Set<String> checkConstraintValues) {
|
||||
visitChildren(inheritInfo -> {
|
||||
BeanProperty prop = inheritInfo.desc().getBeanProperty(propertyName);
|
||||
BeanProperty prop = inheritInfo.desc().beanProperty(propertyName);
|
||||
if (prop != null) {
|
||||
Set<String> values = prop.getDbCheckConstraintValues();
|
||||
Set<String> values = prop.dbCheckConstraintValues();
|
||||
if (values != null) {
|
||||
checkConstraintValues.addAll(values);
|
||||
}
|
||||
@@ -236,7 +236,7 @@ public final class InheritInfo {
|
||||
* Return the IdBinder for this type.
|
||||
*/
|
||||
public IdBinder getIdBinder() {
|
||||
return descriptor.getIdBinder();
|
||||
return descriptor.idBinder();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -72,7 +72,7 @@ public final class IntersectionRow {
|
||||
sb.append("delete from ").append(tableName);
|
||||
} else {
|
||||
sb.append("update ").append(tableName).append(" set ");
|
||||
sb.append(targetDescriptor.getSoftDeleteDbSet());
|
||||
sb.append(targetDescriptor.softDeleteDbSet());
|
||||
}
|
||||
sb.append(" where ");
|
||||
int count = setBindParams(bindParams, sb);
|
||||
|
||||
@@ -40,8 +40,8 @@ public final class IdBinderEmbedded implements IdBinder {
|
||||
|
||||
@Override
|
||||
public void initialise() {
|
||||
this.idDesc = embIdProperty.getTargetDescriptor();
|
||||
this.props = embIdProperty.getProperties();
|
||||
this.idDesc = embIdProperty.targetDescriptor();
|
||||
this.props = embIdProperty.properties();
|
||||
this.idInValueSql = idInExpandedForm ? idInExpanded() : idInCompressed();
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public final class IdBinderEmbedded implements IdBinder {
|
||||
if (i > 0) {
|
||||
sb.append(" and ");
|
||||
}
|
||||
sb.append(idDesc.getBaseTableAlias()).append(".").append(props[i].dbColumn()).append("=?");
|
||||
sb.append(idDesc.baseTableAlias()).append(".").append(props[i].dbColumn()).append("=?");
|
||||
}
|
||||
sb.append(")");
|
||||
return sb.toString();
|
||||
|
||||
@@ -32,11 +32,11 @@ public final class ImportedIdEmbedded implements ImportedId {
|
||||
|
||||
@Override
|
||||
public void addFkeys(String name) {
|
||||
BeanProperty[] embeddedProps = foreignAssocOne.getProperties();
|
||||
BeanProperty[] embeddedProps = foreignAssocOne.properties();
|
||||
for (int i = 0; i < imported.length; i++) {
|
||||
String n = name + "." + foreignAssocOne.name() + "." + embeddedProps[i].name();
|
||||
BeanFkeyProperty fkey = new BeanFkeyProperty(n, imported[i].localDbColumn, foreignAssocOne.getDeployOrder());
|
||||
owner.getBeanDescriptor().add(fkey);
|
||||
BeanFkeyProperty fkey = new BeanFkeyProperty(n, imported[i].localDbColumn, foreignAssocOne.deployOrder());
|
||||
owner.descriptor().add(fkey);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,8 +88,8 @@ public final class ImportedIdSimple implements ImportedId, Comparable<ImportedId
|
||||
|
||||
@Override
|
||||
public void addFkeys(String name) {
|
||||
BeanFkeyProperty fkey = new BeanFkeyProperty(name + "." + foreignProperty.name(), localDbColumn, owner.getDeployOrder());
|
||||
owner.getBeanDescriptor().add(fkey);
|
||||
BeanFkeyProperty fkey = new BeanFkeyProperty(name + "." + foreignProperty.name(), localDbColumn, owner.deployOrder());
|
||||
owner.descriptor().add(fkey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
-5
@@ -194,7 +194,7 @@ public final class DeployBeanPropertyLists {
|
||||
mutable.add(prop);
|
||||
}
|
||||
|
||||
if (desc.getInheritInfo() != null && prop.isLocal()) {
|
||||
if (desc.inheritInfo() != null && prop.isLocal()) {
|
||||
local.add(prop);
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ public final class DeployBeanPropertyLists {
|
||||
public BeanProperty[] getGeneratedInsert() {
|
||||
List<BeanProperty> list = new ArrayList<>();
|
||||
for (BeanProperty prop : nonTransients) {
|
||||
GeneratedProperty gen = prop.getGeneratedProperty();
|
||||
GeneratedProperty gen = prop.generatedProperty();
|
||||
if (gen != null && gen.includeInInsert()) {
|
||||
list.add(prop);
|
||||
}
|
||||
@@ -370,7 +370,7 @@ public final class DeployBeanPropertyLists {
|
||||
public BeanProperty[] getGeneratedUpdate() {
|
||||
List<BeanProperty> list = new ArrayList<>();
|
||||
for (BeanProperty prop : nonTransients) {
|
||||
GeneratedProperty gen = prop.getGeneratedProperty();
|
||||
GeneratedProperty gen = prop.generatedProperty();
|
||||
if (gen != null && gen.includeInUpdate()) {
|
||||
list.add(prop);
|
||||
}
|
||||
@@ -391,12 +391,12 @@ public final class DeployBeanPropertyLists {
|
||||
if (imported != prop.isOneToOneExported()) {
|
||||
switch (mode) {
|
||||
case Save:
|
||||
if (prop.getCascadeInfo().isSave()) {
|
||||
if (prop.cascadeInfo().isSave()) {
|
||||
list.add(prop);
|
||||
}
|
||||
break;
|
||||
case Delete:
|
||||
if (prop.getCascadeInfo().isDelete()) {
|
||||
if (prop.cascadeInfo().isDelete()) {
|
||||
list.add(prop);
|
||||
}
|
||||
break;
|
||||
|
||||
+3
-3
@@ -25,7 +25,7 @@ public class VisitProperties {
|
||||
if (idProp != null) {
|
||||
visit(propertyVisitor, idProp);
|
||||
}
|
||||
BeanPropertyAssocOne<?> unidirectional = desc.getUnidirectional();
|
||||
BeanPropertyAssocOne<?> unidirectional = desc.unidirectional();
|
||||
if (unidirectional != null) {
|
||||
visit(propertyVisitor, unidirectional);
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public class VisitProperties {
|
||||
if (assocOne.isEmbedded()) {
|
||||
// Embedded bean
|
||||
pv.visitEmbedded(assocOne);
|
||||
BeanProperty[] embProps = assocOne.getProperties();
|
||||
BeanProperty[] embProps = assocOne.properties();
|
||||
for (BeanProperty embProp : embProps) {
|
||||
pv.visitEmbeddedScalar(embProp, assocOne);
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public class VisitProperties {
|
||||
* Visit all the other inheritance properties that are not on the root.
|
||||
*/
|
||||
protected void visitInheritanceProperties(BeanDescriptor<?> descriptor, BeanPropertyVisitor pv) {
|
||||
InheritInfo inheritInfo = descriptor.getInheritInfo();
|
||||
InheritInfo inheritInfo = descriptor.inheritInfo();
|
||||
if (inheritInfo != null && inheritInfo.isRoot()) {
|
||||
// add all properties on the children objects
|
||||
inheritInfo.visitChildren(new InheritChildVisitor(this, pv));
|
||||
|
||||
@@ -24,18 +24,18 @@ public final class ElFilter<T> implements Filter<T> {
|
||||
|
||||
private Object convertValue(String propertyName, Object value) {
|
||||
// convert type of value to match expected type
|
||||
ElPropertyValue elGetValue = beanDescriptor.getElGetValue(propertyName);
|
||||
ElPropertyValue elGetValue = beanDescriptor.elGetValue(propertyName);
|
||||
return elGetValue.convert(value);
|
||||
}
|
||||
|
||||
private ElComparator<T> getElComparator(String propertyName) {
|
||||
|
||||
return beanDescriptor.getElComparator(propertyName);
|
||||
return beanDescriptor.elComparator(propertyName);
|
||||
}
|
||||
|
||||
private ElPropertyValue getElGetValue(String propertyName) {
|
||||
|
||||
return beanDescriptor.getElGetValue(propertyName);
|
||||
return beanDescriptor.elGetValue(propertyName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,7 +56,7 @@ abstract class AbstractExpression implements SpiExpression {
|
||||
|
||||
protected String propertyNestedPath(String propertyName, BeanDescriptor<?> desc) {
|
||||
if (propertyName != null) {
|
||||
ElPropertyDeploy elProp = desc.getElPropertyDeploy(propertyName);
|
||||
ElPropertyDeploy elProp = desc.elPropertyDeploy(propertyName);
|
||||
if (elProp != null && elProp.containsMany()) {
|
||||
return SplitName.begin(propName);
|
||||
}
|
||||
@@ -74,7 +74,7 @@ abstract class AbstractExpression implements SpiExpression {
|
||||
*/
|
||||
protected void propertyContainsMany(String propertyName, BeanDescriptor<?> desc, ManyWhereJoins manyWhereJoin) {
|
||||
if (propertyName != null) {
|
||||
ElPropertyDeploy elProp = desc.getElPropertyDeploy(propertyName);
|
||||
ElPropertyDeploy elProp = desc.elPropertyDeploy(propertyName);
|
||||
if (elProp != null) {
|
||||
if (elProp.containsFormulaWithJoin()) {
|
||||
// for findCount query select clause
|
||||
@@ -102,6 +102,6 @@ abstract class AbstractExpression implements SpiExpression {
|
||||
}
|
||||
|
||||
protected final ElPropertyValue getElProp(SpiExpressionRequest request) {
|
||||
return request.getBeanDescriptor().getElGetValue(propName);
|
||||
return request.getBeanDescriptor().elGetValue(propName);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ final class AllEqualsExpression extends NonPrepareExpression {
|
||||
public void containsMany(BeanDescriptor<?> desc, ManyWhereJoins manyWhereJoin) {
|
||||
if (propMap != null) {
|
||||
for (String propertyName : propMap.keySet()) {
|
||||
ElPropertyDeploy elProp = desc.getElPropertyDeploy(name(propertyName));
|
||||
ElPropertyDeploy elProp = desc.elPropertyDeploy(name(propertyName));
|
||||
if (elProp != null && elProp.containsMany()) {
|
||||
manyWhereJoin.add(elProp);
|
||||
}
|
||||
|
||||
+3
-3
@@ -52,7 +52,7 @@ final class BetweenPropertyExpression extends NonPrepareExpression {
|
||||
|
||||
@Override
|
||||
public String nestedPath(BeanDescriptor<?> desc) {
|
||||
ElPropertyDeploy elProp = desc.getElPropertyDeploy(name(lowProperty));
|
||||
ElPropertyDeploy elProp = desc.elPropertyDeploy(name(lowProperty));
|
||||
if (elProp != null && elProp.containsMany()) {
|
||||
// assumes highProperty is also nested property which seems reasonable
|
||||
return SplitName.begin(lowProperty);
|
||||
@@ -62,11 +62,11 @@ final class BetweenPropertyExpression extends NonPrepareExpression {
|
||||
|
||||
@Override
|
||||
public void containsMany(BeanDescriptor<?> desc, ManyWhereJoins manyWhereJoin) {
|
||||
ElPropertyDeploy elProp = desc.getElPropertyDeploy(name(lowProperty));
|
||||
ElPropertyDeploy elProp = desc.elPropertyDeploy(name(lowProperty));
|
||||
if (elProp != null && elProp.containsMany()) {
|
||||
manyWhereJoin.add(elProp);
|
||||
}
|
||||
elProp = desc.getElPropertyDeploy(name(highProperty));
|
||||
elProp = desc.elPropertyDeploy(name(highProperty));
|
||||
if (elProp != null && elProp.containsMany()) {
|
||||
manyWhereJoin.add(elProp);
|
||||
}
|
||||
|
||||
+2
-2
@@ -37,7 +37,7 @@ final class CaseInsensitiveEqualExpression extends AbstractValueExpression {
|
||||
ElPropertyValue prop = getElProp(request);
|
||||
if (prop != null && prop.isDbEncrypted()) {
|
||||
// bind the key as well as the value
|
||||
String encryptKey = prop.beanProperty().getEncryptKey().getStringValue();
|
||||
String encryptKey = prop.beanProperty().encryptKey().getStringValue();
|
||||
request.addBindEncryptKey(encryptKey);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ final class CaseInsensitiveEqualExpression extends AbstractValueExpression {
|
||||
String pname = propName;
|
||||
ElPropertyValue prop = getElProp(request);
|
||||
if (prop != null && prop.isDbEncrypted()) {
|
||||
pname = prop.beanProperty().getDecryptProperty(propName);
|
||||
pname = prop.beanProperty().decryptProperty(propName);
|
||||
}
|
||||
if (not) {
|
||||
request.append("lower(").append(pname).append(") != ?");
|
||||
|
||||
+1
-1
@@ -290,7 +290,7 @@ final class DefaultExampleExpression implements SpiExpression, ExampleExpression
|
||||
|
||||
} else if ((beanProperty instanceof BeanPropertyAssocOne) && (value instanceof EntityBean)) {
|
||||
BeanPropertyAssocOne<?> assocOne = (BeanPropertyAssocOne<?>) beanProperty;
|
||||
BeanDescriptor<?> targetDescriptor = assocOne.getTargetDescriptor();
|
||||
BeanDescriptor<?> targetDescriptor = assocOne.targetDescriptor();
|
||||
addExpressions(list, targetDescriptor, (EntityBean) value, propName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ final class IdExpression extends NonPrepareExpression implements SpiExpression {
|
||||
// 'flatten' EmbeddedId and multiple Id cases
|
||||
// into an array of the underlying scalar field values
|
||||
DefaultExpressionRequest r = (DefaultExpressionRequest) request;
|
||||
Object[] bindIdValues = r.getBeanDescriptor().getBindIdValues(value);
|
||||
Object[] bindIdValues = r.getBeanDescriptor().bindIdValues(value);
|
||||
for (Object bindIdValue : bindIdValues) {
|
||||
request.addBindValue(bindIdValue);
|
||||
}
|
||||
@@ -64,7 +64,7 @@ final class IdExpression extends NonPrepareExpression implements SpiExpression {
|
||||
public void addSql(SpiExpressionRequest request) {
|
||||
|
||||
DefaultExpressionRequest r = (DefaultExpressionRequest) request;
|
||||
String idSql = r.getBeanDescriptor().getIdBinderIdSql(null);
|
||||
String idSql = r.getBeanDescriptor().idBinderIdSql(null);
|
||||
|
||||
request.append(idSql);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public final class IdInExpression extends NonPrepareExpression {
|
||||
|
||||
DefaultExpressionRequest r = (DefaultExpressionRequest) request;
|
||||
BeanDescriptor<?> descriptor = r.getBeanDescriptor();
|
||||
IdBinder idBinder = descriptor.getIdBinder();
|
||||
IdBinder idBinder = descriptor.idBinder();
|
||||
idBinder.addIdInBindValues(request, idCollection);
|
||||
}
|
||||
|
||||
@@ -92,11 +92,11 @@ public final class IdInExpression extends NonPrepareExpression {
|
||||
|
||||
DefaultExpressionRequest r = (DefaultExpressionRequest) request;
|
||||
BeanDescriptor<?> descriptor = r.getBeanDescriptor();
|
||||
IdBinder idBinder = descriptor.getIdBinder();
|
||||
IdBinder idBinder = descriptor.idBinder();
|
||||
if (idCollection.isEmpty()) {
|
||||
request.append(SQL_FALSE); // append false for this stage
|
||||
} else {
|
||||
request.append(descriptor.getIdBinder().getBindIdInSql(null));
|
||||
request.append(descriptor.idBinder().getBindIdInSql(null));
|
||||
String inClause = idBinder.getIdInValueExpr(false, idCollection.size());
|
||||
request.append(inClause);
|
||||
}
|
||||
@@ -105,12 +105,12 @@ public final class IdInExpression extends NonPrepareExpression {
|
||||
@Override
|
||||
public void addSql(SpiExpressionRequest request) {
|
||||
BeanDescriptor<?> descriptor = request.getBeanDescriptor();
|
||||
IdBinder idBinder = descriptor.getIdBinder();
|
||||
IdBinder idBinder = descriptor.idBinder();
|
||||
if (idCollection.isEmpty()) {
|
||||
request.append(SQL_FALSE); // append false for this stage
|
||||
} else {
|
||||
if (idBinder.isComplexId()) {
|
||||
request.append(descriptor.getIdBinderInLHSSql());
|
||||
request.append(descriptor.idBinderInLHSSql());
|
||||
request.append(idBinder.getIdInValueExpr(false, idCollection.size()));
|
||||
} else {
|
||||
request.append(idBinder.getBeanProperty().name());
|
||||
|
||||
@@ -29,7 +29,7 @@ final class LikeExpression extends AbstractValueExpression {
|
||||
ElPropertyValue prop = getElProp(request);
|
||||
if (prop != null && prop.isDbEncrypted()) {
|
||||
// bind the key as well as the value
|
||||
String encryptKey = prop.beanProperty().getEncryptKey().getStringValue();
|
||||
String encryptKey = prop.beanProperty().encryptKey().getStringValue();
|
||||
request.addBindEncryptKey(encryptKey);
|
||||
}
|
||||
String bindValue = getValue(strValue(), caseInsensitive, type, request);
|
||||
@@ -41,7 +41,7 @@ final class LikeExpression extends AbstractValueExpression {
|
||||
String pname = propName;
|
||||
ElPropertyValue prop = getElProp(request);
|
||||
if (prop != null && prop.isDbEncrypted()) {
|
||||
pname = prop.beanProperty().getDecryptProperty(propName);
|
||||
pname = prop.beanProperty().decryptProperty(propName);
|
||||
}
|
||||
if (caseInsensitive) {
|
||||
request.append("lower(").append(pname).append(")");
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@ final class NativeILikeExpression extends AbstractExpression {
|
||||
ElPropertyValue prop = getElProp(request);
|
||||
if (prop != null && prop.isDbEncrypted()) {
|
||||
// bind the key as well as the value
|
||||
String encryptKey = prop.beanProperty().getEncryptKey().getStringValue();
|
||||
String encryptKey = prop.beanProperty().encryptKey().getStringValue();
|
||||
request.addBindEncryptKey(encryptKey);
|
||||
}
|
||||
request.addBindValue(val);
|
||||
@@ -40,7 +40,7 @@ final class NativeILikeExpression extends AbstractExpression {
|
||||
String pname = propName;
|
||||
ElPropertyValue prop = getElProp(request);
|
||||
if (prop != null && prop.isDbEncrypted()) {
|
||||
pname = prop.beanProperty().getDecryptProperty(propName);
|
||||
pname = prop.beanProperty().decryptProperty(propName);
|
||||
}
|
||||
|
||||
request.append(pname).append(" ilike ?");
|
||||
|
||||
@@ -31,7 +31,7 @@ final class NullExpression extends AbstractExpression {
|
||||
|
||||
@Override
|
||||
public void containsMany(BeanDescriptor<?> desc, ManyWhereJoins manyWhereJoin) {
|
||||
elProperty = desc.getElGetValue(propName);
|
||||
elProperty = desc.elGetValue(propName);
|
||||
if (elProperty != null && elProperty.isAssocMany()) {
|
||||
// it is OneToMany or ManyToMany so going to be treated as isEmpty() expression
|
||||
assocMany = true;
|
||||
|
||||
@@ -83,7 +83,7 @@ public final class SimpleExpression extends AbstractValueExpression {
|
||||
}
|
||||
if (prop.isDbEncrypted()) {
|
||||
// bind the key as well as the value
|
||||
String encryptKey = prop.beanProperty().getEncryptKey().getStringValue();
|
||||
String encryptKey = prop.beanProperty().encryptKey().getStringValue();
|
||||
request.addBindEncryptKey(encryptKey);
|
||||
} else if (prop.isLocalEncrypted()) {
|
||||
Object bindVal = prop.localEncrypt(value());
|
||||
@@ -105,7 +105,7 @@ public final class SimpleExpression extends AbstractValueExpression {
|
||||
return;
|
||||
}
|
||||
if (prop.isDbEncrypted()) {
|
||||
String dsql = prop.beanProperty().getDecryptProperty(propName);
|
||||
String dsql = prop.beanProperty().decryptProperty(propName);
|
||||
request.append(dsql).append(type.bind());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ final class DLoadBeanContext extends DLoadBaseContext implements LoadBeanContext
|
||||
}
|
||||
|
||||
LoadBeanRequest req = new LoadBeanRequest(this, ebi, context.hitCache);
|
||||
context.desc.getEbeanServer().loadBean(req);
|
||||
context.desc.ebeanServer().loadBean(req);
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public final class DLoadContext implements LoadContext {
|
||||
public DLoadContext(BeanDescriptor<?> rootDescriptor, PersistenceContext persistenceContext) {
|
||||
this.useDocStore = true;
|
||||
this.rootDescriptor = rootDescriptor;
|
||||
this.ebeanServer = rootDescriptor.getEbeanServer();
|
||||
this.ebeanServer = rootDescriptor.ebeanServer();
|
||||
this.persistenceContext = persistenceContext;
|
||||
this.origin = initOrigin();
|
||||
this.defaultBatchSize = 100;
|
||||
@@ -161,7 +161,7 @@ public final class DLoadContext implements LoadContext {
|
||||
* used to build the appropriate query for +query or +lazy loading.
|
||||
*/
|
||||
private void registerSecondaryQuery(OrmQueryProperties props) {
|
||||
ElPropertyValue elGetValue = rootDescriptor.getElGetValue(props.getPath());
|
||||
ElPropertyValue elGetValue = rootDescriptor.elGetValue(props.getPath());
|
||||
boolean many = elGetValue.beanProperty().containsMany();
|
||||
registerSecondaryNode(many, props);
|
||||
}
|
||||
@@ -295,7 +295,7 @@ public final class DLoadContext implements LoadContext {
|
||||
}
|
||||
|
||||
DLoadBeanContext getBeanContextWithInherit(String path, BeanPropertyAssocOne<?> property) {
|
||||
String key = path + ":" + property.getTargetDescriptor().name();
|
||||
String key = path + ":" + property.targetDescriptor().name();
|
||||
return beanMap.computeIfAbsent(key, p -> createBeanContext(property, path, null));
|
||||
}
|
||||
|
||||
@@ -323,11 +323,11 @@ public final class DLoadContext implements LoadContext {
|
||||
|
||||
private DLoadBeanContext createBeanContext(String path, OrmQueryProperties queryProps) {
|
||||
BeanPropertyAssoc<?> p = (BeanPropertyAssoc<?>) getBeanProperty(rootDescriptor, path);
|
||||
return new DLoadBeanContext(this, p.getTargetDescriptor(), path, queryProps);
|
||||
return new DLoadBeanContext(this, p.targetDescriptor(), path, queryProps);
|
||||
}
|
||||
|
||||
private DLoadBeanContext createBeanContext(BeanPropertyAssoc<?> property, String path, OrmQueryProperties queryProps) {
|
||||
return new DLoadBeanContext(this, property.getTargetDescriptor(), path, queryProps);
|
||||
return new DLoadBeanContext(this, property.targetDescriptor(), path, queryProps);
|
||||
}
|
||||
|
||||
private BeanProperty getBeanProperty(BeanDescriptor<?> desc, String path) {
|
||||
|
||||
@@ -29,7 +29,7 @@ final class DLoadManyContext extends DLoadBaseContext implements LoadManyContext
|
||||
private LoadBuffer currentBuffer;
|
||||
|
||||
DLoadManyContext(DLoadContext parent, BeanPropertyAssocMany<?> property, String path, OrmQueryProperties queryProps) {
|
||||
super(parent, property.getBeanDescriptor(), path, queryProps);
|
||||
super(parent, property.descriptor(), path, queryProps);
|
||||
this.property = property;
|
||||
this.docStoreMapped = property.isTargetDocStoreMapped();
|
||||
// bufferList only required when using query joins (queryFetch)
|
||||
@@ -203,7 +203,7 @@ final class DLoadManyContext extends DLoadBaseContext implements LoadManyContext
|
||||
boolean useCache = !onlyIds && context.hitCache && context.property.isUseCache();
|
||||
if (useCache) {
|
||||
EntityBean ownerBean = bc.getOwnerBean();
|
||||
BeanDescriptor<?> parentDesc = context.desc.getBeanDescriptor(ownerBean.getClass());
|
||||
BeanDescriptor<?> parentDesc = context.desc.descriptor(ownerBean.getClass());
|
||||
Object parentId = parentDesc.getId(ownerBean);
|
||||
if (parentDesc.cacheManyPropLoad(context.property, bc, parentId, context.parent.isReadOnly())) {
|
||||
// we loaded the bean collection from cache so remove it from the buffer
|
||||
|
||||
@@ -739,7 +739,7 @@ public final class DefaultPersister implements Persister {
|
||||
// OneToOne exported side with delete cascade
|
||||
BeanPropertyAssocOne<?>[] expOnes = descriptor.propertiesOneExportedDelete();
|
||||
for (BeanPropertyAssocOne<?> expOne : expOnes) {
|
||||
BeanDescriptor<?> targetDesc = expOne.getTargetDescriptor();
|
||||
BeanDescriptor<?> targetDesc = expOne.targetDescriptor();
|
||||
// only cascade soft deletes when supported by target
|
||||
if (deleteMode.isHard() || targetDesc.isSoftDelete()) {
|
||||
if (deleteMode.isHard() && targetDesc.isDeleteByStatement()) {
|
||||
@@ -758,7 +758,7 @@ public final class DefaultPersister implements Persister {
|
||||
BeanPropertyAssocMany<?>[] manys = descriptor.propertiesManyDelete();
|
||||
for (BeanPropertyAssocMany<?> many : manys) {
|
||||
if (!many.isManyToMany()) {
|
||||
BeanDescriptor<?> targetDesc = many.getTargetDescriptor();
|
||||
BeanDescriptor<?> targetDesc = many.targetDescriptor();
|
||||
// only cascade soft deletes when supported by target
|
||||
if (deleteMode.isHard() || targetDesc.isSoftDelete()) {
|
||||
if (deleteMode.isHard() && targetDesc.isDeleteByStatement()) {
|
||||
@@ -948,7 +948,7 @@ public final class DefaultPersister implements Persister {
|
||||
private SaveManyBase saveManyRequest(boolean insertedParent, BeanPropertyAssocMany<?> many, EntityBean parentBean, PersistRequestBean<?> request) {
|
||||
if (!many.isElementCollection()) {
|
||||
return new SaveManyBeans(this, insertedParent, many, parentBean, request);
|
||||
} else if (many.getManyType().isMap()) {
|
||||
} else if (many.manyType().isMap()) {
|
||||
return new SaveManyElementCollectionMap(this, insertedParent, many, parentBean, request);
|
||||
} else {
|
||||
return new SaveManyElementCollection(this, insertedParent, many, parentBean, request);
|
||||
@@ -1019,7 +1019,7 @@ public final class DefaultPersister implements Persister {
|
||||
}
|
||||
} else {
|
||||
|
||||
if (ModifyListenMode.REMOVALS == many.getModifyListenMode()) {
|
||||
if (ModifyListenMode.REMOVALS == many.modifyListenMode()) {
|
||||
// PrivateOwned ...
|
||||
// if soft delete then check target also supports soft delete
|
||||
if (deleteMode.isHard() || many.isTargetSoftDelete()) {
|
||||
@@ -1059,9 +1059,9 @@ public final class DefaultPersister implements Persister {
|
||||
void deleteManyDetails(SpiTransaction t, BeanDescriptor<?> desc, EntityBean parentBean,
|
||||
BeanPropertyAssocMany<?> many, List<Object> excludeDetailIds, DeleteMode deleteMode) {
|
||||
|
||||
if (many.getCascadeInfo().isDelete()) {
|
||||
if (many.cascadeInfo().isDelete()) {
|
||||
// cascade delete the beans in the collection
|
||||
BeanDescriptor<?> targetDesc = many.getTargetDescriptor();
|
||||
BeanDescriptor<?> targetDesc = many.targetDescriptor();
|
||||
if (deleteMode.isHard() || targetDesc.isSoftDelete()) {
|
||||
if (targetDesc.isDeleteByStatement()) {
|
||||
// Just delete all the children with one statement
|
||||
|
||||
@@ -126,7 +126,7 @@ final class MergeHandler {
|
||||
}
|
||||
|
||||
static MergeNode createMergeNode(String fullPath, BeanDescriptor<?> targetDesc, String path) {
|
||||
BeanProperty prop = targetDesc.getBeanProperty(path);
|
||||
BeanProperty prop = targetDesc.beanProperty(path);
|
||||
if (!(prop instanceof BeanPropertyAssoc)) {
|
||||
throw new PersistenceException("merge path [" + path + "] is not a ToMany or ToOne property of " + targetDesc.fullName());
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ abstract class MergeNode {
|
||||
|
||||
MergeNode(String fullPath, BeanPropertyAssoc<?> property) {
|
||||
this.fullPath = fullPath;
|
||||
this.targetDescriptor = property.getTargetDescriptor();
|
||||
this.targetDescriptor = property.targetDescriptor();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -27,8 +27,8 @@ final class MergeNodeAssocManyToMany extends MergeNode {
|
||||
@Override
|
||||
public void merge(MergeRequest request) {
|
||||
EntityBean parentBean = request.getBean();
|
||||
Collection beans = many.getRawCollection(parentBean);
|
||||
Collection outlines = many.getRawCollection(request.getOutline());
|
||||
Collection beans = many.rawCollection(parentBean);
|
||||
Collection outlines = many.rawCollection(request.getOutline());
|
||||
|
||||
Map<Object, EntityBean> outlineIds = toMap(outlines);
|
||||
List<EntityBean> additions = new ArrayList<>();
|
||||
|
||||
+2
-2
@@ -20,8 +20,8 @@ final class MergeNodeAssocOneToMany extends MergeNode {
|
||||
|
||||
@Override
|
||||
public void merge(MergeRequest request) {
|
||||
Collection beans = many.getRawCollection(request.getBean());
|
||||
Collection outlines = many.getRawCollection(request.getOutline());
|
||||
Collection beans = many.rawCollection(request.getBean());
|
||||
Collection outlines = many.rawCollection(request.getOutline());
|
||||
|
||||
Map<Object, EntityBean> outlineIds = toMap(outlines);
|
||||
if (beans != null) {
|
||||
|
||||
@@ -62,7 +62,7 @@ abstract class SaveManyBase implements SaveMany {
|
||||
final void modifyListenReset(BeanCollection<?> c) {
|
||||
if (insertedParent) {
|
||||
// after insert set the modify listening mode for private owned etc
|
||||
c.setModifyListening(many.getModifyListenMode());
|
||||
c.setModifyListening(many.modifyListenMode());
|
||||
}
|
||||
c.modifyReset();
|
||||
}
|
||||
|
||||
@@ -41,10 +41,10 @@ public final class SaveManyBeans extends SaveManyBase {
|
||||
|
||||
SaveManyBeans(DefaultPersister persister, boolean insertedParent, BeanPropertyAssocMany<?> many, EntityBean parentBean, PersistRequestBean<?> request) {
|
||||
super(persister, insertedParent, many, parentBean, request);
|
||||
this.cascade = many.getCascadeInfo().isSave();
|
||||
this.cascade = many.cascadeInfo().isSave();
|
||||
this.publish = request.isPublish();
|
||||
this.targetDescriptor = many.getTargetDescriptor();
|
||||
this.isMap = many.getManyType().isMap();
|
||||
this.targetDescriptor = many.targetDescriptor();
|
||||
this.isMap = many.manyType().isMap();
|
||||
this.saveRecurseSkippable = many.isSaveRecurseSkippable();
|
||||
this.deleteMode = targetDescriptor.isSoftDelete() ? DeleteMode.SOFT : DeleteMode.HARD;
|
||||
this.untouchedBeanCollection = untouchedBeanCollection();
|
||||
@@ -95,11 +95,11 @@ public final class SaveManyBeans extends SaveManyBase {
|
||||
if (!many.isManyToMany()) {
|
||||
return true;
|
||||
}
|
||||
return transaction.isSaveAssocManyIntersection(many.getIntersectionTableJoin().getTable(), many.getBeanDescriptor().rootName());
|
||||
return transaction.isSaveAssocManyIntersection(many.intersectionTableJoin().getTable(), many.descriptor().rootName());
|
||||
}
|
||||
|
||||
private boolean isModifyListenMode() {
|
||||
return BeanCollection.ModifyListenMode.REMOVALS == many.getModifyListenMode();
|
||||
return BeanCollection.ModifyListenMode.REMOVALS == many.modifyListenMode();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,7 +120,7 @@ public final class SaveManyBeans extends SaveManyBase {
|
||||
if (!insertedParent && canSkipForOrderColumn() && saveRecurseSkippable) {
|
||||
return;
|
||||
}
|
||||
orderColumn = targetDescriptor.getOrderColumn();
|
||||
orderColumn = targetDescriptor.orderColumn();
|
||||
}
|
||||
|
||||
if (insertedParent) {
|
||||
@@ -132,7 +132,7 @@ public final class SaveManyBeans extends SaveManyBase {
|
||||
// collect the Id's (to exclude from deleteManyDetails)
|
||||
List<Object> detailIds = collectIds(collection, targetDescriptor, isMap);
|
||||
// deleting missing children - children not in our collected detailIds
|
||||
persister.deleteManyDetails(transaction, many.getBeanDescriptor(), parentBean, many, detailIds, deleteMode);
|
||||
persister.deleteManyDetails(transaction, many.descriptor(), parentBean, many, detailIds, deleteMode);
|
||||
}
|
||||
|
||||
transaction.depth(+1);
|
||||
@@ -189,7 +189,7 @@ public final class SaveManyBeans extends SaveManyBase {
|
||||
persister.saveRecurse(detail, transaction, parentBean, request.flags());
|
||||
if (many.hasOrderColumn()) {
|
||||
// Clear the bean from the PersistenceContext (L1 cache), because the order of referenced beans might have changed
|
||||
final BeanDescriptor<?> beanDescriptor = many.getBeanDescriptor();
|
||||
final BeanDescriptor<?> beanDescriptor = many.descriptor();
|
||||
beanDescriptor.contextClear(transaction.getPersistenceContext(), beanDescriptor.getId(parentBean));
|
||||
}
|
||||
}
|
||||
@@ -335,7 +335,7 @@ public final class SaveManyBeans extends SaveManyBase {
|
||||
}
|
||||
|
||||
private boolean isChangedProperty() {
|
||||
return parentBean._ebean_getIntercept().isChangedProperty(many.getPropertyIndex());
|
||||
return parentBean._ebean_getIntercept().isChangedProperty(many.propertyIndex());
|
||||
}
|
||||
|
||||
private void removeAssocManyOrphans() {
|
||||
@@ -351,7 +351,7 @@ public final class SaveManyBeans extends SaveManyBase {
|
||||
Set<?> modifyRemovals = c.getModifyRemovals();
|
||||
if (insertedParent) {
|
||||
// after insert set the modify listening mode for private owned etc
|
||||
c.setModifyListening(many.getModifyListenMode());
|
||||
c.setModifyListening(many.modifyListenMode());
|
||||
}
|
||||
// We must not reset when we still have to update other entities in the collection and set their new orderColumn value
|
||||
if (!many.hasOrderColumn()) {
|
||||
@@ -378,7 +378,7 @@ public final class SaveManyBeans extends SaveManyBase {
|
||||
BeanCollection.ModifyListenMode mode = manyValue.getModifyListening();
|
||||
if (mode == null) {
|
||||
// new collection persisted for the first time
|
||||
manyValue.setModifyListening(prop.getModifyListenMode());
|
||||
manyValue.setModifyListening(prop.modifyListenMode());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -27,7 +27,7 @@ final class DeleteMeta extends BaseMeta {
|
||||
this.sqlNone = genSql(ConcurrencyMode.NONE, tableName);
|
||||
this.sqlVersion = genSql(ConcurrencyMode.VERSION, tableName);
|
||||
if (desc.isDraftable()) {
|
||||
String draftTableName = desc.getDraftTable();
|
||||
String draftTableName = desc.draftTable();
|
||||
this.sqlDraftNone = genSql(ConcurrencyMode.NONE, draftTableName);
|
||||
this.sqlDraftVersion = genSql(ConcurrencyMode.VERSION, draftTableName);
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ final class GeneratedProperties {
|
||||
|
||||
SetValue(BeanProperty property) {
|
||||
this.property = property;
|
||||
this.generatedProperty = property.getGeneratedProperty();
|
||||
this.generatedProperty = property.generatedProperty();
|
||||
}
|
||||
|
||||
void preInsert(EntityBean bean, long now) {
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ final class GeneratedPropertyCollector {
|
||||
}
|
||||
|
||||
private void add(BeanProperty prop) {
|
||||
GeneratedProperty gen = prop.getGeneratedProperty();
|
||||
GeneratedProperty gen = prop.generatedProperty();
|
||||
if (gen != null) {
|
||||
if (gen.includeInInsert()) {
|
||||
preInsert.add(prop);
|
||||
|
||||
@@ -49,7 +49,7 @@ final class InsertMeta {
|
||||
this.shadowFKey = shadowFKey;
|
||||
|
||||
String tableName = desc.baseTable();
|
||||
String draftTableName = desc.getDraftTable();
|
||||
String draftTableName = desc.draftTable();
|
||||
this.sqlWithId = genSql(false, tableName, false);
|
||||
this.sqlDraftWithId = desc.isDraftable() ? genSql(false, draftTableName, true) : sqlWithId;
|
||||
|
||||
@@ -81,7 +81,7 @@ final class InsertMeta {
|
||||
}
|
||||
|
||||
private static Bindable getDiscriminator(BeanDescriptor<?> desc) {
|
||||
InheritInfo inheritInfo = desc.getInheritInfo();
|
||||
InheritInfo inheritInfo = desc.inheritInfo();
|
||||
return inheritInfo != null ? new BindableDiscriminator(inheritInfo) : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ final class MetaFactory {
|
||||
embeddedFact.create(setList, desc, DmlMode.UPDATE, includeLobs);
|
||||
assocOneFact.create(setList, desc, DmlMode.UPDATE);
|
||||
|
||||
BeanProperty orderColumn = desc.getOrderColumn();
|
||||
BeanProperty orderColumn = desc.orderColumn();
|
||||
if (orderColumn != null) {
|
||||
setList.add(new BindableOrderColumn(orderColumn));
|
||||
}
|
||||
@@ -89,7 +89,7 @@ final class MetaFactory {
|
||||
assocOneFact.create(allList, desc, DmlMode.INSERT);
|
||||
|
||||
BindableList allBindable = new BindableList(allList);
|
||||
BeanPropertyAssocOne<?> unidirectional = desc.getUnidirectional();
|
||||
BeanPropertyAssocOne<?> unidirectional = desc.unidirectional();
|
||||
Bindable shadowFkey;
|
||||
if (unidirectional == null) {
|
||||
shadowFkey = null;
|
||||
|
||||
@@ -52,7 +52,7 @@ final class UpdateMeta extends BaseMeta {
|
||||
String key = persistRequest.updatePlanHash();
|
||||
// check if we can use a cached UpdatePlan
|
||||
BeanDescriptor<?> beanDescriptor = persistRequest.descriptor();
|
||||
SpiUpdatePlan updatePlan = beanDescriptor.getUpdatePlan(key);
|
||||
SpiUpdatePlan updatePlan = beanDescriptor.updatePlan(key);
|
||||
if (updatePlan != null) {
|
||||
return updatePlan;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ final class UpdateMeta extends BaseMeta {
|
||||
|
||||
updatePlan = new UpdatePlan(key, mode, sql, bindableList);
|
||||
// add the UpdatePlan to the cache
|
||||
beanDescriptor.putUpdatePlan(key, updatePlan);
|
||||
beanDescriptor.updatePlan(key, updatePlan);
|
||||
return updatePlan;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ class BindableAssocOne implements Bindable {
|
||||
|
||||
BindableAssocOne(BeanPropertyAssocOne<?> assocOne) {
|
||||
this.assocOne = assocOne;
|
||||
this.importedId = assocOne.getImportedId();
|
||||
this.importedId = assocOne.importedId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -44,7 +44,7 @@ final class BindableEncryptedProperty implements Bindable {
|
||||
public void dmlAppend(GenerateDmlRequest request) {
|
||||
|
||||
// columnName = AES_ENCRYPT(?,?)
|
||||
request.appendColumn(prop.dbColumn(), prop.getDbBind());
|
||||
request.appendColumn(prop.dbColumn(), prop.dbBind());
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ final class BindableEncryptedProperty implements Bindable {
|
||||
}
|
||||
|
||||
// get Encrypt key
|
||||
String encryptKeyValue = prop.getEncryptKey().getStringValue();
|
||||
String encryptKeyValue = prop.encryptKey().getStringValue();
|
||||
|
||||
if (!bindEncryptDataFirst) {
|
||||
// H2 encrypt function ... different parameter order
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ final class BindableIdEmbedded implements BindableId {
|
||||
|
||||
BindableIdEmbedded(BeanPropertyAssocOne<?> embId, MatchedImportedProperty[] matches) {
|
||||
this.embId = embId;
|
||||
this.props = embId.getProperties();
|
||||
this.props = embId.properties();
|
||||
this.matches = matches;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ final class BindablePropertyJsonInsert extends BindableProperty {
|
||||
|
||||
BindablePropertyJsonInsert(BeanProperty prop) {
|
||||
super(prop);
|
||||
this.propertyIndex = prop.getPropertyIndex();
|
||||
this.propertyIndex = prop.propertyIndex();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ final class BindablePropertyJsonUpdate extends BindableProperty {
|
||||
|
||||
BindablePropertyJsonUpdate(BeanProperty prop) {
|
||||
super(prop);
|
||||
this.propertyIndex = prop.getPropertyIndex();
|
||||
this.propertyIndex = prop.propertyIndex();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ final class BindablePropertyVersion implements Bindable {
|
||||
public void dmlBind(BindableRequest request, EntityBean bean) throws SQLException {
|
||||
|
||||
// get prior version value from 'old values'
|
||||
Object value = bean._ebean_getIntercept().getOrigValue(prop.getPropertyIndex());
|
||||
Object value = bean._ebean_getIntercept().getOrigValue(prop.propertyIndex());
|
||||
request.bind(value, prop);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ public final class BindableUnidirectional implements Bindable {
|
||||
public BindableUnidirectional(BeanDescriptor<?> desc, BeanPropertyAssocOne<?> unidirectional) {
|
||||
this.desc = desc;
|
||||
this.unidirectional = unidirectional;
|
||||
this.importedId = unidirectional.getImportedId();
|
||||
this.importedId = unidirectional.importedId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,7 +57,7 @@ public final class BindableUnidirectional implements Bindable {
|
||||
Object parentBean = persistRequest.parentBean();
|
||||
if (parentBean == null) {
|
||||
Class<?> localType = desc.type();
|
||||
Class<?> targetType = unidirectional.getTargetType();
|
||||
Class<?> targetType = unidirectional.targetType();
|
||||
|
||||
String msg = "Error inserting bean [" + localType + "] with unidirectional relationship. ";
|
||||
msg += "For inserts you must use cascade save on the master bean [" + targetType + "].";
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ public final class FactoryEmbedded {
|
||||
*/
|
||||
public void create(List<Bindable> list, BeanDescriptor<?> desc, DmlMode mode, boolean withLobs) {
|
||||
for (BeanPropertyAssocOne<?> anEmbedded : desc.propertiesEmbedded()) {
|
||||
BeanProperty[] props = anEmbedded.getProperties();
|
||||
BeanProperty[] props = anEmbedded.properties();
|
||||
List<Bindable> bindList = new ArrayList<>(props.length);
|
||||
for (BeanProperty prop : props) {
|
||||
Bindable item = factoryProperty.create(prop, mode, withLobs, true);
|
||||
|
||||
@@ -21,7 +21,7 @@ public final class FactoryId {
|
||||
return new BindableIdScalar(id);
|
||||
} else {
|
||||
BeanPropertyAssocOne<?> embId = (BeanPropertyAssocOne<?>) id;
|
||||
MatchedImportedProperty[] matches = MatchedImportedFactory.build(embId.getProperties(), desc);
|
||||
MatchedImportedProperty[] matches = MatchedImportedFactory.build(embId.properties(), desc);
|
||||
return new BindableIdEmbedded(embId, matches);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -13,7 +13,7 @@ public final class FactoryVersion {
|
||||
* Create a Bindable for the version property(s) for a bean type.
|
||||
*/
|
||||
public Bindable create(BeanDescriptor<?> desc) {
|
||||
BeanProperty versionProperty = desc.getVersionProperty();
|
||||
BeanProperty versionProperty = desc.versionProperty();
|
||||
return (versionProperty == null) ? null : new BindablePropertyVersion(versionProperty);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public final class FactoryVersion {
|
||||
* Create a Bindable for the version property(s) for a bean type.
|
||||
*/
|
||||
public Bindable createForDelete(BeanDescriptor<?> desc) {
|
||||
BeanProperty versionProperty = desc.getVersionProperty();
|
||||
BeanProperty versionProperty = desc.versionProperty();
|
||||
return (versionProperty == null) ? null : new BindableProperty(versionProperty);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public final class FactoryVersion {
|
||||
* Create a Bindable for TenantId If multi-tenant with partitioning is on this bean type.
|
||||
*/
|
||||
public Bindable createTenantId(BeanDescriptor<?> desc) {
|
||||
BeanProperty tenant = desc.getTenantProperty();
|
||||
BeanProperty tenant = desc.tenantProperty();
|
||||
if (tenant == null) {
|
||||
return null;
|
||||
} else if (tenant instanceof BeanPropertyAssocOne) {
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ final class MatchedImportedFactory {
|
||||
for (BeanPropertyAssocOne<?> assocOne1 : desc.propertiesOne()) {
|
||||
if (assocOne1.isImportedPrimaryKey()) {
|
||||
// search using the ImportedId from the assoc one
|
||||
BeanProperty foreignMatch = assocOne1.getImportedId().findMatchImport(dbColumn);
|
||||
BeanProperty foreignMatch = assocOne1.importedId().findMatchImport(dbColumn);
|
||||
if (foreignMatch != null) {
|
||||
return new MatchedImportedEmbedded(prop, assocOne1, foreignMatch);
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
|
||||
if (lazyLoadParentId != null) {
|
||||
if (!lazyLoadParentId.equals(this.lazyLoadParentId)) {
|
||||
// get the appropriate parent bean from the persistence context
|
||||
this.lazyLoadParentBean = (EntityBean) lazyLoadManyProperty.getBeanDescriptor().contextGet(getPersistenceContext(), lazyLoadParentId);
|
||||
this.lazyLoadParentBean = (EntityBean) lazyLoadManyProperty.descriptor().contextGet(getPersistenceContext(), lazyLoadParentId);
|
||||
this.lazyLoadParentId = lazyLoadParentId;
|
||||
}
|
||||
// add the loadedBean to the appropriate collection of lazyLoadParentBean
|
||||
@@ -747,7 +747,7 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
|
||||
if (auditIds == null) {
|
||||
auditIds = new ArrayList<>(100);
|
||||
}
|
||||
auditIds.add(desc.getIdForJson(nextBean));
|
||||
auditIds.add(desc.idForJson(nextBean));
|
||||
if (auditFindIterate && auditIds.size() >= 100) {
|
||||
auditIterateLogMessage();
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ final class CQueryBuilder {
|
||||
}
|
||||
// wrap as - delete from table where id in (select id ...)
|
||||
String sql = buildSqlDelete(null, request, predicates, sqlTree).getSql();
|
||||
sql = request.descriptor().getDeleteByIdInSql() + "in (" + sql + ")";
|
||||
sql = request.descriptor().deleteByIdInSql() + "in (" + sql + ")";
|
||||
sql = aliasReplace(sql, alias);
|
||||
return sql;
|
||||
}
|
||||
@@ -157,7 +157,7 @@ final class CQueryBuilder {
|
||||
}
|
||||
// wrap as - update table set ... where id in (select id ...)
|
||||
String sql = buildSqlUpdate(null, request, predicates, sqlTree).getSql();
|
||||
sql = updateClause + " " + request.descriptor().getWhereIdInSql() + "in (" + sql + ")";
|
||||
sql = updateClause + " " + request.descriptor().whereIdInSql() + "in (" + sql + ")";
|
||||
sql = aliasReplace(sql, alias(rootTableAlias));
|
||||
return sql;
|
||||
}
|
||||
@@ -182,7 +182,7 @@ final class CQueryBuilder {
|
||||
if (!query.isIncludeSoftDeletes()) {
|
||||
BeanDescriptor<?> desc = request.descriptor();
|
||||
if (desc.isSoftDelete()) {
|
||||
query.addSoftDeletePredicate(desc.getSoftDeletePredicate(alias(query.getAlias())));
|
||||
query.addSoftDeletePredicate(desc.softDeletePredicate(alias(query.getAlias())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ final class CQueryBuilder {
|
||||
query.setSelectId();
|
||||
BeanDescriptor<T> desc = request.descriptor();
|
||||
if (!query.isIncludeSoftDeletes() && desc.isSoftDelete()) {
|
||||
query.addSoftDeletePredicate(desc.getSoftDeletePredicate(alias(query.getAlias())));
|
||||
query.addSoftDeletePredicate(desc.softDeletePredicate(alias(query.getAlias())));
|
||||
}
|
||||
return buildFetchAttributeQuery(request);
|
||||
}
|
||||
@@ -361,7 +361,7 @@ final class CQueryBuilder {
|
||||
BeanDescriptor<T> desc = request.descriptor();
|
||||
if (desc.isReadAuditing()) {
|
||||
// log the query plan based bean type (i.e. ignoring query disabling for logging the sql/plan)
|
||||
desc.getReadAuditLogger().queryPlan(new ReadAuditQueryPlan(desc.fullName(), queryPlan.getAuditQueryKey(), queryPlan.getSql()));
|
||||
desc.readAuditLogger().queryPlan(new ReadAuditQueryPlan(desc.fullName(), queryPlan.getAuditQueryKey(), queryPlan.getSql()));
|
||||
}
|
||||
// cache the query plan because we can reuse it and also
|
||||
// gather query performance statistics based on it.
|
||||
@@ -455,11 +455,11 @@ final class CQueryBuilder {
|
||||
SpiRawSql.ColumnMapping.Column column = it.next();
|
||||
String propertyName = column.getPropertyName();
|
||||
if (!SpiRawSql.IGNORE_COLUMN.equals(propertyName)) {
|
||||
ElPropertyValue el = descriptor.getElGetValue(propertyName);
|
||||
ElPropertyValue el = descriptor.elGetValue(propertyName);
|
||||
if (el == null && propertyName.endsWith("Id")) {
|
||||
// try default naming convention for foreign key columns
|
||||
String foreignIdPath = assocOneIdPath(propertyName);
|
||||
el = descriptor.getElGetValue(foreignIdPath);
|
||||
el = descriptor.elGetValue(foreignIdPath);
|
||||
if (el != null) {
|
||||
propertyName = foreignIdPath;
|
||||
}
|
||||
@@ -661,7 +661,7 @@ final class CQueryBuilder {
|
||||
appendAndOrWhere();
|
||||
|
||||
BeanDescriptor<?> desc = request.descriptor();
|
||||
String idSql = desc.getIdBinderIdSql(query.getAlias());
|
||||
String idSql = desc.idBinderIdSql(query.getAlias());
|
||||
if (idSql.isEmpty()) {
|
||||
throw new IllegalStateException("Executing FindById query on entity bean " + desc.name()
|
||||
+ " that doesn't have an @Id property??");
|
||||
|
||||
@@ -85,7 +85,7 @@ final class CQueryBuilderRawSql {
|
||||
BeanDescriptor<?> descriptor = request.descriptor();
|
||||
//FIXME: I think this is broken... needs to be logical
|
||||
// and then parsed for RawSqlSelect...
|
||||
dynamicWhere = descriptor.getIdBinderIdSql(null);
|
||||
dynamicWhere = descriptor.idBinderIdSql(null);
|
||||
}
|
||||
|
||||
String dbWhere = predicates.getDbWhere();
|
||||
|
||||
@@ -54,7 +54,7 @@ final class CQueryOrderBy {
|
||||
private String parseProperty(Property p) {
|
||||
|
||||
String propName = p.getProperty();
|
||||
ElPropertyValue el = desc.getElGetValue(propName);
|
||||
ElPropertyValue el = desc.elGetValue(propName);
|
||||
if (el == null) {
|
||||
return p.toStringFormat();
|
||||
}
|
||||
@@ -62,7 +62,7 @@ final class CQueryOrderBy {
|
||||
BeanProperty beanProperty = el.beanProperty();
|
||||
if (beanProperty instanceof BeanPropertyAssoc<?>) {
|
||||
BeanPropertyAssoc<?> ap = (BeanPropertyAssoc<?>) beanProperty;
|
||||
IdBinder idBinder = ap.getTargetDescriptor().getIdBinder();
|
||||
IdBinder idBinder = ap.targetDescriptor().idBinder();
|
||||
return idBinder.getOrderBy(el.elName(), p.isAscending());
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ public class CQueryPlan implements SpiQueryPlan {
|
||||
this.profileLocation = query.getProfileLocation();
|
||||
this.location = (profileLocation == null) ? null : profileLocation.location();
|
||||
this.label = query.getPlanLabel();
|
||||
this.name = deriveName(label, query.getType(), request.descriptor().getSimpleName());
|
||||
this.name = deriveName(label, query.getType(), request.descriptor().simpleName());
|
||||
this.asOfTableCount = query.getAsOfTableCount();
|
||||
this.sql = sqlRes.getSql();
|
||||
this.sqlTree = sqlTree;
|
||||
@@ -117,7 +117,7 @@ public class CQueryPlan implements SpiQueryPlan {
|
||||
this.profileLocation = query.getProfileLocation();
|
||||
this.location = (profileLocation == null) ? null : profileLocation.location();
|
||||
this.label = query.getPlanLabel();
|
||||
this.name = deriveName(label, query.getType(), request.descriptor().getSimpleName());
|
||||
this.name = deriveName(label, query.getType(), request.descriptor().simpleName());
|
||||
this.planKey = buildPlanKey(sql, logWhereSql);
|
||||
this.asOfTableCount = 0;
|
||||
this.sql = sql;
|
||||
|
||||
@@ -328,14 +328,14 @@ public final class CQueryPredicates {
|
||||
String orderBy = parseOrderBy();
|
||||
|
||||
BeanDescriptor<?> desc = request.descriptor();
|
||||
String orderById = desc.getDefaultOrderBy();
|
||||
String orderById = desc.defaultOrderBy();
|
||||
|
||||
if (orderBy == null) {
|
||||
orderBy = orderById;
|
||||
}
|
||||
|
||||
// check for default ordering on the many property...
|
||||
String manyOrderBy = manyProp.getFetchOrderBy();
|
||||
String manyOrderBy = manyProp.fetchOrderBy();
|
||||
if (manyOrderBy != null) {
|
||||
orderBy = orderBy + ", " + CQueryBuilder.prefixOrderByFields(manyProp.name(), manyOrderBy);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ public interface STreePropertyAssoc extends STreeProperty {
|
||||
/**
|
||||
* Return the extra where clause if set.
|
||||
*/
|
||||
String getExtraWhere();
|
||||
String extraWhere();
|
||||
|
||||
/**
|
||||
* Return the type of the target (other side).
|
||||
@@ -19,7 +19,7 @@ public interface STreePropertyAssoc extends STreeProperty {
|
||||
/**
|
||||
* Return the IdBinder of the underlying type.
|
||||
*/
|
||||
IdBinder getIdBinder();
|
||||
IdBinder idBinder();
|
||||
|
||||
/**
|
||||
* Add a Join with the given alias.
|
||||
@@ -44,5 +44,5 @@ public interface STreePropertyAssoc extends STreeProperty {
|
||||
/**
|
||||
* Return the soft delete predicate.
|
||||
*/
|
||||
String getSoftDeletePredicate(String tableAlias);
|
||||
String softDeletePredicate(String tableAlias);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public interface STreePropertyAssocMany extends STreePropertyAssoc {
|
||||
/**
|
||||
* Return the intersection table join.
|
||||
*/
|
||||
TableJoin getIntersectionTableJoin();
|
||||
TableJoin intersectionTableJoin();
|
||||
|
||||
/**
|
||||
* Add a bean to the collection.
|
||||
|
||||
@@ -13,7 +13,7 @@ public interface STreePropertyAssocOne extends STreePropertyAssoc {
|
||||
/**
|
||||
* Return the scalar type of the associated id property.
|
||||
*/
|
||||
ScalarDataReader<?> getIdReader();
|
||||
ScalarDataReader<?> idReader();
|
||||
|
||||
/**
|
||||
* Returns true, if this relation has a foreign key.
|
||||
|
||||
@@ -40,7 +40,7 @@ public interface STreeType {
|
||||
/**
|
||||
* Return the soft delete predicate using the given table alias.
|
||||
*/
|
||||
String getSoftDeletePredicate(String baseTableAlias);
|
||||
String softDeletePredicate(String baseTableAlias);
|
||||
|
||||
/**
|
||||
* Return the scalar properties.
|
||||
@@ -65,12 +65,12 @@ public interface STreeType {
|
||||
/**
|
||||
* Return the inheritance information for this type.
|
||||
*/
|
||||
InheritInfo getInheritInfo();
|
||||
InheritInfo inheritInfo();
|
||||
|
||||
/**
|
||||
* Return the IdBinder for this type.
|
||||
*/
|
||||
IdBinder getIdBinder();
|
||||
IdBinder idBinder();
|
||||
|
||||
/**
|
||||
* Create a new entity bean instance.
|
||||
@@ -95,7 +95,7 @@ public interface STreeType {
|
||||
/**
|
||||
* Return the base table to use given the temporalMode.
|
||||
*/
|
||||
String getBaseTable(SpiQuery.TemporalMode temporalMode);
|
||||
String baseTable(SpiQuery.TemporalMode temporalMode);
|
||||
|
||||
/**
|
||||
* Return true if the given path is an embedded bean.
|
||||
|
||||
@@ -50,7 +50,7 @@ public final class SqlBeanLoad {
|
||||
return null;
|
||||
}
|
||||
if ((bean == null)
|
||||
|| (lazyLoading && ebi.isLoadedProperty(prop.getPropertyIndex()))
|
||||
|| (lazyLoading && ebi.isLoadedProperty(prop.propertyIndex()))
|
||||
|| (type != null && !prop.isAssignableFrom(type))) {
|
||||
// ignore this property
|
||||
// ... null: bean already in persistence context
|
||||
@@ -62,7 +62,7 @@ public final class SqlBeanLoad {
|
||||
try {
|
||||
return prop.readSet(ctx, bean);
|
||||
} catch (Exception e) {
|
||||
bean._ebean_getIntercept().setLoadError(prop.getPropertyIndex(), e);
|
||||
bean._ebean_getIntercept().setLoadError(prop.propertyIndex(), e);
|
||||
ctx.handleLoadError(prop.fullName(), e);
|
||||
return prop.getValue(bean);
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ public final class SqlTreeBuilder {
|
||||
|
||||
String baseTable = (query == null) ? null : query.getBaseTable();
|
||||
if (baseTable == null) {
|
||||
baseTable = desc.getBaseTable(temporalMode);
|
||||
baseTable = desc.baseTable(temporalMode);
|
||||
}
|
||||
return new SqlTreeNodeRoot(desc, props, myList, withId, includeJoin, lazyLoadMany, temporalMode, disableLazyLoad, sqlDistinct, baseTable);
|
||||
|
||||
@@ -507,7 +507,7 @@ public final class SqlTreeBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
InheritInfo inheritInfo = desc.getInheritInfo();
|
||||
InheritInfo inheritInfo = desc.inheritInfo();
|
||||
if (inheritInfo != null) {
|
||||
// add sub type properties
|
||||
inheritInfo.addChildrenProperties(selectProps);
|
||||
|
||||
@@ -87,15 +87,15 @@ class SqlTreeNodeBean implements SqlTreeNode {
|
||||
List<SqlTreeNode> myChildren, boolean withId, STreePropertyAssocMany lazyLoadParent,
|
||||
SpiQuery.TemporalMode temporalMode, boolean disableLazyLoad) {
|
||||
this.lazyLoadParent = lazyLoadParent;
|
||||
this.lazyLoadParentIdBinder = (lazyLoadParent == null) ? null : lazyLoadParent.getIdBinder();
|
||||
this.lazyLoadParentIdBinder = (lazyLoadParent == null) ? null : lazyLoadParent.idBinder();
|
||||
this.prefix = prefix;
|
||||
this.desc = desc;
|
||||
this.inheritInfo = desc.getInheritInfo();
|
||||
this.idBinder = desc.getIdBinder();
|
||||
this.inheritInfo = desc.inheritInfo();
|
||||
this.idBinder = desc.idBinder();
|
||||
this.temporalMode = temporalMode;
|
||||
this.temporalVersions = temporalMode == SpiQuery.TemporalMode.VERSIONS;
|
||||
this.nodeBeanProp = beanProp;
|
||||
this.extraWhere = (beanProp == null) ? null : beanProp.getExtraWhere();
|
||||
this.extraWhere = (beanProp == null) ? null : beanProp.extraWhere();
|
||||
this.aggregation = props.isAggregation();
|
||||
boolean aggregationRoot = props.isAggregationRoot();
|
||||
// the bean has an Id property and we want to use it
|
||||
@@ -123,14 +123,14 @@ class SqlTreeNodeBean implements SqlTreeNode {
|
||||
// if we have no property ask first children (in a distinct select with join)
|
||||
if (children.length == 0) {
|
||||
// expected to be a findIds query
|
||||
return desc.getIdBinder().getBeanProperty();
|
||||
return desc.idBinder().getBeanProperty();
|
||||
}
|
||||
return children[0].getSingleAttributeReader();
|
||||
}
|
||||
if (properties[0] instanceof STreePropertyAssocOne) {
|
||||
STreePropertyAssocOne assocOne = (STreePropertyAssocOne)properties[0];
|
||||
if (assocOne.isAssocId()) {
|
||||
return assocOne.getIdReader();
|
||||
return assocOne.idReader();
|
||||
}
|
||||
}
|
||||
return properties[0];
|
||||
@@ -184,7 +184,7 @@ class SqlTreeNodeBean implements SqlTreeNode {
|
||||
|
||||
@Override
|
||||
void initBeanType() throws SQLException {
|
||||
InheritInfo localInfo = readId ? inheritInfo.readType(ctx) : desc.getInheritInfo();
|
||||
InheritInfo localInfo = readId ? inheritInfo.readType(ctx) : desc.inheritInfo();
|
||||
if (localInfo == null) {
|
||||
// the bean must be null
|
||||
localIdBinder = idBinder;
|
||||
@@ -602,7 +602,7 @@ class SqlTreeNodeBean implements SqlTreeNode {
|
||||
@Override
|
||||
public final void addSoftDeletePredicate(SpiQuery<?> query) {
|
||||
if (desc.isSoftDelete()) {
|
||||
query.addSoftDeletePredicate(desc.getSoftDeletePredicate(baseTableAlias));
|
||||
query.addSoftDeletePredicate(desc.softDeletePredicate(baseTableAlias));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -626,7 +626,7 @@ class SqlTreeNodeBean implements SqlTreeNode {
|
||||
|
||||
@Override
|
||||
public void dependentTables(Set<String> tables) {
|
||||
tables.add(nodeBeanProp.target().getBaseTable(temporalMode));
|
||||
tables.add(nodeBeanProp.target().baseTable(temporalMode));
|
||||
for (SqlTreeNode child : children) {
|
||||
child.dependentTables(tables);
|
||||
}
|
||||
@@ -642,7 +642,7 @@ class SqlTreeNodeBean implements SqlTreeNode {
|
||||
appendJoinDiscriminator(ctx);
|
||||
}
|
||||
if (desc.isSoftDelete() && temporalMode != SpiQuery.TemporalMode.SOFT_DELETED) {
|
||||
ctx.append(" and ").append(desc.getSoftDeletePredicate(ctx.getTableAlias(prefix)));
|
||||
ctx.append(" and ").append(desc.softDeletePredicate(ctx.getTableAlias(prefix)));
|
||||
}
|
||||
return sqlJoinType;
|
||||
}
|
||||
@@ -658,7 +658,7 @@ class SqlTreeNodeBean implements SqlTreeNode {
|
||||
String alias2 = alias + "z_";
|
||||
|
||||
// adding the additional join to the intersection table
|
||||
TableJoin manyToManyJoin = manyProp.getIntersectionTableJoin();
|
||||
TableJoin manyToManyJoin = manyProp.intersectionTableJoin();
|
||||
manyToManyJoin.addJoin(joinType, parentAlias, alias2, ctx);
|
||||
if (!manyProp.isExcludedFromHistory()) {
|
||||
intersectionAsOfTableAlias = true;
|
||||
|
||||
@@ -101,7 +101,7 @@ final class SqlTreeNodeExtraJoin implements SqlTreeNode {
|
||||
|
||||
@Override
|
||||
public void dependentTables(Set<String> tables) {
|
||||
tables.add(assocBeanProperty.target().getBaseTable(SpiQuery.TemporalMode.CURRENT));
|
||||
tables.add(assocBeanProperty.target().baseTable(SpiQuery.TemporalMode.CURRENT));
|
||||
if (children != null) {
|
||||
for (SqlTreeNode child : children) {
|
||||
child.dependentTables(tables);
|
||||
@@ -123,7 +123,7 @@ final class SqlTreeNodeExtraJoin implements SqlTreeNode {
|
||||
String parentAlias = ctx.getTableAlias(split[0]);
|
||||
String alias2 = alias + "z_";
|
||||
|
||||
TableJoin manyToManyJoin = manyProp.getIntersectionTableJoin();
|
||||
TableJoin manyToManyJoin = manyProp.intersectionTableJoin();
|
||||
manyToManyJoin.addJoin(joinType, parentAlias, alias2, ctx);
|
||||
|
||||
assocBeanProperty.addJoin(joinType, alias2, alias, ctx);
|
||||
@@ -149,7 +149,7 @@ final class SqlTreeNodeExtraJoin implements SqlTreeNode {
|
||||
}
|
||||
joinType = assocBeanProperty.addJoin(joinType, prefix, ctx);
|
||||
if (!oneToOneExported && assocBeanProperty.isTargetSoftDelete() && temporalMode != SpiQuery.TemporalMode.SOFT_DELETED) {
|
||||
ctx.append(" and ").append(assocBeanProperty.getSoftDeletePredicate(ctx.getTableAlias(prefix)));
|
||||
ctx.append(" and ").append(assocBeanProperty.softDeletePredicate(ctx.getTableAlias(prefix)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -94,18 +94,18 @@ final class SqlTreeNodeManyWhereJoin implements SqlTreeNode {
|
||||
if (nodeBeanProp instanceof STreePropertyAssocOne) {
|
||||
nodeBeanProp.addJoin(joinType, parentAlias, alias, ctx);
|
||||
if (softDelete) {
|
||||
ctx.append(" and ").append(target.getSoftDeletePredicate(alias));
|
||||
ctx.append(" and ").append(target.softDeletePredicate(alias));
|
||||
}
|
||||
} else {
|
||||
STreePropertyAssocMany manyProp = (STreePropertyAssocMany) nodeBeanProp;
|
||||
if (!manyProp.hasJoinTable()) {
|
||||
manyProp.addJoin(joinType, parentAlias, alias, ctx);
|
||||
if (softDelete) {
|
||||
ctx.append(" and ").append(target.getSoftDeletePredicate(alias));
|
||||
ctx.append(" and ").append(target.softDeletePredicate(alias));
|
||||
}
|
||||
} else {
|
||||
String alias2 = alias + "z_";
|
||||
TableJoin manyToManyJoin = manyProp.getIntersectionTableJoin();
|
||||
TableJoin manyToManyJoin = manyProp.intersectionTableJoin();
|
||||
manyToManyJoin.addJoin(joinType, parentAlias, alias2, ctx);
|
||||
manyProp.addJoin(joinType, alias2, alias, ctx);
|
||||
}
|
||||
@@ -114,7 +114,7 @@ final class SqlTreeNodeManyWhereJoin implements SqlTreeNode {
|
||||
|
||||
@Override
|
||||
public void dependentTables(Set<String> tables) {
|
||||
tables.add(nodeBeanProp.target().getBaseTable(SpiQuery.TemporalMode.CURRENT));
|
||||
tables.add(nodeBeanProp.target().baseTable(SpiQuery.TemporalMode.CURRENT));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -201,7 +201,7 @@ public final class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<
|
||||
@Override
|
||||
public boolean isFindById() {
|
||||
if (id == null && whereExpressions != null) {
|
||||
id = whereExpressions.idEqualTo(beanDescriptor.getIdName());
|
||||
id = whereExpressions.idEqualTo(beanDescriptor.idName());
|
||||
if (id != null) {
|
||||
whereExpressions = null;
|
||||
}
|
||||
@@ -414,7 +414,7 @@ public final class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<
|
||||
}
|
||||
if (orderBy != null) {
|
||||
for (Property orderProperty : orderBy.getProperties()) {
|
||||
ElPropertyDeploy elProp = beanDescriptor.getElPropertyDeploy(orderProperty.getProperty());
|
||||
ElPropertyDeploy elProp = beanDescriptor.elPropertyDeploy(orderProperty.getProperty());
|
||||
if (elProp != null && elProp.containsFormulaWithJoin()) {
|
||||
manyWhereJoins.addFormulaWithJoin(orderProperty.getProperty());
|
||||
}
|
||||
@@ -588,7 +588,7 @@ public final class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<
|
||||
public void setSelectId() {
|
||||
// clear select and fetch joins..
|
||||
detail.clear();
|
||||
select(beanDescriptor.getIdBinder().getIdProperty());
|
||||
select(beanDescriptor.idBinder().getIdProperty());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -641,7 +641,7 @@ public final class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<
|
||||
if (whereExpressions == null) {
|
||||
return null;
|
||||
}
|
||||
BeanNaturalKey naturalKey = beanDescriptor.getNaturalKey();
|
||||
BeanNaturalKey naturalKey = beanDescriptor.naturalKey();
|
||||
if (naturalKey == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -838,7 +838,7 @@ public final class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<
|
||||
@Override
|
||||
public void setDefaultRawSqlIfRequired() {
|
||||
if (beanDescriptor.isRawSqlBased() && rawSql == null) {
|
||||
rawSql = beanDescriptor.getNamedRawSql(DEFAULT_QUERY_NAME);
|
||||
rawSql = beanDescriptor.namedRawSql(DEFAULT_QUERY_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1014,8 +1014,8 @@ public final class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<
|
||||
if (useDocStore) {
|
||||
sb.append("/ds");
|
||||
}
|
||||
if (beanDescriptor.getDiscValue() != null) {
|
||||
sb.append("/dv").append(beanDescriptor.getDiscValue());
|
||||
if (beanDescriptor.discValue() != null) {
|
||||
sb.append("/dv").append(beanDescriptor.discValue());
|
||||
}
|
||||
if (temporalMode != SpiQuery.TemporalMode.CURRENT) {
|
||||
sb.append("/tm").append(temporalMode.ordinal());
|
||||
@@ -1697,12 +1697,12 @@ public final class DefaultOrmQuery<T> extends AbstractQuery implements SpiQuery<
|
||||
if (type == beanType) {
|
||||
return this;
|
||||
}
|
||||
InheritInfo inheritInfo = rootBeanDescriptor.getInheritInfo();
|
||||
InheritInfo inheritInfo = rootBeanDescriptor.inheritInfo();
|
||||
inheritInfo = inheritInfo == null ? null : inheritInfo.readType(type);
|
||||
if (inheritInfo == null) {
|
||||
throw new IllegalArgumentException("Given type " + type + " is not a subtype of " + beanType);
|
||||
}
|
||||
beanDescriptor = (BeanDescriptor<T>) rootBeanDescriptor.getBeanDescriptor(type);
|
||||
beanDescriptor = (BeanDescriptor<T>) rootBeanDescriptor.descriptor(type);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public final class DefaultUpdateQuery<T> implements UpdateQuery<T> {
|
||||
if (value == null) {
|
||||
values.setNull(property);
|
||||
} else {
|
||||
final BeanProperty beanProperty = descriptor.getBeanProperty(property);
|
||||
final BeanProperty beanProperty = descriptor.beanProperty(property);
|
||||
final ScalarType<Object> scalarType = (beanProperty == null) ? null: beanProperty.scalarType();
|
||||
values.set(property, value, scalarType);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user