Examples of AbstractVirSchema


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

    @RequestMapping(method = RequestMethod.GET, value = "/{kind}/delete/{schema}")
    public VirtualSchemaTO delete(@PathVariable("kind") final String kind,
            @PathVariable("schema") final String virtualSchemaName) {

        Class<? extends AbstractVirSchema> reference = getAttributableUtil(kind).virSchemaClass();
        AbstractVirSchema virSchema = virSchemaDAO.find(virtualSchemaName, reference);
        if (virSchema == null) {
            throw new NotFoundException("Virtual schema '" + virtualSchemaName + "'");
        }

        VirtualSchemaTO schemaToDelete = binder.getVirtualSchemaTO(virSchema);
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

        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

        PropagationByResource propByRes = new PropagationByResource();

        // 1. virtual attributes to be removed
        for (String vAttrToBeRemoved : vAttrsToBeRemoved) {
            AbstractVirSchema virSchema = getVirtualSchema(vAttrToBeRemoved, attrUtil.virSchemaClass());
            if (virSchema != null) {
                AbstractVirAttr virAttr = attributable.getVirtualAttribute(virSchema.getName());
                if (virAttr == null) {
                    LOG.debug("No virtual attribute found for schema {}", virSchema.getName());
                } else {
                    attributable.removeVirtualAttribute(virAttr);
                    virAttrDAO.delete(virAttr);
                }

                for (ExternalResource resource : resourceDAO.findAll()) {
                    for (AbstractMappingItem mapItem : attrUtil.getMappingItems(resource, MappingPurpose.PROPAGATION)) {
                        if (virSchema.getName().equals(mapItem.getIntAttrName())
                                && mapItem.getIntMappingType() == attrUtil.virIntMappingType()
                                && attributable.getResources().contains(resource)) {

                            propByRes.add(ResourceOperation.UPDATE, resource.getName());

                            // Using virtual attribute as AccountId must be avoided
                            if (mapItem.isAccountid() && virAttr != null && !virAttr.getValues().isEmpty()) {
                                propByRes.addOldAccountId(resource.getName(), virAttr.getValues().get(0));
                            }
                        }
                    }
                }
            }
        }

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

        // 2. virtual attributes to be updated
        for (AttributeMod vAttrToBeUpdated : vAttrsToBeUpdated) {
            AbstractVirSchema virSchema = getVirtualSchema(vAttrToBeUpdated.getSchema(), attrUtil.virSchemaClass());
            if (virSchema != null) {
                for (ExternalResource resource : resourceDAO.findAll()) {
                    for (AbstractMappingItem mapItem : attrUtil.getMappingItems(resource, MappingPurpose.PROPAGATION)) {
                        if (virSchema.getName().equals(mapItem.getIntAttrName())
                                && mapItem.getIntMappingType() == attrUtil.virIntMappingType()
                                && attributable.getResources().contains(resource)) {

                            propByRes.add(ResourceOperation.UPDATE, resource.getName());
                        }
                    }
                }

                AbstractVirAttr virAttr = attributable.getVirtualAttribute(virSchema.getName());
                if (virAttr == null) {
                    virAttr = attrUtil.newVirAttr();
                    virAttr.setVirtualSchema(virSchema);
                    attributable.addVirtualAttribute(virAttr);
                }
View Full Code Here

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

            final AttributableUtil attrUtil) {

        for (AttributeTO attributeTO : vAttrs) {
            AbstractVirAttr virAttr = attributable.getVirtualAttribute(attributeTO.getSchema());
            if (virAttr == null) {
                AbstractVirSchema virSchema = getVirtualSchema(attributeTO.getSchema(), attrUtil.virSchemaClass());
                if (virSchema != null) {
                    virAttr = attrUtil.newVirAttr();
                    virAttr.setVirtualSchema(virSchema);
                    virAttr.setOwner(attributable);
                    attributable.addVirtualAttribute(virAttr);
View Full Code Here

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

        // 3. user and role virtual attributes will be evaluated by the propagation manager only (if needed).
        if (AttributableType.USER == attributableUtil.getType()
                || AttributableType.ROLE == attributableUtil.getType()) {

            for (AttributeTO vattrTO : attributableTO.getVirtualAttributes()) {
                AbstractVirSchema uVirSchema = getVirtualSchema(vattrTO.getSchema(), attributableUtil.virSchemaClass());

                if (uVirSchema != null) {
                    AbstractVirAttr vattr = attributableUtil.newVirAttr();
                    vattr.setVirtualSchema(uVirSchema);
                    vattr.setOwner(attributable);
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

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

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

        AbstractVirSchema virtualSchema = virtualSchemaDAO.save(virtualSchemaDataBinder.create(
                virtualSchemaTO, getAttributableUtil(kind).newVirtualSchema(),
                getAttributableUtil(kind).schemaClass()));

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

        response.setStatus(HttpServletResponse.SC_CREATED);
        return virtualSchemaDataBinder.getVirtualSchemaTO(virtualSchema);
    }
View Full Code Here

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

    @RequestMapping(method = RequestMethod.GET, value = "/{kind}/delete/{schema}")
    public VirtualSchemaTO delete(@PathVariable("kind") final String kind,
            @PathVariable("schema") 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 + "'");
        }

        VirtualSchemaTO schemaToDelete = virtualSchemaDataBinder.getVirtualSchemaTO(virtualSchema);
        virtualSchemaDAO.delete(virtualSchemaName, getAttributableUtil(kind));

        auditManager.audit(Category.schema, SchemaSubCategory.deleteVirtual, Result.success,
                "Successfully deleted virtual schema: " + kind + "/" + virtualSchema.getName());
        return schemaToDelete;
    }
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.