@Override public void addFkeys(String name) { BeanFkeyProperty fkey = new BeanFkeyProperty(name + "." + foreignProperty.getName(), localDbColumn, owner.getDeployOrder()); owner.getBeanDescriptor().add(fkey); }
@Override public Object getCacheDataValue(EntityBean bean) { Object ap = getValue(bean); if (ap == null) { return null; } if (embedded) { return targetDescriptor.cacheEmbeddedBeanExtract((EntityBean) ap); } else { return targetDescriptor.getIdProperty().getCacheDataValue((EntityBean) ap); } }
/** * Read setting values into the bean. */ Object readSet(DbReadContext ctx, EntityBean bean) throws SQLException { Object val = read(ctx); if (bean != null) { property.setValue(bean, val); ctx.propagateState(val); } return val; }
@Override public void addFkeys(String name) { BeanProperty[] embeddedProps = foreignAssocOne.getProperties(); for (int i = 0; i < imported.length; i++) { String n = name + "." + foreignAssocOne.getName() + "." + embeddedProps[i].getName(); BeanFkeyProperty fkey = new BeanFkeyProperty(n, imported[i].localDbColumn, foreignAssocOne.getDeployOrder()); owner.getBeanDescriptor().add(fkey); } }
private void buildExport(IntersectionRow row, EntityBean parentBean) { if (embeddedExportedProperties) { BeanProperty idProp = descriptor.getIdProperty(); parentBean = (EntityBean) idProp.getValue(parentBean); } for (ExportedProperty exportedProperty : exportedProperties) { Object val = exportedProperty.getValue(parentBean); String fkColumn = exportedProperty.getForeignDbColumn(); row.put(fkColumn, val); } }
/** * Create the BeanControllers, BeanFinders and BeanListeners. */ private void createListeners() { int qa = beanQueryAdapterManager.getRegisterCount(); int cc = persistControllerManager.getRegisterCount(); int pl = postLoadManager.getRegisterCount(); int pc = postConstructManager.getRegisterCount(); int lc = persistListenerManager.getRegisterCount(); int fc = beanFinderManager.getRegisterCount(); logger.debug("BeanPersistControllers[{}] BeanFinders[{}] BeanPersistListeners[{}] BeanQueryAdapters[{}] BeanPostLoaders[{}] BeanPostConstructors[{}]", cc, fc, lc, qa, pl, pc); }
@Override void appendFrom(DbSqlContext ctx, SqlJoinType joinType) { String relativePrefix = ctx.getRelativePrefix(property.getName()); if (softDelete && !ctx.isIncludeSoftDelete()) { property.tableJoin.addJoin(joinType, relativePrefix, ctx, softDeletePredicate); } else { property.tableJoin.addJoin(joinType, relativePrefix, ctx); } } }
@Override public void appendSelect(DbSqlContext ctx, boolean subQuery) { if (!isTransient) { if (primaryKeyExport) { descriptor.getIdProperty().appendSelect(ctx, subQuery); } else { localHelp.appendSelect(ctx, subQuery); } } }
/** * Add the bean to the appropriate collection on the parent bean. */ @Override public void addBeanToCollectionWithCreate(EntityBean parentBean, EntityBean detailBean, boolean withCheck) { BeanCollection<?> bc = (BeanCollection<?>) super.getValue(parentBean); if (bc == null) { bc = help.createEmpty(parentBean); setValue(parentBean, bc); } help.add(bc, detailBean, withCheck); }
@Override public void initialise(BeanDescriptorInitContext initContext) { super.initialise(initContext); initialiseAssocMany(); if (elementCollection) { // initialise all non-id properties (we don't have an Id property) elementDescriptor.initialiseOther(initContext); } }
@Override public void addSelectExported(DbSqlContext ctx, String tableAlias) { String alias = hasJoinTable() ? "int_" : tableAlias; if (alias == null) { alias = "t0"; } for (ExportedProperty exportedProperty : exportedProperties) { ctx.appendColumn(alias, exportedProperty.getForeignDbColumn()); } }
@Override Object readSet(DbReadContext ctx, EntityBean bean) throws SQLException { Object dbVal = read(ctx); if (bean != null) { // set back to the parent bean property.setValue(bean, dbVal); ctx.propagateState(dbVal); return dbVal; } else { return null; } }
private boolean isNodeSaveRecurseSkippable() { if (!descriptor.isSaveRecurseSkippable()) { return false; } for (InheritInfo child : children) { if (!child.isNodeSaveRecurseSkippable()) { return false; } } return true; }
private boolean isNodeDeleteRecurseSkippable() { if (!descriptor.isDeleteRecurseSkippable()) { return false; } for (InheritInfo child : children) { if (!child.isNodeDeleteRecurseSkippable()) { return false; } } return true; }
@Override public void initialiseOther(BeanDescriptorInitContext initContext) { super.initialiseOther(initContext); this.targetDescriptor = embeddedProperty.getTargetDescriptor(); }
public void register(BeanPersistController c) { List<BeanDescriptor<?>> list = beanDescriptorManager.getBeanDescriptorList(); for (BeanDescriptor<?> aList : list) { aList.register(c); } }
@Override public void setValue(EntityBean bean, Object value) { super.setValue(bean, value); if (embedded && value instanceof EntityBean) { setEmbeddedOwner(bean, value); } }
/** * Add the loaded current bean to its associated parent. * * Helper method used by Elastic integration when loading with a persistence context. */ public void lazyLoadMany(EntityBean current) { EntityBean parentBean = childMasterProperty.getValueAsEntityBean(current); if (parentBean != null) { addBeanToCollectionWithCreate(parentBean, current, true); } }