Example usage for org.hibernate.criterion Restrictions gt

List of usage examples for org.hibernate.criterion Restrictions gt

Introduction

In this page you can find the example usage for org.hibernate.criterion Restrictions gt.

Prototype

public static SimpleExpression gt(String propertyName, Object value) 

Source Link

Document

Apply a "greater than" constraint to the named property

Usage

From source file:de.congrace.blog4j.dao.TagDaoImpl.java

License:Apache License

public List<Tag> getTagByArticleCount(int count) {

    return (List<Tag>) getCurrentSession().createCriteria(Tag.class).add(Restrictions.gt("articleCount", 0))
            .addOrder(Order.desc("articleCount")).setMaxResults(count).list();
}

From source file:de.escidoc.core.common.business.filter.CqlFilter.java

License:Open Source License

/**
 * Evaluate a CQL relation.//from  www.  j a  v  a2s .  co m
 * 
 * @param relation
 *            CQL relation
 * @param propertyName
 *            left side of the statement
 * @param value
 *            right side of the statement
 * @param useLike
 *            use LIKE instead of = in case of an equality relation
 * @return Hibernate query reflecting the given CQL query
 * @throws InvalidSearchQueryException
 *             thrown if the given search query could not be translated into a SQL query
 */
protected Criterion evaluate(final CQLRelation relation, final String propertyName, final Object value,
        final boolean useLike) throws InvalidSearchQueryException {
    final Criterion result;
    final String rel = relation.getBase();

    if (value == null || value.toString().length() == 0) {
        result = Restrictions.isNull(propertyName);
    } else {
        if ("<".equals(rel)) {
            result = Restrictions.lt(propertyName, value);
        } else if ("<=".equals(rel)) {
            result = Restrictions.le(propertyName, value);
        } else if ("=".equals(rel)) {
            result = useLike ? Restrictions.like(propertyName, value) : Restrictions.eq(propertyName, value);
        } else if (">=".equals(rel)) {
            result = Restrictions.ge(propertyName, value);
        } else if (">".equals(rel)) {
            result = Restrictions.gt(propertyName, value);
        } else if ("<>".equals(rel)) {
            result = Restrictions.ne(propertyName, value);
        } else {
            throw new InvalidSearchQueryException(rel + ": relation not implemented");
        }
    }
    return result;
}

From source file:de.forsthaus.backend.dao.impl.CustomerDAOImpl.java

License:Open Source License

@SuppressWarnings("unchecked")
@Override/*from   www . j  a  v a 2s  .  co  m*/
public void testDeleteCustomersOver50000() {

    DetachedCriteria criteria = DetachedCriteria.forClass(Customer.class);
    criteria.add(Restrictions.gt("id", Long.valueOf("50000")));
    List<Customer> list = getHibernateTemplate().findByCriteria(criteria);

    logger.debug("Count records for deleting : " + list.size());

    deleteAll(list);
}

From source file:de.forsthaus.backend.dao.impl.IpToCountryDAOImpl.java

License:Open Source License

@SuppressWarnings("unchecked")
@Override/*from w w w. java2  s . co  m*/
public IpToCountry getCountry(Long ipNumber) {

    IpToCountry result = null;

    DetachedCriteria criteria = DetachedCriteria.forClass(IpToCountry.class);
    criteria.add(Restrictions.lt("ipcIpFrom", ipNumber));
    criteria.add(Restrictions.gt("ipcIpTo", ipNumber));

    result = (IpToCountry) DataAccessUtils.uniqueResult(getHibernateTemplate().findByCriteria(criteria));

    return result;

}

From source file:de.heartbeat.charts.YearOverview.java

License:Apache License

