com.softwareag.mdm.service
Interface ProcedureContext


public interface ProcedureContext

This container class mainly provides operations for modifying adaptations' content or state.

See Also:
Procedure

Method Summary
 Adaptation doCopy(Adaptation anAdaptation)
          Copies the adaptation instance specified.
 Adaptation doCreateChild(AdaptationName aParentName, AdaptationReference requestedNameOrNull)
          Creates a new schema instance that is the child of the parent specified by aParentName.
 Adaptation doCreateDeriving(PrimaryKey parentKey, com.softwareag.mdm.adaptation.uifacade.HrNode aNode, AdaptationTable aTable)
          Deprecated. Replaced by doCreateDeriving(ValueContext, ValueContext, AdaptationTable).
 Adaptation doCreateDeriving(ValueContext parentKey, ValueContext aContent, AdaptationTable aTable)
          Creates a deriving occurrence in the table specified.
 Adaptation doCreateOcculting(PrimaryKey parentKey, AdaptationTable aTable)
          Deprecated. Replaced by doCreateOcculting(ValueContext, AdaptationTable).
 Adaptation doCreateOcculting(ValueContext aKey, AdaptationTable aTable)
          Creates an occulting occurrence in the table specified.
 Adaptation doCreateOverwriting(PrimaryKey parentKey, com.softwareag.mdm.adaptation.uifacade.HrNode aNode, AdaptationTable aTable)
          Deprecated. Replaced by doCreateOverwriting(ValueContext, AdaptationTable).
 Adaptation doCreateOverwriting(ValueContext aContent, AdaptationTable aTable)
          Creates an overwriting occurrence in the table specified.
 Adaptation doCreateRoot(SchemaLocation aSchemaLocation, AdaptationReference requestedNameOrNull, com.softwareag.mdm.core.org.OrganizationName owner)
          Deprecated. Replaced by doCreateRoot(SchemaLocation, AdaptationReference, Profile).
 Adaptation doCreateRoot(SchemaLocation aSchemaLocation, AdaptationReference requestedNameOrNull, Profile owner)
          Creates a new root adaptation instance.
 Adaptation doCreateRoot(ValueContext aContent, AdaptationTable aTable)
          Creates a root occurrence in the table specified.
 Adaptation doCreateRootChild(com.softwareag.mdm.adaptation.uifacade.HrNode rootNode, AdaptationTable aContainer)
          Deprecated. Replaced by doCreateRoot(ValueContext, AdaptationTable).
 void doDelete(AdaptationName aName, boolean isDeletingChildren)
          Deletes the adaptation specified.
 Adaptation doEditionDiscard(AdaptationName aName)
          Deprecated. Since version 4.0, the notion of local edition is replaced by the more general concept of branch. This method does nothing, it just returns the adaptation specified.
 Adaptation doEditionRelease(AdaptationName aName)
          Deprecated. Since version 4.0, the notion of local edition is replaced by the more general concept of branch. This method does nothing, it just returns the adaptation specified.
 void doExport(ExportSpec spec)
          Exports the content of an adaptation to a XML document, as specified by the ExportSpec argument.
 void doExportArchive(Archive anArchive)
          Exports the current home to the archive specified.
 void doExportArchive(ArchiveExportSpec exportSpec)
          Exports the archive specified.
 void doImport(ImportSpec spec)
          Imports an XML content into an adaptation, as specified by the ImportSpec argument.
 void doImportArchive(Archive anArchive)
          Imports the archive specified into the current home.
 void doImportArchive(ArchiveImportSpec importSpec)
          Imports the archive specified into the current home.
 void doMergeToParent(AdaptationHome source)
          Merges source branch to current branch.
 Adaptation doModifyContent(Adaptation aTarget, com.softwareag.mdm.adaptation.uifacade.HrNode aRootNode)
          Deprecated. Replaced by doModifyContent(Adaptation, ValueContext).
 Adaptation doModifyContent(Adaptation aTarget, ValueContext aContent)
          Modifies the adaptation content as specified.
 Adaptation doOccult(Adaptation anOccurrence)
          Occults the adaptation occurrence specified.
 void doOptimizeByRefactoring(AdaptationName aName, boolean includeDescendantsWithoutDelegated, boolean includeAllDescendants)
          Execute tree optimization.
 void doOptimizeByRemovingDuplicates(AdaptationName aName, boolean includeDescendantsWithoutDelegated, boolean includeAllDescendants)
          Executes tree optimization.
 AdaptationHome getAdaptationHome()
          Returns the current home.
 int getCommitThreshold()
           
 ValueContextForUpdate getContext(AdaptationName aName)
          Provides an interface for reading and/or updating a persisted content.
 ValueContextForUpdate getContextForNewOccurrence(Adaptation occurrenceToCopy, AdaptationTable aTable)
          Provides an interface for copying a context from an existing occurrence.
 ValueContextForUpdate getContextForNewOccurrence(AdaptationTable aTable)
          Provides an interface for setting values on a context that conforms to any occurrence of the table specified.
 String getExecutionInformation()
           
 Date getExecutionTimestamp()
          Returns the timestamp of the current procedure execution.
 String getExecutionUUIDString()
          Returns a universally unique identifier (UUID) of the current procedure execution.
 com.softwareag.mdm.adaptation.uifacade.HrNode getNodeForCreatingOccurrence(AdaptationTable aTable)
          Deprecated. Replaced by getContextForNewOccurrence(AdaptationTable).
 com.softwareag.mdm.adaptation.uifacade.HrNode getNodeForUpdatingContent(AdaptationName aName)
          Deprecated. Replaced by getContext(AdaptationName).
 Session getSession()
          Returns the current session context.
 boolean hasEdition(Adaptation target)
          Deprecated. Since version 4.0, the notion of local edition is replaced by the more general concept of branch.
 boolean isAllPrivileges()
          Default value is false.
 boolean isHistoryActivation()
           
 boolean isPrivilegeToModifyReferenceBranch()
          Default value is true.
 boolean isTriggerActivation()
           
 void makeOccultationsInChildTable(Adaptation target, Path tablePath)
          Any parent occurrence that is not overwritten will be occulted.
 void setAllPrivileges(boolean allPrivileges)
          If true, disables all the permission checks for future operations performed by the current run.
 void setCommitThreshold(int commitThreshold)
          Sets the maximum size of the transaction so that intermediate commits are done during the execution of the procedure.
 void setExecutionInformation(String aString)
          Specifies some additional information about the current execution.
 void setHistoryActivation(boolean isActivated)
          Enables or disables the detailed description of updates made by the current run.
 void setPrivilegeToModifyReferenceBranch(boolean enable)
          If true, disables the fact that Reference Branch is normally not modified directly.
 void setTriggerActivation(boolean isActivated)
          Enables or disables triggers.
 

