Search in sources :

Example 21 with DerSchema

use of org.apache.syncope.core.persistence.api.entity.DerSchema in project syncope by apache.

the class JPADerSchemaDAO method findByAnyTypeClasses.

@Override
public List<DerSchema> findByAnyTypeClasses(final Collection<AnyTypeClass> anyTypeClasses) {
    StringBuilder queryString = new StringBuilder("SELECT e FROM ").append(JPADerSchema.class.getSimpleName()).append(" e WHERE ");
    for (AnyTypeClass anyTypeClass : anyTypeClasses) {
        queryString.append("e.anyTypeClass.id='").append(anyTypeClass.getKey()).append("' OR ");
    }
    TypedQuery<DerSchema> query = entityManager().createQuery(queryString.substring(0, queryString.length() - 4), DerSchema.class);
    return query.getResultList();
}
Also used : JPADerSchema(org.apache.syncope.core.persistence.jpa.entity.JPADerSchema) DerSchema(org.apache.syncope.core.persistence.api.entity.DerSchema) AnyTypeClass(org.apache.syncope.core.persistence.api.entity.AnyTypeClass)

Example 22 with DerSchema

use of org.apache.syncope.core.persistence.api.entity.DerSchema in project syncope by apache.

the class DerSchemaTest method delete.

@Test
public void delete() {
    DerSchema cn = derSchemaDAO.find("cn");
    assertNotNull(cn);
    derSchemaDAO.delete(cn.getKey());
    DerSchema actual = derSchemaDAO.find("cn");
    assertNull(actual);
    // ------------- //
    DerSchema rderiveddata = derSchemaDAO.find("rderiveddata");
    assertNotNull(rderiveddata);
    derSchemaDAO.delete(rderiveddata.getKey());
    actual = derSchemaDAO.find("rderiveddata");
    assertNull(actual);
}
Also used : DerSchema(org.apache.syncope.core.persistence.api.entity.DerSchema) Test(org.junit.jupiter.api.Test) AbstractTest(org.apache.syncope.core.persistence.jpa.AbstractTest)

Aggregations

DerSchema (org.apache.syncope.core.persistence.api.entity.DerSchema)22 VirSchema (org.apache.syncope.core.persistence.api.entity.VirSchema)10 PlainSchema (org.apache.syncope.core.persistence.api.entity.PlainSchema)8 Test (org.junit.jupiter.api.Test)6 AbstractTest (org.apache.syncope.core.persistence.jpa.AbstractTest)5 ArrayList (java.util.ArrayList)4 AnyTypeClass (org.apache.syncope.core.persistence.api.entity.AnyTypeClass)4 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)4 List (java.util.List)3 DerSchemaTO (org.apache.syncope.common.lib.to.DerSchemaTO)3 PlainSchemaTO (org.apache.syncope.common.lib.to.PlainSchemaTO)3 VirSchemaTO (org.apache.syncope.common.lib.to.VirSchemaTO)3 User (org.apache.syncope.core.persistence.api.entity.user.User)3 Transactional (org.springframework.transaction.annotation.Transactional)3 ParseException (java.text.ParseException)2 HashMap (java.util.HashMap)2 Optional (java.util.Optional)2 JexlContext (org.apache.commons.jexl3.JexlContext)2 MapContext (org.apache.commons.jexl3.MapContext)2 SyncopeClientException (org.apache.syncope.common.lib.SyncopeClientException)2