/** * Build a map of logical to physical names for use in Orm Updates for a given descriptor. * * <p>This includes the dbWrite scalar properties and imported foreign key properties. */ public static Map<String, String> build(BeanDescriptor<?> descriptor) { Map<String, String> deployMap = new HashMap<String, String>(); String shortName = descriptor.getName(); String beanName = shortName.toLowerCase(); deployMap.put(beanName, descriptor.getBaseTable()); BeanProperty[] baseScalar = descriptor.propertiesBaseScalar(); for (BeanProperty baseProp : baseScalar) { // excluding formula, secondary table properties if (baseProp.isDbInsertable() || baseProp.isDbUpdatable()) { deployMap.put(baseProp.getName().toLowerCase(), baseProp.getDbColumn()); } } BeanPropertyAssocOne<?>[] oneImported = descriptor.propertiesOneImported(); for (BeanPropertyAssocOne<?> assocOne : oneImported) { ImportedId importedId = assocOne.getImportedId(); if (importedId == null) { String m = descriptor.getFullName() + " importedId is null for associated: " + assocOne.getFullBeanName(); logger.log(Level.SEVERE, m); } else if (importedId.isScalar()) { deployMap.put(importedId.getLogicalName(), importedId.getDbColumn()); } } return deployMap; }
/** * Initialise the property before returning to client code. Used to initialise variables that * can't be done in construction due to recursive issues. */ public void initialise() { // do nothing for normal BeanProperty if (!isTransient && scalarType == null) { String msg = "No ScalarType assigned to " + descriptor.getFullName() + "." + getName(); throw new RuntimeException(msg); } }
/** Derive the cache notify flags. */ void deriveNotifyFlags() { cacheNotifyOnAll = (beanCache != null || queryCache != null); cacheNotifyOnDelete = !cacheNotifyOnAll && isNotifyOnDeletes(); if (logger.isDebugEnabled()) { if (isBeanCaching() || isQueryCaching() || cacheNotifyOnAll || cacheNotifyOnDelete) { String notifyMode = cacheNotifyOnAll ? "All" : (cacheNotifyOnDelete ? "Delete" : "None"); logger.debug( "l2 caching on {} - beanCaching:{} queryCaching:{} notifyMode:{} ", desc.getFullName(), isBeanCaching(), isQueryCaching(), notifyMode); } } }
/** Return the full name of this property. */ public String getFullBeanName() { return descriptor.getFullName() + "." + name; }