Search in sources :

Example 1 with AuditEventRecordReferenceValueType

use of com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordReferenceValueType in project midpoint by Evolveum.

the class AuditInsertion method insertReferences.

private void insertReferences(MAuditEventRecord auditRow, List<AuditEventRecordReferenceType> references) {
    if (references.isEmpty()) {
        return;
    }
    QAuditRefValue qr = QAuditRefValueMapping.get().defaultAlias();
    SQLInsertClause insertBatch = jdbcSession.newInsert(qr);
    for (AuditEventRecordReferenceType refSet : references) {
        for (AuditEventRecordReferenceValueType refValue : refSet.getValue()) {
            // id will be generated, but we're not interested in those here
            PolyStringType targetName = refValue.getTargetName();
            insertBatch.set(qr.recordId, auditRow.id).set(qr.timestamp, auditRow.timestamp).set(qr.name, refSet.getName()).set(qr.targetOid, SqaleUtils.oidToUUid(refValue.getOid())).set(qr.targetType, refValue.getType() != null ? MObjectType.fromTypeQName(refValue.getType()) : null).set(qr.targetNameOrig, PolyString.getOrig(targetName)).set(qr.targetNameNorm, PolyString.getNorm(targetName)).addBatch();
        }
    }
    if (insertBatch.getBatchCount() == 0) {
        // strange, no values anywhere?
        return;
    }
    insertBatch.setBatchToBulk(true);
    insertBatch.execute();
}
Also used : PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) AuditEventRecordReferenceType(com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordReferenceType) SQLInsertClause(com.querydsl.sql.dml.SQLInsertClause) AuditEventRecordReferenceValueType(com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordReferenceValueType)

Example 2 with AuditEventRecordReferenceValueType

use of com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordReferenceValueType in project midpoint by Evolveum.

the class AuditReferenceValue method toXml.

public AuditEventRecordReferenceValueType toXml() {
    AuditEventRecordReferenceValueType rv = new AuditEventRecordReferenceValueType();
    rv.setOid(oid);
    rv.setType(type);
    rv.setTargetName(PolyString.toPolyStringType(targetName));
    return rv;
}
Also used : AuditEventRecordReferenceValueType(com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordReferenceValueType)

Aggregations

AuditEventRecordReferenceValueType (com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordReferenceValueType)2 AuditEventRecordReferenceType (com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordReferenceType)1 PolyStringType (com.evolveum.prism.xml.ns._public.types_3.PolyStringType)1 SQLInsertClause (com.querydsl.sql.dml.SQLInsertClause)1