Method Detail

doCreateRoot

public Adaptation doCreateRoot(SchemaLocation aSchemaLocation,
                               AdaptationReference requestedNameOrNull,
                               Profile owner)
                        throws OperationException
Creates a new root adaptation instance.

Parameters:
aSchemaLocation - Specifies the schema of the instance to create. It must refer to an existing and correct XML schema .
requestedNameOrNull - Specifies the public and persistant reference of the instance to create. If null, the reference is allocated randomly.
owner - Specifies the profile that will own the newly created instance (required).
Returns:
the newly created schema instance.
Throws:
IllegalArgumentException - if identifier does not conform to AdaptationReference.MAX_LENGTH and AdaptationReference.REFERENCE_PATTERN.
OperationException
See Also:
doCreateChild(AdaptationName, AdaptationReference)

doCreateChild

public Adaptation doCreateChild(AdaptationName aParentName,
                                AdaptationReference requestedNameOrNull)
                         throws OperationException
Creates a new schema instance that is the child of the parent specified by aParentName.

Parameters:
aParentName - Specifies the parent of the instance to create. It must refer to existing instance in the current home.
requestedNameOrNull - Specifies the public and persistant reference of the instance to create. If null, this reference is allocated randomly.
Returns:
the newly created adaptation
Throws:
IllegalArgumentException - if identifier does not conform to AdaptationReference.MAX_LENGTH and AdaptationReference.REFERENCE_PATTERN.
OperationException
See Also:
doCreateRoot(SchemaLocation, AdaptationReference, Profile)

doCreateRoot

public Adaptation doCreateRoot(ValueContext aContent,
                               AdaptationTable aTable)
                        throws OperationException
