Package org.apache.syncope.core.persistence.beans

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


        if (!requiredValuesMissing.isEmpty()) {
            compositeErrorException.addException(requiredValuesMissing);
        }

        // 2. derived attributes
        AbstractDerSchema derivedSchema;
        AbstractDerAttr derivedAttribute;
        for (AttributeTO attributeTO : attributableTO.getDerivedAttributes()) {

            derivedSchema = getDerivedSchema(attributeTO.getSchema(), attributableUtil.derivedSchemaClass());
View Full Code Here


                binder.create((VirSchemaTO) schemaTO, virSchema);
                virSchema = virSchemaDAO.save(virSchema);
                created = (T) binder.getVirSchemaTO(virSchema);
                break;
            case DERIVED:
                AbstractDerSchema derSchema = attrUtil.newDerSchema();
                binder.create((DerSchemaTO) schemaTO, derSchema);
                derSchema = derSchemaDAO.save(derSchema);

                created = (T) binder.getDerSchemaTO(derSchema);
                break;
View Full Code Here

                read = (T) binder.getVirSchemaTO(virSchema);
                break;

            case DERIVED:
                AbstractDerSchema derSchema = derSchemaDAO.find(schemaName, attrUtil.derSchemaClass());
                if (derSchema == null) {
                    throw new NotFoundException("Derived schema '" + schemaName + "'");
                }

                read = (T) binder.getDerSchemaTO(derSchema);
View Full Code Here

                binder.update((VirSchemaTO) schemaTO, virSchema);
                virSchemaDAO.save(virSchema);
                break;

            case DERIVED:
                AbstractDerSchema derSchema = derSchemaDAO.find(schemaTO.getName(), attrUtil.derSchemaClass());
                if (derSchema == null) {
                    throw new NotFoundException("Derived schema '" + schemaTO.getName() + "'");
                }

                binder.update((DerSchemaTO) schemaTO, derSchema);
View Full Code Here

        LOG.debug("Attributes to be updated:\n{}", propByRes);

        // 5. derived attributes to be removed
        for (String derAttrToBeRemoved : attributableMod.getDerAttrsToRemove()) {
            AbstractDerSchema derSchema = getDerSchema(derAttrToBeRemoved, attrUtil.derSchemaClass());
            if (derSchema != null) {
                AbstractDerAttr derAttr = attributable.getDerAttr(derSchema.getName());
                if (derAttr == null) {
                    LOG.debug("No derived attribute found for schema {}", derSchema.getName());
                } else {
                    derAttrDAO.delete(derAttr);
                }

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

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

                                if (mapItem.isAccountid() && derAttr != null
                                        && !derAttr.getValue(attributable.getAttrs()).isEmpty()) {

                                    propByRes.addOldAccountId(resource.getName(),
                                            derAttr.getValue(attributable.getAttrs()));
                                }
                            }
                        }
                    }
                }
            }
        }

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

        // 6. derived attributes to be added
        for (String derAttrToBeAdded : attributableMod.getDerAttrsToAdd()) {
            AbstractDerSchema derSchema = getDerSchema(derAttrToBeAdded, attrUtil.derSchemaClass());
            if (derSchema != null) {
                if (attributable instanceof AbstractSubject) {
                    for (ExternalResource resource : resourceDAO.findAll()) {
                        for (AbstractMappingItem mapItem : attrUtil.
                                getMappingItems(resource, MappingPurpose.PROPAGATION)) {
                            if (derSchema.getName().equals(mapItem.getIntAttrName())
                                    && mapItem.getIntMappingType() == attrUtil.derIntMappingType()
                                    && ((AbstractSubject) attributable).getResources().contains(resource)) {

                                propByRes.add(ResourceOperation.UPDATE, resource.getName());
                            }
View Full Code Here

            scce.addException(invalidValues);
        }

        // 2. derived attributes
        for (AttributeTO attributeTO : attributableTO.getDerAttrs()) {
            AbstractDerSchema derSchema = getDerSchema(attributeTO.getSchema(), attributableUtil.derSchemaClass());

            if (derSchema != null) {
                AbstractDerAttr derAttr = attributableUtil.newDerAttr();
                setDerAttrSchema(attributable, derAttr, derSchema);
                if (derAttr.getSchema() == null) {
View Full Code Here

    }

    @Override
    @SuppressWarnings("unchecked")
    public void delete(final String name, final AttributableUtil attributableUtil) {
        final AbstractDerSchema schema = find(name, attributableUtil.derSchemaClass());
        if (schema == null) {
            return;
        }

        final Set<Long> attrIds = new HashSet<Long>();
        for (AbstractDerAttr attr : findAttrs(schema, attributableUtil.derAttrClass())) {
            attrIds.add(attr.getId());
        }
        for (Long attrId : attrIds) {
            derAttrDAO.delete(attrId, attributableUtil.derAttrClass());
        }

        if (attributableUtil.getType() != AttributableType.USER) {
            for (Iterator<Number> it = attrTemplateDAO.
                    findBySchemaName(schema.getName(), attributableUtil.derAttrTemplateClass()).iterator();
                    it.hasNext();) {

                attrTemplateDAO.delete(it.next().longValue(), attributableUtil.derAttrTemplateClass());
            }
        }
View Full Code Here

        UDerSchema cn = derSchemaDAO.find("cn", UDerSchema.class);
        assertNotNull(cn);

        derSchemaDAO.delete(cn.getName(), AttributableUtil.getInstance(AttributableType.USER));

        AbstractDerSchema actual = derSchemaDAO.find("cn", UDerSchema.class);
        assertNull("delete did not work", actual);

        // ------------- //

        RDerSchema rderiveddata = derSchemaDAO.find("rderiveddata", RDerSchema.class);
View Full Code Here

     */
    @Override
    public <T extends AbstractSubject> List<T> findByDerAttrValue(final String schemaName, final String value,
            final AttributableUtil attrUtil) {

        AbstractDerSchema schema = derSchemaDAO.find(schemaName, attrUtil.derSchemaClass());
        if (schema == null) {
            LOG.error("Invalid schema name '{}'", schemaName);
            return Collections.<T>emptyList();
        }

        // query string
        final StringBuilder querystring = new StringBuilder();

        boolean subquery = false;
        for (String clause : getWhereClause(schema.getExpression(), value, attrUtil)) {
            if (querystring.length() > 0) {
                subquery = true;
                querystring.append(" AND a.owner_id IN ( ");
            }

View Full Code Here

TOP

Related Classes of org.apache.syncope.core.persistence.beans.AbstractDerSchema

Copyright © 2018 www.massapicom. 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.