Examples of ICourse


Examples of org.olat.course.ICourse

      if(status.isClosed()) {
        if(log.isDebug()) log.debug("Course not indexed because it's closed: repositoryEntry=" + repositoryEntry);
        return;
      }

      ICourse course = CourseFactory.loadCourse(repositoryEntry.getOlatResource());
      // course.getCourseTitle(); // do not index title => index root-node
      parentResourceContext.setParentContextType(TYPE);
      parentResourceContext.setParentContextName(course.getCourseTitle());
      doIndexCourse( parentResourceContext, course,  course.getRunStructure().getRootNode(), indexWriter);     
    } catch (Exception ex) {
      log.warn("Can not index repositoryEntry=" + repositoryEntry,ex);
    }
  }
View Full Code Here

Examples of org.olat.course.ICourse

    if (log.isDebug()) log.debug("repositoryEntry=" + repositoryEntry );

    Long nodeId = bcContextEntry.getOLATResourceable().getResourceableId();
    if (log.isDebug()) log.debug("nodeId=" + nodeId );
   
    ICourse course = CourseFactory.loadCourse(repositoryEntry.getOlatResource());
    IdentityEnvironment ienv = new IdentityEnvironment();
    ienv.setIdentity(identity);
    ienv.setRoles(roles);
    UserCourseEnvironment userCourseEnv = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment());
    if (log.isDebug()) log.debug("userCourseEnv=" + userCourseEnv + "ienv=" + ienv );
   
    CourseNode rootCn = userCourseEnv.getCourseEnvironment().getRunStructure().getRootNode();

    String nodeIdS = nodeId.toString();
    CourseNode courseNode = course.getRunStructure().getNode(nodeIdS);
    if (log.isDebug()) log.debug("courseNode=" + courseNode );
   
    TreeEvaluation treeEval = new TreeEvaluation();
    NodeEvaluation rootNodeEval = rootCn.eval(userCourseEnv.getConditionInterpreter(), treeEval);
    if (log.isDebug()) log.debug("rootNodeEval=" + rootNodeEval );
View Full Code Here

