Search in sources :

Example 31 with ObjectDeltaOperationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType in project midpoint by Evolveum.

the class DeleteAction method executeAction.

@Override
protected void executeAction() throws Exception {
    ModelPortType port = createModelPort();
    ModelExecuteOptionsType options = new ModelExecuteOptionsType();
    options.setForce(getParams().isForce());
    options.setRaw(getParams().isRaw());
    QName type = getParams().getType();
    ObjectDeltaType delta = createDeleteDelta(getParams().getOid(), type);
    ObjectDeltaListType deltas = createDeltaList(delta);
    try {
        ObjectDeltaOperationListType result = port.executeChanges(deltas, options);
        List<ObjectDeltaOperationType> operations = result.getDeltaOperation();
        ObjectDeltaOperationType operation = operations.get(0);
        OperationResultType resultType = operation.getExecutionResult();
        STD_OUT.info("Status: {}", resultType.getStatus());
    } catch (FaultMessage ex) {
        handleError("Couldn't delete object '" + type.getLocalPart() + "' with oid '" + getParams().getOid() + "'", ex);
    }
}
Also used : ObjectDeltaOperationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType) ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) FaultMessage(com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage) ModelPortType(com.evolveum.midpoint.xml.ns._public.model.model_3.ModelPortType) QName(javax.xml.namespace.QName) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) ModelExecuteOptionsType(com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType) ObjectDeltaOperationListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)

Example 32 with ObjectDeltaOperationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType in project midpoint by Evolveum.

the class SchemaDebugUtil method prettyPrint.

public static String prettyPrint(ObjectDeltaOperationType deltaOpType) {
    if (deltaOpType == null) {
        return "null";
    }
    StringBuilder sb = new StringBuilder("ObjectDeltaOperationType(");
    sb.append(prettyPrint(deltaOpType.getObjectDelta()));
    sb.append(": ");
    OperationResultType result = deltaOpType.getExecutionResult();
    if (result == null) {
        sb.append("null result");
    } else {
        sb.append(result.getStatus());
    }
    // object, resource?
    sb.append(")");
    return sb.toString();
}
Also used : OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)

Example 33 with ObjectDeltaOperationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType in project midpoint by Evolveum.

the class DeltaConvertor method toObjectDeltaOperationType.

/**
 * Object delta operation: native -> XML.
 */
public static ObjectDeltaOperationType toObjectDeltaOperationType(ObjectDeltaOperation<?> odo, DeltaConversionOptions options) throws SchemaException {
    ObjectDeltaOperationType odoBean = new ObjectDeltaOperationType();
    toObjectDeltaOperationType(odo, odoBean, options);
    return odoBean;
}
Also used : ObjectDeltaOperationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType)

Example 34 with ObjectDeltaOperationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType in project midpoint by Evolveum.

the class SqlAuditServiceImpl method insertAuditDeltas.

private void insertAuditDeltas(JdbcSession jdbcSession, MAuditEventRecord auditRow, List<ObjectDeltaOperationType> deltas) {
    // we want to keep only unique deltas, checksum is also part of PK
    Map<String, MAuditDelta> deltasByChecksum = new HashMap<>();
    for (ObjectDeltaOperationType delta : deltas) {
        if (delta == null) {
            continue;
        }
        MAuditDelta mAuditDelta = convertDelta(delta, auditRow);
        deltasByChecksum.put(mAuditDelta.checksum, mAuditDelta);
    }
    if (!deltasByChecksum.isEmpty()) {
        SQLInsertClause insertBatch = jdbcSession.newInsert(QAuditDeltaMapping.get().defaultAlias());
        for (MAuditDelta value : deltasByChecksum.values()) {
            // NULLs are important to keep the value count consistent during the batch
            insertBatch.populate(value, DefaultMapper.WITH_NULL_BINDINGS).addBatch();
        }
        insertBatch.setBatchToBulk(true);
        insertBatch.execute();
    }
}
Also used : MAuditDelta(com.evolveum.midpoint.repo.sql.audit.beans.MAuditDelta) ObjectDeltaOperationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType) SQLInsertClause(com.querydsl.sql.dml.SQLInsertClause) PolyString(com.evolveum.midpoint.prism.polystring.PolyString)

Example 35 with ObjectDeltaOperationType

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();
    SQLTemplates querydslTemplates = repositoryContext().getQuerydslTemplates();
    boolean usingSqlServer = querydslTemplates instanceof SQLServerTemplates;
    odo.setObjectDelta(parseBytes(row.delta, usingSqlServer, ObjectDeltaType.class));
    odo.setExecutionResult(parseBytes(row.fullResult, usingSqlServer, OperationResultType.class));
    if (row.objectNameOrig != null || row.objectNameNorm != null) {
        odo.setObjectName(new PolyStringType(new PolyString(row.objectNameOrig, row.objectNameNorm)));
    }
    odo.setResourceOid(row.resourceOid);
    if (row.resourceNameOrig != null || row.resourceNameNorm != null) {
        odo.setResourceName(new PolyStringType(new PolyString(row.resourceNameOrig, row.resourceNameNorm)));
    }
    return odo;
}
Also used : ObjectDeltaOperationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType) SQLServerTemplates(com.querydsl.sql.SQLServerTemplates) PolyStringType(com.evolveum.prism.xml.ns._public.types_3.PolyStringType) ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) SQLTemplates(com.querydsl.sql.SQLTemplates)

Aggregations

ObjectDeltaOperationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType)28 ObjectDeltaType (com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType)23 ObjectDeltaOperationListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType)12 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)12 ObjectDeltaListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)11 ItemDeltaType (com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType)9 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)6 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)6 QName (javax.xml.namespace.QName)5 Test (org.testng.annotations.Test)4 SystemException (com.evolveum.midpoint.util.exception.SystemException)3 AuditEventRecordType (com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType)3 ModelExecuteOptionsType (com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType)3 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)3 PolyStringType (com.evolveum.prism.xml.ns._public.types_3.PolyStringType)3 CanonicalItemPath (com.evolveum.midpoint.prism.path.CanonicalItemPath)2 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)2 MAuditDelta (com.evolveum.midpoint.repo.sql.audit.beans.MAuditDelta)2 DeltaConversionOptions (com.evolveum.midpoint.schema.DeltaConversionOptions)2 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)2