Examples of AbstractVirSchema


Examples of org.apache.syncope.core.persistence.beans.AbstractVirSchema

    @RequestMapping(method = RequestMethod.GET, value = "/{kind}/read/{virtualSchema}")
    public VirtualSchemaTO read(@PathVariable("kind") final String kind,
            @PathVariable("virtualSchema") final String virtualSchemaName) throws NotFoundException {

        Class reference = getAttributableUtil(kind).virtualSchemaClass();
        AbstractVirSchema virtualSchema = virtualSchemaDAO.find(virtualSchemaName, reference);
        if (virtualSchema == null) {
            throw new NotFoundException("Virtual schema '" + virtualSchemaName + "'");
        }

        auditManager.audit(Category.schema, SchemaSubCategory.readVirtual, Result.success,
                "Successfully read virtual schema: " + kind + "/" + virtualSchema.getName());

        return virtualSchemaDataBinder.getVirtualSchemaTO(virtualSchema);
    }
View Full Code Here

Examples of org.apache.syncope.core.persistence.beans.AbstractVirSchema

    @RequestMapping(method = RequestMethod.POST, value = "/{kind}/update")
    public VirtualSchemaTO update(@RequestBody final VirtualSchemaTO virtualSchemaTO,
            @PathVariable("kind") final String kind) throws SyncopeClientCompositeErrorException, NotFoundException {

        Class reference = getAttributableUtil(kind).virtualSchemaClass();
        AbstractVirSchema virtualSchema = virtualSchemaDAO.find(virtualSchemaTO.getName(), reference);
        if (virtualSchema == null) {
            throw new NotFoundException("Virtual schema is null");
        }

        virtualSchema = virtualSchemaDataBinder.update(virtualSchemaTO, virtualSchema,
                getAttributableUtil(kind).schemaClass());
        virtualSchema = virtualSchemaDAO.save(virtualSchema);

        auditManager.audit(Category.schema, SchemaSubCategory.updateVirtual, Result.success,
                "Successfully updated virtual schema: " + kind + "/" + virtualSchema.getName());

        return virtualSchemaDataBinder.getVirtualSchemaTO(virtualSchema);
    }
View Full Code Here

