Search in sources :

Example 76 with SyncopeClientException

use of org.apache.syncope.common.lib.SyncopeClientException in project syncope by apache.

the class AnyObjectDataBinderImpl method update.

@Override
public PropagationByResource update(final AnyObject toBeUpdated, final AnyObjectPatch anyObjectPatch) {
    // Re-merge any pending change from workflow tasks
    AnyObject anyObject = anyObjectDAO.save(toBeUpdated);
    PropagationByResource propByRes = new PropagationByResource();
    SyncopeClientCompositeException scce = SyncopeClientException.buildComposite();
    AnyUtils anyUtils = anyUtilsFactory.getInstance(AnyTypeKind.ANY_OBJECT);
    Collection<String> currentResources = anyObjectDAO.findAllResourceKeys(anyObject.getKey());
    // fetch connObjectKeys before update
    Map<String, String> oldConnObjectKeys = getConnObjectKeys(anyObject, anyUtils);
    // realm
    setRealm(anyObject, anyObjectPatch);
    // name
    if (anyObjectPatch.getName() != null && StringUtils.isNotBlank(anyObjectPatch.getName().getValue())) {
        propByRes.addAll(ResourceOperation.UPDATE, anyObjectDAO.findAllResourceKeys(anyObject.getKey()));
        anyObject.setName(anyObjectPatch.getName().getValue());
    }
    // attributes and resources
    propByRes.merge(fill(anyObject, anyObjectPatch, anyUtils, scce));
    // relationships
    anyObjectPatch.getRelationships().stream().filter(patch -> patch.getRelationshipTO() != null).forEachOrdered((patch) -> {
        RelationshipType relationshipType = relationshipTypeDAO.find(patch.getRelationshipTO().getType());
        if (relationshipType == null) {
            LOG.debug("Ignoring invalid relationship type {}", patch.getRelationshipTO().getType());
        } else {
            Optional<? extends ARelationship> relationship = anyObject.getRelationship(relationshipType, patch.getRelationshipTO().getOtherEndKey());
            if (relationship.isPresent()) {
                anyObject.getRelationships().remove(relationship.get());
                relationship.get().setLeftEnd(null);
            }
            if (patch.getOperation() == PatchOperation.ADD_REPLACE) {
                if (StringUtils.isBlank(patch.getRelationshipTO().getOtherEndType()) || AnyTypeKind.USER.name().equals(patch.getRelationshipTO().getOtherEndType()) || AnyTypeKind.GROUP.name().equals(patch.getRelationshipTO().getOtherEndType())) {
                    SyncopeClientException invalidAnyType = SyncopeClientException.build(ClientExceptionType.InvalidAnyType);
                    invalidAnyType.getElements().add(AnyType.class.getSimpleName() + " not allowed for relationship: " + patch.getRelationshipTO().getOtherEndType());
                    scce.addException(invalidAnyType);
                } else {
                    AnyObject otherEnd = anyObjectDAO.find(patch.getRelationshipTO().getOtherEndKey());
                    if (otherEnd == null) {
                        LOG.debug("Ignoring invalid any object {}", patch.getRelationshipTO().getOtherEndKey());
                    } else if (anyObject.getRealm().getFullPath().startsWith(otherEnd.getRealm().getFullPath())) {
                        ARelationship newRelationship = entityFactory.newEntity(ARelationship.class);
                        newRelationship.setType(relationshipType);
                        newRelationship.setRightEnd(otherEnd);
                        newRelationship.setLeftEnd(anyObject);
                        anyObject.add(newRelationship);
                    } else {
                        LOG.error("{} cannot be assigned to {}", otherEnd, anyObject);
                        SyncopeClientException unassignable = SyncopeClientException.build(ClientExceptionType.InvalidRelationship);
                        unassignable.getElements().add("Cannot be assigned: " + otherEnd);
                        scce.addException(unassignable);
                    }
                }
            }
        }
    });
    // prepare for membership-related resource management
    Collection<ExternalResource> resources = anyObjectDAO.findAllResources(anyObject);
    Map<String, Set<String>> reasons = new HashMap<>();
    anyObject.getResources().forEach(resource -> {
        reasons.put(resource.getKey(), new HashSet<>(Collections.singleton(anyObject.getKey())));
    });
    anyObjectDAO.findAllGroupKeys(anyObject).forEach(group -> {
        groupDAO.findAllResourceKeys(group).forEach(resource -> {
            if (!reasons.containsKey(resource)) {
                reasons.put(resource, new HashSet<>());
            }
            reasons.get(resource).add(group);
        });
    });
    Set<String> toBeDeprovisioned = new HashSet<>();
    Set<String> toBeProvisioned = new HashSet<>();
    SyncopeClientException invalidValues = SyncopeClientException.build(ClientExceptionType.InvalidValues);
    // memberships
    anyObjectPatch.getMemberships().stream().filter((membPatch) -> (membPatch.getGroup() != null)).forEachOrdered(membPatch -> {
        Optional<? extends AMembership> membership = anyObject.getMembership(membPatch.getGroup());
        if (membership.isPresent()) {
            anyObject.getMemberships().remove(membership.get());
            membership.get().setLeftEnd(null);
            anyObject.getPlainAttrs(membership.get()).forEach(attr -> {
                anyObject.remove(attr);
                attr.setOwner(null);
            });
            if (membPatch.getOperation() == PatchOperation.DELETE) {
                groupDAO.findAllResourceKeys(membership.get().getRightEnd().getKey()).stream().filter(resource -> reasons.containsKey(resource)).forEach(resource -> {
                    reasons.get(resource).remove(membership.get().getRightEnd().getKey());
                    toBeProvisioned.add(resource);
                });
            }
        }
        if (membPatch.getOperation() == PatchOperation.ADD_REPLACE) {
            Group group = groupDAO.find(membPatch.getGroup());
            if (group == null) {
                LOG.debug("Ignoring invalid group {}", membPatch.getGroup());
            } else if (anyObject.getRealm().getFullPath().startsWith(group.getRealm().getFullPath())) {
                AMembership newMembership = entityFactory.newEntity(AMembership.class);
                newMembership.setRightEnd(group);
                newMembership.setLeftEnd(anyObject);
                anyObject.add(newMembership);
                membPatch.getPlainAttrs().forEach(attrTO -> {
                    PlainSchema schema = getPlainSchema(attrTO.getSchema());
                    if (schema == null) {
                        LOG.debug("Invalid " + PlainSchema.class.getSimpleName() + "{}, ignoring...", attrTO.getSchema());
                    } else {
                        Optional<? extends APlainAttr> attr = anyObject.getPlainAttr(schema.getKey(), newMembership);
                        if (!attr.isPresent()) {
                            LOG.debug("No plain attribute found for {} and membership of {}", schema, newMembership.getRightEnd());
                            APlainAttr newAttr = anyUtils.newPlainAttr();
                            newAttr.setOwner(anyObject);
                            newAttr.setMembership(newMembership);
                            newAttr.setSchema(schema);
                            anyObject.add(newAttr);
                            AttrPatch patch = new AttrPatch.Builder().attrTO(attrTO).build();
                            processAttrPatch(anyObject, patch, schema, newAttr, anyUtils, resources, propByRes, invalidValues);
                        }
                    }
                });
                if (!invalidValues.isEmpty()) {
                    scce.addException(invalidValues);
                }
                toBeProvisioned.addAll(groupDAO.findAllResourceKeys(group.getKey()));
            } else {
                LOG.error("{} cannot be assigned to {}", group, anyObject);
                SyncopeClientException unassignabled = SyncopeClientException.build(ClientExceptionType.InvalidMembership);
                unassignabled.getElements().add("Cannot be assigned: " + group);
                scce.addException(unassignabled);
            }
        }
    });
    // finalize resource management
    reasons.entrySet().stream().filter(entry -> entry.getValue().isEmpty()).forEach(entry -> toBeDeprovisioned.add(entry.getKey()));
    propByRes.addAll(ResourceOperation.DELETE, toBeDeprovisioned);
    propByRes.addAll(ResourceOperation.UPDATE, toBeProvisioned);
    // attribute values.
    if (!toBeDeprovisioned.isEmpty() || !toBeProvisioned.isEmpty()) {
        currentResources.removeAll(toBeDeprovisioned);
        propByRes.addAll(ResourceOperation.UPDATE, currentResources);
    }
    // check if some connObjectKey was changed by the update above
    Map<String, String> newcCnnObjectKeys = getConnObjectKeys(anyObject, anyUtils);
    oldConnObjectKeys.entrySet().stream().filter(entry -> newcCnnObjectKeys.containsKey(entry.getKey()) && !entry.getValue().equals(newcCnnObjectKeys.get(entry.getKey()))).forEach(entry -> {
        propByRes.addOldConnObjectKey(entry.getKey(), entry.getValue());
        propByRes.add(ResourceOperation.UPDATE, entry.getKey());
    });
    Pair<Set<String>, Set<String>> dynGroupMembs = anyObjectDAO.saveAndGetDynGroupMembs(anyObject);
    // finally check if any resource assignment is to be processed due to dynamic group membership change
    dynGroupMembs.getLeft().stream().filter(group -> !dynGroupMembs.getRight().contains(group)).forEach(delete -> {
        groupDAO.find(delete).getResources().stream().filter(resource -> !propByRes.contains(resource.getKey())).forEach(resource -> {
            propByRes.add(ResourceOperation.DELETE, resource.getKey());
        });
    });
    dynGroupMembs.getLeft().stream().filter(group -> dynGroupMembs.getRight().contains(group)).forEach(update -> {
        groupDAO.find(update).getResources().stream().filter(resource -> !propByRes.contains(resource.getKey())).forEach(resource -> {
            propByRes.add(ResourceOperation.UPDATE, resource.getKey());
        });
    });
    dynGroupMembs.getRight().stream().filter(group -> !dynGroupMembs.getLeft().contains(group)).forEach(create -> {
        groupDAO.find(create).getResources().stream().filter(resource -> !propByRes.contains(resource.getKey())).forEach(resource -> {
            propByRes.add(ResourceOperation.CREATE, resource.getKey());
        });
    });
    // Throw composite exception if there is at least one element set in the composing exceptions
    if (scce.hasExceptions()) {
        throw scce;
    }
    return propByRes;
}
Also used : SyncopeClientException(org.apache.syncope.common.lib.SyncopeClientException) Realm(org.apache.syncope.core.persistence.api.entity.Realm) AnyObjectPatch(org.apache.syncope.common.lib.patch.AnyObjectPatch) AnyType(org.apache.syncope.core.persistence.api.entity.AnyType) Autowired(org.springframework.beans.factory.annotation.Autowired) HashMap(java.util.HashMap) ResourceOperation(org.apache.syncope.common.lib.types.ResourceOperation) BeanUtils(org.apache.syncope.core.spring.BeanUtils) StringUtils(org.apache.commons.lang3.StringUtils) HashSet(java.util.HashSet) AnyTypeKind(org.apache.syncope.common.lib.types.AnyTypeKind) Pair(org.apache.commons.lang3.tuple.Pair) Map(java.util.Map) PropagationByResource(org.apache.syncope.core.provisioning.api.PropagationByResource) SyncopeClientCompositeException(org.apache.syncope.common.lib.SyncopeClientCompositeException) ClientExceptionType(org.apache.syncope.common.lib.types.ClientExceptionType) MembershipTO(org.apache.syncope.common.lib.to.MembershipTO) AnyObject(org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject) Collection(java.util.Collection) AMembership(org.apache.syncope.core.persistence.api.entity.anyobject.AMembership) Set(java.util.Set) Collectors(java.util.stream.Collectors) AnyTypeDAO(org.apache.syncope.core.persistence.api.dao.AnyTypeDAO) VirSchema(org.apache.syncope.core.persistence.api.entity.VirSchema) ExternalResource(org.apache.syncope.core.persistence.api.entity.resource.ExternalResource) List(java.util.List) ARelationship(org.apache.syncope.core.persistence.api.entity.anyobject.ARelationship) Component(org.springframework.stereotype.Component) AttrPatch(org.apache.syncope.common.lib.patch.AttrPatch) PatchOperation(org.apache.syncope.common.lib.types.PatchOperation) PlainSchema(org.apache.syncope.core.persistence.api.entity.PlainSchema) Group(org.apache.syncope.core.persistence.api.entity.group.Group) Optional(java.util.Optional) RelationshipType(org.apache.syncope.core.persistence.api.entity.RelationshipType) AnyUtils(org.apache.syncope.core.persistence.api.entity.AnyUtils) AnyObjectDataBinder(org.apache.syncope.core.provisioning.api.data.AnyObjectDataBinder) Collections(java.util.Collections) AnyObjectTO(org.apache.syncope.common.lib.to.AnyObjectTO) APlainAttr(org.apache.syncope.core.persistence.api.entity.anyobject.APlainAttr) Transactional(org.springframework.transaction.annotation.Transactional) Group(org.apache.syncope.core.persistence.api.entity.group.Group) HashSet(java.util.HashSet) Set(java.util.Set) APlainAttr(org.apache.syncope.core.persistence.api.entity.anyobject.APlainAttr) HashMap(java.util.HashMap) RelationshipType(org.apache.syncope.core.persistence.api.entity.RelationshipType) PropagationByResource(org.apache.syncope.core.provisioning.api.PropagationByResource) PlainSchema(org.apache.syncope.core.persistence.api.entity.PlainSchema) AnyType(org.apache.syncope.core.persistence.api.entity.AnyType) HashSet(java.util.HashSet) SyncopeClientCompositeException(org.apache.syncope.common.lib.SyncopeClientCompositeException) Optional(java.util.Optional) SyncopeClientException(org.apache.syncope.common.lib.SyncopeClientException) ARelationship(org.apache.syncope.core.persistence.api.entity.anyobject.ARelationship) ExternalResource(org.apache.syncope.core.persistence.api.entity.resource.ExternalResource) AttrPatch(org.apache.syncope.common.lib.patch.AttrPatch) AnyObject(org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject) AMembership(org.apache.syncope.core.persistence.api.entity.anyobject.AMembership) AnyUtils(org.apache.syncope.core.persistence.api.entity.AnyUtils)

