Changeset Objects

Sepasoft MES Module Suite

Changeset Objects

Note Inheritance note: Both types extend ConfigurationChangeset and implement OpenChangeset or ClosedChangeset. The methods above are those intended for end-user scripts. Methods such as setNote and setDescription throw on ClosedConfigurationChangeset because closed changesets are immutable.


OpenConfigurationChangeset Object

An open changeset tracks pending MES configuration changes. Users typically obtain it from system.mes.changeset.createNewChangeset() or system.mes.changeset.getOpenConfigurationChangeset(uuid).

getUUID()

Description: Returns the unique identifier of the changeset.

Returns: UUID

Example:

Python
openCs = system.mes.changeset.createNewChangeset()
uuid = openCs.getUUID()
print(str(uuid))

getDescription()

Description: Returns the optional description of the changeset.

Returns: String

setDescription(description)

Description: Sets the description of the changeset. Useful for labeling the changeset before closing.

Parameters:

  • description (String): The description text.

Returns: OpenConfigurationChangeset (for chaining)

Example:

Python
openCs = system.mes.changeset.createNewChangeset()
openCs.setDescription("Recipe updates for Phase 3 validation")

getNote()

Description: Returns the optional note explaining the changeset.

Returns: String

setNote(note)

Description: Sets the note for the changeset. Use for additional context (e.g., reason for changes, ticket reference).

Parameters:

  • note (String): The note text.

Returns: OpenConfigurationChangeset (for chaining)

Example:

Python
openCs.setNote("MES-1234: Adjust batch size limits")

hasChanges()

Description: Returns whether the changeset contains any pending changes. Use to decide whether it is worth closing and applying.

Returns: boolean

Example:

Python
if openCs.hasChanges():
  closedCs = system.mes.changeset.closeChangeset(openCs)
  system.mes.changeset.applyChangeset(closedCs)
else:
  system.mes.changeset.cancelChangeset(openCs, "No changes to apply")

isEmpty()

Description: Returns whether the changeset has no modified objects. Equivalent to checking that no changes have been recorded.

Returns: boolean

Example:

Python
if openCs.isEmpty():
  print("Changeset has no edits yet")

isCancelled()

Description: Returns whether the changeset has been cancelled. Cancelled changesets cannot be closed or applied.

Returns: boolean

getCancelledBy()

Description: Returns the username of the user who cancelled the changeset, or null if not cancelled.

Returns: String or null

getCancelledReason()

Description: Returns the reason provided when the changeset was cancelled, or null if not cancelled.

Returns: String or null

getCancelledAt()

Description: Returns the timestamp when the changeset was cancelled, or null if not cancelled.

Returns: Instant or null

Example:

Python
if openCs.isCancelled():
  print("Cancelled by", openCs.getCancelledBy(), "at", openCs.getCancelledAt())
  print("Reason:", openCs.getCancelledReason())

getDataAsJson()

Description: Returns the full changeset data as a JSON object. Useful for inspection, auditing, or passing to external tools. The returned structure reflects the current in-memory state of the changeset.

Returns: JsonObject (com.inductiveautomation.ignition.common.gson.JsonObject)

Note: For a string representation of a persisted changeset (from disk), use system.mes.changeset.getChangesetJSON(uuid) instead.

Example:

Python
jsonObj = openCs.getDataAsJson()
print(jsonObj.toString())


ClosedConfigurationChangeset Object

A closed changeset is an immutable snapshot of an open changeset. Users typically obtain it from system.mes.changeset.closeChangeset(openChangeset) or system.mes.changeset.getClosedConfigurationChangeset(uuid).

getUUID()

Description: Returns the unique identifier of the changeset.

Returns: UUID

getDescription()

Description: Returns the description of the changeset (copied from the open changeset at close time).

Returns: String

getNote()

Description: Returns the note of the changeset (copied from the open changeset at close time).

Returns: String

isApplied()

Description: Returns whether the changeset has been applied to the live configuration. Once applied, the changes are visible in production.

Returns: boolean

Example:

Python
closedCs = system.mes.changeset.getClosedConfigurationChangeset(str(meta.changesetUUID))
if not closedCs.isApplied():
  result = system.mes.changeset.applyChangeset(closedCs)

getAppliedBy()

Description: Returns the username of the user who applied the changeset, or null if not yet applied.

Returns: String or null

getAppliedAt()

Description: Returns the timestamp when the changeset was applied, or null if not yet applied.

Returns: Instant or null

getAppliedOn()

Description: Returns the UUID (as string) of the changeset that this one was applied on top of, or "INITIAL" if it was the first applied changeset, or null if not yet applied. Used for dependency ordering.

Returns: String or null

getHash()

Description: Returns the SHA-256 hash of the changeset content. Used for integrity verification when transferring or importing changesets.

Returns: String

Example:

Python
closedCs = system.mes.changeset.getClosedConfigurationChangeset(str(meta.changesetUUID))
print("Applied:", closedCs.isApplied(), "by", closedCs.getAppliedBy(), "at", closedCs.getAppliedAt())
print("Hash:", closedCs.getHash())

getDataAsJson()

Description: Returns the full changeset data as a JSON object. Useful for inspection, auditing, or export. The structure is immutable and matches what was captured when the changeset was closed.

Returns: JsonObject (com.inductiveautomation.ignition.common.gson.JsonObject)

Note: For a string representation of the persisted changeset from disk, use system.mes.changeset.getChangesetJSON(uuid) instead.

Example:

Python
jsonObj = closedCs.getDataAsJson()
print(jsonObj.toString())


Sepasoft MES Module Suite