Examples of OLATResourceImpl


Examples of org.olat.resource.OLATResourceImpl

      if (ref.getUserdata().equals(GLOSSARY_REPO_REF_IDENTIFYER)) {
        // remove the reference from the course configuration
        // TODO:RH:improvement: this should use a callback method or send a general delete
        // event so that the course can take care of this rather than having it
        // here hardcoded
        OLATResourceImpl courseResource = ref.getSource();
        //ICourse course = CourseFactory.loadCourse(courseResource);
        ICourse course = CourseFactory.openCourseEditSession(courseResource.getResourceableId());
        CourseConfig cc = course.getCourseEnvironment().getCourseConfig();
        cc.setGlossarySoftKey(null);
        CourseFactory.setCourseConfig(course.getResourceableId(), cc);
        CourseFactory.closeCourseEditSession(course.getResourceableId(),true);
        // remove reference from the references table
View Full Code Here

Examples of org.olat.resource.OLATResourceImpl

   * @param target
   * @param userdata
   */
  public void addReference(OLATResourceable source, OLATResourceable target, String userdata) {
      //FIXME:ms:b consider the case where source does not exists yet in the OLATResource db table
    OLATResourceImpl sourceImpl = (OLATResourceImpl)resManager.findResourceable(source);
    OLATResourceImpl targetImpl = (OLATResourceImpl)resManager.findResourceable(target);
    ReferenceImpl ref = new ReferenceImpl(sourceImpl, targetImpl, userdata);
    DBFactory.getInstance().saveObject(ref);
  }
View Full Code Here

Examples of org.olat.resource.OLATResourceImpl

   *
   * @param source
   * @return List of renerences.
   */
  public List getReferences(OLATResourceable source) {
    OLATResourceImpl sourceImpl = (OLATResourceImpl)resManager.findResourceable(source);
    if (sourceImpl == null) return new ArrayList(0);
   
    return DBFactory.getInstance().find(
        "select v from org.olat.resource.references.ReferenceImpl as v where v.source = ?",
        sourceImpl.getKey(), Hibernate.LONG);
  }
View Full Code Here

Examples of org.olat.resource.OLATResourceImpl

   *
   * @param target
   * @return List of references.
   */
  public List getReferencesTo(OLATResourceable target) {
    OLATResourceImpl targetImpl = (OLATResourceImpl)resManager.findResourceable(target);
    if (targetImpl == null) return new ArrayList(0);
   
    return DBFactory.getInstance().find(
        "select v from org.olat.resource.references.ReferenceImpl as v where v.target = ?",
        targetImpl.getKey(), Hibernate.LONG);
  }
View Full Code Here

Examples of org.olat.resource.OLATResourceImpl

    StringBuilder result = new StringBuilder(100);
    List refs = getReferencesTo(target);
    if (refs.size() == 0) return null;
    for (Iterator iter = refs.iterator(); iter.hasNext();) {
      ReferenceImpl ref = (ReferenceImpl) iter.next();
      OLATResourceImpl source = ref.getSource();
     
      // special treatment for referenced courses: find out the course title
      if (source.getResourceableTypeName().equals(CourseModule.getCourseTypeName())) {
        ICourse course = CourseFactory.loadCourse(source);
        result.append(translator.translate("ref.course", new String[] { course.getCourseTitle() }));
      } else {
        result.append(translator.translate("ref.generic", new String[] { source.getKey().toString() }));
      }
      result.append("<br />");
    }
    return result.toString();
  }
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.