private void onRelation ( Object entity , Map < String , Object > relationsMap , final Relation relation , final EntityMetadata metadata , final PersistenceDelegator pd , boolean lazilyloaded , Map < Object , Object > relationStack ) { final Object entityId = PropertyAccessorHelper . getId ( entity , metadata ) ; // if relation map contains value, then invoke target entity with find // by id. // else invoke target entity for find by relation, pass it's entityId as // a column value and relation.getJoinColumnName as column name. Object relationValue = relationsMap != null ? relationsMap . get ( relation . getJoinColumnName ( kunderaMetadata ) ) : null ; EntityMetadata targetEntityMetadata = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , relation . getTargetEntity ( ) ) ; List relationalEntities = fetchRelations ( relation , metadata , pd , entityId , relationValue , targetEntityMetadata ) ; if ( relationalEntities != null ) { for ( Object relationEntity : relationalEntities ) { if ( relationEntity != null ) { addToRelationStack ( relationStack , relationEntity , targetEntityMetadata ) ; } } for ( Object relationEntity : relationalEntities ) { if ( relationEntity != null ) { onParseRelation ( entity , pd , targetEntityMetadata , relationEntity , relation , lazilyloaded , relationStack ) ; PersistenceCacheManager . addEntityToPersistenceCache ( getEntity ( relationEntity ) , pd , PropertyAccessorHelper . getId ( relationEntity , targetEntityMetadata ) ) ; } } } }
Method to handle one to one association relation events .