Package org.olat.resource

Examples of org.olat.resource.OLATResource


  public ImsRepositoryResolver(Long repositoryEntryKey) {
    RepositoryManager rm = RepositoryManager.getInstance();
    RepositoryEntry entry = rm.lookupRepositoryEntry(repositoryEntryKey);
    if (entry != null) {
      OLATResource ores = entry.getOlatResource();
      init(ores);
    }
  }
View Full Code Here


    calRenderWrapper.getKalendarConfig().setResId(businessGroup.getKey());
    if (businessGroup.getType().equals(BusinessGroup.TYPE_LEARNINGROUP)) {
      // add linking
      List<OLATResource> resources = BGContextManagerImpl.getInstance().findOLATResourcesForBGContext(businessGroup.getGroupContext());
      for (Iterator<OLATResource> iter = resources.iterator(); iter.hasNext();) {
        OLATResource resource = iter.next();
        if (resource.getResourceableTypeName().equals(CourseModule.getCourseTypeName())) {
          ICourse course = CourseFactory.loadCourse(resource);
          CourseLinkProviderController clp = new CourseLinkProviderController(course, ureq, wControl);
          calRenderWrapper.setLinkProvider(clp);
          // for the time being only internal learning groups are supported, therefore we only get
          // the first course reference.
View Full Code Here

  //  - getIdentitiesWithPermissionOnOlatResourceable
  /**
   *
   */
  public void testAddReference() {
    OLATResource oressource = OLATResourceManager.getInstance().findOrPersistResourceable(OresHelper.createOLATResourceableInstance("type1", new Long(123)));
    OLATResource orestarget = OLATResourceManager.getInstance().findOrPersistResourceable(OresHelper.createOLATResourceableInstance("type2targ", new Long(456)));
    String udata = "üserdätä";
   
    // add a reference
    ReferenceManager.getInstance().addReference(oressource, orestarget, udata);
    DBFactory.getInstance().closeSession();
   
    OLATResource orestarget2 = OLATResourceManager.getInstance().findOrPersistResourceable(OresHelper.createOLATResourceableInstance("type2targ", new Long(456)));
    List refs = ReferenceManager.getInstance().getReferencesTo(orestarget2);
    for (Iterator it_refs = refs.iterator(); it_refs.hasNext();) {
      ReferenceImpl ref = (ReferenceImpl) it_refs.next();
      System.out.println("ref:"+ref);
    }
View Full Code Here

    assertTrue("only one reference may exist", refs.size() == 1);
  }
 
  public void testReferencesToAndFrom() {
    // same resouceable id on purpose
    OLATResource s1 = OLATResourceManager.getInstance().findOrPersistResourceable(OresHelper.createOLATResourceableInstance("s1rrtype1", new Long(123)));
    OLATResource s2 = OLATResourceManager.getInstance().findOrPersistResourceable(OresHelper.createOLATResourceableInstance("s2rrtype1", new Long(123)));
    OLATResource s3 = OLATResourceManager.getInstance().findOrPersistResourceable(OresHelper.createOLATResourceableInstance("s31rrtype1", new Long(123)));
    OLATResource t1 = OLATResourceManager.getInstance().findOrPersistResourceable(OresHelper.createOLATResourceableInstance("t1rrtype1", new Long(123)));
    OLATResource t2 = OLATResourceManager.getInstance().findOrPersistResourceable(OresHelper.createOLATResourceableInstance("t2rrtype1", new Long(123)));
   
    // add references
    ReferenceManager.getInstance().addReference(s1,t1,"r11");
    ReferenceManager.getInstance().addReference(s2,t1,"r21");
    ReferenceManager.getInstance().addReference(s2,t2,"r22");
View Full Code Here

    assertTrue ("t2 holds two source refs (to s2 and s3)", t2refs.size() == 2);   
   
  }
 
  public void testAddAndDeleteReference() {
    OLATResource oressource = OLATResourceManager.getInstance().findOrPersistResourceable(OresHelper.createOLATResourceableInstance("type1", new Long(123)));
    OLATResource orestarget = OLATResourceManager.getInstance().findOrPersistResourceable(OresHelper.createOLATResourceableInstance("type2targ", new Long(456)));
    String udata = "üserdätä";
   
    // add a reference
    ReferenceManager.getInstance().addReference(oressource, orestarget, udata);
    DBFactory.getInstance().closeSession();
       
    OLATResource orestarget2 = OLATResourceManager.getInstance().findOrPersistResourceable(OresHelper.createOLATResourceableInstance("type2targ", new Long(456)));
    List refs = ReferenceManager.getInstance().getReferencesTo(orestarget2);
    assertTrue("only one reference may exist", refs.size() == 1);
    for (Iterator it_refs = refs.iterator(); it_refs.hasNext();) {
      ReferenceImpl ref = (ReferenceImpl) it_refs.next();
      ReferenceManager.getInstance().delete(ref);
    }

    DBFactory.getInstance().closeSession();

    // now make sure the reference was deleted
    OLATResource orestarget3 = OLATResourceManager.getInstance().findOrPersistResourceable(OresHelper.createOLATResourceableInstance("type2targ", new Long(456)));
    List norefs = ReferenceManager.getInstance().getReferencesTo(orestarget3);
    assertTrue("reference should now be deleted", norefs.size() == 0);
   
  }
View Full Code Here

      // create course and persist as OLATResourceImpl
      OLATResourceable resourceable = new OLATResourceable() {
          public String getResourceableTypeName() {  return "Course";}
          public Long getResourceableId() {return new Long(456);}
      };
      OLATResource r =  rm.createOLATResourceInstance(resourceable);
      db.saveObject(r);
 
      // now make a repository entry for this course
      RepositoryEntry d = new RepositoryEntry();
      d.setOlatResource(r);
View Full Code Here

      final int ifin = i;
      OLATResourceable resourceable = new OLATResourceable() {
        public String getResourceableTypeName() {  return CourseModule.getCourseTypeName();}
        public Long getResourceableId() {return new Long(ifin);}
      };
      OLATResource r =  resm.createOLATResourceInstance(resourceable);
      db.saveObject(r);
     
      // now make a repository entry for this course
      RepositoryEntry re = rm.createRepositoryEntryInstance("Florian Gnägi", "Lernen mit OLAT " + i, "yo man description bla bla + i");
      re.setDisplayname("JunitTest_RepositoryEntry_" + i);
View Full Code Here

    // create course and persist as OLATResourceImpl
    OLATResourceable resourceable = new OLATResourceable() {
        public String getResourceableTypeName() {  return CourseModule.ORES_TYPE_COURSE;}
        public Long getResourceableId() {return resourceableId;}
    };
    OLATResource r =  rm.createOLATResourceInstance(resourceable);
    DBFactory.getInstance().saveObject(r);

    // now make a repository entry for this course
    RepositoryEntry d = new RepositoryEntry();
    d.setOlatResource(r);
View Full Code Here

TOP

Related Classes of org.olat.resource.OLATResource

Copyright © 2018 www.massapicom. 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.