Package org.olat.search.service

Examples of org.olat.search.service.SearchResourceContext


  }
 
  public void doIndex(SearchResourceContext repositoryResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) throws IOException,InterruptedException  {
    if (Tracing.isDebugEnabled(BCCourseNodeIndexer.class)) Tracing.logDebug("Index Briefcase..." , BCCourseNodeIndexer.class);

    SearchResourceContext courseNodeResourceContext = new SearchResourceContext(repositoryResourceContext);
    courseNodeResourceContext.setBusinessControlFor(courseNode);
    courseNodeResourceContext.setDocumentType(TYPE);
    courseNodeResourceContext.setTitle(courseNode.getShortTitle());
    courseNodeResourceContext.setDescription(courseNode.getLongTitle());

    OlatNamedContainerImpl namedContainer = BCCourseNode.getNodeFolderContainer((BCCourseNode) courseNode, course.getCourseEnvironment());
    doIndexVFSContainer(courseNodeResourceContext,namedContainer,indexWriter,"", FolderIndexerAccess.FULL_ACCESS);
    // go further, index my child nodes
    courseNodeIndexer.doIndexCourse(repositoryResourceContext, course, courseNode, indexWriter);
View Full Code Here


  }
 
  public void doIndex(SearchResourceContext repositoryResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) throws IOException,InterruptedException  {
    if (log.isDebug()) log.debug("Index SinglePage...");

    SearchResourceContext courseNodeResourceContext = new SearchResourceContext(repositoryResourceContext);
    courseNodeResourceContext.setBusinessControlFor(courseNode);
    courseNodeResourceContext.setDocumentType(TYPE);
    courseNodeResourceContext.setTitle(courseNode.getShortTitle());
    courseNodeResourceContext.setDescription(courseNode.getLongTitle());

    VFSContainer rootContainer = SPCourseNode.getNodeFolderContainer((SPCourseNode) courseNode, course.getCourseEnvironment());
    String chosenFile = (String) courseNode.getModuleConfiguration().get(SPEditController.CONFIG_KEY_FILE);
    // First: Index choosen HTML file
    if (log.isDebug()) log.debug("Index chosen file in SP. chosenFile=" + chosenFile);
View Full Code Here

  public TACourseNodeIndexer() {
    courseNodeIndexer = new CourseIndexer();
  }
 
  public void doIndex(SearchResourceContext repositoryResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) throws IOException,InterruptedException  {
    SearchResourceContext courseNodeResourceContext = new SearchResourceContext(repositoryResourceContext);
    courseNodeResourceContext.setBusinessControlFor(courseNode);
    courseNodeResourceContext.setTitle(courseNode.getShortTitle());
    courseNodeResourceContext.setDescription(courseNode.getLongTitle());
   
    // Index Task
    File fTaskfolder = new File(FolderConfig.getCanonicalRoot() + TACourseNode.getTaskFolderPathRelToFolderRoot(course.getCourseEnvironment(), courseNode));
    VFSContainer taskRootContainer = new LocalFolderImpl(fTaskfolder);
    courseNodeResourceContext.setDocumentType(TYPE_TASK);
    doIndexVFSContainer(courseNodeResourceContext, taskRootContainer, indexWriter, "", FolderIndexerAccess.FULL_ACCESS);
   
    // Index Dropbox
    String dropboxFilePath = FolderConfig.getCanonicalRoot() + DropboxController.getDropboxPathRelToFolderRoot(course.getCourseEnvironment(), courseNode);
    File fDropboxFolder = new File(dropboxFilePath);
    VFSContainer dropboxRootContainer = new LocalFolderImpl(fDropboxFolder);
    courseNodeResourceContext.setDocumentType(TYPE_DROPBOX);
    doIndexVFSContainer(courseNodeResourceContext, dropboxRootContainer, indexWriter, "", FolderIndexerAccess.FULL_ACCESS);
   
    // Index Returnbox
    String returnboxFilePath = FolderConfig.getCanonicalRoot() + ReturnboxController.getReturnboxPathRelToFolderRoot(course.getCourseEnvironment(), courseNode);
    File fResturnboxFolder = new File(returnboxFilePath);
    VFSContainer returnboxRootContainer = new LocalFolderImpl(fResturnboxFolder);
    courseNodeResourceContext.setDocumentType(TYPE_RETURNBOX);
    doIndexVFSContainer(courseNodeResourceContext, returnboxRootContainer, indexWriter, "", FolderIndexerAccess.FULL_ACCESS);
   
    // Index Solutionbox
    String solutionFilePath = FolderConfig.getCanonicalRoot() + SolutionController.getSolutionPathRelToFolderRoot(course.getCourseEnvironment(), courseNode);
    File fSolutionFolder = new File(solutionFilePath);
    VFSContainer solutionRootContainer = new LocalFolderImpl(fSolutionFolder);
    courseNodeResourceContext.setDocumentType(TYPE_SOLUTIONBOX);
    doIndexVFSContainer(courseNodeResourceContext, solutionRootContainer, indexWriter, "", FolderIndexerAccess.FULL_ACCESS);
   
    // go further, index my child nodes
    courseNodeIndexer.doIndexCourse(repositoryResourceContext, course, courseNode, indexWriter);
  }
View Full Code Here

    BufferedOutputStream bos = new BufferedOutputStream(leaf.getOutputStream(false));
    FileUtils.save(bos,htmlText,"utf-8");
    try {
      bos.close();
     
      SearchResourceContext resourceContext = new SearchResourceContext();
      resourceContext.setBusinessControlFor(OresHelper.createOLATResourceableType("FileDocumentFactoryTest"));
      resourceContext.setFilePath(filePath + "/" + leaf.getName());
      Document htmlDocument = FileDocumentFactory.createDocument(resourceContext, leaf);
      // 1. Check content
      String content = htmlDocument.get(OlatDocument.CONTENT_FIELD_NAME);
      assertEquals("Wrong HTML content=" + content.trim() + " , must be =" + text.trim(), text.trim(), content.trim());
      // 2. Check resourceUrl
View Full Code Here

TOP

Related Classes of org.olat.search.service.SearchResourceContext

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.