Example 77 with SyncopeClientException

use of org.apache.syncope.common.lib.SyncopeClientException in project syncope by apache.

the class ConfigurationDataBinderImpl method fillAttr.

private void fillAttr(final List<String> values, final PlainSchema schema, final CPlainAttr attr, final SyncopeClientException invalidValues) {
    // if schema is multivalue, all values are considered for addition;
    // otherwise only the fist one - if provided - is considered
    List<String> valuesProvided = schema.isMultivalue() ? values : (values.isEmpty() ? Collections.<String>emptyList() : Collections.singletonList(values.iterator().next()));
    if (valuesProvided.isEmpty()) {
        JexlContext jexlContext = new MapContext();
        JexlUtils.addPlainAttrsToContext(confDAO.get().getPlainAttrs(), jexlContext);
        if (!schema.isReadonly() && Boolean.parseBoolean(JexlUtils.evaluate(schema.getMandatoryCondition(), jexlContext))) {
            LOG.error("Mandatory schema " + schema.getKey() + " not provided with values");
            SyncopeClientException reqValMissing = SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing);
            reqValMissing.getElements().add(schema.getKey());
            throw reqValMissing;
        }
    }
    for (String value : valuesProvided) {
        if (value == null || value.isEmpty()) {
            LOG.debug("Null value for {}, ignoring", schema.getKey());
        } else {
            try {
                PlainAttrValue attrValue;
                if (schema.isUniqueConstraint()) {
                    attrValue = entityFactory.newEntity(CPlainAttrUniqueValue.class);
                    ((PlainAttrUniqueValue) attrValue).setSchema(schema);
                } else {
                    attrValue = entityFactory.newEntity(CPlainAttrValue.class);
                }
                attr.add(value, attrValue);
            } catch (InvalidPlainAttrValueException e) {
                LOG.warn("Invalid value for attribute " + schema.getKey() + ": " + value, e);
                invalidValues.getElements().add(schema.getKey() + ": " + value + " - " + e.getMessage());
            }
        }
    }
}
Also used : CPlainAttrUniqueValue(org.apache.syncope.core.persistence.api.entity.conf.CPlainAttrUniqueValue) PlainAttrUniqueValue(org.apache.syncope.core.persistence.api.entity.PlainAttrUniqueValue) CPlainAttrValue(org.apache.syncope.core.persistence.api.entity.conf.CPlainAttrValue) CPlainAttrUniqueValue(org.apache.syncope.core.persistence.api.entity.conf.CPlainAttrUniqueValue) JexlContext(org.apache.commons.jexl3.JexlContext) SyncopeClientException(org.apache.syncope.common.lib.SyncopeClientException) PlainAttrValue(org.apache.syncope.core.persistence.api.entity.PlainAttrValue) CPlainAttrValue(org.apache.syncope.core.persistence.api.entity.conf.CPlainAttrValue) MapContext(org.apache.commons.jexl3.MapContext) InvalidPlainAttrValueException(org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidPlainAttrValueException)

