Search in sources :

Example 1 with JPAAnyUtilsFactory

use of org.apache.syncope.core.persistence.jpa.entity.JPAAnyUtilsFactory in project syncope by apache.

the class JPAPlainSchemaDAO method delete.

@Override
public void delete(final String key) {
    PlainSchema schema = find(key);
    if (schema == null) {
        return;
    }
    AnyUtilsFactory anyUtilsFactory = new JPAAnyUtilsFactory();
    for (AnyTypeKind anyTypeKind : AnyTypeKind.values()) {
        AnyUtils anyUtils = anyUtilsFactory.getInstance(anyTypeKind);
        for (PlainAttr<?> attr : findAttrs(schema, anyUtils.plainAttrClass())) {
            plainAttrDAO.delete(attr.getKey(), anyUtils.plainAttrClass());
        }
        resourceDAO().deleteMapping(key);
    }
    if (schema.getAnyTypeClass() != null) {
        schema.getAnyTypeClass().getPlainSchemas().remove(schema);
    }
    entityManager().remove(schema);
}
Also used : AnyUtilsFactory(org.apache.syncope.core.persistence.api.entity.AnyUtilsFactory) JPAAnyUtilsFactory(org.apache.syncope.core.persistence.jpa.entity.JPAAnyUtilsFactory) AnyTypeKind(org.apache.syncope.common.lib.types.AnyTypeKind) JPAAnyUtilsFactory(org.apache.syncope.core.persistence.jpa.entity.JPAAnyUtilsFactory) JPAPlainSchema(org.apache.syncope.core.persistence.jpa.entity.JPAPlainSchema) PlainSchema(org.apache.syncope.core.persistence.api.entity.PlainSchema) AnyUtils(org.apache.syncope.core.persistence.api.entity.AnyUtils)

Aggregations

AnyTypeKind (org.apache.syncope.common.lib.types.AnyTypeKind)1 AnyUtils (org.apache.syncope.core.persistence.api.entity.AnyUtils)1 AnyUtilsFactory (org.apache.syncope.core.persistence.api.entity.AnyUtilsFactory)1 PlainSchema (org.apache.syncope.core.persistence.api.entity.PlainSchema)1 JPAAnyUtilsFactory (org.apache.syncope.core.persistence.jpa.entity.JPAAnyUtilsFactory)1 JPAPlainSchema (org.apache.syncope.core.persistence.jpa.entity.JPAPlainSchema)1