readHistoryModified
If the server allows it (HistoryUpdate change history), the data may have been modified. readHistoryModified Retrieve all versions and change logs for auditing and regulatory compliance purposes.
Preliminary / Supporting
- For standard read access without auditing, please use ReadRaw.
- To write or edit history, please see HistoryUpdate.
Signature
public List<OpcUaDataValue> readHistoryModified(
String nodeId,
Instant start,
Instant end,
int maxValues,
boolean returnBounds);
| Parameters | Note |
|---|---|
| nodeId | Objective NodeId |
| start / end | Interval (UTC Instant) |
| maxValues | 0 = No limit |
| returnBounds | true = Also returns boundary points outside the interval |
Returns List<OpcUaDataValue> (Each item must be closed). The modification metadata contained within the server is not currently exposed; only DataValue its own values, state, and timestamps are revealed.
Usage
import java.time.Instant;
List<OpcUaDataValue> modified = ua.readHistoryModified("ns=2;s=Temperature",
yesterday, today, 0, false);
try {
for (OpcUaDataValue dv : modified) {
long ft = dv.sourceTimestamp();
Instant t = (ft > 0)
? Instant.ofEpochMilli((ft - 116444736000000000L) / 10000L)
: Instant.now();
System.out.println(t + ": " + dv.variant() + " (" + dv.getStatusEnum() + ")");
}
} finally {
for (OpcUaDataValue dv : modified) if (dv != null) dv.close();
}
When to Use
- Regulatory Compliance: Regulated industries (pharmaceuticals, food, etc.) require "data traceability"
- Audit Log: Who Changed the Key Parameters?
- Data Recovery Rollback: Know what the value was before the change
Server Requirements
- Must be implemented HistoryUpdate
- The revision history must be preserved (rather than overwritten).
- User credentials must be passed correctly (Username / Certificate Token)