public final class RelationshipReference extends AbstractAttributedType implements Relationship
Adapter class that encapsulates a target Relationship
instance and provides additional methods
to resolve the referenced IdentityType
instances.
This class is particularly used when using multiple stores to store different identity and relationship types. In this scenario, the referenced identity type may not be stored in the same store of the relationship, which requires to hold only an identifier-based reference to the referenced type.
Relationship.RELATIONSHIP_QUERY_ATTRIBUTE
AttributedType.QUERY_ATTRIBUTE
IDENTITY
ID
Constructor and Description |
---|
RelationshipReference(Relationship relationship) |
Modifier and Type | Method and Description |
---|---|
void |
addIdentityTypeReference(String descriptor,
String referencedId)
Add a reference to a
IdentityType . |
static String |
formatId(IdentityType identityType)
Return a formatted string representing the reference to the given
IdentityType . |
Set<String> |
getDescriptors()
Returns a
Set of strings representing all registered identity type references. |
String |
getId()
Returns the unique identifier for this instance
|
String |
getIdentityType(String descriptor)
Return the type given a descriptor.
|
String |
getIdentityTypeId(String descriptor)
Return the identifier of the identity type referenced by the descriptor.
|
String |
getPartitionId(String descriptor)
Return the identifier of the partition where the identity type is stored.
|
Relationship |
getRelationship()
Return the target relationship instance.
|
equals, getAttribute, getAttributes, getAttributesMap, hashCode, removeAttribute, setAttribute, setId
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getAttribute, getAttributes, removeAttribute, setAttribute, setId
public RelationshipReference(Relationship relationship)
public String getId()
AttributedType
getId
in interface AttributedType
getId
in class AbstractAttributedType
public void addIdentityTypeReference(String descriptor, String referencedId)
Add a reference to a IdentityType
.
descriptor
- The descriptor for the identity type. The descriptor usually matches the property name on the
target
relationship instance used to store the identity type instance.referencedId
- The identifier of the identity type.public Set<String> getDescriptors()
Returns a Set
of strings representing all registered identity type references.
Descriptors have a format: typeName:partitionId:identityTypeId
.
public String getIdentityType(String descriptor)
Return the type given a descriptor.
descriptor
- public String getPartitionId(String descriptor)
Return the identifier of the partition where the identity type is stored.
descriptor
- public String getIdentityTypeId(String descriptor)
Return the identifier of the identity type referenced by the descriptor.
descriptor
- public Relationship getRelationship()
Return the target relationship instance.
public static String formatId(IdentityType identityType)
Return a formatted string representing the reference to the given IdentityType
.
identityType
- Copyright © 2018 JBoss by Red Hat. All rights reserved.