Example usage for org.hibernate.criterion Projections projectionList

List of usage examples for org.hibernate.criterion Projections projectionList

Introduction

In this page you can find the example usage for org.hibernate.criterion Projections projectionList.

Prototype

public static ProjectionList projectionList() 

Source Link

Document

Create a new projection list.

Usage

From source file:br.com.hrstatus.dao.impl.ConfigurationDAO.java

License:Open Source License

public String getJndiMailNotLogged() {

    log.fine("[ System ] getJndiMail()");

    final Criteria subject = session().createCriteria(Configurations.class);
    final ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("jndiMail"));
    subject.setProjection(proList);/*from  ww  w  . j a va2s . c  om*/
    return (String) subject.uniqueResult();
}

From source file:br.com.hrstatus.dao.impl.ConfigurationDAO.java

License:Open Source License

public int getDiffirenceSecs() {

    log.fine("[ " + userInfo.getLoggedUsername() + " ] getDiffirenceSecs()");

    final Criteria difference = session().createCriteria(Configurations.class);
    final ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("difference"));
    difference.setProjection(proList);/*from w ww  .  j  a v  a  2  s .  co  m*/
    final int value = (Integer) difference.uniqueResult();
    return value;
}

From source file:br.com.hrstatus.dao.impl.ConfigurationDAO.java

License:Open Source License

public int getDiffirenceSecsScheduler(String schedulerName) {

    log.fine("[ " + schedulerName + " ] getDiffirenceSecsScheduler()");

    final Criteria difference = session().createCriteria(Configurations.class);
    final ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("difference"));
    difference.setProjection(proList);/*w  w  w  .j ava2s.c o m*/
    final int value = (Integer) difference.uniqueResult();
    return value;
}

From source file:br.com.hrstatus.dao.impl.ConfigurationDAO.java

License:Open Source License

public String getNtpServerAddress() {

    log.fine("[ " + userInfo.getLoggedUsername() + " ] getNtpServerAddress()");

    final Criteria ntpServer = session().createCriteria(Configurations.class);
    final ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("ntpServer"));
    ntpServer.setProjection(proList);//ww w .j a va2s  .c o  m
    return (String) ntpServer.uniqueResult();
}

From source file:br.com.hrstatus.dao.impl.ConfigurationDAO.java

License:Open Source License

public String getNtpServerAddressNotLogged() {

    log.fine("[ System ] getNtpServerAddress()");

    final Criteria ntpServer = session().createCriteria(Configurations.class);
    final ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("ntpServer"));
    ntpServer.setProjection(proList);/* ww w  . j a v  a  2 s .  co m*/
    return (String) ntpServer.uniqueResult();
}

From source file:br.com.hrstatus.dao.impl.InstallProcessDAO.java

License:Open Source License

public boolean freshInstall() {

    log.fine("[ System ] invoking freshInstall()");

    final Criteria freshInstall = session().createCriteria(InstallationProcess.class);
    final ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("freshInstall"));
    freshInstall.setProjection(proList);

    boolean result = false;

    try {/*from ww  w.ja v  a2 s.  com*/
        final String temp = freshInstall.uniqueResult().toString();

        if (new Boolean(temp)) {
            result = true;
        } else if (!new Boolean(temp)) {
            result = false;
        }
    } catch (java.lang.NullPointerException NPE) {
        result = true;
    }
    return result;
}

From source file:br.com.hrstatus.dao.impl.InstallProcessDAO.java

License:Open Source License

public String getInstallationDate() {

    log.fine("[ System ] invoking getInstallationDate()");
    final Criteria installDate = session().createCriteria(InstallationProcess.class);
    final ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("installDate"));
    installDate.setProjection(proList);//ww w . j av a  2 s.  c o m
    return installDate.uniqueResult().toString();
}

From source file:br.com.hrstatus.dao.impl.ServersDAO.java

License:Open Source License

@SuppressWarnings("unchecked")
public List<Servidores> getHostnames() {

    log.fine("[ " + userInfo.getLoggedUsername() + " ] getHostnames()");

    try {//  ww  w.  ja v a2 s .  com

        final Criteria criteriaHostname = session().createCriteria(Servidores.class);
        final ProjectionList proList = Projections.projectionList();
        proList.add(Projections.property("id"));
        proList.add(Projections.property("hostname"));
        criteriaHostname.setProjection(proList);
        return criteriaHostname.list();

    } catch (Exception e) {
        log.severe("Error: " + e);
        return new ArrayList<Servidores>();
    }
}

From source file:br.com.hrstatus.dao.impl.UsersDAO.java

License:Open Source License

public String getPass(String username) {

    log.fine("[ " + userInfo.getLoggedUsername() + " ] getPass(String user)[" + username + "]");

    final Criteria criteria = session().createCriteria(Users.class);
    criteria.add(Restrictions.eq("username", username));
    final ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("password"));
    criteria.setProjection(proList);//from w w w.j  av  a  2s . c o  m
    return criteria.uniqueResult().toString();
}

From source file:br.com.hrstatus.dao.impl.UsersDAO.java

License:Open Source License

public String getMail(String username) {

    log.fine("[ " + userInfo.getLoggedUsername() + " ] getMail(String username)[" + username + "]");
    final Criteria criteria = session().createCriteria(Users.class);
    criteria.add(Restrictions.eq("username", username));
    final ProjectionList proList = Projections.projectionList();
    proList.add(Projections.property("mail"));
    criteria.setProjection(proList);/* w ww.  jav  a 2 s .c om*/
    return criteria.uniqueResult().toString();
}