Examples of org.apache.syncope.core.persistence.beans.AbstractVirSchema

        PropagationByResource propByRes = new PropagationByResource();

        // 1. virtual attributes to be removed
        for (String vAttrToBeRemoved : vAttrsToBeRemoved) {
            AbstractVirSchema virtualSchema = getVirtualSchema(vAttrToBeRemoved, attributableUtil.virtualSchemaClass());

            if (virtualSchema != null) {
                AbstractVirAttr virtualAttribute = attributable.getVirtualAttribute(virtualSchema.getName());

                if (virtualAttribute == null) {
                    LOG.debug("No virtual attribute found for schema {}", virtualSchema.getName());
                } else {
                    attributable.removeVirtualAttribute(virtualAttribute);
                    virAttrDAO.delete(virtualAttribute);
                }

                for (SchemaMapping mapping : resourceDAO.findAllMappings()) {
                    if (virtualSchema.getName().equals(mapping.getIntAttrName())
                            && mapping.getIntMappingType() == attributableUtil.virtualIntMappingType()
                            && mapping.getResource() != null
                            && attributable.getResources().contains(mapping.getResource())) {

                        propByRes.add(PropagationOperation.UPDATE, mapping.getResource().getName());

                        // TODO: must be avoided to use virtual attribute as AccountId
                        if (mapping.isAccountid() && virtualAttribute != null
                                && !virtualAttribute.getValues().isEmpty()) {

                            propByRes.addOldAccountId(mapping.getResource().getName(), virtualAttribute.getValues()
                                    .get(0));
                        }
                    }
                }
            }
        }

        LOG.debug("Virtual attributes to be removed:\n{}", propByRes);

        // 2. virtual attributes to be updated
        for (AttributeMod vAttrToBeUpdated : vAttrsToBeUpdated) {
            AbstractVirSchema virtualSchema = getVirtualSchema(vAttrToBeUpdated.getSchema(), attributableUtil
                    .virtualSchemaClass());

            if (virtualSchema != null) {
                for (SchemaMapping mapping : resourceDAO.findAllMappings()) {
                    if (virtualSchema.getName().equals(mapping.getIntAttrName())
                            && mapping.getIntMappingType() == attributableUtil.virtualIntMappingType()
                            && mapping.getResource() != null
                            && attributable.getResources().contains(mapping.getResource())) {

                        propByRes.add(PropagationOperation.UPDATE, mapping.getResource().getName());
                    }
                }

                AbstractVirAttr virtualAttribute = attributable.getVirtualAttribute(virtualSchema.getName());

                if (virtualAttribute == null) {
                    virtualAttribute = attributableUtil.newVirtualAttribute();
                    virtualAttribute.setVirtualSchema(virtualSchema);
                    attributable.addVirtualAttribute(virtualAttribute);
View Full Code Here

Examples of org.apache.syncope.core.persistence.beans.AbstractVirSchema

        for (AttributeTO attributeTO : vAttrs) {
            AbstractVirAttr virtualAttribute = attributable.getVirtualAttribute(attributeTO.getSchema());

            if (virtualAttribute == null) {
                AbstractVirSchema virtualSchema = getVirtualSchema(attributeTO.getSchema(), attributableUtil
                        .virtualSchemaClass());

                if (virtualSchema != null) {
                    virtualAttribute = attributableUtil.newVirtualAttribute();
                    virtualAttribute.setVirtualSchema(virtualSchema);
View Full Code Here

Examples of org.apache.syncope.core.persistence.beans.AbstractVirSchema

        }

        // 3. user virtual attributes will be valued by the propagation manager only (if needed).
        if (AttributableType.USER == attributableUtil.getType()) {
            for (AttributeTO vattrTO : attributableTO.getVirtualAttributes()) {
                AbstractVirSchema uVirSchema = getVirtualSchema(vattrTO.getSchema(), attributableUtil
                        .virtualSchemaClass());

                if (uVirSchema != null) {
                    AbstractVirAttr vattr = attributableUtil.newVirtualAttribute();
                    vattr.setVirtualSchema(uVirSchema);
View Full Code Here

Examples of org.apache.syncope.core.persistence.beans.AbstractVirSchema

    }

    @Override
    public void delete(final String name, final AttributableUtil attributableUtil) {

        final AbstractVirSchema virtualSchema = find(name, attributableUtil.virtualSchemaClass());

        if (virtualSchema == null) {
            return;
        }
View Full Code Here

Examples of org.apache.syncope.core.persistence.beans.AbstractVirSchema

        PropagationByResource propByRes = new PropagationByResource();

        // 1. virtual attributes to be removed
        for (String vAttrToBeRemoved : vAttrsToBeRemoved) {
            AbstractVirSchema virtualSchema = getVirtualSchema(vAttrToBeRemoved, attributableUtil.virtualSchemaClass());

            if (virtualSchema != null) {
                AbstractVirAttr virtualAttribute = attributable.getVirtualAttribute(virtualSchema.getName());

                if (virtualAttribute == null) {
                    LOG.debug("No virtual attribute found for schema {}", virtualSchema.getName());
                } else {
                    attributable.removeVirtualAttribute(virtualAttribute);
                    virAttrDAO.delete(virtualAttribute);
                }

                for (SchemaMapping mapping : resourceDAO.findAllMappings()) {
                    if (virtualSchema.getName().equals(mapping.getIntAttrName())
                            && mapping.getIntMappingType() == attributableUtil.virtualIntMappingType()
                            && mapping.getResource() != null
                            && attributable.getResources().contains(mapping.getResource())) {

                        propByRes.add(PropagationOperation.UPDATE, mapping.getResource().getName());

                        // TODO: must be avoided to use virtual attribute as AccountId
                        if (mapping.isAccountid() && virtualAttribute != null
                                && !virtualAttribute.getValues().isEmpty()) {

                            propByRes.addOldAccountId(mapping.getResource().getName(), virtualAttribute.getValues().get(
                                    0));
                        }
                    }
                }
            }
        }

        LOG.debug("Virtual attributes to be removed:\n{}", propByRes);

        // 2. virtual attributes to be updated
        for (AttributeMod vAttrToBeUpdated : vAttrsToBeUpdated) {
            AbstractVirSchema virtualSchema = getVirtualSchema(vAttrToBeUpdated.getSchema(), attributableUtil.
                    virtualSchemaClass());

            if (virtualSchema != null) {
                for (SchemaMapping mapping : resourceDAO.findAllMappings()) {
                    if (virtualSchema.getName().equals(mapping.getIntAttrName())
                            && mapping.getIntMappingType() == attributableUtil.virtualIntMappingType()
                            && mapping.getResource() != null
                            && attributable.getResources().contains(mapping.getResource())) {

                        propByRes.add(PropagationOperation.UPDATE, mapping.getResource().getName());
                    }
                }

                AbstractVirAttr virtualAttribute = attributable.getVirtualAttribute(virtualSchema.getName());

                if (virtualAttribute == null) {
                    virtualAttribute = attributableUtil.newVirtualAttribute();
                    virtualAttribute.setVirtualSchema(virtualSchema);
                    attributable.addVirtualAttribute(virtualAttribute);
View Full Code Here

Examples of org.apache.syncope.core.persistence.beans.AbstractVirSchema

        for (AttributeTO attributeTO : vAttrs) {
            AbstractVirAttr virtualAttribute = attributable.getVirtualAttribute(attributeTO.getSchema());

            if (virtualAttribute == null) {
                AbstractVirSchema virtualSchema = getVirtualSchema(attributeTO.getSchema(), attributableUtil.
                        virtualSchemaClass());

                if (virtualSchema != null) {
                    virtualAttribute = attributableUtil.newVirtualAttribute();
                    virtualAttribute.setVirtualSchema(virtualSchema);
View Full Code Here

Examples of org.apache.syncope.core.persistence.beans.AbstractVirSchema

        }

        // 3. user virtual attributes will be valued by the propagation manager only (if needed).
        if (AttributableType.USER == attributableUtil.getType()) {
            for (AttributeTO vattrTO : attributableTO.getVirtualAttributes()) {
                AbstractVirSchema uVirSchema = getVirtualSchema(vattrTO.getSchema(),
                        attributableUtil.virtualSchemaClass());

                if (uVirSchema != null) {
                    AbstractVirAttr vattr = attributableUtil.newVirtualAttribute();
                    vattr.setVirtualSchema(uVirSchema);
View Full Code Here

Examples of org.apache.syncope.core.persistence.beans.AbstractVirSchema

            case UserVirtualSchema:
            case RoleVirtualSchema:
            case MembershipVirtualSchema:
                VirSchemaDAO virSchemaDAO = context.getBean(VirSchemaDAO.class);
                AbstractVirSchema virSchema = virSchemaDAO.find(mapItem.getIntAttrName(),
                        MappingUtil.getIntMappingTypeClass(mapItem.getIntMappingType()));
                readOnlyVirSchema = (virSchema != null && virSchema.isReadonly());
                schemaType = AttributeSchemaType.String;
                break;

            default:
                schemaType = AttributeSchemaType.String;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.