public YearOverview(PageParameters parameters) {
    super(parameters);
    StringValue deviceId = parameters.get("deviceId");
    Person person;//  ww w  .j av  a 2 s .co  m
    Session session = sessionFactory.openSession();
    session.beginTransaction();
    person = (Person) session.createCriteria(Person.class)
            .add(Restrictions.like("deviceID", deviceId.toString())).uniqueResult();
    heartBeatList = person.getHeartbeats();
    session.getTransaction().commit();
    session.close();

    Collections.sort(heartBeatList);
    Options options = new Options();

    options.setTooltip(
            new Tooltip().setFormatter(new Function().setFunction("return '<b>'+ this.series.name +'</b><br/>'+"
                    + "Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) +'<br/>'+"
                    + "Highcharts.numberFormat(this.y, 2);")));
    List<PlotBand> plotBands = new ArrayList<>();
    plotBands.add(createPlotBand("HIGH", 120, 10000, true));
    plotBands.add(createPlotBand("NORMAL", 45, 120, false));
    plotBands.add(createPlotBand("LOW", 0, 45, true));
    options.setTitle(new Title("Puls"));
    options.setChartOptions((new ChartOptions().setType(SeriesType.SPLINE).setMarginRight(10)));
    options.setxAxis(new Axis().setType(AxisType.DATETIME));

    Axis yAxis = new Axis();
    yAxis.setTitle(new Title("Puls")).setPlotLines(Collections
            .singletonList(new PlotLine().setValue(1f).setWidth(1).setColor(new HexColor("#808080"))));
    yAxis.setPlotBands(plotBands);

    options.setyAxis(yAxis);

    options.setLegend(new Legend(Boolean.FALSE));
    options.setExporting(new ExportingOptions().setEnabled(Boolean.FALSE));

    series = new LiveDataSeries(options, 6000) {

        @Override
        public Point update(LiveDataUpdateEvent ldue) {
            Session session = sessionFactory.openSession();
            session.beginTransaction();
            heartBeatListNew = session.createCriteria(HeartBeat.class)
                    .add(Restrictions.gt("time", heartBeatList.get(heartBeatList.size() - 1).getTime())).list();
            session.getTransaction().commit();
            session.close();

            if (heartBeatListNew.size() > 0) {
                HeartBeat hb = heartBeatListNew.get(0);
                Date time = new Date(hb.getTime().getTime());
                heartBeatList.addAll(heartBeatListNew);
                return new Point(time.getTime(), Double.parseDouble(hb.getPulse()));
            } else {
                return null;
            }

        }
    };

    series.setData(getPoints(this.heartBeatList)).setName("Puls");
    options.addSeries(series);

    add(new Chart("chart", options));
}

From source file:de.iew.sketchpad.persistence.hibernate.HbmPolygonDaoImpl.java

License:Apache License

public List<Polygon> listPolygonsFrom(long sketchPadId, long fromPolygonId) {
    Criteria criteria = createCriteria();
    criteria.createAlias("sketchPad", "sp").add(Restrictions.eq("sp.id", sketchPadId))
            .add(Restrictions.gt("id", fromPolygonId)).createAlias("segments", "segs")
            .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);

    List list = criteria.list();/*from  ww w  . ja  v  a 2  s  . co  m*/

    return list;
}

From source file:de.iteratec.iteraplan.businesslogic.reports.query.node.AbstractLeafNode.java

License:Open Source License

/**
 * Returns the {@link Criterion} for the specified {@code effectivePropertyName} and {@code comparator}.
 * //from www  .j  a  v  a 2  s . c o  m
 * @param effectivePropertyName the property name path
 * @param comparator the comparator describing the compare operation
 * @param attrType string representation of the property's attribute type as in {@link BBAttribute#getTypeOfAttribute(String)} 
 * @return the newly created {@link Criterion} for the specified {@code comparator} or {@code null} if the 
 *    comparator is not supported
 */