Examples of org.olat.course.ICourse

    Roles roles = new Roles(true, true, true, true, false, true);
    List<RepositoryEntry> allCourses = rm.queryByTypeLimitAccess(CourseModule.getCourseTypeName(), roles);
    int counter = 0;
    for (Iterator<RepositoryEntry> iterator = allCourses.iterator(); iterator.hasNext();) {
      RepositoryEntry entry = iterator.next();
      ICourse course = null;
      try{
        course = CourseFactory.loadCourse(entry.getOlatResource());
      } catch (Exception e) {
        log.error("Could not load Course! OlatResourcable: "+entry.getOlatResource(), e);
        continue;
      }
     
      CourseGroupManager groupManager = course.getCourseEnvironment().getCourseGroupManager();
      List<BusinessGroup> groups = groupManager.getAllLearningGroupsFromAllContexts();
        for (Iterator<BusinessGroup> iter = groups.iterator(); iter.hasNext();) {
          BusinessGroup group = iter.next();
          if (!synchonizeBuddyRoster(group)) {
            log.error("couldn't sync group: "+group.getResourceableTypeName());
View Full Code Here

Examples of org.olat.course.ICourse

   * if null, the properties of all identities (=all properties of this course)
   * are loaded.
   * @return
   */
  private List loadPropertiesFor(Identity identity) {
    ICourse course = CourseFactory.loadCourse(ores);
    StringBuilder sb = new StringBuilder();
    sb.append("from org.olat.properties.Property as p");
    sb.append(" inner join fetch p.identity as ident where");
    sb.append(" p.resourceTypeName = :restypename");
    sb.append(" and p.resourceTypeId = :restypeid");
    sb.append(" and ( p.name = '").append(ATTEMPTS);
    sb.append("' or p.name = '").append(SCORE);
    sb.append("' or p.name = '").append(PASSED);
    sb.append("' or p.name = '").append(ASSESSMENT_ID);
    sb.append("' or p.name = '").append(COMMENT);
    sb.append("' or p.name = '").append(COACH_COMMENT);
    sb.append("' )");
    if (identity != null) {
      sb.append(" and p.identity = :id");
    }
    DBQuery query = DBFactory.getInstance().createQuery(sb.toString());
    query.setString("restypename", course.getResourceableTypeName());
    query.setLong("restypeid", course.getResourceableId().longValue());
    if (identity != null) {
      query.setEntity("id", identity);
    }
    List properties = query.list();
    return properties;   
View Full Code Here

Examples of org.olat.course.ICourse

    // the caller of this method would have to make sure that this happens in the same transaction.
    // While this is not explicitly so, implicitly it is: currently the only user this method is
    // the AssessmentEditController - which as the 2nd last method calls into saveScoreEvaluation
    // - which in turn does update the EfficiencyStatement - at which point we're happy and everything works fine.
    // But it seems like this mechanism is a bit unobvious and might well be worth some refactoring...
    ICourse course = CourseFactory.loadCourse(ores);
    final CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();
    CoordinatorManager.getCoordinator().getSyncer().doInSync(createOLATResourceableForLocking(assessedIdentity), new SyncerExecutor(){
      public void execute() {
        Property attemptsProperty = cpm.findCourseNodeProperty(courseNode, assessedIdentity, null, ATTEMPTS);
        if (attemptsProperty == null) {
          attemptsProperty = cpm.createCourseNodePropertyInstance(courseNode, assessedIdentity, null, ATTEMPTS,
              null, new Long(attempts.intValue()), null, null);
          cpm.saveProperty(attemptsProperty);
        } else {
          attemptsProperty.setLongValue(new Long(attempts.intValue()));
          cpm.updateProperty(attemptsProperty);
        }
        // add to cache
        putPropertyIntoCache(assessedIdentity, attemptsProperty);
      }
    });

    // node log
    UserNodeAuditManager am = course.getCourseEnvironment().getAuditManager();
    am.appendToUserNodeLog(courseNode, identity, assessedIdentity, ATTEMPTS + " set to: " + String.valueOf(attempts));

    // notify about changes
    AssessmentChangedEvent ace = new AssessmentChangedEvent(AssessmentChangedEvent.TYPE_ATTEMPTS_CHANGED, assessedIdentity);
    CoordinatorManager.getCoordinator().getEventBus().fireEventToListenersOf(ace, course);
View Full Code Here

Examples of org.olat.course.ICourse

   * @see org.olat.course.assessment.AssessmentManager#saveNodeComment(org.olat.course.nodes.CourseNode,
   *      org.olat.core.id.Identity, org.olat.core.id.Identity,
   *      java.lang.String)
   */
  public void saveNodeComment(final CourseNode courseNode, final Identity identity, final Identity assessedIdentity, final String comment) {
    ICourse course = CourseFactory.loadCourse(ores);
    final CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();
    CoordinatorManager.getCoordinator().getSyncer().doInSync(createOLATResourceableForLocking(assessedIdentity), new SyncerExecutor(){
      public void execute() {
        Property commentProperty = cpm.findCourseNodeProperty(courseNode, assessedIdentity, null, COMMENT);
        if (commentProperty == null) {
          commentProperty = cpm.createCourseNodePropertyInstance(courseNode, assessedIdentity, null, COMMENT, null, null, null, comment);
          cpm.saveProperty(commentProperty);
        } else {
          commentProperty.setTextValue(comment);
          cpm.updateProperty(commentProperty);
        }
        // add to cache
        putPropertyIntoCache(assessedIdentity, commentProperty);
      }
    });
    // node log
    UserNodeAuditManager am = course.getCourseEnvironment().getAuditManager();
    am.appendToUserNodeLog(courseNode, identity, assessedIdentity, COMMENT + " set to: " + comment);

    // notify about changes
    AssessmentChangedEvent ace = new AssessmentChangedEvent(AssessmentChangedEvent.TYPE_USER_COMMENT_CHANGED, assessedIdentity);
    CoordinatorManager.getCoordinator().getEventBus().fireEventToListenersOf(ace, course);
View Full Code Here

Examples of org.olat.course.ICourse

  /**
   * @see org.olat.course.assessment.AssessmentManager#saveNodeCoachComment(org.olat.course.nodes.CourseNode,
   *      org.olat.core.id.Identity, java.lang.String)
   */
  public void saveNodeCoachComment(final CourseNode courseNode, final Identity assessedIdentity, final String comment) {
    ICourse course = CourseFactory.loadCourse(ores);
    final CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();
    CoordinatorManager.getCoordinator().getSyncer().doInSync(createOLATResourceableForLocking(assessedIdentity), new SyncerExecutor(){
      public void execute() {
        Property commentProperty = cpm.findCourseNodeProperty(courseNode, assessedIdentity, null, COACH_COMMENT);
        if (commentProperty == null) {
          commentProperty = cpm.createCourseNodePropertyInstance(courseNode, assessedIdentity, null, COACH_COMMENT, null, null, null, comment);
View Full Code Here

Examples of org.olat.course.ICourse

    List<String> courseTitles = new ArrayList<String>();
    List resources = BGContextManagerImpl.getInstance().findOLATResourcesForBGContext(context);
    for (Iterator iter = resources.iterator(); iter.hasNext();) {
      OLATResource resource = (OLATResource) iter.next();
      if (resource.getResourceableTypeName().equals(CourseModule.getCourseTypeName())) {
        ICourse course = CourseFactory.loadCourse(resource);
        courseTitles.add(course.getCourseTitle());
      }
      }
    return courseTitles;
    }
View Full Code Here

Examples of org.olat.course.ICourse

    // 2) reload course contexts for all courses wher this context is used
    List resources = findOLATResourcesForBGContext(bgContext);
    for (Iterator iter = resources.iterator(); iter.hasNext();) {
      OLATResource resource = (OLATResource) iter.next();
      if (resource.getResourceableTypeName().equals(CourseModule.getCourseTypeName())) {
        ICourse course = CourseFactory.loadCourse(resource);
        course.getCourseEnvironment().getCourseGroupManager().initGroupContextsList();
      } else if (resource.getResourceableTypeName().equals("junitcourse")) {
        // do nothing when in junit test mode
      } else {
        throw new AssertException("Currently only course resources allowed in resource to context relations.");
      }
View Full Code Here

Examples of org.olat.course.ICourse

  public void addBGContextToResource(BGContext bgContext, OLATResource resource) {
    BGContext2Resource courseBgContext = new BGContext2Resource(resource, bgContext);
    DBFactory.getInstance().saveObject(courseBgContext);
    // update course context list in this course resource
    if (resource.getResourceableTypeName().equals(CourseModule.getCourseTypeName())) {
      ICourse course = CourseFactory.loadCourse(resource);
      course.getCourseEnvironment().getCourseGroupManager().initGroupContextsList();
    } else if (resource.getResourceableTypeName().equals("junitcourse")) {
      // do nothing when in junit test mode
    } else {
      throw new AssertException("Currently only course resources allowed in resource to context relations.");
    }
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.