use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectSynchronizationType in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method determineSynchronization.
/**
* Returns appropriate object synchronization settings for the class.
* Assumes single sync setting for now.
*/
protected ObjectSynchronizationType determineSynchronization(ResourceType resource, Class<UserType> type, String name) {
SynchronizationType synchronization = resource.getSynchronization();
if (synchronization == null) {
return null;
}
List<ObjectSynchronizationType> objectSynchronizations = synchronization.getObjectSynchronization();
if (objectSynchronizations.isEmpty()) {
return null;
}
for (ObjectSynchronizationType objSyncType : objectSynchronizations) {
QName focusTypeQName = objSyncType.getFocusType();
if (focusTypeQName == null) {
if (type != UserType.class) {
continue;
}
} else {
ObjectTypes focusType = ObjectTypes.getObjectTypeFromTypeQName(focusTypeQName);
if (type != focusType.getClassDefinition()) {
continue;
}
}
if (name == null) {
// we got it
return objSyncType;
} else {
if (name.equals(objSyncType.getName())) {
return objSyncType;
}
}
}
throw new IllegalArgumentException("Synchronization setting for " + type + " and name " + name + " not found in " + resource);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectSynchronizationType in project midpoint by Evolveum.
the class Migrator method migrateObjectSynchronization.
private void migrateObjectSynchronization(ObjectSynchronizationType sync) {
if (sync == null || sync.getReaction() == null) {
return;
}
List<SynchronizationReactionType> migratedReactions = new ArrayList<SynchronizationReactionType>();
for (SynchronizationReactionType reaction : sync.getReaction()) {
if (reaction.getAction() == null) {
continue;
}
List<SynchronizationActionType> migratedAction = new ArrayList<SynchronizationActionType>();
for (SynchronizationActionType action : reaction.getAction()) {
migratedAction.add(migrateAction(action));
}
SynchronizationReactionType migratedReaction = reaction.clone();
migratedReaction.getAction().clear();
migratedReaction.getAction().addAll(migratedAction);
migratedReactions.add(migratedReaction);
}
sync.getReaction().clear();
sync.getReaction().addAll(migratedReactions);
}
Aggregations