Package org.olat.core.commons.persistence

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


  private void updateUserLocaleAndLogout(UserRequest ureq, String localeKey) {
    User currUser = ureq.getIdentity().getUser();
    // direct DB calls have to be made here because the
    // user manager is not available in the core
    DB db = DBFactory.getInstance();
    currUser = (User) db.loadObject(currUser);
    currUser.getPreferences().setLanguage(localeKey);
    db.saveObject(currUser);
    DispatcherAction.redirectToDefaultDispatcher(ureq.getHttpResp());
  }
View Full Code Here


   */
  @Override
  public UserRating reloadRating(UserRating rating) {
    try {
      DB db = DBFactory.getInstance();
      return (UserRating) db.loadObject(rating);     
    } catch (Exception e) {
      // Huh, most likely the given object does not exist anymore on the
      // db, probably deleted by someone else
      logWarn("Tried to reload a user rating but got an exception. Probably deleted in the meantime", e);
      return null;
View Full Code Here

   * @see org.olat.core.commons.services.commentAndRating.UserCommentsManager#reloadComment(org.olat.core.commons.services.commentAndRating.model.UserComment)
   */
  public UserComment reloadComment(UserComment comment) {
    try {
      DB db = DBFactory.getInstance();
      return (UserComment) db.loadObject(comment);     
    } catch (Exception e) {
      // Huh, most likely the given object does not exist anymore on the
      // db, probably deleted by someone else
      logWarn("Tried to reload a user comment but got an exception. Probably deleted in the meantime", e);
      return null;
View Full Code Here

     * hibernate session, reloading before delete"); m =
     * loadMessage(m.getKey()); }
     */
    // make sure the message is reloaded if it is not in the hibernate session
    // cache
    m = (Message) db.loadObject(m);
    // delete all properties of one single message
    deleteMessageProperties(forumKey, m);
    db.deleteObject(m);
   
    if(isLogDebugEnabled()){
View Full Code Here

      Iterator<Message> messageIterator = subthreadList.iterator();
      Message firstMessage = null;
      DB db = DBFactory.getInstance();
      if (messageIterator.hasNext()) {
        firstMessage = messageIterator.next();
        firstMessage = (Message) db.loadObject(firstMessage);
        firstMessage.setParent(null);
        firstMessage.setThreadtop(null);
        this.updateMessage(firstMessage, new ForumChangedEvent("split"));
        newTopMessage = firstMessage;
      }
View Full Code Here

        this.updateMessage(firstMessage, new ForumChangedEvent("split"));
        newTopMessage = firstMessage;
      }
      while (firstMessage != null && messageIterator.hasNext()) {
        Message message = messageIterator.next();
        message = (Message) db.loadObject(message);
        message.setThreadtop(firstMessage);
        this.updateMessage(message, null);
     
    }   
    return newTopMessage;
View Full Code Here

    List<Message> subThreadList = new ArrayList<Message>();
    this.getSubthread(msg, oldThreadList, subThreadList);
    // one has to set a new parent for all childs of the moved message
    // first message of sublist has to get the parent from the moved message
    for(Message childMessage : subThreadList) {
      childMessage = (Message)db.loadObject(childMessage);
      childMessage.setParent(msg.getParent());
      updateMessage(childMessage, null);
    }
    // now move the message to the choosen thread
    Message oldMessage = (Message)db.loadObject(msg);
View Full Code Here

      childMessage = (Message)db.loadObject(childMessage);
      childMessage.setParent(msg.getParent());
      updateMessage(childMessage, null);
    }
    // now move the message to the choosen thread
    Message oldMessage = (Message)db.loadObject(msg);
    Message message = createMessage();
    message.setCreator(oldMessage.getCreator());
    message.setForum(oldMessage.getForum());
    message.setModifier(oldMessage.getModifier());
    message.setTitle(oldMessage.getTitle());
View Full Code Here

  public void deleteChecklist(final Checklist cl) {
    final DB db = DBFactory.getInstance();
    OLATResourceable ores = OresHelper.createOLATResourceableInstance(Checklist.class, cl.getKey());
    CoordinatorManager.getCoordinator().getSyncer().doInSync(ores, new SyncerExecutor() {
        public void execute() {
          Checklist checklist = (Checklist) db.loadObject(cl);
          db.deleteObject(checklist);
        }
    });
  }
View Full Code Here

    DB db = DBFactory.getInstance();
    //FIXME: fj: Please review: Create rep entry, restart olat, delete the rep
    // entry. previous implementation resulted in orange screen
    // secGroup = (SecurityGroup)db.loadObject(secGroup); // so we can later
    // delete it (hibernate needs an associated session)
    secGroup = (SecurityGroup) db.loadObject(secGroup);
    //o_clusterREVIEW
    //db.reputInHibernateSessionCache(secGroup);

    /*
     * if (!db.contains(secGroup)) { secGroup = (SecurityGroupImpl)
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.