use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType in project midpoint by Evolveum.
the class AuditInsertion method convertDelta.
/**
* Returns prepared audit delta row without PK columns which will be added later.
* For normal repo this code would be in mapper, but here we know exactly what type we work with.
*/
@Nullable
private MAuditDelta convertDelta(ObjectDeltaOperationType deltaOperation) {
try {
MAuditDelta deltaRow = new MAuditDelta();
ObjectDeltaType delta = deltaOperation.getObjectDelta();
if (delta != null) {
DeltaConversionOptions options = DeltaConversionOptions.createSerializeReferenceNames();
options.setEscapeInvalidCharacters(escapeIllegalCharacters);
String serializedDelta = DeltaConvertor.serializeDelta(delta, options, repoContext.getJdbcRepositoryConfiguration().getFullObjectFormat());
// serializedDelta is transient, needed for changed items later
deltaRow.serializedDelta = serializedDelta;
deltaRow.delta = serializedDelta.getBytes(StandardCharsets.UTF_8);
deltaRow.deltaOid = SqaleUtils.oidToUUid(delta.getOid());
deltaRow.deltaType = delta.getChangeType();
}
OperationResultType executionResult = deltaOperation.getExecutionResult();
byte[] fullResult = null;
if (executionResult != null) {
fullResult = repoContext.createFullResult(executionResult);
deltaRow.status = executionResult.getStatus();
deltaRow.fullResult = fullResult;
}
deltaRow.resourceOid = SqaleUtils.oidToUUid(deltaOperation.getResourceOid());
if (deltaOperation.getObjectName() != null) {
deltaRow.objectNameOrig = deltaOperation.getObjectName().getOrig();
deltaRow.objectNameNorm = deltaOperation.getObjectName().getNorm();
}
if (deltaOperation.getResourceName() != null) {
deltaRow.resourceNameOrig = deltaOperation.getResourceName().getOrig();
deltaRow.resourceNameNorm = deltaOperation.getResourceName().getNorm();
}
deltaRow.checksum = computeChecksum(deltaRow.delta, fullResult);
return deltaRow;
} catch (Exception ex) {
logger.warn("Unexpected problem during audit delta conversion", ex);
return null;
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType in project midpoint by Evolveum.
the class QAuditDeltaMapping method toSchemaObject.
public ObjectDeltaOperationType toSchemaObject(MAuditDelta row) {
ObjectDeltaOperationType odo = new ObjectDeltaOperationType();
String deltaId = row.recordId + "-" + row.checksum;
odo.setObjectDelta(parseBytes(row.delta, "delta-" + deltaId, ObjectDeltaType.class));
odo.setExecutionResult(parseBytes(row.fullResult, "result-" + deltaId, OperationResultType.class));
if (row.objectNameOrig != null || row.objectNameNorm != null) {
odo.setObjectName(new PolyStringType(new PolyString(row.objectNameOrig, row.objectNameNorm)));
}
odo.setResourceOid(row.resourceOid != null ? row.resourceOid.toString() : null);
if (row.resourceNameOrig != null || row.resourceNameNorm != null) {
odo.setResourceName(new PolyStringType(new PolyString(row.resourceNameOrig, row.resourceNameNorm)));
}
return odo;
}
Aggregations