use of com.evolveum.midpoint.xml.ns._public.common.common_3.SynchronizationSituationDescriptionType in project midpoint by Evolveum.
the class SynchronizationUtils method createSynchronizationSituationDescriptionDelta.
public static List<PropertyDelta<?>> createSynchronizationSituationDescriptionDelta(PrismObject object, SynchronizationSituationType situation, XMLGregorianCalendar timestamp, String sourceChannel, boolean full) {
SynchronizationSituationDescriptionType syncSituationDescription = new SynchronizationSituationDescriptionType();
syncSituationDescription.setSituation(situation);
syncSituationDescription.setChannel(sourceChannel);
syncSituationDescription.setTimestamp(timestamp);
syncSituationDescription.setFull(full);
List<PropertyDelta<?>> deltas = new ArrayList<PropertyDelta<?>>();
PropertyDelta syncSituationDelta = PropertyDelta.createDelta(new ItemPath(ShadowType.F_SYNCHRONIZATION_SITUATION_DESCRIPTION), object.getDefinition());
syncSituationDelta.addValueToAdd(new PrismPropertyValue(syncSituationDescription));
deltas.add(syncSituationDelta);
List<PrismPropertyValue<SynchronizationSituationDescriptionType>> oldSituationDescriptions = getSituationFromSameChannel(object, sourceChannel);
if (oldSituationDescriptions != null && !oldSituationDescriptions.isEmpty()) {
syncSituationDelta = PropertyDelta.createDelta(new ItemPath(ShadowType.F_SYNCHRONIZATION_SITUATION_DESCRIPTION), object.getDefinition());
syncSituationDelta.addValuesToDelete(oldSituationDescriptions);
deltas.add(syncSituationDelta);
}
return deltas;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SynchronizationSituationDescriptionType in project midpoint by Evolveum.
the class SynchronizationUtils method getSituationFromSameChannel.
private static List<PrismPropertyValue<SynchronizationSituationDescriptionType>> getSituationFromSameChannel(PrismObject prismObject, String channel) {
ShadowType target = (ShadowType) prismObject.asObjectable();
List<SynchronizationSituationDescriptionType> syncSituationDescriptions = ((ShadowType) target).getSynchronizationSituationDescription();
List<PrismPropertyValue<SynchronizationSituationDescriptionType>> valuesToDelete = new ArrayList<PrismPropertyValue<SynchronizationSituationDescriptionType>>();
if (syncSituationDescriptions == null || syncSituationDescriptions.isEmpty()) {
return null;
}
for (SynchronizationSituationDescriptionType syncSituationDescription : syncSituationDescriptions) {
if (StringUtils.isEmpty(syncSituationDescription.getChannel()) && StringUtils.isEmpty(channel)) {
valuesToDelete.add(new PrismPropertyValue<SynchronizationSituationDescriptionType>(syncSituationDescription));
continue;
// return syncSituationDescription;
}
if ((StringUtils.isEmpty(syncSituationDescription.getChannel()) && channel != null) || (StringUtils.isEmpty(channel) && syncSituationDescription.getChannel() != null)) {
// return null;
continue;
}
if (syncSituationDescription.getChannel().equals(channel)) {
valuesToDelete.add(new PrismPropertyValue<SynchronizationSituationDescriptionType>(syncSituationDescription));
continue;
// return syncSituationDescription;
}
}
return valuesToDelete;
}
Aggregations