com.softwareag.mdm.adaptation
Class Adaptation

java.lang.Object
  extended bycom.softwareag.mdm.adaptation.ReadContext
      extended bycom.softwareag.mdm.adaptation.Adaptation

public class Adaptation
extends ReadContext

Provides a read-only access facade to Master Data values.

An adaptation represents either a XML Schema instance or a table occurrence (see Table definition).

Adaptations Tree and Inheritance

An adaptation has a parent adaptation (unless it is a root) and it can have children. Moreover common Master Data values can be factorized, this is the inheritance mechanism.

An adaptations inherits the values it does not define itself from its parent adaptation. This process is recursive, possibly up to the node's default value, that can be specified in associated XML Schema. If schema node itself does not define a default value, null is then returned.

Access to a value

Values in an adaptation are organized in a tree structure conforming to the underlying Adaptation Model (XML Schema document). Each value is accessed by means of a path. For reliability and performance, it is advised to use path generated as Java constants (see schema bindings).

Only terminal adaptation nodes hold actually values.

The interface ValueContext provides equivalent access functionalities. However an absolute path is not interpreted the same way by both type:

See Also:
ValueContext

Field Summary
 
Fields inherited from class com.softwareag.mdm.adaptation.ReadContext
KEY
 
Method Summary
 ActivationStatus checkActivable()
          Returns a status telling whether this adaptation can be used externally (mainly it is activated and it has no validation errors).
 AdaptationName getAdaptationName()
          Returns the name that uniquely identifies this adaptation in the repository.
 AdaptationNode getAdaptationNode(Path aPath)
          Deprecated. Replaced by getSchemaNode().
 Adaptation getContainer()
          If this adaptation is a table occurrence, returns the instance that contains it; returns null if this adaptation is an instance.
 AdaptationTable getContainerTable()
          If this is an occurrence, returns the table that contains it; returns null if this is an instance.
 String getDescription(Locale aLocale)
          Returns the descption corresponding to the given locale.
 Profile getDistributor()
          Returns the distributor of this adaptation, null if it is not an agreement or under an agreement.
 com.softwareag.mdm.core.org.OrganizationName getDistributorName()
          Deprecated.  
 AdaptationHome getHome()
          Returns the home which contains this instance.
 String getLabel(Locale aLocale)
          Returns the instance label corresponding to the given locale.
 String getLabelOrName(Locale aLocale)
          Returns the instance label corresponding to the given locale.
 String getModuleName()
          Returns the name of the module that holds the schema document.
 DefinitionMode getOccurrenceDefinitionMode()
          Returns the definition mode of this occurrence.
 PrimaryKey getOccurrencePrimaryKey()
          Returns the primary key of this occurrence.
 Profile getProvider()
          Returns the owner of this adaptation.
 com.softwareag.mdm.core.org.OrganizationName getProviderName()
          Deprecated.  
 SchemaLocation getSchemaLocation()
          Returns the location of the schema document.
 SchemaNode getSchemaNode()
          Returns the root schema node of this adaptation.
 Date getTimeOfCreation()
          Returns the time of the creation of this adaptation.
 Date getTimeOfLastModification()
          Returns the time of the last modification of this adaptation.
 AdaptationReference getTreeReference()
          Returns the name that uniquely identifies the tree of this adaptation in the repository.
 Adaptation getUpToDateInstance()
          Returns an up-to-date instance.
 String getUrlResourceRelative(Path aPath)
          Deprecated.  
 ValidationReport getValidationReport()
          Returns the validation status of this instance regarding its schema definition.
 Object getValueWithoutResolution(Path aPath)
          Returns the own value hold by the node specified.
 boolean isActivated()
          Returns true if this adaptation is activated, however its activation status is valid.
 boolean isAgreement()
          Returns true if this adaptation is an agreement between the provider and a distributor, false otherwise.
 boolean isAgreementDescendant()
          Returns true if this adaptation has an agreement in its ancestors, false otherwise.
 boolean isDeleted()
          Returns true if this adaptation has been deleted.
 boolean isEditionOfRelease()
          Deprecated. Replaced by the method isNewOrModifiedInCurrentBranch().
 boolean isNewOrModifiedInCurrentBranch()
          Returns true if we are in a branch and, regarding the initial version of this branch, this adaptation is newly created or it has been updated.
 boolean isObsolete()
          This instance is obsolete if a new call to getUpToDateInstance() returns a more recent content or null (that is, adaptation has been deleted).
 boolean isOccurrenceHidden()
          Returns true if this adaptation is a table occurrence that is in occulting mode or in edition-delete state.
 boolean isOccurrenceInheriting()
          Returns true if this adaptation is a table ocurrence in inherit mode.
 boolean isOccurrenceOcculting()
          Returns true if this adaptation is a table ocurrence in occulting mode.
 boolean isRelease()
          Deprecated. Replaced by the opposite result of method isNewOrModifiedInCurrentBranch().
 boolean isRootAdaptation()
          Returns true if this adaptation is root (it has no parent adaptation).
 boolean isSchemaDefinitionCompliant(boolean strictValidation)
          Returns true if this adaptation instance has no errors (and no warnings if strictValidation is true).
 boolean isSchemaInstance()
          Returns true if this adaptation is a schema instance, not a table occurrence.
 boolean isTableOccurrence()
          Returns true if this adaptation is a table occurrence, not a schema instance.
 boolean isTemporaryActivation()
          Tests if this adaptation comes from a temporary activation.
 void toHtmlString(Writer aWriter)
          For debugging purpose, adds an HTML representation to the writer specified.
 String toPublicReference()
          Returns a string that identifies this object from the user's point of view.
 String toString()
           
 String toXPathExpression()
          For an occurrence, this method returns the XPath expression that selects it in the instance.
 
