Sepasoft MES Module Suite
trace.getOperationObjectsAsJava(operationID)
Overview
Retrieves all MES objects associated with a traceability operation identified by its user-provided userID.
Returns live Java AbstractMESObject instances so scripts can call object methods directly—for example, reading material properties on a response segment or inspecting lot references—without working through serialized Python dictionaries. Use this when you need full object behavior after recording or modifying an operation with recordOperation() or modifyOperation().
|
Available in MES 3.81.6 RC 3 and later. |
Syntax
Python |
system.mes.trace.getOperationObjectsAsJava(userID) |
Parameters
Parameter | Type | Required | Description |
|---|---|---|---|
userID | String | Required | User-defined ID supplied when the operation was recorded with recordOperation(). Must match exactly one operations response in the database. |
Return Value
Type | Description |
|---|---|
List (Java) | Live MES objects linked to the operation. Each element is an AbstractMESObject subclass. When the operation is found, the list always includes at least the OperationsResponse object, followed by response segments and their associated references. |
Objects included
The list is built from the matching Operations Response, its Response Segment(s), and each segment's associated references. Duplicate UUIDs appear only once.
Object type | Description |
|---|---|
OperationsResponse | The top-level operation response for the userID. Always included when the operation is found. |
ResponseSegment | Response segment(s) attached to the operation. |
MaterialLot | Lots consumed or created by material properties on the segment. |
Material | Material definition references from material properties. |
Equipment | Segment equipment, material storage equipment, and supplemental equipment references. |
Person | Personnel assigned to the operation. |
Associated references come from each segment's equipment, material, supplemental equipment, and personnel properties. Objects without resolvable MES object info are skipped.
Scope / Availability
Context | Available |
|---|---|
Gateway scripts (TraceGatewayScript) | Yes |
Client / Designer scripts (TraceClientScript) | Yes (via RPC to gateway) |
Registered under system.mes.trace.
Excluded / Edge Cases
Operation not found — Raises IllegalArgumentException if no operations response exists for userID, or if userID is blank, null, or matches more than one operation.
No partial match — Lookup is by exact userID on the operations response; wildcards are not supported.
Disabled operations — Disabled operations can still be retrieved if the userID matches a stored operations response.
Property data vs. linked objects — Material quantities, timestamps, and other property fields live on the ResponseSegment complex properties (getMaterialProperties(), getPersonnelProperties(), and so on). The returned list contains the referenced MES objects (lots, equipment, persons), not separate objects for each property row.
Prefer Python dictionaries — Use getOperationObjectsAsPython() when you only need read-only, JSON-like data structures and do not need to call Java methods or save objects.
Example Usage
Minimal example
Retrieve objects for a previously recorded operation and log each type and name:
Python |
userID = 'blend-op-001' objects = system.mes.trace.getOperationObjectsAsJava(userID) for obj in objects: typeName = obj.getMESObjectType().getName() system.util.getLogger('trace').info( '{}: {}'.format(typeName, obj.getName()) ) |
Complex example
Record an operation, modify it, then read allocated quantity from the response segment material property:
Python |
userID = 'pack-op-042' equipmentPath = 'Enterprise/Site/Area/PackLine' operationName = 'Packaging' # Record the operation system.mes.trace.recordOperation( name=operationName, equipmentPath=equipmentPath, userId=userID, materialOut=[ system.mes.trace.configureMaterial( userId='output-material', name='Output', lotNo='LOT-1001', quantity=25.0, materialName='Finished Goods' ) ] ) # Modify quantity on the output material system.mes.trace.modifyOperation( userId=userID, materialOut=[ system.mes.trace.configureMaterial( userId='output-material', quantity=30.0 ) ] ) # Load live Java objects and inspect the segment objects = system.mes.trace.getOperationObjectsAsJava(userID) segment = None for obj in objects: if obj.getMESObjectType().getName() == 'ResponseSegment': segment = obj break if segment: for matProp in segment.getMaterialProperties(): propUserId = matProp.getUserID() quantity = matProp.getQuantity() lotUUID = matProp.getLotUUID() if matProp.hasLotRef() else None system.util.getLogger('trace').info( 'Material {} qty={} lotUUID={}'.format(propUserId, quantity, lotUUID) ) # Find the material lot object in the returned list for obj in objects: if obj.getMESObjectType().getName() == 'MaterialLot': system.util.getLogger('trace').info( 'Lot {} UUID: {}'.format(obj.getName(), obj.getUUID()) ) |
Related Functions
getOperationObjectsAsPython() — Same lookup by userID, but returns Python-friendly dictionaries instead of live Java objects.
recordOperation() — Records a new traceability operation and assigns its userId.
modifyOperation() — Updates an existing operation identified by userId.
deleteOperation() — Deletes an operation and its response data by userId.
getUserIDList() — Finds operation user IDs matching search criteria before calling this function.
configureMaterial() / configurePersonnel() / configureSupplementalEquipment() — Build arrays used when recording or modifying operations.
Python |
operationID = '1714597108821' opData = system.mes.trace.getOperationObjectsAsJava(operationID) print opData for obj in opData: print obj |
Python |
Size 11 OperationsResponse (cc0aa95b-2953-47e4-a084-cf110b69580e, Bottle Beer, 0 parents, 0 children, 0 custom properties, 2 complex properties, artifacts not loaded) ResponseSegment (cb95dc3e-2393-41b0-a722-6712e1be20ac, Bottle Beer, 0 parents, 0 children, 0 custom properties, 9 complex properties, artifacts not loaded) MESLine (2ff1415c-97bf-4f2d-ac72-f169124bd0cb, Packaging Line 1, 1 parents, 6 children, 1 custom properties, 8 complex properties, 0 artifacts) MaterialDef (057578f4-a395-4858-ae86-350a40c949ff, 500 ml, 1 parents, 0 children, 0 custom properties, 1 complex properties, artifacts not loaded) MaterialLot (770a1247-c58c-4b1b-8452-d674be05b298, 1714176051018, 0 parents, 0 children, 3 custom properties, 1 complex properties, artifacts not loaded) MaterialDef (53548bc1-9075-455a-8b16-4b56e1c6b3a9, Silver Caps, 1 parents, 0 children, 0 custom properties, 1 complex properties, artifacts not loaded) MaterialLot (f0a1d40f-abc1-44d3-946b-1495cdf4e712, 1714176062442, 0 parents, 0 children, 3 custom properties, 1 complex properties, artifacts not loaded) MaterialDef (250792f6-9be2-4ed4-86ef-ec3909a90a65, 6 Pack, 1 parents, 0 children, 0 custom properties, 1 complex properties, artifacts not loaded) MaterialLot (6c411496-62db-4b2a-a8b2-993d957ff87e, 1714176073647, 0 parents, 0 children, 3 custom properties, 1 complex properties, artifacts not loaded) MaterialDef (4c54448c-eb7b-485b-bd7e-58671db28c7e, Stout, 1 parents, 0 children, 0 custom properties, 1 complex properties, artifacts not loaded) MaterialLot (6ffc5c58-255d-4194-b422-c63d2fd7547e, Stout-1714597108821, 0 parents, 0 children, 0 custom properties, 1 complex properties, artifacts not loaded) >>> |
Sepasoft MES Module Suite