SMILA (incubation) API documentation

org.eclipse.smila.datamodel.id
Interface Id

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
IdImpl

public interface Id
extends java.io.Serializable

Interface for Ids of SMILA records. A record Id must contain:

During processing, the record Id may be be extended: Because Ids must be immutable objects to be used as hash keys, extending an Id means to create a new Id with the additional part. Ids which contain fragment names already cannot be extended by new element keys.

Author:
jschumacher

Method Summary
 Id createCompoundId()
          create a new Id for the containing compund of this Id.
 Id createElementId(Key elementKey)
          create a new Id from this Id by adding a container element key.
 Id createElementId(java.lang.String elementName)
          create a new Id from this Id by adding a simple unnamed container element key.
 Id createFragmentId(java.lang.String framentName)
          create a new Id from this Id by adding a fragment name.
 java.util.List<? extends Key> getElementKeys()
          get the list of container element keys.
 java.util.List<java.lang.String> getFragmentNames()
          get the list of fragment names.
 java.lang.String getIdHash()
          Create a hash string for this Id that can be used by databases as simple primary key.
 Key getKey()
          key of the source object with respect to the data source configuration.
 java.lang.String getSource()
          name of the data source containing the object.
 boolean hasElementKeys()
          check if this Id contains element keys.
 boolean hasFragmentNames()
          check if this Id contains fragment names.
 

Method Detail

getSource

java.lang.String getSource()
name of the data source containing the object.

Returns:
data source name.

getKey

Key getKey()
key of the source object with respect to the data source configuration.

Returns:
source object key.

hasElementKeys

boolean hasElementKeys()
check if this Id contains element keys.

Returns:
true if this contains element keys, else false.

getElementKeys

java.util.List<? extends Key> getElementKeys()
get the list of container element keys. The implementation must ensure that a modification of this list does not modify the Id.

Returns:
list of container element keys.

hasFragmentNames

boolean hasFragmentNames()
check if this Id contains fragment names.

Returns:
true if this contains fragment names, else false.

getFragmentNames

java.util.List<java.lang.String> getFragmentNames()
get the list of fragment names. The implementation must ensure that a modification of this list does not modify the Id.

Returns:
list of fragment names.

createElementId

Id createElementId(Key elementKey)
                   throws IdHandlingException
create a new Id from this Id by adding a container element key.

Parameters:
elementKey - the container element key
Returns:
an extended for the container element.
Throws:
IdHandlingException - if this cannot be extended with element keys, because it contains fragment names already.

createElementId

Id createElementId(java.lang.String elementName)
                   throws IdHandlingException
create a new Id from this Id by adding a simple unnamed container element key.

Parameters:
elementName - the key value of the container element
Returns:
an extended for the container element.
Throws:
IdHandlingException - if this cannot be extended with element keys, because it contains fragment names already.

createFragmentId

Id createFragmentId(java.lang.String framentName)
create a new Id from this Id by adding a fragment name.

Parameters:
framentName - name of the fragment
Returns:
an extended Id for the fragment.

createCompoundId

Id createCompoundId()
                    throws IdHandlingException
create a new Id for the containing compund of this Id. This is the Id derived by removing the last fragment name, if this Id has fragments or the last container element key, if it only has elements keys. If this Id has neither element keys nor fragment names, an exception is thrown.

Returns:
Id of the compound containing this Id.
Throws:
IdHandlingException - if this is not a compund part Id.

getIdHash

java.lang.String getIdHash()
Create a hash string for this Id that can be used by databases as simple primary key. The implementation must make sure that different Ids lead to different Id hashes.

Returns:
a hash string for this Id

SMILA (incubation) API documentation