use of org.apache.syncope.core.provisioning.api.LogicActions in project syncope by apache.
the class AbstractAnyLogic method beforeUpdate.
protected Pair<P, List<LogicActions>> beforeUpdate(final P input, final String realmPath) {
Realm realm = realmDAO.findByFullPath(realmPath);
if (realm == null) {
SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRealm);
sce.getElements().add(realmPath);
throw sce;
}
P mod = input;
List<LogicActions> actions = getActions(realm);
for (LogicActions action : actions) {
mod = action.beforeUpdate(mod);
}
LOG.debug("Input: {}\nOutput: {}\n", input, mod);
return ImmutablePair.of(mod, actions);
}
use of org.apache.syncope.core.provisioning.api.LogicActions in project syncope by apache.
the class AbstractAnyLogic method beforeCreate.
protected Pair<TO, List<LogicActions>> beforeCreate(final TO input) {
Realm realm = realmDAO.findByFullPath(input.getRealm());
if (realm == null) {
SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRealm);
sce.getElements().add(input.getRealm());
throw sce;
}
AnyType anyType = input instanceof UserTO ? anyTypeDAO.findUser() : input instanceof GroupTO ? anyTypeDAO.findGroup() : anyTypeDAO.find(input.getType());
if (anyType == null) {
SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidAnyType);
sce.getElements().add(input.getType());
throw sce;
}
TO any = input;
templateUtils.apply(any, realm.getTemplate(anyType));
List<LogicActions> actions = getActions(realm);
for (LogicActions action : actions) {
any = action.beforeCreate(any);
}
LOG.debug("Input: {}\nOutput: {}\n", input, any);
return ImmutablePair.of(any, actions);
}
use of org.apache.syncope.core.provisioning.api.LogicActions in project syncope by apache.
the class AbstractAnyLogic method afterDelete.
protected ProvisioningResult<TO> afterDelete(final TO input, final List<PropagationStatus> statuses, final List<LogicActions> actions) {
TO any = input;
for (LogicActions action : actions) {
any = action.afterDelete(any);
}
ProvisioningResult<TO> result = new ProvisioningResult<>();
result.setEntity(any);
result.getPropagationStatuses().addAll(statuses);
return result;
}
use of org.apache.syncope.core.provisioning.api.LogicActions in project syncope by apache.
the class AbstractAnyLogic method afterUpdate.
protected ProvisioningResult<TO> afterUpdate(final TO input, final List<PropagationStatus> statuses, final List<LogicActions> actions, final boolean authDynRealms, final Set<String> dynRealmsBefore) {
Set<String> dynRealmsAfter = new HashSet<>(input.getDynRealms());
if (authDynRealms && !dynRealmsBefore.equals(dynRealmsAfter)) {
throw new DelegatedAdministrationException(this instanceof UserLogic ? AnyTypeKind.USER : this instanceof GroupLogic ? AnyTypeKind.GROUP : AnyTypeKind.ANY_OBJECT, input.getKey());
}
TO any = input;
for (LogicActions action : actions) {
any = action.afterUpdate(any);
}
ProvisioningResult<TO> result = new ProvisioningResult<>();
result.setEntity(any);
result.getPropagationStatuses().addAll(statuses);
return result;
}
use of org.apache.syncope.core.provisioning.api.LogicActions in project syncope by apache.
the class AbstractAnyLogic method beforeDelete.
protected Pair<TO, List<LogicActions>> beforeDelete(final TO input) {
Realm realm = realmDAO.findByFullPath(input.getRealm());
if (realm == null) {
SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRealm);
sce.getElements().add(input.getRealm());
throw sce;
}
TO any = input;
List<LogicActions> actions = getActions(realm);
for (LogicActions action : actions) {
any = action.beforeDelete(any);
}
LOG.debug("Input: {}\nOutput: {}\n", input, any);
return ImmutablePair.of(any, actions);
}
Aggregations