Class CopyConceptGraphJob

java.lang.Object
edu.ucsb.cs.scaffold.jobs.CopyConceptGraphJob
All Implemented Interfaces:
edu.ucsb.cs156.jobs.services.JobContextConsumer

public class CopyConceptGraphJob extends Object implements edu.ucsb.cs156.jobs.services.JobContextConsumer
Copies one course's entire concept-graph content (concepts, subconcepts, prerequisite edges, and practice problems) into another course, replacing ALL of the destination course's content and clearing every user's saved per-course scaffold state for that course.

Implemented as an in-memory YAML export of the "from" course immediately followed by a YAML import into the "to" course (see docs/yaml-format.md), so this job cannot drift from the behavior of the download/upload endpoints in ConceptsYamlController: the same code performs both, and any future bug fix in ConceptYamlService applies to this job automatically.

Before copying anything, the job verifies that both courses exist and that the launching user has admin or instructor/staff level access to both; otherwise it logs an error and terminates without touching either course.

  • Constructor Details

    • CopyConceptGraphJob

      public CopyConceptGraphJob()
  • Method Details

    • getScopeType

      public String getScopeType()
      Specified by:
      getScopeType in interface edu.ucsb.cs156.jobs.services.JobContextConsumer
    • getScopeId

      public Long getScopeId()
      Specified by:
      getScopeId in interface edu.ucsb.cs156.jobs.services.JobContextConsumer
    • accept

      public void accept(edu.ucsb.cs156.jobs.services.JobContext ctx) throws Exception
      Specified by:
      accept in interface edu.ucsb.cs156.jobs.services.JobContextConsumer
      Throws:
      Exception