#2359 - Rename internal methods - BeanDescriptorManager

This commit is contained in:
rbygrave committed 2021-09-08 15:34:23 +12:00
1 parent 93ff2ef2e4
commit cee879d2f3
15 files changed
+89 -125

No files matched your search

@@ -8,6 +8,6 @@ public interface SpiBeanTypeManager {
/**
* Return the bean type for the given entity class.
*/
SpiBeanType getBeanType(Class<?> entityType);
SpiBeanType beanType(Class<?> entityType);
}
@@ -1391,7 +1391,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
// FutureList query always run in it's own persistence content
spiQuery.setPersistenceContext(new DefaultPersistenceContext());
if (!spiQuery.isDisableReadAudit()) {
BeanDescriptor<T> desc = beanDescriptorManager.getBeanDescriptor(spiQuery.getBeanType());
BeanDescriptor<T> desc = beanDescriptorManager.descriptor(spiQuery.getBeanType());
desc.readAuditFutureList(spiQuery);
}
// Create a new transaction solely to execute the findList() at some future time
@@ -2049,7 +2049,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
*/
@Override
public List<BeanDescriptor<?>> descriptors() {
return beanDescriptorManager.getBeanDescriptorList();
return beanDescriptorManager.descriptorList();
}
/**
@@ -2061,13 +2061,13 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
public void register(BeanPersistController controller) {
for (BeanDescriptor<?> desc : beanDescriptorManager.getBeanDescriptorList()) {
for (BeanDescriptor<?> desc : beanDescriptorManager.descriptorList()) {
desc.register(controller);
}
}
public void deregister(BeanPersistController c) {
for (BeanDescriptor<?> desc : beanDescriptorManager.getBeanDescriptorList()) {
for (BeanDescriptor<?> desc : beanDescriptorManager.descriptorList()) {
desc.deregister(c);
}
}
@@ -2103,7 +2103,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
*/
@Override
public <T> BeanDescriptor<T> descriptor(Class<T> beanClass) {
return beanDescriptorManager.getBeanDescriptor(beanClass);
return beanDescriptorManager.descriptor(beanClass);
}
/**
@@ -2111,7 +2111,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
*/
@Override
public List<BeanDescriptor<?>> descriptors(String tableName) {
return beanDescriptorManager.getBeanDescriptors(tableName);
return beanDescriptorManager.descriptors(tableName);
}
/**
@@ -2127,7 +2127,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
*/
@Override
public List<? extends BeanType<?>> beanTypes(String tableName) {
return beanDescriptorManager.getBeanTypes(tableName);
return beanDescriptorManager.beanTypes(tableName);
}
@Override
@@ -2137,7 +2137,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
@Override
public BeanDescriptor<?> descriptorByQueueId(String queueId) {
return beanDescriptorManager.getBeanDescriptorByQueueId(queueId);
return beanDescriptorManager.descriptorByQueueId(queueId);
}
/**
@@ -2153,7 +2153,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
*/
@Override
public BeanDescriptor<?> descriptorById(String beanClassName) {
return beanDescriptorManager.getBeanDescriptorByClassName(beanClassName);
return beanDescriptorManager.descriptorByClassName(beanClassName);
}
/**
@@ -175,7 +175,7 @@ public final class InternalConfiguration {
this.dtoBeanManager = new DtoBeanManager(typeManager, xmlMap.readDtoMapping());
this.beanDescriptorManager = new BeanDescriptorManager(this);
Map<String, String> asOfTableMapping = beanDescriptorManager.deploy(xmlMap.xmlDeployment());
Map<String, String> draftTableMap = beanDescriptorManager.getDraftTableMap();
Map<String, String> draftTableMap = beanDescriptorManager.draftTableMap();
beanDescriptorManager.scheduleBackgroundTrim();
this.dataTimeZone = initDataTimeZone();
this.binder = getBinder(typeManager, databasePlatform, dataTimeZone);
@@ -352,7 +352,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
this.idOnlyReference = isIdOnlyReference(propertiesBaseScalar);
boolean noRelationships = propertiesOne.length + propertiesMany.length == 0;
this.cacheSharableBeans = noRelationships && deploy.getCacheOptions().isReadOnly();
this.cacheHelp = new BeanDescriptorCacheHelp<>(this, owner.getCacheManager(), deploy.getCacheOptions(), cacheSharableBeans, propertiesOneImported);
this.cacheHelp = new BeanDescriptorCacheHelp<>(this, owner.cacheManager(), deploy.getCacheOptions(), cacheSharableBeans, propertiesOneImported);
this.jsonHelp = initJsonHelp();
this.draftHelp = new BeanDescriptorDraftHelp<>(this);
this.docStoreAdapter = owner.createDocStoreBeanAdapter(this, deploy);
@@ -453,7 +453,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
* Return the DatabaseConfig.
*/
public DatabaseConfig config() {
return owner.getConfig();
return owner.config();
}
/**
@@ -935,25 +935,25 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
* Return the Encrypt key given the BeanProperty.
*/
public EncryptKey encryptKey(BeanProperty p) {
return owner.getEncryptKey(baseTable, p.dbColumn());
return owner.encryptKey(baseTable, p.dbColumn());
}
/**
* Return the Encrypt key given the table and column name.
*/
public EncryptKey encryptKey(String tableName, String columnName) {
return owner.getEncryptKey(tableName, columnName);
return owner.encryptKey(tableName, columnName);
}
/**
* Return the Scalar type for the given JDBC type.
*/
public ScalarType<?> scalarType(int jdbcType) {
return owner.getScalarType(jdbcType);
return owner.scalarType(jdbcType);
}
public ScalarType<?> scalarType(String cast) {
return owner.getScalarType(cast);
return owner.scalarType(cast);
}
/**
@@ -1940,7 +1940,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
* Return the BeanDescriptor of another bean type.
*/
public <U> BeanDescriptor<U> descriptor(Class<U> otherType) {
return owner.getBeanDescriptor(otherType);
return owner.descriptor(otherType);
}
/**
@@ -136,8 +136,8 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
this.multiValueBind = config.getMultiValueBind();
this.idBinderFactory = new IdBinderFactory(databasePlatform.isIdInExpandedForm(), multiValueBind);
this.queryPlanTTLSeconds = this.config.getQueryPlanTTLSeconds();
this.asOfViewSuffix = getAsOfViewSuffix(databasePlatform, this.config);
String versionsBetweenSuffix = getVersionsBetweenSuffix(databasePlatform, this.config);
this.asOfViewSuffix = asOfViewSuffix(databasePlatform, this.config);
String versionsBetweenSuffix = versionsBetweenSuffix(databasePlatform, this.config);
this.readAnnotations = new ReadAnnotations(config.getGeneratedPropertyFactory(), asOfViewSuffix, versionsBetweenSuffix, this.config);
this.bootupClasses = config.getBootupClasses();
this.createProperties = config.getDeployCreateProperties();
@@ -183,19 +183,19 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
}
@Override
public ScalarType<?> getScalarType(String cast) {
public ScalarType<?> scalarType(String cast) {
return typeManager.getScalarType(cast);
}
@Override
public ScalarType<?> getScalarType(int jdbcType) {
public ScalarType<?> scalarType(int jdbcType) {
return typeManager.getScalarType(jdbcType);
}
/**
* Return the AsOfViewSuffix based on the DbHistorySupport.
*/
private String getAsOfViewSuffix(DatabasePlatform databasePlatform, DatabaseConfig serverConfig) {
private String asOfViewSuffix(DatabasePlatform databasePlatform, DatabaseConfig serverConfig) {
DbHistorySupport historySupport = databasePlatform.getHistorySupport();
// with historySupport returns a simple view suffix or the sql2011 as of timestamp suffix
return (historySupport == null) ? serverConfig.getAsOfViewSuffix() : historySupport.getAsOfViewSuffix(serverConfig.getAsOfViewSuffix());
@@ -204,7 +204,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
/**
* Return the versions between timestamp suffix based on the DbHistorySupport.
*/
private String getVersionsBetweenSuffix(DatabasePlatform databasePlatform, DatabaseConfig serverConfig) {
private String versionsBetweenSuffix(DatabasePlatform databasePlatform, DatabaseConfig serverConfig) {
DbHistorySupport historySupport = databasePlatform.getHistorySupport();
// with historySupport returns a simple view suffix or the sql2011 versions between timestamp suffix
return (historySupport == null) ? serverConfig.getAsOfViewSuffix() : historySupport.getVersionsBetweenSuffix(serverConfig.getAsOfViewSuffix());
@@ -216,7 +216,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
}
@Override
public DatabaseConfig getConfig() {
public DatabaseConfig config() {
return config;
}
@@ -225,38 +225,38 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
return docStoreFactory.createAdapter(descriptor, deploy);
}
public BeanDescriptor<?> getBeanDescriptorByQueueId(String queueId) {
public BeanDescriptor<?> descriptorByQueueId(String queueId) {
return descQueueMap.get(queueId);
}
@Override
public SpiBeanType getBeanType(Class<?> entityType) {
return getBeanDescriptor(entityType);
public SpiBeanType beanType(Class<?> entityType) {
return descriptor(entityType);
}
@Override
@SuppressWarnings("unchecked")
public <T> BeanDescriptor<T> getBeanDescriptor(Class<T> entityType) {
public <T> BeanDescriptor<T> descriptor(Class<T> entityType) {
return (BeanDescriptor<T>) descMap.get(entityType.getName());
}
@SuppressWarnings("unchecked")
public <T> BeanDescriptor<T> getBeanDescriptorByClassName(String entityClassName) {
public <T> BeanDescriptor<T> descriptorByClassName(String entityClassName) {
return (BeanDescriptor<T>) descMap.get(entityClassName);
}
@Override
public String getServerName() {
public String name() {
return serverName;
}
@Override
public SpiCacheManager getCacheManager() {
public SpiCacheManager cacheManager() {
return cacheManager;
}
@Override
public NamingConvention getNamingConvention() {
public NamingConvention namingConvention() {
return namingConvention;
}
@@ -277,7 +277,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
/**
* Return the map of base tables to draft tables.
*/
public Map<String, String> getDraftTableMap() {
public Map<String, String> draftTableMap() {
return draftTableMap;
}
@@ -369,7 +369,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
* Return the Encrypt key given the table and column name.
*/
@Override
public EncryptKey getEncryptKey(String tableName, String columnName) {
public EncryptKey encryptKey(String tableName, String columnName) {
return encryptKeyManager.getEncryptKey(tableName, columnName);
}
@@ -397,14 +397,14 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
/**
* Return the BeanDescriptors mapped to the table.
*/
public List<BeanDescriptor<?>> getBeanDescriptors(String tableName) {
public List<BeanDescriptor<?>> descriptors(String tableName) {
return tableToDescMap.get(tableName.toLowerCase());
}
/**
* Return the BeanDescriptors mapped to the table.
*/
public List<? extends BeanType<?>> getBeanTypes(String tableName) {
public List<? extends BeanType<?>> beanTypes(String tableName) {
return tableToDescMap.get(tableName.toLowerCase());
}
@@ -546,11 +546,11 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
/**
* Return an immutable list of all the BeanDescriptors.
*/
public List<BeanDescriptor<?>> getBeanDescriptorList() {
public List<BeanDescriptor<?>> descriptorList() {
return immutableDescriptorList;
}
public BeanTable getBeanTable(Class<?> type) {
public BeanTable beanTable(Class<?> type) {
return beanTableMap.get(type);
}
@@ -562,11 +562,11 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
}
@SuppressWarnings("unchecked")
public <T> BeanManager<T> getBeanManager(Class<T> entityType) {
return (BeanManager<T>) getBeanManager(entityType.getName());
public <T> BeanManager<T> beanManager(Class<T> entityType) {
return (BeanManager<T>) beanManager(entityType.getName());
}
private BeanManager<?> getBeanManager(String beanClassName) {
private BeanManager<?> beanManager(String beanClassName) {
return beanManagerMap.get(beanClassName);
}
@@ -591,11 +591,11 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
* Return the bean deploy info for the given class.
*/
@SuppressWarnings("unchecked")
public <T> DeployBeanInfo<T> getDeploy(Class<T> cls) {
public <T> DeployBeanInfo<T> deploy(Class<T> cls) {
return (DeployBeanInfo<T>) deployInfoMap.get(cls);
}
private void registerBeanDescriptor(DeployBeanInfo<?> info) {
private void registerDescriptor(DeployBeanInfo<?> info) {
BeanDescriptor<?> desc = new BeanDescriptor<>(this, info.getDescriptor());
descMap.put(desc.type().getName(), desc);
if (desc.isDocStoreMapped()) {
@@ -640,7 +640,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
private void registerEmbeddedBean(DeployBeanInfo<?> info) {
readDeployAssociations(info);
registerBeanDescriptor(info);
registerDescriptor(info);
}
/**
@@ -711,7 +711,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
}
for (DeployBeanInfo<?> info : deployInfoMap.values()) {
if (!info.isEmbedded()) {
registerBeanDescriptor(info);
registerDescriptor(info);
}
}
}
@@ -785,7 +785,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
}
}
private DeployBeanDescriptor<?> getTargetDescriptor(DeployBeanPropertyAssoc<?> prop) {
private DeployBeanDescriptor<?> targetDescriptor(DeployBeanPropertyAssoc<?> prop) {
Class<?> targetType = prop.getTargetType();
DeployBeanInfo<?> info = deployInfoMap.get(targetType);
if (info == null) {
@@ -805,7 +805,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
Set<String> matchSet = new HashSet<>();
// get the bean descriptor that holds the mappedBy property
DeployBeanDescriptor<?> targetDesc = getTargetDescriptor(prop);
DeployBeanDescriptor<?> targetDesc = targetDescriptor(prop);
List<DeployBeanPropertyAssocOne<?>> ones = targetDesc.propertiesAssocOne();
for (DeployBeanPropertyAssocOne<?> possibleMappedBy : ones) {
Class<?> possibleMappedByType = possibleMappedBy.getTargetType();
@@ -866,7 +866,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
}
private void makeOrderColumn(DeployBeanPropertyAssocMany<?> oneToMany) {
DeployBeanDescriptor<?> targetDesc = getTargetDescriptor(oneToMany);
DeployBeanDescriptor<?> targetDesc = targetDescriptor(oneToMany);
DeployOrderColumn orderColumn = oneToMany.getOrderColumn();
final ScalarType<?> scalarType = typeManager.getScalarType(Integer.class);
DeployBeanProperty orderProperty = new DeployBeanProperty(targetDesc, Integer.class, scalarType, null);
@@ -898,7 +898,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
* into the order_id column on the order_lines table).
*/
private void makeUnidirectional(DeployBeanPropertyAssocMany<?> oneToMany) {
DeployBeanDescriptor<?> targetDesc = getTargetDescriptor(oneToMany);
DeployBeanDescriptor<?> targetDesc = targetDescriptor(oneToMany);
Class<?> owningType = oneToMany.getOwningType();
if (!oneToMany.getCascadeInfo().isSave()) {
// The property MUST have persist cascading so that inserts work.
@@ -915,7 +915,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
oneToMany.setUnidirectional();
// specify table and table alias...
BeanTable beanTable = getBeanTable(owningType);
BeanTable beanTable = beanTable(owningType);
// define the TableJoin
DeployTableJoin oneToManyJoin = oneToMany.getTableJoin();
@@ -951,7 +951,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
// its associated join information if it is available
String mappedBy = prop.getMappedBy();
// get the mappedBy property
DeployBeanDescriptor<?> targetDesc = getTargetDescriptor(prop);
DeployBeanDescriptor<?> targetDesc = targetDescriptor(prop);
DeployBeanProperty mappedProp = targetDesc.getBeanProperty(mappedBy);
if (mappedProp == null) {
String m = "Error on " + prop.getFullBeanName();
@@ -1008,7 +1008,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
// skip mapping check
return;
}
DeployBeanDescriptor<?> targetDesc = getTargetDescriptor(prop);
DeployBeanDescriptor<?> targetDesc = targetDescriptor(prop);
if (targetDesc.isDraftableElement()) {
// automatically turning on orphan removal and CascadeType.ALL
@@ -1087,14 +1087,14 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
// get the bean descriptor that holds the mappedBy property
String mappedBy = prop.getMappedBy();
if (mappedBy == null) {
if (getTargetDescriptor(prop).isDraftable()) {
if (targetDescriptor(prop).isDraftable()) {
prop.setIntersectionDraftTable();
}
return;
}
// get the mappedBy property
DeployBeanDescriptor<?> targetDesc = getTargetDescriptor(prop);
DeployBeanDescriptor<?> targetDesc = targetDescriptor(prop);
DeployBeanProperty mappedProp = targetDesc.getBeanProperty(mappedBy);
if (mappedProp == null) {
@@ -1433,14 +1433,14 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
* Return the changeLogPrepare (for setting user context into the ChangeSet
* in the foreground thread).
*/
public ChangeLogPrepare getChangeLogPrepare() {
public ChangeLogPrepare changeLogPrepare() {
return changeLogPrepare;
}
/**
* Return the changeLogListener (that actually does the logging).
*/
public ChangeLogListener getChangeLogListener() {
public ChangeLogListener changeLogListener() {
return changeLogListener;
}
@@ -20,22 +20,22 @@ public interface BeanDescriptorMap {
/**
* Return the name of the server/database.
*/
String getServerName();
String name();
/**
* Return the DatabaseConfig.
*/
DatabaseConfig getConfig();
DatabaseConfig config();
/**
* Return the Cache Manager.
*/
SpiCacheManager getCacheManager();
SpiCacheManager cacheManager();
/**
* Return the naming convention.
*/
NamingConvention getNamingConvention();
NamingConvention namingConvention();
/**
* Return true if multiple values can be bound as Array or Table Value and hence share the same query plan.
@@ -45,12 +45,12 @@ public interface BeanDescriptorMap {
/**
* Return the BeanDescriptor for a given class.
*/
<T> BeanDescriptor<T> getBeanDescriptor(Class<T> entityType);
<T> BeanDescriptor<T> descriptor(Class<T> entityType);
/**
* Return the Encrypt key given the table and column name.
*/
EncryptKey getEncryptKey(String tableName, String columnName);
EncryptKey encryptKey(String tableName, String columnName);
/**
* Create a IdBinder for this bean property.
@@ -65,18 +65,18 @@ public interface BeanDescriptorMap {
/**
* Return the scalarType for the given JDBC type.
*/
ScalarType<?> getScalarType(int jdbcType);
ScalarType<?> scalarType(int jdbcType);
/**
* Return the scalarType for the given logical type.
*/
ScalarType<?> getScalarType(String cast);
ScalarType<?> scalarType(String cast);
/**
* Return true if Jackson core is present on the classpath.
*/
boolean isJacksonCorePresent();
/**
* Returns true, if the given table (or view) is managed by ebean
* (= an entity exists)
@@ -19,7 +19,7 @@ final class BeanEmbeddedMetaFactory {
// we can get a BeanDescriptor for an Embedded bean
// and know that it is NOT recursive, as Embedded beans are
// only allow to hold simple scalar types...
BeanDescriptor<?> targetDesc = owner.getBeanDescriptor(prop.getTargetType());
BeanDescriptor<?> targetDesc = owner.descriptor(prop.getTargetType());
if (targetDesc == null) {
String msg = "Could not find BeanDescriptor for " + prop.getTargetType()
+ ". Perhaps the EmbeddedId class is not registered? See https://ebean.io/docs/trouble-shooting#not-registered";
@@ -103,7 +103,7 @@ public final class BeanTable {
String lc = prop.dbColumn();
String fk = lc;
if (foreignKeyPrefix != null) {
fk = owner.getNamingConvention().getForeignKey(foreignKeyPrefix, fk);
fk = owner.namingConvention().getForeignKey(foreignKeyPrefix, fk);
}
if (complexKey) {
// just to copy the column name rather than prefix with the foreignKeyPrefix.
@@ -192,7 +192,7 @@ public class DeployBeanDescriptor<T> {
* Return the DeployBeanInfo for the given bean class.
*/
DeployBeanInfo<?> getDeploy(Class<?> cls) {
return manager.getDeploy(cls);
return manager.deploy(cls);
}
public void setStorageEngine(String storageEngine) {
@@ -29,7 +29,7 @@ abstract class AnnotationAssoc extends AnnotationParser {
}
BeanTable getBeanTable(DeployBeanPropertyAssoc<?> prop) {
return factory.getBeanTable(prop.getTargetType());
return factory.beanTable(prop.getTargetType());
}
private String errorMsgMissingBeanTable(Class<?> type, String from) {
@@ -154,13 +154,13 @@ final class AnnotationAssocManys extends AnnotationAssoc {
if (!prop.getTableJoin().hasJoinColumns() && beanTable != null) {
// use naming convention to define join (based on the bean name for this side of relationship)
// A unidirectional OneToMany or OneToMany with no mappedBy property
NamingConvention nc = factory.getNamingConvention();
NamingConvention nc = factory.namingConvention();
String fkeyPrefix = null;
if (nc.isUseForeignKeyPrefix()) {
fkeyPrefix = nc.getColumnFromProperty(descriptor.getBeanType(), descriptor.getName());
}
// Use the owning bean table to define the join
BeanTable owningBeanTable = factory.getBeanTable(descriptor.getBeanType());
BeanTable owningBeanTable = factory.beanTable(descriptor.getBeanType());
owningBeanTable.createJoinColumn(fkeyPrefix, prop.getTableJoin(), false, prop.getSqlFormulaSelect());
}
}
@@ -190,7 +190,7 @@ final class AnnotationAssocManys extends AnnotationAssoc {
fullTableName = descriptor.getBaseTable()+"_"+ CamelCaseHelper.toUnderscoreFromCamel(prop.getName());
}
BeanTable localTable = factory.getBeanTable(descriptor.getBeanType());
BeanTable localTable = factory.beanTable(descriptor.getBeanType());
if (collectionTable != null) {
prop.getTableJoin().addJoinColumn(util, true, collectionTable.joinColumns(), localTable);
}
@@ -296,8 +296,8 @@ final class AnnotationAssocManys extends AnnotationAssoc {
private void readJoinTable(JoinTable joinTable, DeployBeanPropertyAssocMany<?> prop) {
String intTableName = getFullTableName(joinTable);
if (intTableName.isEmpty()) {
BeanTable localTable = factory.getBeanTable(descriptor.getBeanType());
BeanTable otherTable = factory.getBeanTable(prop.getTargetType());
BeanTable localTable = factory.beanTable(descriptor.getBeanType());
BeanTable otherTable = factory.beanTable(prop.getTargetType());
intTableName = getM2MJoinTableName(localTable, otherTable);
}
@@ -362,8 +362,8 @@ final class AnnotationAssocManys extends AnnotationAssoc {
intTableName = intJoin.getTable();
}
BeanTable localTable = factory.getBeanTable(descriptor.getBeanType());
BeanTable otherTable = factory.getBeanTable(prop.getTargetType());
BeanTable localTable = factory.beanTable(descriptor.getBeanType());
BeanTable otherTable = factory.beanTable(prop.getTargetType());
final String localTableName = localTable.getUnqualifiedBaseTable();
final String otherTableName = otherTable.getUnqualifiedBaseTable();
@@ -145,7 +145,7 @@ final class AnnotationAssocOnes extends AnnotationAssoc {
} else {
// use naming convention to define join.
NamingConvention nc = factory.getNamingConvention();
NamingConvention nc = factory.namingConvention();
String fkeyPrefix = null;
if (nc.isUseForeignKeyPrefix()) {
@@ -231,7 +231,7 @@ final class AnnotationAssocOnes extends AnnotationAssoc {
if (!primaryKeyJoin.referencedColumnName().isEmpty()) {
log.info("Automatically determining join columns for @PrimaryKeyJoinColumn - Ignoring PrimaryKeyJoinColumn.referencedColumnName attribute [{}] on {}", primaryKeyJoin.referencedColumnName(), prop.getFullBeanName());
}
BeanTable baseBeanTable = factory.getBeanTable(info.getDescriptor().getBeanType());
BeanTable baseBeanTable = factory.beanTable(info.getDescriptor().getBeanType());
String localPrimaryKey = baseBeanTable.getIdColumn();
String foreignColumn = getBeanTable(prop).getIdColumn();
prop.getTableJoin().addJoinColumn(new DeployTableJoinColumn(localPrimaryKey, foreignColumn, false, false));
@@ -98,7 +98,7 @@ public final class DefaultPersister implements Persister {
SpiUpdate<?> ormUpdate = (SpiUpdate<?>) update;
BeanManager<?> mgr = beanDescriptorManager.getBeanManager(ormUpdate.getBeanType());
BeanManager<?> mgr = beanDescriptorManager.beanManager(ormUpdate.getBeanType());
if (mgr == null) {
String msg = "No BeanManager found for type [" + ormUpdate.getBeanType() + "]. Is it an entity?";
@@ -187,7 +187,7 @@ public final class DefaultPersister implements Persister {
draftHandler.fetchDestinationBeans(liveBeans, true);
BeanManager<T> mgr = beanDescriptorManager.getBeanManager(beanType);
BeanManager<T> mgr = beanDescriptorManager.beanManager(beanType);
for (T liveBean : liveBeans) {
T draftBean = draftHandler.publishToDestinationBean(liveBean);
@@ -232,7 +232,7 @@ public final class DefaultPersister implements Persister {
draftHandler.fetchDestinationBeans(draftBeans, false);
BeanManager<T> mgr = beanDescriptorManager.getBeanManager(beanType);
BeanManager<T> mgr = beanDescriptorManager.beanManager(beanType);
List<T> livePublish = new ArrayList<>(draftBeans.size());
for (T draftBean : draftBeans) {
@@ -640,7 +640,7 @@ public final class DefaultPersister implements Persister {
return 0;
}
BeanDescriptor<?> descriptor = beanDescriptorManager.getBeanDescriptor(beanType);
BeanDescriptor<?> descriptor = beanDescriptorManager.descriptor(beanType);
DeleteMode deleteMode = (permanent || !descriptor.isSoftDelete()) ? DeleteMode.HARD : DeleteMode.SOFT;
if (descriptor.isMultiTenant()) {
return deleteAsBeans(ids, transaction, deleteMode, descriptor);
@@ -679,7 +679,7 @@ public final class DefaultPersister implements Persister {
*/
@Override
public int delete(Class<?> beanType, Object id, Transaction transaction, boolean permanent) {
BeanDescriptor<?> descriptor = beanDescriptorManager.getBeanDescriptor(beanType);
BeanDescriptor<?> descriptor = beanDescriptorManager.descriptor(beanType);
if (descriptor.isMultiTenant()) {
// convert to a delete by bean
EntityBean bean = descriptor.createEntityBean();
@@ -1274,7 +1274,7 @@ public final class DefaultPersister implements Persister {
*/
@SuppressWarnings("unchecked")
private <T> BeanManager<T> getBeanManager(Object bean) {
BeanManager<T> mgr = (BeanManager<T>) beanDescriptorManager.getBeanManager(bean.getClass());
BeanManager<T> mgr = (BeanManager<T>) beanDescriptorManager.beanManager(bean.getClass());
if (mgr == null) {
throw new PersistenceException(errNotRegistered(bean.getClass()));
}
@@ -336,7 +336,7 @@ public final class DefaultPersistenceContext implements SpiPersistenceContext {
* Add the dirty beans to the list.
*/
void dirtyBeans(SpiBeanTypeManager manager, List<Object> list) {
final SpiBeanType beanType = manager.getBeanType(rootType);
final SpiBeanType beanType = manager.beanType(rootType);
for (Object value : map.values()) {
EntityBean bean = (EntityBean) value;
if (bean._ebean_getIntercept().isDirty() || beanType.isToManyDirty(bean)) {
@@ -48,16 +48,13 @@ import java.util.concurrent.atomic.AtomicLong;
public class TransactionManager implements SpiTransactionManager {
private static final Logger logger = LoggerFactory.getLogger(TransactionManager.class);
private static final Logger clusterLogger = LoggerFactory.getLogger("io.ebean.Cluster");
private final SpiServer server;
private final BeanDescriptorManager beanDescriptorManager;
/**
* Ebean defaults this to true but for EJB compatible behaviour set this to
* false;
* Ebean defaults this to true but for EJB compatible behaviour set this to false;
*/
private final boolean rollbackOnChecked;
@@ -65,9 +62,7 @@ public class TransactionManager implements SpiTransactionManager {
* Prefix for transaction id's (logging).
*/
final String prefix;
private final String externalTransPrefix;
private final AtomicLong counter = new AtomicLong(1000L);
/**
@@ -80,69 +75,38 @@ public class TransactionManager implements SpiTransactionManager {
* to close queryOnly transactions rather than commit or rollback them.
*/
private final OnQueryOnly onQueryOnly;
private final BackgroundExecutor backgroundExecutor;
private final ClusterManager clusterManager;
private final String serverName;
private final boolean docStoreActive;
/**
* The elastic search index update processor.
*/
final DocStoreUpdateProcessor docStoreUpdateProcessor;
private final boolean autoPersistUpdates;
private final boolean persistBatch;
private final boolean persistBatchOnCascade;
private final BulkEventListenerMap bulkEventListenerMap;
/**
* Used to prepare the change set setting user context information in the
* foreground thread before logging.
*/
private final ChangeLogPrepare changeLogPrepare;
/**
* Performs the actual logging of the change set in background.
*/
private final ChangeLogListener changeLogListener;
/**
* Use Background executor to perform change-logging
*/
private final boolean changeLogAsync;
final boolean notifyL2CacheInForeground;
private final boolean viewInvalidation;
private final boolean skipCacheAfterWrite;
private final TransactionFactory transactionFactory;
private final SpiLogManager logManager;
private final SpiLogger txnLogger;
private final boolean txnDebug;
private final DatabasePlatform databasePlatform;
private final SpiProfileHandler profileHandler;
private final TimedMetric txnMain;
private final TimedMetric txnReadOnly;
private final TimedMetricMap txnNamed;
private final TransactionScopeManager scopeManager;
private final TableModState tableModState;
private final ServerCacheNotify cacheNotify;
private final boolean supportsSavepointId;
private final ConcurrentHashMap<String, ProfileLocation> profileLocations = new ConcurrentHashMap<>();
/**
@@ -163,8 +127,8 @@ public class TransactionManager implements SpiTransactionManager {
this.rollbackOnChecked = options.config.isTransactionRollbackOnChecked();
this.beanDescriptorManager = options.descMgr;
this.viewInvalidation = options.descMgr.requiresViewEntityCacheInvalidation();
this.changeLogPrepare = options.descMgr.getChangeLogPrepare();
this.changeLogListener = options.descMgr.getChangeLogListener();
this.changeLogPrepare = options.descMgr.changeLogPrepare();
this.changeLogListener = options.descMgr.changeLogListener();
this.changeLogAsync = options.config.isChangeLogAsync();
this.clusterManager = options.clusterManager;
this.serverName = options.config.getName();