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());
}
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;
}
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;
}
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;
}
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;
}
Aggregations