Search in sources :

Example 1 with ObjectDeltaType

use of com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType in project midpoint by Evolveum.

the class ImportAction method executeAction.

@Override
protected void executeAction() {
    ModelPortType port = createModelPort();
    ModelExecuteOptionsType options = new ModelExecuteOptionsType();
    options.setRaw(getParams().isRaw());
    com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType object = readObject();
    ObjectDeltaType delta = createAddDelta(object);
    ObjectDeltaListType deltas = createDeltaList(delta);
    OperationResultType resultType;
    try {
        ObjectDeltaOperationListType result = port.executeChanges(deltas, options);
        List<ObjectDeltaOperationType> operations = result.getDeltaOperation();
        ObjectDeltaOperationType operation = operations.get(0);
        resultType = operation.getExecutionResult();
    } catch (FaultMessage ex) {
        //todo error handling
        FaultType fault = ex.getFaultInfo();
        resultType = fault.getOperationResult();
    }
    STD_OUT.info("Status: {}", resultType.getStatus());
}
Also used : ModelPortType(com.evolveum.midpoint.xml.ns._public.model.model_3.ModelPortType) ModelExecuteOptionsType(com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType) FaultType(com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultType) 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) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) 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 2 with ObjectDeltaType

use of com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType in project midpoint by Evolveum.

the class Action method createDeleteDelta.

protected ObjectDeltaType createDeleteDelta(String oid, QName type) {
    ObjectDeltaType delta = new ObjectDeltaType();
    delta.setOid(oid);
    delta.setChangeType(ChangeTypeType.DELETE);
    if (type == null) {
        type = com.evolveum.midpoint.cli.ninja.util.ObjectType.OBJECT.getType();
    }
    delta.setObjectType(type);
    return delta;
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType)

Example 3 with ObjectDeltaType

use of com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType in project midpoint by Evolveum.

the class LensProjectionContext method fromLensProjectionContextType.

public static LensProjectionContext fromLensProjectionContextType(LensProjectionContextType projectionContextType, LensContext lensContext, Task task, OperationResult result) throws SchemaException, ConfigurationException, ObjectNotFoundException, CommunicationException, ExpressionEvaluationException {
    String objectTypeClassString = projectionContextType.getObjectTypeClass();
    if (StringUtils.isEmpty(objectTypeClassString)) {
        throw new SystemException("Object type class is undefined in LensProjectionContextType");
    }
    ResourceShadowDiscriminator resourceShadowDiscriminator = ResourceShadowDiscriminator.fromResourceShadowDiscriminatorType(projectionContextType.getResourceShadowDiscriminator());
    LensProjectionContext projectionContext = new LensProjectionContext(lensContext, resourceShadowDiscriminator);
    projectionContext.retrieveFromLensElementContextType(projectionContextType, task, result);
    if (projectionContextType.getSyncDelta() != null) {
        projectionContext.syncDelta = DeltaConvertor.createObjectDelta(projectionContextType.getSyncDelta(), lensContext.getPrismContext());
    } else {
        projectionContext.syncDelta = null;
    }
    ObjectDeltaType secondaryDeltaType = projectionContextType.getSecondaryDelta();
    projectionContext.secondaryDelta = secondaryDeltaType != null ? (ObjectDelta) DeltaConvertor.createObjectDelta(secondaryDeltaType, lensContext.getPrismContext()) : null;
    ObjectType object = projectionContextType.getObjectNew() != null ? projectionContextType.getObjectNew() : projectionContextType.getObjectOld();
    projectionContext.fixProvisioningTypeInDelta(projectionContext.secondaryDelta, object, task, result);
    projectionContext.wave = projectionContextType.getWave() != null ? projectionContextType.getWave() : 0;
    projectionContext.fullShadow = projectionContextType.isFullShadow() != null ? projectionContextType.isFullShadow() : false;
    projectionContext.isAssigned = projectionContextType.isIsAssigned() != null ? projectionContextType.isIsAssigned() : false;
    projectionContext.isAssignedOld = projectionContextType.isIsAssignedOld() != null ? projectionContextType.isIsAssignedOld() : false;
    projectionContext.isActive = projectionContextType.isIsActive() != null ? projectionContextType.isIsActive() : false;
    projectionContext.isLegal = projectionContextType.isIsLegal();
    projectionContext.isLegalOld = projectionContextType.isIsLegalOld();
    projectionContext.isExists = projectionContextType.isIsExists() != null ? projectionContextType.isIsExists() : false;
    projectionContext.synchronizationPolicyDecision = SynchronizationPolicyDecision.fromSynchronizationPolicyDecisionType(projectionContextType.getSynchronizationPolicyDecision());
    projectionContext.doReconciliation = projectionContextType.isDoReconciliation() != null ? projectionContextType.isDoReconciliation() : false;
    projectionContext.synchronizationSituationDetected = projectionContextType.getSynchronizationSituationDetected();
    projectionContext.synchronizationSituationResolved = projectionContextType.getSynchronizationSituationResolved();
    projectionContext.accountPasswordPolicy = projectionContextType.getAccountPasswordPolicy();
    projectionContext.syncAbsoluteTrigger = projectionContextType.isSyncAbsoluteTrigger();
    return projectionContext;
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) ResourceShadowDiscriminator(com.evolveum.midpoint.schema.ResourceShadowDiscriminator) ObjectDelta(com.evolveum.midpoint.prism.delta.ObjectDelta)