protected Criterion getCriterionForComparator(String effectivePropertyName, Comparator comparator,
        String attrType) {
    Criterion criterion = null;
    switch (comparator) {
    case EQ:
        criterion = Restrictions.eq(effectivePropertyName, getProcessedPattern());
        break;
    case GEQ:
        criterion = Restrictions.ge(effectivePropertyName, getProcessedPattern());
        break;
    case LEQ:
        criterion = Restrictions.le(effectivePropertyName, getProcessedPattern());
        break;
    case GT:
        criterion = Restrictions.gt(effectivePropertyName, getProcessedPattern());
        break;
    case LT:
        criterion = Restrictions.lt(effectivePropertyName, getProcessedPattern());
        break;
    case LIKE:
        criterion = new IteraplanLikeExpression(effectivePropertyName, getProcessedPattern().toString(), true);
        break;
    case NOT_LIKE:
        criterion = Restrictions.not(
                new IteraplanLikeExpression(effectivePropertyName, getProcessedPattern().toString(), true));
        break;
    case IS:
        // see Type#getSpecialPropertyHQLStrings
        criterion = "null".equals(getPattern()) ? Restrictions.isNull(effectivePropertyName)
                : Restrictions.isNotNull(effectivePropertyName);
        break;
    case ANY_ASSIGNMENT:
        criterion = getAnyAssignmentCriterion(effectivePropertyName, attrType);
        break;
    case NO_ASSIGNMENT:
        criterion = getNoAssignmentCriterion(effectivePropertyName, attrType);
        break;
    case NEQ:
        criterion = Restrictions.ne(effectivePropertyName, getProcessedPattern());
        break;
    default:
        break;
    }

    return criterion;
}

From source file:de.iteratec.iteraplan.businesslogic.reports.query.node.DateAttributeLeafNode.java

License:Open Source License

/** {@inheritDoc} */
@Override//from  w  w  w . j a  v a 2 s .c o m
protected Criterion getCriterionForComparator() {
    Criterion criterion = null;
    switch (getComparator()) {
    case GT:
        criterion = Restrictions.gt("value", getPattern());
        break;
    case EQ:
        criterion = Restrictions.eq("value", getPattern());
        break;
    case LT:
        criterion = Restrictions.lt("value", getPattern());
        break;
    case ANY_ASSIGNMENT:
        criterion = Restrictions.naturalId();
        break;
    default:
        throw new IteraplanTechnicalException(IteraplanErrorMessages.INTERNAL_ERROR);
    }

    return criterion;
}

From source file:de.iteratec.iteraplan.businesslogic.reports.query.node.NumberAttributeLeafNode.java

License:Open Source License

/** {@inheritDoc} */
@Override/* w w w  .j  a va 2  s . c  om*/
protected Criterion getCriterionForComparator() {
    String value = "value";

    Criterion criterion = null;
    switch (getComparator()) {
    case GT:
        criterion = Restrictions.gt(value, getPattern());
        break;
    case GEQ:
        criterion = Restrictions.ge(value, getPattern());
        break;
    case EQ:
        criterion = Restrictions.eq(value, getPattern());
        break;
    case LEQ:
        criterion = Restrictions.le(value, getPattern());
        break;
    case LT:
        criterion = Restrictions.lt(value, getPattern());
        break;
    case ANY_ASSIGNMENT:
        criterion = Restrictions.naturalId();
        break;
    default:
        throw new IteraplanTechnicalException(IteraplanErrorMessages.INTERNAL_ERROR);
    }

    return criterion;
}

From source file:de.lemo.dms.connectors.clix2010.ClixImporter.java

License:Open Source License

/**
 * Loads all necessary tables from the Clix2010 database.
 *//*from w  w  w  .  j a  v a  2s  .  co m*/
