Package edu.ucsb.cs.scaffold.services
Class ConceptYamlService
java.lang.Object
edu.ucsb.cs.scaffold.services.ConceptYamlService
Exports and imports a course's entire concept-graph content (concepts, subconcepts, prerequisite
edges, and practice problems) as a human-editable YAML document. See docs/yaml-format.md for the
format specification.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateYAML(long courseId) The complete concept-graph content of the course as a YAML document (see docs/yaml-format.md).replaceFromYAML(long courseId, InputStream yamlStream) Replaces the course's entire concept-graph content with the content of a YAML document in the docs/yaml-format.md format, reporting the outcome as a JSON-shaped map.
-
Field Details
-
MAX_URL_LENGTH
public static final int MAX_URL_LENGTH- See Also:
-
-
Constructor Details
-
ConceptYamlService
public ConceptYamlService()
-
-
Method Details
-
createYAML
public String createYAML(long courseId) throws EntityNotFoundException, com.fasterxml.jackson.core.JsonProcessingException The complete concept-graph content of the course as a YAML document (see docs/yaml-format.md). Top-level concepts are numbered with consecutive external ids 1..n in database-id order; edges refer to those external ids.- Throws:
EntityNotFoundExceptioncom.fasterxml.jackson.core.JsonProcessingException
-
replaceFromYAML
@Transactional public Map<String,Object> replaceFromYAML(long courseId, InputStream yamlStream) throws EntityNotFoundException Replaces the course's entire concept-graph content with the content of a YAML document in the docs/yaml-format.md format, reporting the outcome as a JSON-shaped map.The replacement is all-or-nothing: the document is fully parsed and validated first, and if anything is wrong the course is left untouched and every problem found is reported under
errors. Only a valid document deletes the course's concepts, edges, practice problems, and per-user scaffold state (user_staterows, which refer to concepts by ids that no longer exist after a replacement) before creating the new content.- Throws:
EntityNotFoundException
-