Example 78 with SyncopeClientException

use of org.apache.syncope.common.lib.SyncopeClientException in project syncope by apache.

the class GroupDataBinderImpl method create.

@Override
public void create(final Group group, final GroupTO groupTO) {
    SyncopeClientCompositeException scce = SyncopeClientException.buildComposite();
    // name
    SyncopeClientException invalidGroups = SyncopeClientException.build(ClientExceptionType.InvalidGroup);
    if (groupTO.getName() == null) {
        LOG.error("No name specified for this group");
        invalidGroups.getElements().add("No name specified for this group");
    } else {
        group.setName(groupTO.getName());
    }
    // realm
    Realm realm = realmDAO.findByFullPath(groupTO.getRealm());
    if (realm == null) {
        SyncopeClientException noRealm = SyncopeClientException.build(ClientExceptionType.InvalidRealm);
        noRealm.getElements().add("Invalid or null realm specified: " + groupTO.getRealm());
        scce.addException(noRealm);
    }
    group.setRealm(realm);
    // attributes and resources
    fill(group, groupTO, anyUtilsFactory.getInstance(AnyTypeKind.GROUP), scce);
    // owner
    if (groupTO.getUserOwner() != null) {
        User owner = userDAO.find(groupTO.getUserOwner());
        if (owner == null) {
            LOG.warn("Ignoring invalid user specified as owner: {}", groupTO.getUserOwner());
        } else {
            group.setUserOwner(owner);
        }
    }
    if (groupTO.getGroupOwner() != null) {
        Group owner = groupDAO.find(groupTO.getGroupOwner());
        if (owner == null) {
            LOG.warn("Ignoring invalid group specified as owner: {}", groupTO.getGroupOwner());
        } else {
            group.setGroupOwner(owner);
        }
    }
    // dynamic membership
    if (groupTO.getUDynMembershipCond() != null) {
        setDynMembership(group, anyTypeDAO.findUser(), groupTO.getUDynMembershipCond());
    }
    groupTO.getADynMembershipConds().forEach((type, fiql) -> {
        AnyType anyType = anyTypeDAO.find(type);
        if (anyType == null) {
            LOG.warn("Ignoring invalid {}: {}", AnyType.class.getSimpleName(), type);
        } else {
            setDynMembership(group, anyType, fiql);
        }
    });
    // type extensions
    groupTO.getTypeExtensions().forEach(typeExtTO -> {
        AnyType anyType = anyTypeDAO.find(typeExtTO.getAnyType());
        if (anyType == null) {
            LOG.warn("Ignoring invalid {}: {}", AnyType.class.getSimpleName(), typeExtTO.getAnyType());
        } else {
            TypeExtension typeExt = entityFactory.newEntity(TypeExtension.class);
            typeExt.setAnyType(anyType);
            typeExt.setGroup(group);
            group.add(typeExt);
            typeExtTO.getAuxClasses().forEach(name -> {
                AnyTypeClass anyTypeClass = anyTypeClassDAO.find(name);
                if (anyTypeClass == null) {
                    LOG.warn("Ignoring invalid {}: {}", AnyTypeClass.class.getSimpleName(), name);
                } else {
                    typeExt.add(anyTypeClass);
                }
            });
            if (typeExt.getAuxClasses().isEmpty()) {
                group.getTypeExtensions().remove(typeExt);
                typeExt.setGroup(null);
            }
        }
    });
    // Throw composite exception if there is at least one element set in the composing exceptions
    if (scce.hasExceptions()) {
        throw scce;
    }
}
Also used : Group(org.apache.syncope.core.persistence.api.entity.group.Group) SyncopeClientCompositeException(org.apache.syncope.common.lib.SyncopeClientCompositeException) User(org.apache.syncope.core.persistence.api.entity.user.User) SyncopeClientException(org.apache.syncope.common.lib.SyncopeClientException) TypeExtension(org.apache.syncope.core.persistence.api.entity.group.TypeExtension) Realm(org.apache.syncope.core.persistence.api.entity.Realm) AnyType(org.apache.syncope.core.persistence.api.entity.AnyType) AnyTypeClass(org.apache.syncope.core.persistence.api.entity.AnyTypeClass)