@SuppressWarnings("unchecked")
private void loadData(final DBConfigObject dbConfig, List<Long> courses, List<String> logins, long startTime) {

    // accessing DB by creating a session and a transaction using HibernateUtil
    final Session session = ClixHibernateUtil.getSessionFactory(dbConfig).openSession();

    boolean hasCR = false;
    if (courses != null && courses.size() > 0)
        hasCR = true;
    boolean empty = false;

    if (logins != null && !logins.isEmpty()) {
        List<Long> newCourses = new ArrayList<Long>();
        Criteria criteria = session.createCriteria(Person.class, "obj");
        criteria.add(CriteriaHelper.in("obj.login", logins));
        List<Long> usId = new ArrayList<Long>();

        for (Person p : (List<Person>) criteria.list())
            usId.add(p.getId());

        if (!usId.isEmpty()) {
            criteria = session.createCriteria(PersonComponentAssignment.class, "obj");
            criteria.add(CriteriaHelper.in("obj.person", usId));
            for (PersonComponentAssignment pca : (List<PersonComponentAssignment>) criteria.list())
                newCourses.add(pca.getComponent());

            courses.addAll(newCourses);
            hasCR = true;
            logger.info(newCourses.toString());

        }

    }

    this.logger.info("Starting data extraction.");

    // The Clix database uses date representation of the type varchar, so the unix-timestamp has to be converted
    // to a string
    String startStr = TimeConverter.getStringRepresentation(startTime);

    //Get QTiTestPlayerResp tables
    this.tQtiTestPlayerResp = new ArrayList<TQtiTestPlayerResp>();
    Criteria criteria = session.createCriteria(TQtiTestPlayerResp.class, "obj");
    if (hasCR) {
        criteria.add(CriteriaHelper.in("obj.container", courses));
    }
    criteria.add(Restrictions.gt("obj.evaluationDate", startStr));
    criteria.addOrder(Property.forName("obj.id").asc());

    this.tQtiTestPlayerResp = criteria.list();
    logger.info("TQtiTestPlayerResp tables: " + this.tQtiTestPlayerResp.size());

    //Get QTiTestPlayer tables
    this.tQtiTestPlayer = new ArrayList<TQtiTestPlayer>();
    criteria = session.createCriteria(TQtiTestPlayer.class, "obj");
    if (hasCR) {
        criteria.add(CriteriaHelper.in("obj.container", courses));
    }
    criteria.add(Restrictions.gt("obj.created", startStr));
    criteria.addOrder(Property.forName("obj.id").asc());
    this.tQtiTestPlayer = criteria.list();
    logger.info("TQtiTestPlayer tables: " + this.tQtiTestPlayer.size());

    //Get EComposing tables
    this.eComposing = new ArrayList<EComposing>();
    criteria = session.createCriteria(EComposing.class, "obj");
    if (hasCR) {
        criteria.add(CriteriaHelper.in("obj.composing", courses));
    }
    criteria.add(Restrictions.gt("obj.lastUpdated", startStr));
    criteria.addOrder(Property.forName("obj.id").asc());
    this.eComposing = criteria.list();
    this.eComposingMap = new HashMap<Long, EComposing>();
    for (int i = 0; i < this.eComposing.size(); i++) {
        this.eComposingMap.put(this.eComposing.get(i).getComponent(), this.eComposing.get(i));
    }
    logger.info("EComposing tables: " + this.eComposing.size());

    //Get ExerciseGroup tables
    this.exerciseGroup = new ArrayList<ExerciseGroup>();
    criteria = session.createCriteria(ExerciseGroup.class, "obj");
    if (hasCR) {
        criteria.add(CriteriaHelper.in("obj.associatedCourse", courses));
    }
    criteria.addOrder(Property.forName("obj.id").asc());
    this.exerciseGroup = criteria.list();
    this.logger.info("ExerciseGroup tables: " + this.exerciseGroup.size());

    //Get ExercisePersonalised tables
    this.exercisePersonalised = new ArrayList<ExercisePersonalised>();
    criteria = session.createCriteria(ExercisePersonalised.class, "obj");
    if (hasCR) {
        Set<Long> ids = new HashSet<Long>();
        for (ExerciseGroup eg : this.exerciseGroup)
            ids.add(eg.getId());
        if (!(empty = ids.isEmpty()))
            criteria.add(CriteriaHelper.in("obj.community", ids));
    }
    criteria.addOrder(Property.forName("obj.id").asc());
    if (!(hasCR && empty))
        this.exercisePersonalised = criteria.list();
    else
        this.exercisePersonalised = new ArrayList<ExercisePersonalised>();

    this.logger.info("ExercisePersonalised tables: " + this.exercisePersonalised.size());

    Set<Long> tmpComp = new HashSet<Long>();

    //Get EComponent tables
    criteria = session.createCriteria(EComponent.class, "obj");
    if (hasCR) {
        tmpComp.addAll(this.eComposingMap.keySet());
        tmpComp.addAll(courses);
        for (ExercisePersonalised eP : this.exercisePersonalised)
            tmpComp.add(eP.getExercise());
        if (!(empty = tmpComp.isEmpty())) {
            criteria.add(CriteriaHelper.in("obj.id", new ArrayList<Long>(tmpComp)));
            //criteria.add(CriteriaHelper.in("obj.id", tmpComp));
        }
    }
    criteria.add(Restrictions.gt("obj.lastUpdated", startStr));
    criteria.addOrder(Property.forName("obj.id").asc());
    final List<EComponent> tmp;
    if (!(hasCR && empty))
        tmp = criteria.list();
    else
        tmp = new ArrayList<EComponent>();
    this.eComponentMap = new HashMap<Long, EComponent>();
    for (final EComponent c : tmp) {
        this.eComponentMap.put(c.getId(), c);
    }
    tmp.clear();
    this.logger.info("EComponent tables: " + this.eComponentMap.values().size());

    //Get TQtiContentStructure tables

    criteria = session.createCriteria(TQtiContentStructure.class, "obj");
    if (hasCR) {
        ArrayList<Long> newKeys = new ArrayList<Long>(this.eComposingMap.keySet());
        HashSet<Long> allKeys = new HashSet<Long>();
        while (!newKeys.isEmpty()) {

            criteria = session.createCriteria(TQtiContentStructure.class, "obj");
            criteria.add(CriteriaHelper.in("obj.container", newKeys));
            List<TQtiContentStructure> t = criteria.list();
            newKeys.clear();
            for (TQtiContentStructure tqs : t) {
                newKeys.add(tqs.getContent());
                allKeys.add(tqs.getContainer());
            }
            allKeys.addAll(newKeys);
        }
        criteria = session.createCriteria(TQtiContentStructure.class, "obj");
        if (!(empty = allKeys.isEmpty()))
            criteria.add(CriteriaHelper.in("obj.container", allKeys));
    }
    criteria.addOrder(Property.forName("obj.id").asc());
    if (!(hasCR && empty))
        this.tQtiContentStructure = criteria.list();
    else
        this.tQtiContentStructure = new ArrayList<TQtiContentStructure>();
    this.logger.info("TQtiContentStructure tables: " + this.tQtiContentStructure.size());

    //Get TQtiContentComposing tables
    criteria = session.createCriteria(TQtiContentComposing.class, "obj");
    if (hasCR) {
        HashSet<Long> tmp1 = new HashSet<Long>();
        for (TQtiContentStructure tqs : this.tQtiContentStructure)
            tmp1.add(tqs.getContent());
        if (!(empty = tmp1.isEmpty()))
            criteria.add(CriteriaHelper.in("obj.container", tmp1));
    }
    criteria.addOrder(Property.forName("obj.id").asc());
    if (!(hasCR && empty))
        this.tQtiContentComposing = criteria.list();
    else
        this.tQtiContentComposing = new ArrayList<TQtiContentComposing>();
    logger.info("TQtiContentComposing tables: " + this.tQtiContentComposing.size());

    //Get TQtiContent tables
    criteria = session.createCriteria(TQtiContent.class, "obj");
    if (hasCR) {
        HashSet<Long> ids = new HashSet<Long>();
        for (TQtiContentStructure tqs : this.tQtiContentStructure) {
            ids.add(tqs.getContainer());
            ids.add(tqs.getContent());
        }
        for (TQtiContentComposing tqs : this.tQtiContentComposing) {
            ids.add(tqs.getContainer());
            ids.add(tqs.getContent());
        }
        if (!(empty = ids.isEmpty()))
            criteria.add(CriteriaHelper.in("obj.id", ids));

    }
    criteria.add(Restrictions.gt("obj.lastUpdated", startStr));
    criteria.addOrder(Property.forName("obj.id").asc());
    if (!(hasCR && empty))
        this.tQtiContent = criteria.list();
    else
        this.tQtiContent = new ArrayList<TQtiContent>();
    this.logger.info("TQtiContent tables: " + this.tQtiContent.size());

    //Get ChatProtocol tables
    criteria = session.createCriteria(ChatProtocol.class, "obj");
    if (hasCR) {
        HashSet<Long> tmp1 = new HashSet<Long>(this.eComposingMap.keySet());
        if (!(empty = tmp1.isEmpty()))
            criteria.add(CriteriaHelper.in("obj.chatroom", tmp1));
    }
    criteria.add(Restrictions.gt("obj.lastUpdated", startStr));
    criteria.addOrder(Property.forName("obj.id").asc());
    if (!(hasCR && empty))
        this.chatProtocol = criteria.list();
    else
        this.chatProtocol = new ArrayList<ChatProtocol>();
    logger.info("ChatProtocol tables: " + this.chatProtocol.size());

    //Get EComponentType tables
    criteria = session.createCriteria(EComponentType.class, "obj");
    if (hasCR) {
        Set<Long> ids = new HashSet<Long>();

        for (EComponent eg : this.eComponentMap.values()) {
            ids.add(eg.getType());
        }
        //if(!(empty = ids.isEmpty()))
        //criteria.add(CriteriaHelper.in("obj.id", ids));
    }
    criteria.add(Restrictions.gt("obj.lastUpdated", startStr));
    criteria.addOrder(Property.forName("obj.id").asc());
    this.eComponentType = criteria.list();
    this.logger.info("EComponentType tables: " + this.eComponentType.size());

    //Get ForumEntry tables
    criteria = session.createCriteria(ForumEntry.class, "obj");
    if (hasCR) {
        if (!(empty = this.eComposingMap.isEmpty())) {
            criteria.add(CriteriaHelper.in("obj.forum", this.eComposingMap.keySet()));
        }
    }
    criteria.add(Restrictions.gt("obj.lastUpdated", startStr));
    criteria.addOrder(Property.forName("obj.id").asc());
    if (!empty) {
        this.forumEntry = criteria.list();
    } else
        this.forumEntry = new ArrayList<ForumEntry>();
    this.logger.info("ForumEntry tables: " + this.forumEntry.size());

    //Get ForumEntryState tables
    /*criteria = session.createCriteria(ForumEntryState.class, "obj");
    if(hasCR)
    {
       if(!(empty = this.eComposingMap.isEmpty()))
       {
    criteria.add(CriteriaHelper.in("obj.forum", this.eComposingMap.keySet()));
       }
    }
    criteria.add(Restrictions.gt("obj.lastUpdated", startStr));
    criteria.addOrder(Property.forName("obj.id").asc());
    if(!hasCR || !empty)
    {
       this.forumEntryState = criteria.list();
    }
    else*/
    this.forumEntryState = new ArrayList<ForumEntryState>();
    this.logger.info("ForumEntryState tables: " + this.forumEntryState.size());

    //Get LearningLog tables
    criteria = session.createCriteria(LearningLog.class, "obj");
    if (hasCR) {
        criteria.add(CriteriaHelper.in("obj.course", courses));
    }
    criteria.add(Restrictions.gt("obj.lastUpdated", startStr));
    criteria.addOrder(Property.forName("obj.id").asc());
    this.learningLog = criteria.list();
    this.logger.info("LearningLog tables: " + this.learningLog.size());

    //Get Portfolio tables
    criteria = session.createCriteria(Portfolio.class, "obj");
    if (hasCR) {
        criteria.add(CriteriaHelper.in("obj.component", courses));
    }
    criteria.add(Restrictions.gt("obj.lastUpdated", startStr));
    criteria.addOrder(Property.forName("obj.id").asc());
    this.portfolio = criteria.list();
    this.logger.info("Portfolio tables: " + this.portfolio.size());

    //Get PortfolioLog tables
    criteria = session.createCriteria(PortfolioLog.class, "obj");
    if (hasCR) {
        criteria.add(CriteriaHelper.in("obj.component", courses));
    }
    criteria.add(Restrictions.gt("obj.lastUpdated", startStr));
    criteria.addOrder(Property.forName("obj.id").asc());
    this.portfolioLog = criteria.list();
    this.logger.info("PortfolioLog tables: " + this.portfolioLog.size());

    //Get PersonComponentAssignment tables
    criteria = session.createCriteria(PersonComponentAssignment.class, "obj");
    if (hasCR) {
        criteria.add(CriteriaHelper.in("obj.component", courses));
    }
    criteria.addOrder(Property.forName("obj.id").asc());
    this.personComponentAssignment = criteria.list();
    this.logger.info("PersonComponentAssignment tables: " + this.personComponentAssignment.size());

    //Get Person tables
    criteria = session.createCriteria(Person.class, "obj");
    if (hasCR) {
        Set<Long> ids = new HashSet<Long>();
        for (Portfolio eg : this.portfolio)
            ids.add(eg.getPerson());
        for (ExercisePersonalised eP : this.exercisePersonalised)
            ids.add(eP.getUser());
        for (PersonComponentAssignment eP : this.personComponentAssignment)
            ids.add(eP.getPerson());
        if (!(empty = ids.isEmpty()))
            criteria.add(CriteriaHelper.in("obj.id", ids));
    }
    criteria.add(Restrictions.gt("obj.lastUpdated", startStr));
    criteria.addOrder(Property.forName("obj.id").asc());
    if (!(hasCR && empty))
        this.person = criteria.list();
    else
        this.person = new ArrayList<Person>();
    this.logger.info("Person tables: " + this.person.size());

    //Get PlatformGroupSpecification tables
    /*criteria = session.createCriteria(PlatformGroupSpecification.class, "obj");
    if(hasCR)
    {
       Set<Long> ids = new HashSet<Long>();
       for(Person eg : this.person)
    ids.add(eg.getId());
       if(!(empty = ids.isEmpty()))
    criteria.add(CriteriaHelper.in("obj.person", ids));
    }
    criteria.addOrder(Property.forName("obj.id").asc());
    if(!(hasCR && empty))
       this.platformGroupSpecification = criteria.list();
    else*/
    this.platformGroupSpecification = new ArrayList<PlatformGroupSpecification>();
    this.logger.info("PlatformGroupSpecification tables: " + this.platformGroupSpecification.size());

    //Get PlatformGroup tables
    criteria = session.createCriteria(PlatformGroup.class, "obj");
    if (hasCR) {
        Set<Long> ids = new HashSet<Long>();
        for (PlatformGroupSpecification eg : this.platformGroupSpecification)
            ids.add(eg.getGroup());
        if (!(empty = ids.isEmpty()))
            criteria.add(CriteriaHelper.in("obj.id", ids));
    }
    criteria.add(Restrictions.gt("obj.lastUpdated", startStr));
    criteria.addOrder(Property.forName("obj.id").asc());
    if (!(hasCR && empty))
        this.platformGroup = criteria.list();
    else
        this.platformGroup = new ArrayList<PlatformGroup>();
    this.logger.info("PlatformGroup tables: " + this.platformGroup.size());

    //Get ScormSessionTimes tables
    criteria = session.createCriteria(ScormSessionTimes.class, "obj");
    if (hasCR) {
        criteria.add(CriteriaHelper.in("obj.component", courses));
    }
    criteria.add(Restrictions.gt("obj.lastUpdated", startStr));
    criteria.addOrder(Property.forName("obj.id").asc());
    this.scormSessionTimes = criteria.list();
    this.logger.info("ScormSessionTimes tables: " + this.scormSessionTimes.size());

    //Get TeamExerciseGroup tables
    criteria = session.createCriteria(TeamExerciseGroup.class, "obj");
    if (hasCR) {
        criteria.add(CriteriaHelper.in("obj.component", courses));
    }
    criteria.addOrder(Property.forName("obj.id").asc());
    this.teamExerciseGroup = criteria.list();
    this.logger.info("TeamExerciseGroup tables: " + this.teamExerciseGroup.size());

    //Get TQtiTestItemD tables
    criteria = session.createCriteria(TQtiTestItemD.class, "obj");
    if (hasCR) {
        HashSet<Long> ids = new HashSet<Long>();
        for (TQtiContent tc : this.tQtiContent) {
            ids.add(tc.getId());
        }
        if (!(empty = ids.isEmpty())) {
            criteria.add(CriteriaHelper.in("obj.content", ids));
        }
    }
    criteria.addOrder(Property.forName("obj.id").asc());
    if (!(hasCR && empty))
        this.tQtiTestItemD = criteria.list();
    else
        this.tQtiTestItemD = new ArrayList<TQtiTestItemD>();
    this.logger.info("TQtiTestItemD tables: " + this.tQtiTestItemD.size());

    //Get TGroupFullSpecification tables
    criteria = session.createCriteria(TGroupFullSpecification.class, "obj");
    if (hasCR) {

        Set<Long> ids = new HashSet<Long>();
        for (TeamExerciseGroup eg : this.teamExerciseGroup)
            ids.add(eg.getId());
        if (!(empty = ids.isEmpty()))
            criteria.add(CriteriaHelper.in("obj.group", ids));
    }
    criteria.addOrder(Property.forName("obj.id").asc());
    if (!(hasCR && empty))
        this.tGroupFullSpecification = criteria.list();
    else
        this.tGroupFullSpecification = new ArrayList<TGroupFullSpecification>();
    this.logger.info("TGroupFullSpecification tables: " + this.tGroupFullSpecification.size());

    //Get TQtiEvalAssessment tables
    criteria = session.createCriteria(TQtiEvalAssessment.class, "obj");
    if (hasCR) {
        criteria.add(CriteriaHelper.in("obj.component", courses));
    }
    criteria.add(Restrictions.gt("obj.lastInvocation", startStr));
    criteria.addOrder(Property.forName("obj.id").asc());
    this.tQtiEvalAssessment = criteria.list();
    this.logger.info("TQtiEvalAssessment tables: " + this.tQtiEvalAssessment.size());

    //Get WikiEntry tables
    criteria = session.createCriteria(WikiEntry.class, "obj");
    if (hasCR) {
        criteria.add(CriteriaHelper.in("obj.component", courses));
    }
    criteria.add(Restrictions.gt("obj.lastUpdated", startStr));
    criteria.addOrder(Property.forName("obj.id").asc());
    this.wikiEntry = criteria.list();
    this.logger.info("WikiEntry tables: " + this.wikiEntry.size());

    startStr = startStr.substring(0, startStr.indexOf(' '));

    //Get BiTrackContentImpressions tables
    criteria = session.createCriteria(BiTrackContentImpressions.class, "obj");
    if (hasCR) {
        criteria.add(CriteriaHelper.in("obj.container", courses));
    }
    criteria.add(Restrictions.gt("obj.dayOfAccess", startStr));
    criteria.addOrder(Property.forName("obj.id").asc());
    this.biTrackContentImpressions = criteria.list();
    logger.info("BiTrackContentImpressions tables: " + this.biTrackContentImpressions.size());

    session.clear();
    session.close();
}