Example 4 with ObjectDeltaType

use of com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType in project midpoint by Evolveum.

the class TestParseDiffPatch method getParsedShadowBefore.

protected PrismObject<ShadowType> getParsedShadowBefore(PrismContext prismContext) throws SchemaException, IOException {
    PrismObject<ShadowType> oldObject = getRawShadowBefore(prismContext);
    // resolve rawtypes
    ObjectDeltaType objectChange = oldObject.asObjectable().getObjectChange();
    for (ItemDeltaType itemDeltaType : objectChange.getItemDelta()) {
        for (RawType rawType : itemDeltaType.getValue()) {
            rawType.getParsedItem(new PrismPropertyDefinitionImpl(itemDeltaType.getPath().getItemPath().lastNamed().getName(), rawType.getXnode().getTypeQName(), prismContext));
        }
    }
    return oldObject;
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) RawType(com.evolveum.prism.xml.ns._public.types_3.RawType) ItemDeltaType(com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType)

Example 5 with ObjectDeltaType

use of com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType in project midpoint by Evolveum.

the class PrismPropertyPanel method hasPendingModification.

private boolean hasPendingModification(IModel<IW> model) {
    ItemWrapper propertyWrapper = model.getObject();
    ContainerWrapper containerWrapper = propertyWrapper.getContainer();
    if (containerWrapper == null) {
        // TODO - ok?
        return false;
    }
    ObjectWrapper objectWrapper = containerWrapper.getObject();
    if (objectWrapper == null) {
        return false;
    }
    PrismObject prismObject = objectWrapper.getObject();
    if (!ShadowType.class.isAssignableFrom(prismObject.getCompileTimeClass())) {
        return false;
    }
    PrismProperty objectChange = prismObject.findProperty(ShadowType.F_OBJECT_CHANGE);
    if (objectChange == null || objectChange.getValue() == null) {
        return false;
    }
    ItemPath path = propertyWrapper.getItem().getPath();
    ObjectDeltaType delta = (ObjectDeltaType) objectChange.getValue().getValue();
    try {
        for (ItemDeltaType itemDelta : delta.getItemDelta()) {
            ItemDelta iDelta = DeltaConvertor.createItemDelta(itemDelta, (Class<? extends Objectable>) prismObject.getCompileTimeClass(), prismObject.getPrismContext());
            if (iDelta.getPath().equivalent(path)) {
                return true;
            }
        }
    } catch (SchemaException ex) {
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't check if property has pending modification", ex);
    }
    return false;
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) ItemDelta(com.evolveum.midpoint.prism.delta.ItemDelta) ItemDeltaType(com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Aggregations

ObjectDeltaType (com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType)165 Test (org.testng.annotations.Test)54 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)53 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)50 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)47 PrismAsserts.assertEqualsPolyString (com.evolveum.midpoint.prism.util.PrismAsserts.assertEqualsPolyString)47 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)44 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)41 ObjectDeltaListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)37 ItemDeltaType (com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType)33 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)30 ChangeRecordEntry (org.opends.server.util.ChangeRecordEntry)30 ObjectDeltaOperationListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType)23 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)21 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)18 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)18 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)17 QName (javax.xml.namespace.QName)16 ObjectDeltaOperationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType)15 SystemException (com.evolveum.midpoint.util.exception.SystemException)13