Example 79 with SyncopeClientException

use of org.apache.syncope.common.lib.SyncopeClientException in project syncope by apache.

the class GroupDataBinderImpl method setDynMembership.

private void setDynMembership(final Group group, final AnyType anyType, final String dynMembershipFIQL) {
    SearchCond dynMembershipCond = SearchCondConverter.convert(dynMembershipFIQL);
    if (!dynMembershipCond.isValid()) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidSearchExpression);
        sce.getElements().add(dynMembershipFIQL);
        throw sce;
    }
    if (anyType.getKind() == AnyTypeKind.GROUP) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidAnyType);
        sce.getElements().add(anyType.getKind().name());
        throw sce;
    }
    DynGroupMembership<?> dynMembership;
    if (anyType.getKind() == AnyTypeKind.ANY_OBJECT && !group.getADynMembership(anyType).isPresent()) {
        dynMembership = entityFactory.newEntity(ADynGroupMembership.class);
        dynMembership.setGroup(group);
        ((ADynGroupMembership) dynMembership).setAnyType(anyType);
        group.add((ADynGroupMembership) dynMembership);
    } else if (anyType.getKind() == AnyTypeKind.USER && group.getUDynMembership() == null) {
        dynMembership = entityFactory.newEntity(UDynGroupMembership.class);
        dynMembership.setGroup(group);
        group.setUDynMembership((UDynGroupMembership) dynMembership);
    } else {
        dynMembership = anyType.getKind() == AnyTypeKind.ANY_OBJECT ? group.getADynMembership(anyType).get() : group.getUDynMembership();
    }
    dynMembership.setFIQLCond(dynMembershipFIQL);
}
Also used : UDynGroupMembership(org.apache.syncope.core.persistence.api.entity.user.UDynGroupMembership) SyncopeClientException(org.apache.syncope.common.lib.SyncopeClientException) SearchCond(org.apache.syncope.core.persistence.api.dao.search.SearchCond) ADynGroupMembership(org.apache.syncope.core.persistence.api.entity.anyobject.ADynGroupMembership)