Methods inherited from class com.softwareag.mdm.adaptation.ReadContext
formatValue, formatValue, formatValues, get_boolean, get_int, get, getDate, getDescription, getLabel, getList, getLocale, getNomenclatureItemLabel, getResourcePathInModule, getResourcePathWithModule, getString, getTable, isEndUserDebug
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

checkActivable

public ActivationStatus checkActivable()
Returns a status telling whether this adaptation can be used externally (mainly it is activated and it has no validation errors).

When this adaptation is a temporary activation, the number of times this method is called on same instance is meaningful (in case of a temporary activation, the first call will return OK but next calls will say that a temporary activation is activable only once (see ActivationStatus.isTemporaryAlreadyActivated()).


getAdaptationNode

public AdaptationNode getAdaptationNode(Path aPath)
                                 throws PathAccessException
Deprecated. Replaced by getSchemaNode().

Returns the node specified.

Throws:
PathAccessException - if aPath does not refer to an adaptable node in the underlying type tree structure.

getContainerTable

public AdaptationTable getContainerTable()
If this is an occurrence, returns the table that contains it; returns null if this is an instance.


getContainer

public Adaptation getContainer()
If this adaptation is a table occurrence, returns the instance that contains it; returns null if this adaptation is an instance.


getAdaptationName

public AdaptationName getAdaptationName()
Returns the name that uniquely identifies this adaptation in the repository.


getTreeReference

public AdaptationReference getTreeReference()
Returns the name that uniquely identifies the tree of this adaptation in the repository. All the instances in a tree share the same reference and it is the reference of the root instance.

If this adaptatiion is an occurrence, then the returned reference is the one of its container instance tree.


getHome

public AdaptationHome getHome()
Returns the home which contains this instance.


getLabel

public String getLabel(Locale aLocale)

Returns the instance label corresponding to the given locale.

Returns null if no label exists for the locale.


getLabelOrName

public String getLabelOrName(Locale aLocale)

Returns the instance label corresponding to the given locale.

Returns the instance reference if no label exists for the locale.


getDescription

public String getDescription(Locale aLocale)

Returns the descption corresponding to the given locale.

Returns null if no description exists for the locale.


getDistributor

public Profile getDistributor()
Returns the distributor of this adaptation, null if it is not an agreement or under an agreement.

The distributor profile is defined only in the context of an agreement.

See Also:
getProvider()

getDistributorName

public com.softwareag.mdm.core.org.OrganizationName getDistributorName()
Deprecated.  

See Also:
getDistributor()

getModuleName

public String getModuleName()
Returns the name of the module that holds the schema document.

See Also:
getSchemaLocation(), SchemaLocation.getModuleName()

getSchemaLocation

public SchemaLocation getSchemaLocation()
Returns the location of the schema document.


getValueWithoutResolution

public Object getValueWithoutResolution(Path aPath)
Returns the own value hold by the node specified. There are four possibilities:
  1. If actual value is inherited, it returns AdaptationValue.INHERIT_VALUE.
  2. If actual value is not inherited and not null, it returns the object defined (it must be an instance of the node's type).
  3. If actual value is set to null (not inherited), it returns null.
  4. If node specified does not exist, it returns AdaptationValue.INHERIT_VALUE.

Parameters:
aPath - location of the node, only an absolute path is supported (if this adaptation is a table occurrence, path begins at the root of the occurrence).
See Also:
ReadContext.get(Path)

getProvider

public Profile getProvider()
Returns the owner of this adaptation.

See Also:
getDistributor()

getProviderName

public com.softwareag.mdm.core.org.OrganizationName getProviderName()
Deprecated.  

See Also:
getProvider()

getUpToDateInstance

public Adaptation getUpToDateInstance()
Returns an up-to-date instance.

This method has the same result as ada.getHome().findAdaptationOrNull(ada.getAdaptationName()).


getUrlResourceRelative

public String getUrlResourceRelative(Path aPath)
Deprecated.  

Replaced by method getResourcePathWithModule().


isActivated

public boolean isActivated()
Returns true if this adaptation is activated, however its activation status is valid.

See Also:
checkActivable()

isAgreement

public boolean isAgreement()
Returns true if this adaptation is an agreement between the provider and a distributor, false otherwise.


isAgreementDescendant

public boolean isAgreementDescendant()
Returns true if this adaptation has an agreement in its ancestors, false otherwise. An agreement itself returns false


isDeleted

public boolean isDeleted()
Returns true if this adaptation has been deleted. In this case it is also considered as obsolete.

See Also:
isObsolete()

isObsolete

public boolean isObsolete()
This instance is obsolete if a new call to getUpToDateInstance() returns a more recent content or null (that is, adaptation has been deleted).

See Also:
isDeleted()

isSchemaInstance

public boolean isSchemaInstance()
Returns true if this adaptation is a schema instance, not a table occurrence.

This is the opposite of isTableOccurrence().


isTableOccurrence

public boolean isTableOccurrence()
Returns true if this adaptation is a table occurrence, not a schema instance.

This is the opposite of isSchemaInstance().


isNewOrModifiedInCurrentBranch

public boolean isNewOrModifiedInCurrentBranch()
Returns true if we are in a branch and, regarding the initial version of this branch, this adaptation is newly created or it has been updated. It returns false if either the current home is a version or if this instance has not been modified since the initial version of the branch.

Note: the modification criterium does not include the modification on inherited values, inherited occurrences and inherited structure. For a schema instance, it does not include modifications on its tables.

See Also:
getTimeOfLastModification()

isEditionOfRelease

public boolean isEditionOfRelease()
Deprecated. Replaced by the method isNewOrModifiedInCurrentBranch().


isRelease

public boolean isRelease()
Deprecated. Replaced by the opposite result of method isNewOrModifiedInCurrentBranch().


isRootAdaptation

public boolean isRootAdaptation()
Returns true if this adaptation is root (it has no parent adaptation).

If this adaptation is a table occurrence, the method always returns false.


isTemporaryActivation

public boolean isTemporaryActivation()
Tests if this adaptation comes from a temporary activation.

A temporary activation is created by webMethods Master Data Manager, for preview or test purpose.


toHtmlString

public void toHtmlString(Writer aWriter)
Description copied from class: ReadContext
For debugging purpose, adds an HTML representation to the writer specified. The table displays hierarchically the values in this context.

Specified by:
toHtmlString in class ReadContext

toString

public String toString()

toPublicReference

public String toPublicReference()
Returns a string that identifies this object from the user's point of view.

See Also:
getAdaptationName()

getSchemaNode

public SchemaNode getSchemaNode()
Returns the root schema node of this adaptation.


getTimeOfCreation

public Date getTimeOfCreation()
Returns the time of the creation of this adaptation.


getTimeOfLastModification

public Date getTimeOfLastModification()
Returns the time of the last modification of this adaptation.

If this adaptation is a schema instance, not an occurrence, the time returned does not take into account modifications done on contained table occurrences. It is updated only for local modifications.

See Also:
isNewOrModifiedInCurrentBranch()

getOccurrencePrimaryKey

public PrimaryKey getOccurrencePrimaryKey()
Returns the primary key of this occurrence.

If this adaptation is a schema instance, not an occurrence, the method returns null.


getOccurrenceDefinitionMode

public DefinitionMode getOccurrenceDefinitionMode()
Returns the definition mode of this occurrence.

If this adaptation is a schema instance, not an occurrence, the method returns null.


toXPathExpression

public String toXPathExpression()
For an occurrence, this method returns the XPath expression that selects it in the instance.

Example :

/root/categoryX/tableY[pkey1="A01" and pkey2="666"]

If this adaptation is a schema instance, not an occurrence, the method always returns "/" (root path).

See Also:
AdaptationTable.createRequestResult(String)

isOccurrenceInheriting

public boolean isOccurrenceInheriting()
Returns true if this adaptation is a table ocurrence in inherit mode.

If this adaptation is a schema instance, not an occurrence, the method always returns false.


isOccurrenceOcculting

public boolean isOccurrenceOcculting()
Returns true if this adaptation is a table ocurrence in occulting mode.

If this adaptation is a schema instance, not an occurrence, the method always returns false.


isOccurrenceHidden

public boolean isOccurrenceHidden()
Returns true if this adaptation is a table occurrence that is in occulting mode or in edition-delete state.

If this adaptation is a schema instance, not an occurrence, the method always returns false.


isSchemaDefinitionCompliant

public boolean isSchemaDefinitionCompliant(boolean strictValidation)
Returns true if this adaptation instance has no errors (and no warnings if strictValidation is true).

Parameters:
strictValidation - specifies whether warnings are taken into account for compliance.
Throws:
IllegalStateException - If this adaptation is a table occurrence.
See Also:
getValidationReport()

getValidationReport

public ValidationReport getValidationReport()
Returns the validation status of this instance regarding its schema definition.

Note: the report returned by this method is not mutable in the sense that it will not be affected by udpates done after this method is called.

Throws:
IllegalStateException - If this adaptation is a table occurrence.
See Also:
isSchemaDefinitionCompliant(boolean), AdaptationHome.getValidationReportsMap(Severity), Consistency and validation


(report a bug)
webMethods MDM 4.2.8 [0558]
Copyright Software AG 2000-2007. All rights reserved.