use of org.apache.syncope.core.provisioning.api.propagation.PropagationReporter in project syncope by apache.
the class DefaultGroupProvisioningManager method update.
@Transactional(propagation = Propagation.REQUIRES_NEW)
@Override
public Pair<GroupPatch, List<PropagationStatus>> update(final GroupPatch groupPatch, final Set<String> excludedResources, final boolean nullPriorityAsync) {
WorkflowResult<GroupPatch> updated = gwfAdapter.update(groupPatch);
List<PropagationTaskTO> tasks = propagationManager.getUpdateTasks(AnyTypeKind.GROUP, updated.getResult().getKey(), false, null, updated.getPropByRes(), groupPatch.getVirAttrs(), excludedResources);
PropagationReporter propagationReporter = taskExecutor.execute(tasks, nullPriorityAsync);
return Pair.of(updated.getResult(), propagationReporter.getStatuses());
}
use of org.apache.syncope.core.provisioning.api.propagation.PropagationReporter in project syncope by apache.
the class DefaultGroupProvisioningManager method provision.
@Override
public List<PropagationStatus> provision(final String key, final Collection<String> resources, final boolean nullPriorityAsync) {
PropagationByResource propByRes = new PropagationByResource();
propByRes.addAll(ResourceOperation.UPDATE, resources);
List<PropagationTaskTO> tasks = propagationManager.getUpdateTasks(AnyTypeKind.GROUP, key, false, null, propByRes, null, null);
PropagationReporter propagationReporter = taskExecutor.execute(tasks, nullPriorityAsync);
return propagationReporter.getStatuses();
}
use of org.apache.syncope.core.provisioning.api.propagation.PropagationReporter in project syncope by apache.
the class DefaultGroupProvisioningManager method deprovision.
@Override
public List<PropagationStatus> deprovision(final String key, final Collection<String> resources, final boolean nullPriorityAsync) {
PropagationByResource propByRes = new PropagationByResource();
propByRes.addAll(ResourceOperation.DELETE, resources);
List<PropagationTaskTO> tasks = propagationManager.getDeleteTasks(AnyTypeKind.GROUP, key, propByRes, groupDAO.findAllResourceKeys(key).stream().filter(resource -> !resources.contains(resource)).collect(Collectors.toList()));
PropagationReporter propagationReporter = taskExecutor.execute(tasks, nullPriorityAsync);
return propagationReporter.getStatuses();
}
use of org.apache.syncope.core.provisioning.api.propagation.PropagationReporter in project syncope by apache.
the class RealmLogic method update.
@PreAuthorize("hasRole('" + StandardEntitlement.REALM_UPDATE + "')")
public ProvisioningResult<RealmTO> update(final RealmTO realmTO) {
Realm realm = realmDAO.findByFullPath(realmTO.getFullPath());
if (realm == null) {
LOG.error("Could not find realm '" + realmTO.getFullPath() + "'");
throw new NotFoundException(realmTO.getFullPath());
}
PropagationByResource propByRes = binder.update(realm, realmTO);
realm = realmDAO.save(realm);
List<PropagationTaskTO> tasks = propagationManager.createTasks(realm, propByRes, null);
PropagationReporter propagationReporter = taskExecutor.execute(tasks, false);
ProvisioningResult<RealmTO> result = new ProvisioningResult<>();
result.setEntity(binder.getRealmTO(realm, true));
result.getPropagationStatuses().addAll(propagationReporter.getStatuses());
return result;
}
use of org.apache.syncope.core.provisioning.api.propagation.PropagationReporter in project syncope by apache.
the class RealmLogic method create.
@PreAuthorize("hasRole('" + StandardEntitlement.REALM_CREATE + "')")
public ProvisioningResult<RealmTO> create(final String parentPath, final RealmTO realmTO) {
Realm parent;
if (StringUtils.isBlank(realmTO.getParent())) {
parent = realmDAO.findByFullPath(parentPath);
if (parent == null) {
LOG.error("Could not find parent realm " + parentPath);
throw new NotFoundException(parentPath);
}
realmTO.setParent(parent.getFullPath());
} else {
parent = realmDAO.find(realmTO.getParent());
if (parent == null) {
LOG.error("Could not find parent realm " + realmTO.getParent());
throw new NotFoundException(realmTO.getParent());
}
if (!parent.getFullPath().equals(parentPath)) {
SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidPath);
sce.getElements().add("Mismatching parent realm: " + parentPath + " Vs " + parent.getFullPath());
throw sce;
}
}
String fullPath = StringUtils.appendIfMissing(parent.getFullPath(), "/") + realmTO.getName();
if (realmDAO.findByFullPath(fullPath) != null) {
throw new DuplicateException(fullPath);
}
Realm realm = realmDAO.save(binder.create(parent, realmTO));
PropagationByResource propByRes = new PropagationByResource();
realm.getResourceKeys().forEach(resource -> {
propByRes.add(ResourceOperation.CREATE, resource);
});
List<PropagationTaskTO> tasks = propagationManager.createTasks(realm, propByRes, null);
PropagationReporter propagationReporter = taskExecutor.execute(tasks, false);
ProvisioningResult<RealmTO> result = new ProvisioningResult<>();
result.setEntity(binder.getRealmTO(realm, true));
result.getPropagationStatuses().addAll(propagationReporter.getStatuses());
return result;
}
Aggregations