Skip to main content

MGCBallastVersionService

Ballast service for parameter versions: create, read, update, activate, restore and delete a version, find the one effective today, read or stage its stored values, and add or delete rows of its lists. Each operation runs the same code as the version forms, so an automated test exercises exactly what a user does.

Methods​

createVersion​

Creates a Draft version, exactly as the version form's New does: numbered after the latest version, seeded from its predecessor, and filled from the live parameter tables where the predecessor has nothing.

  • Visibility: public
  • Returns: MGCBallastVersionResponseContract The new version.
NameTypeOptionalDescription
_requestMGCBallastVersionRequestContractNoBundle, LegalEntityId (per-company bundles), Name, and optionally Description, FromDate, ToDate.

getVersion​

Reads one version: status, effective state, window, number and lineage.

  • Visibility: public
  • Returns: MGCBallastVersionResponseContract The version, or NotFound.
NameTypeOptionalDescription
_requestMGCBallastVersionRequestContractNoBundle, LegalEntityId (per-company bundles) and VersionRecId.

activateVersion​

Activates a Draft version, as the version form's Activate button does. Publishing is separate: see MGCBallastPublishService.publishNow. On success, Message carries the pre-flight warnings (MGCBallastActivationPreflight): a gap before or after the version, or an overlap with a Planned one.

  • Visibility: public
  • Returns: MGCBallastVersionResponseContract The version after activation.
NameTypeOptionalDescription
_requestMGCBallastVersionRequestContractNoBundle, LegalEntityId (per-company bundles) and VersionRecId.

restoreVersion​

Restores a version into a new Draft carrying its values and lineage, as the version form's Restore does.

  • Visibility: public
  • Returns: MGCBallastVersionResponseContract The new Draft; RestoredFromRecId names the source.
NameTypeOptionalDescription
_requestMGCBallastVersionRequestContractNoBundle, LegalEntityId (per-company bundles), VersionRecId (the source) and optionally Reason.

withdrawVersion​

Withdraws an approved version before it takes effect, as the version form's Withdraw button does: only a Planned version (Approved, From date ahead, never published), and Reason is required. The version becomes Withdrawn and is never published. Not gated by the license, as the button is not: it only stops a change.

  • Visibility: public
  • Returns: MGCBallastVersionResponseContract The version after it is withdrawn.
NameTypeOptionalDescription
_requestMGCBallastVersionRequestContractNoBundle, LegalEntityId (per-company bundles), VersionRecId and Reason; ReasonCode, required once codes are set up for Withdraw, and TicketReference.

deleteVersion​

Deletes a version and its stored values, subject to the same rule as the form: an Active version cannot be deleted. Lets a test clean up the Drafts it created.

  • Visibility: public
  • Returns: MGCBallastVersionResponseContract The version as it was before it was deleted.
NameTypeOptionalDescription
_requestMGCBallastVersionRequestContractNoBundle, LegalEntityId (per-company bundles) and VersionRecId.

updateVersion​

Changes a Draft version's name, description or effective window. Only the fields supplied are changed; a blank Name or Description, or an empty date, leaves that field as it is. An Active version is refused by the version table's own validation, exactly as in the form.

  • Visibility: public
  • Returns: MGCBallastVersionResponseContract The version after the change.
NameTypeOptionalDescription
_requestMGCBallastVersionRequestContractNoBundle, LegalEntityId (per-company bundles), VersionRecId and at least one of Name, Description, FromDate, ToDate.

getEffectiveVersion​

Reads the version effective today for the bundle - the one the publish engine applies - in the requested company. It is also the version a new version is seeded from, so it is what a new version should compare clean against.

  • Visibility: public
  • Returns: MGCBallastVersionResponseContract The effective version, or NotFound when none covers today.
NameTypeOptionalDescription
_requestMGCBallastVersionRequestContractNoBundle and LegalEntityId (per-company bundles).

getVersionValue​

Reads one stored value of a version.

  • Visibility: public
  • Returns: MGCBallastValueResponseContract The value as stored.
NameTypeOptionalDescription
_requestMGCBallastValueRequestContractNoBundle, LegalEntityId (per-company bundles), VersionRecId, TableName, RowKey (list tables) and FieldName.

updateVersionValue​

Stages one value change in a Draft version - what a user does by editing a field on the version form. The value table's own validation refuses an Active version, and the draft-edit capture point records a DraftEdited audit event for the field, as for an edit in the form. Key fields, system fields and the version field cannot be set.

  • Visibility: public
  • Returns: MGCBallastValueResponseContract The value as stored, and PreviousValue.
NameTypeOptionalDescription
_requestMGCBallastValueRequestContractNoBundle, LegalEntityId (per-company bundles), VersionRecId, TableName, RowKey (list tables), FieldName and Value.

addVersionValueRow​

Adds a row to a list table of a Draft version - what a user does with New on a list grid of the version form. RowKey carries the new row's key field values in key order, separated by | (an enum by its name or number); the other fields take their defaults and can then be set with updateVersionValue. The value table's own validation refuses an Active version. Recorded as a DraftEdited audit event.

  • Visibility: public
  • Returns: MGCBallastValueResponseContract The new row's RowKey as the other value operations address it.
NameTypeOptionalDescription
_requestMGCBallastValueRequestContractNoBundle, LegalEntityId (per-company bundles), VersionRecId, TableName and RowKey.

deleteVersionValueRow​

Deletes a row from a list table of a Draft version - Delete on a list grid of the version form. The value table's own validation refuses an Active version. Recorded as a DraftEdited audit event.

  • Visibility: public
  • Returns: MGCBallastValueResponseContract Success, or NotFound when the version has no row with that key.
NameTypeOptionalDescription
_requestMGCBallastValueRequestContractNoBundle, LegalEntityId (per-company bundles), VersionRecId, TableName and RowKey.