java.lang.Object
io.ebeaninternal.server.deploy.BeanProperty
io.ebeaninternal.server.deploy.BeanPropertyAssoc<T>
io.ebeaninternal.server.deploy.BeanPropertyAssocMany<T>
- All Implemented Interfaces:
ScalarDataReader<Object>,ExpressionPath,Property,PropertyAssocMany,ElPropertyDeploy,ElPropertyValue,STreeProperty,STreePropertyAssoc,STreePropertyAssocMany
- Direct Known Subclasses:
BeanPropertySimpleCollection
public class BeanPropertyAssocMany<T>
extends BeanPropertyAssoc<T>
implements STreePropertyAssocMany, PropertyAssocMany
Property mapped to a List Set or Map.
-
Field Summary
Fields inherited from class io.ebeaninternal.server.deploy.BeanProperty
idFields inherited from interface io.ebeaninternal.server.el.ElPropertyDeploy
ROOT_ELPREFIX -
Constructor Summary
ConstructorsConstructorDescriptionBeanPropertyAssocMany(BeanDescriptor<?> descriptor, DeployBeanPropertyAssocMany<T> deploy) Create this property. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(BeanCollection<?> collection, EntityBean bean) voidaddBeanToCollectionWithCreate(EntityBean parentBean, EntityBean detailBean, boolean withCheck) Add the bean to the appropriate collection on the parent bean.voidaddSelectExported(DbSqlContext ctx, String tableAlias) Append exported columns to the select.voidaddWhereParentIdIn(SpiQuery<?> query, List<Object> parentIds) voidappendSelect(DbSqlContext ctx, boolean subQuery) Append to the select clause.asMany()Return as BeanPropertyAssocMany.assocIdExpression(String prefix, String operator) Return the Id expression to add to where clause etc.assocIdInExpr(String prefix) Return the logical id in expression taking into account embedded id's.assocIdInValueExpr(boolean not, int size) Return the logical id value expression taking into account embedded id's.Object[]assocIdValues(EntityBean bean) Return the Id values from the given bean.assocIsEmpty(SpiExpressionRequest request, String path) Return the logical where clause to support "Is empty".voidbindElementValue(SqlUpdate insert, Object value) Bind all the property values to the SqlUpdate.buildElPropertyValue(String propName, String remainder, ElPropertyChainBuilder chain, boolean propertyDeploy) buildManyDeleteChildren(EntityBean parentBean, Set<Object> excludeDetailIds) buildManyToManyDeleteChildren(EntityBean parentBean) buildManyToManyMapBean(EntityBean parent, EntityBean other) voidbuildRawSqlSelectChain(String prefix, List<String> selectChain) For RawSql build the select chain.booleanReturns true.createEmpty(EntityBean parentBean) voidcreateEmptyReference(EntityBean localBean) Populate the collection for read-only disabled lazy loading (aka Java Collections non mutable empty collection).booleanReturns true, if we must create a m2m join table.createReference(EntityBean parentBean) createReference(EntityBean localBean, boolean forceNewReference) Return a reference collection forcing a new reference on REFRESH query.createReferenceIfNull(EntityBean parentBean) Return a reference collection.deleteByParentId(Object parentId) Create SqlUpdate statement to delete all child beans of the parentid.deleteByParentIdList(List<Object> parentIdist) Create SqlUpdate statement to delete all child beans of the parent ids inidList.Return the element bean descriptor (for an element collection only).Return the order by clause used to order the fetching of the data for this list, set or map.findIdsByParentId(Object parentId, Transaction t, boolean includeSoftDeletes) Find the Id's of detail beans given a parent IdfindIdsByParentId(Object parentId, Transaction t, boolean includeSoftDeletes, Set<Object> excludeDetailIds) Find the Id's of detail beans given a parent Id and optionally exclude detail IDsfindIdsByParentIdList(List<Object> parentIdList, Transaction t, boolean includeSoftDeletes) Find the Id's of detail beans given a list of parent Id's.getCacheDataValue(EntityBean bean) Return the value for this property which we hold in the L2 cache entry.booleanhasImportedId(EntityBean otherBean) Return true if the otherBean has an Id value.booleanReturn true if this is many to many.booleanvoidinitialise(io.ebeaninternal.server.deploy.BeanDescriptorInitContext initContext) Initialise post construction.voidintersectionBind(SqlUpdate sql, EntityBean parentBean, EntityBean other) Bind the two side of a many to many to the given SqlUpdate.Return the intersection table helper.ManyToMany only, join from local table to intersection table.booleanReturn true if this is an ManyToOne or OneToOne associated bean property.booleanReturn true if the property is a OneToMany or ManyToMany associated bean property.booleanReturn true if any path of this path contains a Associated One or Many.booleanExclude many properties from bean cache data.booleanbooleanbooleanbooleanisMany()booleanReturn true if this is many to many.booleanReturn true if this is a ManyToMany with history.booleanReturn true if this is a one to many with a join table.booleanbooleanisSkipSaveBeanCollection(EntityBean bean, boolean insertedParent) Return true if this is considered 'empty' from a save perspective.booleanOnly cache Many Ids if the target bean is also cached.voidjsonRead(SpiJsonReader readJson, EntityBean parentBean) jsonReadCollection(SpiJsonReader readJson, EntityBean parentBean, Object targets) Read the collection (JSON Array) containing entity beans.voidjsonWrite(SpiJsonWriter ctx, EntityBean bean) JSON write the bean property.jsonWriteCollection(Object value) Write the collection to JSON.voidjsonWriteValue(SpiJsonWriter writeJson, Object value) Skip JSON write value for ToMany property.Return the order by for use when lazy loading the associated collection.voidlazyLoadMany(EntityBean current) Add the loaded current bean to its associated parent.voidload(SqlBeanLoad sqlBeanLoad) Load into the bean (from the DataReader/ResultSet).voidloadIgnore(DbReadContext ctx) Ignore the property (moving the column index position without reading).manyType()Return the many type.mapKey()Return the default mapKey when returning a Map.voidmerge(EntityBean bean, EntityBean existing) Copy collection value if existing is empty.Return the mode for listening to modifications to collections for this association.parentId(EntityBean parentBean) rawCollection(EntityBean bean) Return the underlying collection of beans.read(DbReadContext ctx) readSet(DbReadContext ctx, EntityBean bean) voidregisterColumn(BeanDescriptor<?> desc, String prefix) voidresetMany(EntityBean bean) Reset the many properties to be empty and ready for reloading.voidsetCacheDataValue(EntityBean bean, Object cacheData, PersistenceContext context) A Many (element collection) property in bean cache to held as JSON.voidsetEbeanServer(SpiEbeanServer server) Set the lazy load server to help create reference collections (that lazy load on demand).voidsetParentToChild(EntityBean parent, EntityBean child, Object mapKeyValue) Set the parent bean to the child (update the relationship).booleansetParentToChild(EntityBean parent, EntityBean child, Object mapKeyValue, BeanDescriptor<?> parentDesc) Return true if the parent bean has been set to the child (updated the relationship).Methods inherited from class io.ebeaninternal.server.deploy.BeanPropertyAssoc
addJoin, addJoin, beanTable, cascadeInfo, extraWhere, fetchPreference, foreignKey, hasForeignKeyConstraint, hasForeignKeyIndex, hasId, idBinder, isInsertable, isSaveRecurseSkippable, isSaveRecurseSkippable, isScalar, isTargetSoftDelete, isUpdateable, mappedBy, newQuery, softDeletePredicate, tableJoin, target, targetDescriptor, targetIdProperty, targetTypeMethods inherited from class io.ebeaninternal.server.deploy.BeanProperty
addTenant, appendFrom, beanProperty, bind, containsFormulaWithJoin, containsManySince, convert, createMutableInfo, dbBind, dbCheckConstraintValues, dbColumn, dbColumnDefault, dbColumnDefn, dbComment, dbEncryptedType, dbLength, dbMigrationInfos, dbScale, dbType, decryptProperty, deployOrder, descriptor, diff, elName, elPlaceholder, elPrefix, encryptKey, encryptKeyAsString, format, fullName, generatedProperty, getCacheDataValueOrig, getValue, getValueIntercept, isAggregation, isArrayType, isAssignableFrom, isDbEncrypted, isDbInsertable, isDbUpdatable, isDDLColumn, isDDLNotNull, isDiscriminator, isEmbedded, isExcludedFromHistory, isFetchEager, isFormula, isGenerated, isId, isImportedPrimaryKey, isJsonSerialize, isLoadProperty, isLob, isLobForPlatform, isLobType, isLocal, isLocalEncrypted, isMutableScalarType, isNaturalKey, isNullable, isSecondaryTable, isSoftDelete, isTenantId, isTransient, isUnique, isUnmappedJson, isVersion, jdbcType, jsonRead, jsonWriteForInsert, localEncrypt, name, override, parse, pathGet, pathGetNested, pathSet, property, propertyIndex, read, readData, readSet, renderDbType, scalarType, secondaryTableJoinPrefix, setDeployOrder, setTenantValue, setValue, setValueChanged, setValueIntercept, stringParser, toString, type, value, writeDataMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.ebean.core.type.ScalarDataReader
readMethods inherited from interface io.ebeaninternal.server.query.STreeProperty
appendFrom, elPrefix, encryptKeyAsString, extraIncludes, fullName, isAggregation, isAggregationManyToOne, isEmbedded, isFormula, isId, isLobForPlatform, name, scalarTypeMethods inherited from interface io.ebeaninternal.server.query.STreePropertyAssoc
addJoin, addJoin, extraWhere, idBinder, isTargetSoftDelete, setValue, softDeletePredicate, targetMethods inherited from interface io.ebeaninternal.server.query.STreePropertyAssocMany
isExcludedFromHistory
-
Constructor Details
-
BeanPropertyAssocMany
Create this property.
-
-
Method Details
-
initialise
public void initialise(io.ebeaninternal.server.deploy.BeanDescriptorInitContext initContext) Description copied from class:BeanPropertyAssocInitialise post construction.- Overrides:
initialisein classBeanPropertyAssoc<T>
-
asMany
Description copied from interface:STreePropertyAssocManyReturn as BeanPropertyAssocMany.- Specified by:
asManyin interfaceSTreePropertyAssocMany
-
isManyToManyWithHistory
public boolean isManyToManyWithHistory()Description copied from interface:STreePropertyAssocManyReturn true if this is a ManyToMany with history.- Specified by:
isManyToManyWithHistoryin interfaceSTreePropertyAssocMany
-
registerColumn
- Overrides:
registerColumnin classBeanProperty
-
rawCollection
Return the underlying collection of beans. -
merge
Copy collection value if existing is empty.- Overrides:
mergein classBeanProperty
-
addBeanToCollectionWithCreate
public void addBeanToCollectionWithCreate(EntityBean parentBean, EntityBean detailBean, boolean withCheck) Add the bean to the appropriate collection on the parent bean.- Specified by:
addBeanToCollectionWithCreatein interfaceSTreePropertyAssocMany
-
isSkipSaveBeanCollection
Return true if this is considered 'empty' from a save perspective. -
resetMany
Reset the many properties to be empty and ready for reloading.Used in bean refresh.
-
buildElPropertyValue
public ElPropertyValue buildElPropertyValue(String propName, String remainder, ElPropertyChainBuilder chain, boolean propertyDeploy) - Overrides:
buildElPropertyValuein classBeanProperty
-
buildRawSqlSelectChain
Description copied from interface:STreePropertyFor RawSql build the select chain.- Specified by:
buildRawSqlSelectChainin interfaceSTreeProperty- Overrides:
buildRawSqlSelectChainin classBeanProperty
-
deleteByParentId
Description copied from class:BeanPropertyAssocCreate SqlUpdate statement to delete all child beans of the parentid.- Specified by:
deleteByParentIdin classBeanPropertyAssoc<T>
-
deleteByParentIdList
Description copied from class:BeanPropertyAssocCreate SqlUpdate statement to delete all child beans of the parent ids inidList.- Specified by:
deleteByParentIdListin classBeanPropertyAssoc<T>
-
findIdsByParentId
Find the Id's of detail beans given a parent Id- Specified by:
findIdsByParentIdin classBeanPropertyAssoc<T>
-
findIdsByParentId
public List<Object> findIdsByParentId(Object parentId, Transaction t, boolean includeSoftDeletes, Set<Object> excludeDetailIds) Find the Id's of detail beans given a parent Id and optionally exclude detail IDs -
findIdsByParentIdList
public List<Object> findIdsByParentIdList(List<Object> parentIdList, Transaction t, boolean includeSoftDeletes) Find the Id's of detail beans given a list of parent Id's.- Specified by:
findIdsByParentIdListin classBeanPropertyAssoc<T>
-
isCacheDataInclude
public boolean isCacheDataInclude()Exclude many properties from bean cache data.- Overrides:
isCacheDataIncludein classBeanProperty
-
lazyLoadMany
Add the loaded current bean to its associated parent.Helper method used by Elastic integration when loading with a persistence context.
- Specified by:
lazyLoadManyin interfacePropertyAssocMany
-
addWhereParentIdIn
-
setEbeanServer
Set the lazy load server to help create reference collections (that lazy load on demand). -
intersectionTable
Return the intersection table helper. -
modifyListenMode
Return the mode for listening to modifications to collections for this association. -
appendSelect
Description copied from interface:STreePropertyAppend to the select clause.- Specified by:
appendSelectin interfaceSTreeProperty- Overrides:
appendSelectin classBeanProperty
-
loadIgnore
Description copied from interface:STreePropertyIgnore the property (moving the column index position without reading).- Specified by:
loadIgnorein interfaceSTreeProperty- Overrides:
loadIgnorein classBeanProperty
-
load
Description copied from interface:STreePropertyLoad into the bean (from the DataReader/ResultSet).- Specified by:
loadin interfaceSTreeProperty- Overrides:
loadin classBeanProperty
-
readSet
- Overrides:
readSetin classBeanProperty
-
read
- Overrides:
readin classBeanProperty
-
add
-
assocIsEmpty
Description copied from interface:ElPropertyValueReturn the logical where clause to support "Is empty".- Specified by:
assocIsEmptyin interfaceElPropertyValue- Overrides:
assocIsEmptyin classBeanProperty
-
assocIdValues
Return the Id values from the given bean.- Specified by:
assocIdValuesin interfaceExpressionPath- Overrides:
assocIdValuesin classBeanProperty
-
assocIdExpression
Return the Id expression to add to where clause etc.- Specified by:
assocIdExpressionin interfaceExpressionPath- Overrides:
assocIdExpressionin classBeanProperty
-
assocIdInValueExpr
Return the logical id value expression taking into account embedded id's.- Specified by:
assocIdInValueExprin interfaceElPropertyValue- Overrides:
assocIdInValueExprin classBeanProperty
-
assocIdInExpr
Return the logical id in expression taking into account embedded id's.- Specified by:
assocIdInExprin interfaceElPropertyValue- Overrides:
assocIdInExprin classBeanProperty
-
isMany
public boolean isMany()- Specified by:
isManyin interfaceProperty- Overrides:
isManyin classBeanProperty
-
hasOrderColumn
public boolean hasOrderColumn() -
isOrphanRemoval
public boolean isOrphanRemoval() -
isAssocMany
public boolean isAssocMany()Description copied from interface:ElPropertyValueReturn true if the property is a OneToMany or ManyToMany associated bean property.- Specified by:
isAssocManyin interfaceElPropertyValue- Overrides:
isAssocManyin classBeanProperty
-
isAssocId
public boolean isAssocId()Description copied from interface:ElPropertyValueReturn true if this is an ManyToOne or OneToOne associated bean property.- Specified by:
isAssocIdin interfaceElPropertyValue- Specified by:
isAssocIdin interfaceExpressionPath- Overrides:
isAssocIdin classBeanProperty
-
isAssocProperty
public boolean isAssocProperty()Description copied from interface:ElPropertyValueReturn true if any path of this path contains a Associated One or Many.- Specified by:
isAssocPropertyin interfaceElPropertyValue- Overrides:
isAssocPropertyin classBeanProperty
-
containsMany
public boolean containsMany()Returns true.- Specified by:
containsManyin interfaceElPropertyDeploy- Specified by:
containsManyin interfaceExpressionPath- Overrides:
containsManyin classBeanProperty
-
manyType
Return the many type. -
hasJoinTable
public boolean hasJoinTable()Return true if this is many to many.- Specified by:
hasJoinTablein interfaceSTreePropertyAssocMany
-
isO2mJoinTable
public boolean isO2mJoinTable()Return true if this is a one to many with a join table. -
isManyToMany
public boolean isManyToMany()Return true if this is many to many. -
isElementCollection
public boolean isElementCollection() -
elementDescriptor
Return the element bean descriptor (for an element collection only). -
intersectionTableJoin
ManyToMany only, join from local table to intersection table.- Specified by:
intersectionTableJoinin interfaceSTreePropertyAssocMany
-
setParentToChild
Set the parent bean to the child (update the relationship). -
setParentToChild
public boolean setParentToChild(EntityBean parent, EntityBean child, Object mapKeyValue, BeanDescriptor<?> parentDesc) Return true if the parent bean has been set to the child (updated the relationship). -
fetchOrderBy
Return the order by clause used to order the fetching of the data for this list, set or map. -
lazyFetchOrderBy
Return the order by for use when lazy loading the associated collection. -
mapKey
Return the default mapKey when returning a Map. -
createEmptyReference
Description copied from interface:STreePropertyAssocManyPopulate the collection for read-only disabled lazy loading (aka Java Collections non mutable empty collection).- Specified by:
createEmptyReferencein interfaceSTreePropertyAssocMany
-
createReference
Description copied from interface:STreePropertyAssocManyReturn a reference collection forcing a new reference on REFRESH query.- Specified by:
createReferencein interfaceSTreePropertyAssocMany
-
createReferenceIfNull
Description copied from interface:STreePropertyAssocManyReturn a reference collection.- Specified by:
createReferenceIfNullin interfaceSTreePropertyAssocMany
-
createReference
-
createEmpty
-
parentId
-
addSelectExported
Description copied from interface:STreePropertyAssocManyAppend exported columns to the select.- Specified by:
addSelectExportedin interfaceSTreePropertyAssocMany
-
buildManyDeleteChildren
-
buildManyToManyDeleteChildren
-
buildManyToManyMapBean
-
intersectionBind
Bind the two side of a many to many to the given SqlUpdate. -
hasImportedId
Return true if the otherBean has an Id value. -
jsonWriteValue
Skip JSON write value for ToMany property.- Overrides:
jsonWriteValuein classBeanProperty
-
jsonWrite
Description copied from class:BeanPropertyJSON write the bean property.- Overrides:
jsonWritein classBeanProperty- Throws:
IOException
-
jsonRead
- Overrides:
jsonReadin classBeanProperty- Throws:
IOException
-
isIncludeCascadeSave
public boolean isIncludeCascadeSave() -
isIncludeCascadeDelete
public boolean isIncludeCascadeDelete() -
insertElementCollection
-
isUseCache
public boolean isUseCache()Only cache Many Ids if the target bean is also cached. -
setCacheDataValue
A Many (element collection) property in bean cache to held as JSON.- Overrides:
setCacheDataValuein classBeanProperty
-
getCacheDataValue
Description copied from class:BeanPropertyReturn the value for this property which we hold in the L2 cache entry.This uses format() where possible to store the value as a string and this is done to make any resulting Java object serialisation content smaller as strings get special treatment.
- Overrides:
getCacheDataValuein classBeanProperty
-
jsonWriteCollection
Write the collection to JSON.- Throws:
IOException
-
jsonReadCollection
public Object jsonReadCollection(SpiJsonReader readJson, EntityBean parentBean, Object targets) throws IOException Read the collection (JSON Array) containing entity beans.- Throws:
IOException
-
bindElementValue
Bind all the property values to the SqlUpdate. -
createJoinTable
public boolean createJoinTable()Returns true, if we must create a m2m join table.
-