Creates a root occurrence in the table specified.

Parameters:
aContent - Specifies the content of the occurrence to create. At least, it must define its primary key. An object of this type is obtained by calling a method getContext...(...), for example getContextForNewOccurrence(AdaptationTable).
aTable - Specifies in which table the occurrence is defined.
Returns:
the occurrence that has been created.
Throws:
OperationException

doCreateOverwriting

public Adaptation doCreateOverwriting(ValueContext aContent,
                                      AdaptationTable aTable)
                               throws OperationException
Creates an overwriting occurrence in the table specified.

Parameters:
aContent - Specifies the content of the occurrence to create. At least, it must define its primary key. An object of this type is obtained by calling a method getContext...(...), for example getContextForNewOccurrence(AdaptationTable).
aTable - Specifies in which table the new occurrence will be defined.
Returns:
the occurrence that has been created.
Throws:
OperationException

doCreateOcculting

public Adaptation doCreateOcculting(ValueContext aKey,
                                    AdaptationTable aTable)
                             throws OperationException
Creates an occulting occurrence in the table specified.

Parameters:
aKey - Specifies the key of the parent occurrence to occult. An object of this type is obtained by calling the method getContext(AdaptationName) (the parent reference must be used as argument), or getContextForNewOccurrence(AdaptationTable).
aTable - Specifies in which table the occultation is made.
Returns:
the occurrence that defines the occultation.
Throws:
OperationException
See Also:
getContextForNewOccurrence(AdaptationTable)

doOccult

public Adaptation doOccult(Adaptation anOccurrence)
                    throws OperationException
Occults the adaptation occurrence specified.

Depending on the occurrence specified, this method performs the following operations:

  1. If the occurrence specified is in inherit mode, it creates a new occulting occurrence.
  2. If the occurrence specified is an edition but its release is already occulting, the edition is simply discarded.
  3. If the occurrence specified is overwriting, an edition is created in occulting mode.

Parameters:
anOccurrence - the adaptation occurrence that must be occulted.
Returns:
the occulted occurrence.
Throws:
OperationException - if adaptation specified is not a child occurrence.

doCreateDeriving

public Adaptation doCreateDeriving(ValueContext parentKey,
                                   ValueContext aContent,
                                   AdaptationTable aTable)
                            throws OperationException
Creates a deriving occurrence in the table specified.

Parameters:
parentKey - Specifies the parent of the occurrence to create. Usually it is obtained by calling getContext(AdaptationName) or getContextForNewOccurrence(AdaptationTable).
aContent - Specifies the content of the occurrence to create. At least it must define its primary key. An object of this type is obtained by calling a method getContext...(...), for example getContextForNewOccurrence(AdaptationTable).
aTable - Specifies in which table the occurrence is defined.
Returns:
the occurrence that has been created.
Throws:
OperationException
See Also:
getContext(AdaptationName), getContextForNewOccurrence(AdaptationTable)

doModifyContent

public Adaptation doModifyContent(Adaptation aTarget,
                                  ValueContext aContent)
                           throws OperationException
Modifies the adaptation content as specified. This method transparently applies modifications on schema instances and table occurrences as well. For table occurrences, two specific definition modes are handled as follows:
  1. If the adaptation specified is an inherited occurrence, a new overwriting occurrence is created.
  2. If the adaptation specified is actually an occurrence occultation, it is first transformed to an overwriting occurrence.

Parameters:
aTarget - Specifies the adaptation to modify.
aContent - Specifies the modifications to apply. An object of this type is typically obtained by calling the method getContext(AdaptationName) (with the adaptation to modify passed as parameter).
Returns:
the adaptation that has been modified.
Throws:
OperationException
See Also:
getContext(AdaptationName)

doDelete

public void doDelete(AdaptationName aName,
                     boolean isDeletingChildren)
              throws OperationException
Deletes the adaptation specified.

Parameters:
aName - reference to the adaptation that must be deleted.
isDeletingChildren - if set to true, any children will be also deleted recursively.
Throws:
OperationException

doCopy

public Adaptation doCopy(Adaptation anAdaptation)
                  throws OperationException
Copies the adaptation instance specified. The new adaptation will have the same parent and its reference is allocated randomly.

Returns:
the copied adaptation.
Throws:
OperationException - if adaptation specified is not an instance.

