Package org.olat.core.commons.persistence

Examples of org.olat.core.commons.persistence.DB.find()


    slct.append("rset.olatResource=? ");
    slct.append("and rset.olatResourceDetail=? ");
    slct.append("and rset.repositoryRef=? ");
    if (identity != null) {
      slct.append("and rset.identity.key=? ");
      return db.find(slct.toString(), new Object[] { olatRes, olatResDet, repRef, identity.getKey() }, new Type[] { Hibernate.LONG, Hibernate.STRING,
          Hibernate.LONG, Hibernate.LONG });
    } else {
      return db.find(slct.toString(), new Object[] { olatRes, olatResDet, repRef }, new Type[] { Hibernate.LONG, Hibernate.STRING,
          Hibernate.LONG });
    }
View Full Code Here


    if (identity != null) {
      slct.append("and rset.identity.key=? ");
      return db.find(slct.toString(), new Object[] { olatRes, olatResDet, repRef, identity.getKey() }, new Type[] { Hibernate.LONG, Hibernate.STRING,
          Hibernate.LONG, Hibernate.LONG });
    } else {
      return db.find(slct.toString(), new Object[] { olatRes, olatResDet, repRef }, new Type[] { Hibernate.LONG, Hibernate.STRING,
          Hibernate.LONG });
    }
  }

  /**
 
View Full Code Here

      // if names and quantity of the persons is well-known
    else
        slct.append("order by rset.creationDate, rset.assessmentID, res.itemIdent");

    List results = null;
    results = db.find(slct.toString(), new Object[] { olatRes, olatResDet, repRef }, new Type[] { Hibernate.LONG, Hibernate.STRING,
        Hibernate.LONG });
   
    return results;
  }
View Full Code Here

    slct.append("rset.olatResource=? ");
    slct.append("and rset.olatResourceDetail=? ");
    slct.append("and rset.repositoryRef=? ");

    List results = null;
    results = db.find(slct.toString(), new Object[] { olatRes, olatResDet, repRef }, new Type[] { Hibernate.LONG, Hibernate.STRING,
        Hibernate.LONG });

    String delRes = "from res in class org.olat.ims.qti.QTIResult where res.resultSet.key = ?";
    String delRset = "from rset in class org.olat.ims.qti.QTIResultSet where rset.key = ?";
View Full Code Here

  private void deleteMessageRecursion(Long forumKey, Message m) {
    deleteMessageContainer(forumKey, m.getKey());
    DB db = DBFactory.getInstance();
    Long message_id = m.getKey();
    List messages = db
        .find("select msg from msg in class org.olat.modules.fo.MessageImpl where msg.parent = ?", message_id, Hibernate.LONG);

    for (Iterator iter = messages.iterator(); iter.hasNext();) {
      Message element = (Message) iter.next();
      deleteMessageRecursion(forumKey, element);
View Full Code Here

   * @param assessmentID
   * @return
   */
  public List findQtiResults(long assessmentID) {
    DB persister = DBFactory.getInstance();
    return persister.find("from q in class org.olat.ims.qti.QTIResult where q.assessmentID = ?",
        new Long(assessmentID), Hibernate.LONG);
  }

  /**
   *
 
View Full Code Here

   * @param versionID
   * @return
   */
  public List findQtiResults(long assessmentID, long versionID) {
    DB persister = DBFactory.getInstance();
    return persister.find("from q in class org.olat.ims.qti.QTIResult where "
        + "q.assessmentID = ? and q.versionid = ?", new Object[]{new Long(assessmentID), new Long(versionID)},
        new Type[]{Hibernate.LONG, Hibernate.LONG});
  }
 
  /**
 
View Full Code Here

   * @param itemIdent
   * @return
   */
  public List findQtiResults(long assessmentID, long versionID, String itemIdent) {
    DB persister = DBFactory.getInstance();
    return persister.find("from q in class org.olat.ims.qti.QTIResult where "
        + "q.assessmentID = ? and q.versionid = ? and q.itemident = ?", new Object[]{new Long(assessmentID),
        new Long(versionID), itemIdent}, new Type[]{Hibernate.LONG, Hibernate.LONG, Hibernate.STRING});
  }
 
  /**
 
View Full Code Here

   * @return Returns the last recorded QTIResultSet
   */
  public QTIResultSet getLastResultSet(Identity identity, long olatResource, String olatResourceDetail) {
    QTIResultSet returnQTIResultSet=null;
    DB persister = DBFactory.getInstance();
    List resultSetList =  persister.find("from q in class org.olat.ims.qti.QTIResultSet where "
        + "q.identity = ? and q.olatResource = ? and q.olatResourceDetail = ? order by q.creationDate desc", new Object[]{identity.getKey(), new Long(olatResource), new String(olatResourceDetail)},
        new Type[]{Hibernate.LONG, Hibernate.LONG, Hibernate.STRING});
    Iterator resultSetIterator = resultSetList.iterator();
    while(resultSetIterator.hasNext()) {
      returnQTIResultSet = (QTIResultSet)resultSetIterator.next();
View Full Code Here

    }
    DB dbInstance = DBFactory.getInstance();
    if (dbInstance==null) {
      throw new IllegalStateException("DBFactory.getInstance() returned null");
    }
    List results = dbInstance.find(
        "select auth from org.olat.basesecurity.AuthenticationImpl as auth where auth.identity.key = ? and auth.provider = ?",
        new Object[] { identity.getKey(), provider }, new Type[] { Hibernate.LONG, Hibernate.STRING });
    if (results == null || results.size() == 0) return null;
    if (results.size() > 1) throw new AssertException("Found more than one Authentication for a given subject and a given provider.");
    return (Authentication) results.get(0);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.