Example 80 with SyncopeClientException

use of org.apache.syncope.common.lib.SyncopeClientException in project syncope by apache.

the class ConnInstanceDataBinderImpl method getConnInstance.

@Override
public ConnInstance getConnInstance(final ConnInstanceTO connInstanceTO) {
    SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing);
    if (connInstanceTO.getLocation() == null) {
        sce.getElements().add("location");
    }
    if (connInstanceTO.getBundleName() == null) {
        sce.getElements().add("bundlename");
    }
    if (connInstanceTO.getVersion() == null) {
        sce.getElements().add("bundleversion");
    }
    if (connInstanceTO.getConnectorName() == null) {
        sce.getElements().add("connectorname");
    }
    if (connInstanceTO.getConf().isEmpty()) {
        sce.getElements().add("configuration");
    }
    ConnInstance connInstance = entityFactory.newEntity(ConnInstance.class);
    BeanUtils.copyProperties(connInstanceTO, connInstance, IGNORE_PROPERTIES);
    if (connInstanceTO.getAdminRealm() != null) {
        connInstance.setAdminRealm(realmDAO.findByFullPath(connInstanceTO.getAdminRealm()));
    }
    if (connInstance.getAdminRealm() == null) {
        sce.getElements().add("Invalid or null realm specified: " + connInstanceTO.getAdminRealm());
    }
    if (connInstanceTO.getLocation() != null) {
        connInstance.setLocation(connInstanceTO.getLocation());
    }
    connInstance.setConf(connInstanceTO.getConf());
    if (connInstanceTO.getPoolConf() != null) {
        connInstance.setPoolConf(ConnPoolConfUtils.getConnPoolConf(connInstanceTO.getPoolConf(), entityFactory.newConnPoolConf()));
    }
    // Throw exception if there is at least one element set
    if (!sce.isEmpty()) {
        throw sce;
    }
    return connInstance;
}
Also used : SyncopeClientException(org.apache.syncope.common.lib.SyncopeClientException) ConnInstance(org.apache.syncope.core.persistence.api.entity.ConnInstance)