getAdaptationHome

public AdaptationHome getAdaptationHome()
Returns the current home.


doImport

public void doImport(ImportSpec spec)
              throws OperationException
Imports an XML content into an adaptation, as specified by the ImportSpec argument.

This operation is tolerant regarding implicit schema of the XML source. That is, if some elements do not exist in target's schema, they are simply ignored.

The resulting adaptation may have validation errors, however for some integrity constraints violations, an exception is thrown (for example, if a primary key is not unique).

Parameters:
spec - definition of the import.
Throws:
OperationException - if an error occurs during the operation (for example an integrity constraint is violated in the source content).
See Also:
doExport(ExportSpec)

doExport

public void doExport(ExportSpec spec)
              throws OperationException
Exports the content of an adaptation to a XML document, as specified by the ExportSpec argument.

Parameters:
spec - definition of the export.
Throws:
OperationException - if an error occurs during the operation.
See Also:
doImport(ImportSpec)

doExportArchive

public void doExportArchive(Archive anArchive)
                     throws OperationException
Exports the current home to the archive specified.

Throws:
OperationException
See Also:
doExportArchive(ArchiveExportSpec)

doExportArchive

public void doExportArchive(ArchiveExportSpec exportSpec)
                     throws OperationException
Exports the archive specified.

Throws:
OperationException
See Also:
doImportArchive(ArchiveImportSpec)

doImportArchive

public void doImportArchive(Archive anArchive)
                     throws OperationException
Imports the archive specified into the current home.

Import principles

The behaviour of this method depends on the content of the archive. For each instance in the archive:

Permission Warning

This method disables all permission checks (as it is done by setAllPrivileges(boolean)). Therefore, it is important before calling this method, to guarantee that the current session is actually able to execute the import.

For more information, see ServicePermission and Session.isUserInRole(Profile).

Throws:
OperationException
See Also:
doImportArchive(ArchiveImportSpec)

doImportArchive

public void doImportArchive(ArchiveImportSpec importSpec)
                     throws OperationException
Imports the archive specified into the current home.

Import principles

Only the instances selected by the ArchiveImportSpec are imported. Then, for each instance in the import selection, the behaviour of this method depends on the content of the archive:

Permission Warning

This method disables all permission checks (as it is done by setAllPrivileges(boolean)). Therefore, it is important before calling this method, to guarantee that the current session is actually able to execute the import.

For more information, see ServicePermission and Session.isUserInRole(Profile).

Throws:
OperationException
See Also:
doExportArchive(ArchiveExportSpec)

doMergeToParent

public void doMergeToParent(AdaptationHome source)
                     throws OperationException
Merges source branch to current branch. All conflicts are solved by applying all the updates between the initial and current states of the source to the current branch.

Parameters:
source - AdaptationHome source branch to merge to current branch
Throws:
IllegalArgumentException - when source is :
  • Reference branch
  • a version
  • null
  • not a child of the current branch
OperationException - when the merge fails

doOptimizeByRemovingDuplicates

public void doOptimizeByRemovingDuplicates(AdaptationName aName,
                                           boolean includeDescendantsWithoutDelegated,
                                           boolean includeAllDescendants)
                                    throws OperationException
Executes tree optimization.

The optimization is made by comparing the adaptation specified by aName (say A) and each descendant specified (say B). For all A and B pairs, each node pair is compared: if the value of a B node is defined and is equals to the corresponding value of A node, then value in B is set to "inherited".

Throws:
OperationException

doOptimizeByRefactoring

public void doOptimizeByRefactoring(AdaptationName aName,
                                    boolean includeDescendantsWithoutDelegated,
                                    boolean includeAllDescendants)
                             throws OperationException
Execute tree optimization.

Throws:
OperationException

makeOccultationsInChildTable

public void makeOccultationsInChildTable(Adaptation target,
                                         Path tablePath)
                                  throws OperationException
Any parent occurrence that is not overwritten will be occulted. Does nothing if target is root.

Throws:
OperationException

getCommitThreshold

public int getCommitThreshold()
See Also:
setCommitThreshold(int)

setCommitThreshold

public void setCommitThreshold(int commitThreshold)
Sets the maximum size of the transaction so that intermediate commits are done during the execution of the procedure.

