forked from hibernate/hibernate-ogm
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OGM-469 Changing GridDialect#isStoredInEntityStructure() to accept ke…
…y and context specific to the association family only rather than specific to association instances
- Loading branch information
1 parent
adfbace
commit fedf0e6
Showing
22 changed files
with
252 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
core/src/main/java/org/hibernate/ogm/dialect/impl/AssociationTypeContextImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Hibernate OGM, Domain model persistence for NoSQL datastores | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.ogm.dialect.impl; | ||
|
||
import org.hibernate.ogm.dialect.spi.AssociationTypeContext; | ||
import org.hibernate.ogm.dialect.spi.GridDialect; | ||
import org.hibernate.ogm.model.key.spi.AssociatedEntityKeyMetadata; | ||
import org.hibernate.ogm.model.spi.Association; | ||
import org.hibernate.ogm.options.spi.OptionsContext; | ||
|
||
/** | ||
* Provides context information to {@link GridDialect}s when accessing {@link Association}s. | ||
* | ||
* @author Guillaume Scheibel <guillaume.scheibel@gmail.com> | ||
* @author Gunnar Morling | ||
*/ | ||
public class AssociationTypeContextImpl implements AssociationTypeContext { | ||
|
||
private final OptionsContext optionsContext; | ||
private final AssociatedEntityKeyMetadata associatedEntityKeyMetadata; | ||
private final String roleOnMainSide; | ||
|
||
public AssociationTypeContextImpl(OptionsContext optionsContext, AssociatedEntityKeyMetadata associatedEntityKeyMetadata, String roleOnMainSide) { | ||
this.optionsContext = optionsContext; | ||
this.associatedEntityKeyMetadata = associatedEntityKeyMetadata; | ||
this.roleOnMainSide = roleOnMainSide; | ||
} | ||
|
||
@Override | ||
public OptionsContext getOptionsContext() { | ||
return optionsContext; | ||
} | ||
|
||
/** | ||
* Provides meta-data about the entity key on the other side of this association. | ||
* | ||
* @return A meta-data object providing information about the entity key on the other side of this information. | ||
*/ | ||
@Override | ||
public AssociatedEntityKeyMetadata getAssociatedEntityKeyMetadata() { | ||
return associatedEntityKeyMetadata; | ||
} | ||
|
||
/** | ||
* Provides the role of the represented association on the main side in case the current operation is invoked for | ||
* the inverse side of a bi-directional association. | ||
* | ||
* @return The role of the represented association on the main side. The association's own role will be returned in | ||
* case this operation is invoked for an uni-directional association or the main-side of a bi-directional | ||
* association. | ||
*/ | ||
@Override | ||
public String getRoleOnMainSide() { | ||
return roleOnMainSide; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "AssociationContext [optionsContext=" + optionsContext + "]"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
core/src/main/java/org/hibernate/ogm/dialect/spi/AssociationTypeContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Hibernate OGM, Domain model persistence for NoSQL datastores | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.ogm.dialect.spi; | ||
|
||
import org.hibernate.ogm.model.key.spi.AssociatedEntityKeyMetadata; | ||
import org.hibernate.ogm.model.spi.Association; | ||
import org.hibernate.ogm.options.spi.OptionsContext; | ||
|
||
/** | ||
* Provides context information to {@link GridDialect}s when accessing {@link Association}s. | ||
* | ||
* @author Guillaume Scheibel <guillaume.scheibel@gmail.com> | ||
* @author Gunnar Morling | ||
*/ | ||
public interface AssociationTypeContext { | ||
|
||
/** | ||
* Returns a context object providing access to the options effectively applying for a given entity or property. | ||
*/ | ||
OptionsContext getOptionsContext(); | ||
|
||
/** | ||
* Provides meta-data about the entity key on the other side of this association. | ||
* | ||
* @return A meta-data object providing information about the entity key on the other side of this information. | ||
*/ | ||
AssociatedEntityKeyMetadata getAssociatedEntityKeyMetadata(); | ||
|
||
/** | ||
* Provides the role of the represented association on the main side in case the current operation is invoked for | ||
* the inverse side of a bi-directional association. | ||
* | ||
* @return The role of the represented association on the main side. The association's own role will be returned in | ||
* case this operation is invoked for an uni-directional association or the main-side of a bi-directional | ||
* association. | ||
*/ | ||
String getRoleOnMainSide(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
core/src/main/java/org/hibernate/ogm/dialect/spi/GridDialectOperationContext.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.