Aggregations

SyncopeClientException (org.apache.syncope.common.lib.SyncopeClientException)240 Test (org.junit.jupiter.api.Test)105 UserTO (org.apache.syncope.common.lib.to.UserTO)50 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)42 NotFoundException (org.apache.syncope.core.persistence.api.dao.NotFoundException)40 Response (javax.ws.rs.core.Response)34 ResourceTO (org.apache.syncope.common.lib.to.ResourceTO)20 PlainSchemaTO (org.apache.syncope.common.lib.to.PlainSchemaTO)19 MembershipTO (org.apache.syncope.common.lib.to.MembershipTO)18 Realm (org.apache.syncope.core.persistence.api.entity.Realm)18 GroupTO (org.apache.syncope.common.lib.to.GroupTO)17 ClientExceptionType (org.apache.syncope.common.lib.types.ClientExceptionType)16 AttrTO (org.apache.syncope.common.lib.to.AttrTO)15 Map (java.util.Map)14 SyncopeClientCompositeException (org.apache.syncope.common.lib.SyncopeClientCompositeException)14 ArrayList (java.util.ArrayList)12 List (java.util.List)12 ItemTO (org.apache.syncope.common.lib.to.ItemTO)12 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)12 AnyObjectTO (org.apache.syncope.common.lib.to.AnyObjectTO)11