If commitThreshold > 0, a commit will be done every times the amout of current changes is equal to commitThreshold. If commitThreshold = 0, only one commit is done (after the procedure execution returns).

If not specified, the commit threshold is 0.

Internally, table records are gathered by blocks and a change relates to one block. It means that if several records are updated (created, modified or deleted) in the same block, this will be counted as only one change. Since a block groups up to 100 records, the number of records actually updated in a single commit is consequently obtained by the following formula:

commitThreshold <= Nrecords <= 100 * commitThreshold

For example, for an initial import, if the commit threshold is set to 50, a commit will occur periodically for at most 5000 record creations.

Concerning relational database transaction size, the number of SQL queries will be:

Nqueries = commitThreshold * i, where i belongs to [2;5]

Here i depends on the average size of the serialized representation of a record.

Throws:
IllegalArgumentException - if commitThreshold < 0.

isHistoryActivation

public boolean isHistoryActivation()
See Also:
setHistoryActivation(boolean)

setHistoryActivation

public void setHistoryActivation(boolean isActivated)
Enables or disables the detailed description of updates made by the current run.

If not specified, the detailed description of updates is disabled. For mass-updates a detailed description can imply an expensive memory cost.


isTriggerActivation

public boolean isTriggerActivation()
See Also:
setTriggerActivation(boolean)

setTriggerActivation

public void setTriggerActivation(boolean isActivated)
Enables or disables triggers.

If not specified, the triggers are enabled.


getExecutionInformation

public String getExecutionInformation()
See Also:
setExecutionInformation(String)

setExecutionInformation

public void setExecutionInformation(String aString)
Specifies some additional information about the current execution.

If specified, the information is displayed in the history log. If not specified, only the procedure class name is displayed.

The execution information plays a similar role as session tracking info, but in a more local way (in the context of a single execution).

See Also:
Session.getTrackingInfo()

isAllPrivileges

public boolean isAllPrivileges()
Default value is false.

See Also:
setAllPrivileges(boolean)

setAllPrivileges

public void setAllPrivileges(boolean allPrivileges)
If true, disables all the permission checks for future operations performed by the current run. If false, sets the default mode that enables usual permission checks.

Warning

When a procedure disables all permission checks, it is important, before running it or during its execution, to guarantee that the session is actually able to execute the procedure.

Note

Setting all privileges to true does not set privilege to modify Reference Branch.

See Also:
ServicePermission, Session.isUserInRole(Profile), setPrivilegeToModifyReferenceBranch(boolean)

isPrivilegeToModifyReferenceBranch

public boolean isPrivilegeToModifyReferenceBranch()
Default value is true.

See Also:
setPrivilegeToModifyReferenceBranch(boolean)

setPrivilegeToModifyReferenceBranch

public void setPrivilegeToModifyReferenceBranch(boolean enable)
If true, disables the fact that Reference Branch is normally not modified directly. If false, sets the default mode that forbids any direct modification onto Reference Branch content.

See Also:
setAllPrivileges(boolean)

getContextForNewOccurrence

public ValueContextForUpdate getContextForNewOccurrence(AdaptationTable aTable)
Provides an interface for setting values on a context that conforms to any occurrence of the table specified. This context is useful for specifying a parent or a new root occurrence.

See Also:
doCreateRoot(ValueContext, AdaptationTable), doCreateOverwriting(ValueContext, AdaptationTable)

getContextForNewOccurrence

public ValueContextForUpdate getContextForNewOccurrence(Adaptation occurrenceToCopy,
                                                        AdaptationTable aTable)
Provides an interface for copying a context from an existing occurrence. This context is useful for specifying a parent or a new root occurrence.

See Also:
doCreateRoot(ValueContext, AdaptationTable), doCreateOverwriting(ValueContext, AdaptationTable)

getContext

public ValueContextForUpdate getContext(AdaptationName aName)
Provides an interface for reading and/or updating a persisted content.

See Also:
doModifyContent(Adaptation, ValueContext), doCreateOcculting(ValueContext, AdaptationTable)

getExecutionTimestamp

public Date getExecutionTimestamp()
Returns the timestamp of the current procedure execution.


getExecutionUUIDString

public String getExecutionUUIDString()
Returns a universally unique identifier (UUID) of the current procedure execution. This identifier is logged into history and may be used for example in exports so as to identify them.

