Example usage for org.hibernate Session disableFilter

List of usage examples for org.hibernate Session disableFilter

Introduction

In this page you can find the example usage for org.hibernate Session disableFilter.

Prototype

void disableFilter(String filterName);

Source Link

Document

Disable the named filter for the current session.

Usage

From source file:com.abiquo.server.core.common.persistence.JPAConfiguration.java

License:Open Source License

public static EntityManager disableAllFilters(final EntityManager em) {
    if (!em.isOpen()) {
        throw new IllegalStateException("EntityManager must be open");
    }//from ww w.  ja va 2  s .com

    Session session = (Session) em.getDelegate();

    for (String filter : ONLY_TEMPORAL_FILTERS) {
        session.disableFilter(filter);
    }
    for (String filter : NOT_TEMPORAL_FILTERS) {
        session.disableFilter(filter);
    }

    return em;
}

From source file:com.abiquo.server.core.common.persistence.JPAConfiguration.java

License:Open Source License

public static EntityManager enableNotTemporalFilters(final EntityManager em) {
    if (!em.isOpen()) {
        throw new IllegalStateException("EntityManager must be open");
    }//from   ww w .  j ava  2  s .co m

    Session session = (Session) em.getDelegate();

    for (String filter : ONLY_TEMPORAL_FILTERS) {
        session.disableFilter(filter);
    }
    for (String filter : NOT_TEMPORAL_FILTERS) {
        session.enableFilter(filter);
    }

    return em;
}

From source file:com.abiquo.server.core.common.persistence.JPAConfiguration.java

License:Open Source License

public static EntityManager enableOnlyTemporalFilters(final EntityManager em) {
    if (!em.isOpen()) {
        throw new IllegalStateException("EntityManager must be open");
    }/*from  w  w w. j a v a2 s . c o m*/

    Session session = (Session) em.getDelegate();

    for (String filter : NOT_TEMPORAL_FILTERS) {
        session.disableFilter(filter);
    }
    for (String filter : ONLY_TEMPORAL_FILTERS) {
        session.enableFilter(filter);
    }

    return em;
}

From source file:com.masetta.spann.orm.hibernate.integration.FilterActivationsTest.java

License:Apache License

public void expectFilterDisable(Session session, String filter) {
    session.disableFilter(filter);
    EasyMock.expectLastCall();
}

From source file:com.masetta.spann.orm.hibernate.support.HibernateSupport.java

License:Apache License

private static void disableFilters(Session session, List<String> filters) {
    for (String filter : filters) {
        session.disableFilter(filter);
    }/*from w w  w. ja v a2 s .  c om*/
}

From source file:edu.purdue.cybercenter.dm.web.TermController.java

private String fetchAllTerms(HttpServletRequest request, HttpServletResponse response, boolean isTemplate) {
    Session session = DomainObjectHelper.getHbmSession();

    Filter filter = session.enableFilter("mostRecentUpdatedTermFilter");
    filter.setParameter("isTemplate", isTemplate);
    Filter assetStatusFilter = session.enableFilter("assetStatusFilter");
    assetStatusFilter.setParameterList("statusIds", Arrays.asList(1));
    String responseBody = listTerms(request, response, isTemplate ? "template" : "term");
    session.disableFilter("assetStatusFilter");
    session.disableFilter("mostRecentUpdatedTermFilter");

    return responseBody;
}

From source file:gov.nih.nci.caarray.util.CaArrayHibernateHelperImpl.java

License:BSD License

private void disableFilters(Session session) {
    Set<String> filters = session.getSessionFactory().getDefinedFilterNames();
    for (String filterName : filters) {
        // we only want to disable the security filters. assume security filters are ones
        // with GROUP_NAMES and APPLICATION_ID parameters
        FilterDefinition fd = session.getSessionFactory().getFilterDefinition(filterName);
        if (fd.getParameterNames().contains("GROUP_NAMES")
                && fd.getParameterNames().contains("APPLICATION_ID")) {
            session.disableFilter(filterName);
        }//from ww  w. j a va 2 s .  c o  m
    }
}

From source file:it.av.youeat.service.impl.RistoranteServiceHibernate.java

License:Apache License

/**
 * {@inheritDoc}/*from www.j  a v  a  2 s .  c o  m*/
 */
@Override
public List<Ristorante> freeTextSearch(String pattern, ArrayList<Eater> eaters, int firstResult,
        int maxResult) {
    FullTextQuery persistenceQuery = createFreeTextQuery(pattern);
    if (maxResult >= 0) {
        persistenceQuery.setMaxResults(maxResult);
    }
    if (firstResult >= 0) {
        persistenceQuery.setFirstResult(firstResult);
    }
    if (eaters != null) {
        Session session = (Session) getJpaTemplate().getEntityManager().getDelegate();
        session.enableFilter("friends").setParameterList("friendlist", eaters);
        List<Ristorante> results = persistenceQuery.getResultList();
        session.disableFilter("friends");
        return results;
    }
    return persistenceQuery.getResultList();
}

From source file:it.eng.spagobi.commons.dao.AbstractHibernateDAO.java

License:Mozilla Public License

protected void disableTenantFilter(Session session) {
    Filter filter = session.getEnabledFilter(TENANT_FILTER_NAME);
    if (filter != null) {
        session.disableFilter(TENANT_FILTER_NAME);
    }/*from w  ww  .  ja va 2  s. c o  m*/
}

From source file:ome.security.basic.AbstractSecurityFilter.java

License:Open Source License

public void disable(Session sess) {
    sess.disableFilter(getName());
    disableBaseFilters(sess);
}