@@ -0,0 +1,2740 @@
+package org.opennms.netmgt.model;%0A%0Aimport org.hibernate.FetchMode;%0Aimport org.hibernate.HibernateException;%0Aimport org.hibernate.criterion.Criterion;%0Aimport org.hibernate.criterion.DetachedCriteria;%0Aimport org.hibernate.criterion.Order;%0Aimport org.hibernate.criterion.Projection;%0Aimport org.hibernate.transform.ResultTransformer;%0A%0Apublic class OnmsCriteria %7B%0A    %0A    private DetachedCriteria m_criteria;%0A    private String m_entityName;%0A    %0A    public OnmsCriteria(String entityName) %7B%0A        this(entityName, DetachedCriteria.forEntityName(entityName));%0A    %7D%0A    %0A    public OnmsCriteria(String entityName, String alias) %7B%0A        this(entityName, DetachedCriteria.forEntityName(entityName, alias));%0A    %7D%0A    %0A    public OnmsCriteria(Class clazz) %7B%0A        this(clazz.getName(), DetachedCriteria.forClass(clazz));%0A    %7D%0A    %0A    public OnmsCriteria(Class clazz, String alias) %7B%0A        this(clazz.getName(), DetachedCriteria.forClass(clazz, alias));%0A    %7D%0A    %0A    protected OnmsCriteria(String entityName, DetachedCriteria criteria) %7B%0A        m_entityName = entityName;%0A        m_criteria = criteria;%0A    %7D%0A    %0A    public OnmsCriteria add(Criterion criterion) %7B%0A        m_criteria.add(criterion);%0A        return this;%0A    %7D%0A%0A    public OnmsCriteria addOrder(Order order) %7B%0A        m_criteria.addOrder(order);%0A        return this;%0A    %7D%0A%0A    public OnmsCriteria createAlias(String associationPath, String alias)%0A    throws HibernateException %7B%0A        m_criteria.createAlias(associationPath, alias);%0A        return this;%0A    %7D%0A%0A    public OnmsCriteria createCriteria(String associationPath, String alias) %7B%0A        return new OnmsCriteria(null, m_criteria.createCriteria(associationPath, alias));%0A    %7D%0A%0A    public OnmsCriteria createCriteria(String associationPath) %7B%0A        return new OnmsCriteria(null,  m_criteria.createCriteria(associationPath) );%0A    %7D%0A%0A    public String getAlias() %7B%0A        return m_criteria.getAlias();%0A    %7D%0A%0A    public OnmsCriteria setFetchMode(String associationPath, FetchMode mode)%0A    throws HibernateException %7B%0A        m_criteria.setFetchMode(associationPath, mode);%0A        return this;%0A    %7D%0A%0A    public OnmsCriteria setProjection(Projection projection) %7B%0A        m_criteria.setProjection(projection);%0A        return this;%0A    %7D%0A%0A    public OnmsCriteria setResultTransformer(ResultTransformer resultTransformer) %7B%0A        m_criteria.setResultTransformer(resultTransformer);%0A        return this;%0A    %7D%0A    %0A    public DetachedCriteria getDetachedCriteria() %7B%0A        return m_criteria;%0A    %7D%0A%0A    public boolean resultsOfType(Class clazz) %7B%0A        if (m_entityName == null) %7B%0A            return true;%0A        %7D %7B%0A            return clazz.getName().endsWith(m_entityName);%0A        %7D%0A    %7D%0A    %0A%0A%7D%0A

add new OnmsCriteria