The UUID format used is the hexadecimal representation of UUID Leach-Salz variant, version 1 (time-based).

For more information, see the Internet-Draft UUIDs and GUIDs or the standards body definition at ISO/IEC 11578:1996 .


getSession

public Session getSession()
Returns the current session context.


doCreateRoot

public Adaptation doCreateRoot(SchemaLocation aSchemaLocation,
                               AdaptationReference requestedNameOrNull,
                               com.softwareag.mdm.core.org.OrganizationName owner)
                        throws OperationException
Deprecated. Replaced by doCreateRoot(SchemaLocation, AdaptationReference, Profile).

Creates a new root adaptation instance.

Parameters:
aSchemaLocation - Specifies the schema of the instance to create. It must refer to an existing and correct XML schema .
requestedNameOrNull - Specifies the public and persistant reference of the instance to create. If null, the reference is allocated randomly.
owner - Specifies the name of the organization that will own the newly created instance. If null, the default provider organization is taken.
Returns:
the newly created instance.
Throws:
IllegalArgumentException - if identifier does not conform to AdaptationReference.MAX_LENGTH and AdaptationReference.REFERENCE_PATTERN.
OperationException
See Also:
doCreateChild(AdaptationName, AdaptationReference)

hasEdition

public boolean hasEdition(Adaptation target)
Deprecated. Since version 4.0, the notion of local edition is replaced by the more general concept of branch.

Always returns false.


doEditionRelease

public Adaptation doEditionRelease(AdaptationName aName)
                            throws OperationException
Deprecated. Since version 4.0, the notion of local edition is replaced by the more general concept of branch. This method does nothing, it just returns the adaptation specified.

Returns:
the adaptation specified, null if it does not exist in the current home.
Throws:
OperationException
See Also:
Repository

doEditionDiscard

public Adaptation doEditionDiscard(AdaptationName aName)
                            throws OperationException
Deprecated. Since version 4.0, the notion of local edition is replaced by the more general concept of branch. This method does nothing, it just returns the adaptation specified.

Returns:
the adaptation specified, null if it does not exist in the current home.
Throws:
OperationException
See Also:
Repository

doModifyContent

public Adaptation doModifyContent(Adaptation aTarget,
                                  com.softwareag.mdm.adaptation.uifacade.HrNode aRootNode)
                           throws OperationException
Deprecated. Replaced by doModifyContent(Adaptation, ValueContext).

Throws:
OperationException

getNodeForUpdatingContent

public com.softwareag.mdm.adaptation.uifacade.HrNode getNodeForUpdatingContent(AdaptationName aName)
Deprecated. Replaced by getContext(AdaptationName).


getNodeForCreatingOccurrence

public com.softwareag.mdm.adaptation.uifacade.HrNode getNodeForCreatingOccurrence(AdaptationTable aTable)
Deprecated. Replaced by getContextForNewOccurrence(AdaptationTable).


doCreateDeriving

public Adaptation doCreateDeriving(PrimaryKey parentKey,
                                   com.softwareag.mdm.adaptation.uifacade.HrNode aNode,
                                   AdaptationTable aTable)
                            throws OperationException
Deprecated. Replaced by doCreateDeriving(ValueContext, ValueContext, AdaptationTable).

Throws:
OperationException

doCreateOcculting

public Adaptation doCreateOcculting(PrimaryKey parentKey,
                                    AdaptationTable aTable)
                             throws OperationException
Deprecated. Replaced by doCreateOcculting(ValueContext, AdaptationTable).

Throws:
OperationException

doCreateOverwriting

public Adaptation doCreateOverwriting(PrimaryKey parentKey,
                                      com.softwareag.mdm.adaptation.uifacade.HrNode aNode,
                                      AdaptationTable aTable)
                               throws OperationException
Deprecated. Replaced by doCreateOverwriting(ValueContext, AdaptationTable).

Throws:
OperationException

doCreateRootChild

public Adaptation doCreateRootChild(com.softwareag.mdm.adaptation.uifacade.HrNode rootNode,
                                    AdaptationTable aContainer)
                             throws OperationException
Deprecated. Replaced by doCreateRoot(ValueContext, AdaptationTable).

Throws:
OperationException


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