Search in sources :

Example 1 with TaskConfigVO

use of org.olat.restapi.support.vo.elements.TaskConfigVO in project OpenOLAT by OpenOLAT.

the class CoursesElementsTest method testCreateCoursePut.

@Test
public void testCreateCoursePut() throws IOException, URISyntaxException {
    assertTrue(conn.login("administrator", "openolat"));
    // create an empty course
    URI uri = getCoursesUri().queryParam("shortTitle", "course3").queryParam("title", "course3 long name").build();
    HttpPut method = conn.createPut(uri, MediaType.APPLICATION_JSON, true);
    HttpResponse response = conn.execute(method);
    assertEquals(200, response.getStatusLine().getStatusCode());
    CourseVO course = conn.parse(response, CourseVO.class);
    assertNotNull(course);
    assertNotNull(course.getKey());
    assertNotNull(course.getEditorRootNodeId());
    try {
        ICourse savedCourse = CourseFactory.loadCourse(course.getKey());
        assertNotNull(savedCourse);
    } catch (Exception e) {
        assertTrue(false);
    }
    // create a learning group
    GroupVO groupVo = new GroupVO();
    groupVo.setName("hello");
    groupVo.setDescription("hello description");
    groupVo.setMinParticipants(new Integer(-1));
    groupVo.setMaxParticipants(new Integer(-1));
    URI newGroupUri = getCoursesUri().path(course.getKey().toString()).path("groups").build();
    HttpPut newGrpMethod = conn.createPut(newGroupUri, MediaType.APPLICATION_JSON, true);
    conn.addJsonEntity(newGrpMethod, groupVo);
    HttpResponse newGrpCode = conn.execute(newGrpMethod);
    assertEquals(200, newGrpCode.getStatusLine().getStatusCode());
    GroupVO group = conn.parse(newGrpCode, GroupVO.class);
    assertNotNull(group);
    assertNotNull(group.getKey());
    // create an structure node
    URI newStructureUri = getElementsUri(course).path("structure").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "0").queryParam("shortTitle", "Structure-0").queryParam("longTitle", "Structure-long-0").queryParam("objectives", "Structure-objectives-0").build();
    HttpPut newStructureMethod = conn.createPut(newStructureUri, MediaType.APPLICATION_JSON, true);
    HttpResponse newStructureCode = conn.execute(newStructureMethod);
    assertTrue(newStructureCode.getStatusLine().getStatusCode() == 200 || newStructureCode.getStatusLine().getStatusCode() == 201);
    CourseNodeVO structureNode = conn.parse(newStructureCode, CourseNodeVO.class);
    assertNotNull(structureNode);
    assertNotNull(structureNode.getId());
    assertEquals(structureNode.getShortTitle(), "Structure-0");
    assertEquals(structureNode.getLongTitle(), "Structure-long-0");
    assertEquals(structureNode.getLearningObjectives(), "Structure-objectives-0");
    assertEquals(structureNode.getParentId(), course.getEditorRootNodeId());
    // create single page
    URL pageUrl = CoursesElementsTest.class.getResource("singlepage.html");
    assertNotNull(pageUrl);
    File page = new File(pageUrl.toURI());
    URI newPageUri = getElementsUri(course).path("singlepage").build();
    HttpPut newPageMethod = conn.createPut(newPageUri, MediaType.APPLICATION_JSON, true);
    HttpEntity newPageEntity = MultipartEntityBuilder.create().setMode(HttpMultipartMode.BROWSER_COMPATIBLE).addBinaryBody("file", page, ContentType.APPLICATION_OCTET_STREAM, page.getName()).addTextBody("filename", page.getName()).addTextBody("parentNodeId", course.getEditorRootNodeId()).addTextBody("position", "1").addTextBody("shortTitle", "Single-Page-0").addTextBody("longTitle", "Single-Page-long-0").addTextBody("objectives", "Single-Page-objectives-0").build();
    newPageMethod.setEntity(newPageEntity);
    HttpResponse newPageCode = conn.execute(newPageMethod);
    assertTrue(newPageCode.getStatusLine().getStatusCode() == 200 || newPageCode.getStatusLine().getStatusCode() == 201);
    CourseNodeVO pageNode = conn.parse(newPageCode, CourseNodeVO.class);
    assertNotNull(pageNode);
    assertNotNull(pageNode.getId());
    assertEquals(pageNode.getShortTitle(), "Single-Page-0");
    assertEquals(pageNode.getLongTitle(), "Single-Page-long-0");
    assertEquals(pageNode.getLearningObjectives(), "Single-Page-objectives-0");
    assertEquals(structureNode.getParentId(), course.getEditorRootNodeId());
    // create a folder node
    URI newFolderUri = getElementsUri(course).path("folder").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "2").queryParam("shortTitle", "Folder-0").queryParam("longTitle", "Folder-long-0").queryParam("objectives", "Folder-objectives-0").build();
    HttpPut newFolderMethod = conn.createPut(newFolderUri, MediaType.APPLICATION_JSON, true);
    HttpResponse newFolderCode = conn.execute(newFolderMethod);
    assertTrue(newFolderCode.getStatusLine().getStatusCode() == 200 || newFolderCode.getStatusLine().getStatusCode() == 201);
    CourseNodeVO folderNode = conn.parse(newFolderCode, CourseNodeVO.class);
    assertNotNull(folderNode);
    assertNotNull(folderNode.getId());
    assertEquals(folderNode.getShortTitle(), "Folder-0");
    assertEquals(folderNode.getLongTitle(), "Folder-long-0");
    assertEquals(folderNode.getLearningObjectives(), "Folder-objectives-0");
    assertEquals(folderNode.getParentId(), course.getEditorRootNodeId());
    // create a forum node
    URI newForumUri = getElementsUri(course).path("forum").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "3").queryParam("shortTitle", "Forum-0").queryParam("longTitle", "Forum-long-0").queryParam("objectives", "Forum-objectives-0").build();
    HttpPut newForumMethod = conn.createPut(newForumUri, MediaType.APPLICATION_JSON, true);
    HttpResponse newForumCode = conn.execute(newForumMethod);
    assertTrue(newForumCode.getStatusLine().getStatusCode() == 200 || newForumCode.getStatusLine().getStatusCode() == 201);
    CourseNodeVO forumNode = conn.parse(newForumCode, CourseNodeVO.class);
    assertNotNull(forumNode);
    assertNotNull(forumNode.getId());
    assertEquals(forumNode.getShortTitle(), "Forum-0");
    assertEquals(forumNode.getLongTitle(), "Forum-long-0");
    assertEquals(forumNode.getLearningObjectives(), "Forum-objectives-0");
    assertEquals(forumNode.getParentId(), course.getEditorRootNodeId());
    // create a task node
    URI newTaskUri = getElementsUri(course).path("task").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "4").queryParam("shortTitle", "Task-0").queryParam("longTitle", "Task-long-0").queryParam("objectives", "Task-objectives-0").queryParam("points", "25").queryParam("text", "A very difficult test").build();
    HttpPut newTaskMethod = conn.createPut(newTaskUri, MediaType.APPLICATION_JSON, true);
    HttpResponse newTaskCode = conn.execute(newTaskMethod);
    assertTrue(newTaskCode.getStatusLine().getStatusCode() == 200 || newTaskCode.getStatusLine().getStatusCode() == 201);
    CourseNodeVO taskNode = conn.parse(newTaskCode, CourseNodeVO.class);
    assertNotNull(taskNode);
    assertNotNull(taskNode.getId());
    assertEquals(taskNode.getShortTitle(), "Task-0");
    assertEquals(taskNode.getLongTitle(), "Task-long-0");
    assertEquals(taskNode.getLearningObjectives(), "Task-objectives-0");
    assertEquals(taskNode.getParentId(), course.getEditorRootNodeId());
    // add task configuration
    URI taskConfigUri = getElementsUri(course).path("task/" + taskNode.getId() + "/configuration").queryParam("enableAssignment", Boolean.FALSE).queryParam("enableScoring", Boolean.TRUE).queryParam("grantScoring", Boolean.TRUE).queryParam("scoreMin", new Float(1.5)).queryParam("scoreMax", 10).build();
    HttpPut taskConfigMethod = conn.createPut(taskConfigUri, MediaType.APPLICATION_JSON, true);
    HttpResponse taskConfigCode = conn.execute(taskConfigMethod);
    assertTrue(taskConfigCode.getStatusLine().getStatusCode() == 200 || taskConfigCode.getStatusLine().getStatusCode() == 201);
    EntityUtils.consume(taskConfigCode.getEntity());
    HttpGet getTaskConfig = conn.createGet(taskConfigUri, MediaType.APPLICATION_JSON, true);
    taskConfigCode = conn.execute(getTaskConfig);
    assertTrue(taskConfigCode.getStatusLine().getStatusCode() == 200 || taskConfigCode.getStatusLine().getStatusCode() == 201);
    TaskConfigVO taskConfig = conn.parse(taskConfigCode, TaskConfigVO.class);
    assertNotNull(taskConfig);
    // default is true
    assertTrue(!taskConfig.getIsAssignmentEnabled());
    assertTrue(taskConfig.getIsScoringEnabled() & taskConfig.getIsScoringGranted());
    assertTrue(taskConfig.getMinScore().floatValue() == 1.5);
    assertTrue(taskConfig.getMaxScore().floatValue() == 10);
    // create an assessment node
    URI newAssessmentUri = getElementsUri(course).path("assessment").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "5").queryParam("shortTitle", "Assessment-0").queryParam("longTitle", "Assessment-long-0").queryParam("objectives", "Assessment-objectives-0").build();
    HttpPut newAssessmentMethod = conn.createPut(newAssessmentUri, MediaType.APPLICATION_JSON, true);
    HttpResponse newAssessmentCode = conn.execute(newAssessmentMethod);
    assertTrue(newAssessmentCode.getStatusLine().getStatusCode() == 200 || newAssessmentCode.getStatusLine().getStatusCode() == 201);
    CourseNodeVO assessmentNode = conn.parse(newAssessmentCode, CourseNodeVO.class);
    assertNotNull(assessmentNode);
    assertNotNull(assessmentNode.getId());
    assertEquals(assessmentNode.getShortTitle(), "Assessment-0");
    assertEquals(assessmentNode.getLongTitle(), "Assessment-long-0");
    assertEquals(assessmentNode.getLearningObjectives(), "Assessment-objectives-0");
    assertEquals(assessmentNode.getParentId(), course.getEditorRootNodeId());
    // create an contact node
    URI newContactUri = getElementsUri(course).path("contact").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "6").queryParam("shortTitle", "Contact-0").queryParam("longTitle", "Contact-long-0").queryParam("objectives", "Contact-objectives-0").build();
    HttpPut newContactMethod = conn.createPut(newContactUri, MediaType.APPLICATION_JSON, true);
    HttpResponse newContactCode = conn.execute(newContactMethod);
    assertEquals(200, newContactCode.getStatusLine().getStatusCode());
    CourseNodeVO contactNode = conn.parse(newContactCode, CourseNodeVO.class);
    assertNotNull(contactNode);
    assertNotNull(contactNode.getId());
    assertEquals(contactNode.getShortTitle(), "Contact-0");
    assertEquals(contactNode.getLongTitle(), "Contact-long-0");
    assertEquals(contactNode.getLearningObjectives(), "Contact-objectives-0");
    assertEquals(contactNode.getParentId(), course.getEditorRootNodeId());
    // try to create an invalid enrollment node
    URI newENUri = getElementsUri(course).path("enrollment").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "7").queryParam("shortTitle", "Enrollment-0").queryParam("longTitle", "Enrollment-long-0").queryParam("objectives", "Enrollment-objectives-0").build();
    HttpPut newENMethod = conn.createPut(newENUri, MediaType.APPLICATION_JSON, true);
    HttpResponse newENCode = conn.execute(newENMethod);
    assertEquals(406, newENCode.getStatusLine().getStatusCode());
    EntityUtils.consume(newENCode.getEntity());
    // create an enrollment node
    newENUri = getElementsUri(course).path("enrollment").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "7").queryParam("shortTitle", "Enrollment-0").queryParam("longTitle", "Enrollment-long-0").queryParam("objectives", "Enrollment-objectives-0").queryParam("groups", group.getKey().toString()).queryParam("cancelEnabled", "true").build();
    newENMethod = conn.createPut(newENUri, MediaType.APPLICATION_JSON, true);
    newENCode = conn.execute(newENMethod);
    assertEquals(200, newENCode.getStatusLine().getStatusCode());
    CourseNodeVO enNode = conn.parse(newENCode, CourseNodeVO.class);
    assertNotNull(enNode);
    assertNotNull(enNode.getId());
    assertEquals(enNode.getShortTitle(), "Enrollment-0");
    assertEquals(enNode.getLongTitle(), "Enrollment-long-0");
    assertEquals(enNode.getLearningObjectives(), "Enrollment-objectives-0");
    assertEquals(enNode.getParentId(), course.getEditorRootNodeId());
    // create a test node
    URL qtiDemoUrl = CoursesElementsTest.class.getResource("qti-demo.zip");
    assertNotNull(qtiDemoUrl);
    File qtiFile = new File(qtiDemoUrl.toURI());
    Assert.assertEquals(7518, qtiFile.length());
    URI repoEntriesUri = UriBuilder.fromUri(getContextURI()).path("repo/entries").build();
    HttpPut qtiRepoMethod = conn.createPut(repoEntriesUri, MediaType.APPLICATION_JSON, true);
    HttpEntity entity = MultipartEntityBuilder.create().setMode(HttpMultipartMode.BROWSER_COMPATIBLE).addBinaryBody("file", qtiFile, ContentType.APPLICATION_OCTET_STREAM, qtiFile.getName()).addTextBody("filename", "qti-demo.zip").addTextBody("resourcename", "QTI demo").addTextBody("displayname", "QTI demo").build();
    qtiRepoMethod.setEntity(entity);
    HttpResponse qtiRepoCode = conn.execute(qtiRepoMethod);
    int qtiHttpCode = qtiRepoCode.getStatusLine().getStatusCode();
    assertTrue(qtiHttpCode == 200 || qtiHttpCode == 201);
    RepositoryEntryVO newTestVO = conn.parse(qtiRepoCode, RepositoryEntryVO.class);
    assertNotNull(newTestVO);
    Long key = newTestVO.getKey();
    RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(key);
    assertNotNull(re);
    assertNotNull(re.getOlatResource());
    assertEquals("QTI demo", re.getDisplayname());
    URI newTestUri = getElementsUri(course).path("test").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "8").queryParam("shortTitle", "Test-0").queryParam("longTitle", "Test-long-0").queryParam("objectives", "Test-objectives-0").queryParam("testResourceableId", key).build();
    HttpPut newTestMethod = conn.createPut(newTestUri, MediaType.APPLICATION_JSON, true);
    HttpResponse newTestCode = conn.execute(newTestMethod);
    assertTrue(newTestCode.getStatusLine().getStatusCode() == 200 || newTestCode.getStatusLine().getStatusCode() == 201);
    CourseNodeVO testNode = conn.parse(newTestCode, CourseNodeVO.class);
    assertNotNull(testNode);
    assertNotNull(testNode.getId());
    assertEquals(testNode.getShortTitle(), "Test-0");
    assertEquals(testNode.getParentId(), course.getEditorRootNodeId());
    // configure test node
    URI testConfigUri = getElementsUri(course).path("test/" + testNode.getId() + "/configuration").queryParam("allowCancel", Boolean.TRUE).queryParam("allowNavigation", Boolean.TRUE).queryParam("allowSuspend", Boolean.TRUE).queryParam("numAttempts", 10).queryParam("sequencePresentation", AssessmentInstance.QMD_ENTRY_SEQUENCE_ITEM).queryParam("showNavigation", Boolean.TRUE).queryParam("showQuestionTitle", Boolean.TRUE).queryParam("showResultsAfterFinish", Boolean.TRUE).queryParam("showResultsDependendOnDate", Boolean.TRUE).queryParam("showResultsOnHomepage", key).queryParam("showScoreInfo", Boolean.TRUE).queryParam("showScoreProgress", Boolean.TRUE).queryParam("showSectionsOnly", Boolean.TRUE).queryParam("summaryPresentation", AssessmentInstance.QMD_ENTRY_SUMMARY_DETAILED).queryParam("startDate", // new Date(1280444400))
    new Long(1280444400)).queryParam("endDate", // new Date(1293667200))
    new Long(1293667200)).build();
    HttpPut testConfigMethod = conn.createPut(testConfigUri, MediaType.APPLICATION_JSON, true);
    HttpResponse testConfigCode = conn.execute(testConfigMethod);
    assertTrue(testConfigCode.getStatusLine().getStatusCode() == 200 || testConfigCode.getStatusLine().getStatusCode() == 201);
    EntityUtils.consume(testConfigCode.getEntity());
    HttpGet getTestConfig = conn.createGet(testConfigUri, MediaType.APPLICATION_JSON, true);
    testConfigCode = conn.execute(getTestConfig);
    assertTrue(testConfigCode.getStatusLine().getStatusCode() == 200 || testConfigCode.getStatusLine().getStatusCode() == 201);
    TestConfigVO testConfig = conn.parse(testConfigCode, TestConfigVO.class);
    assertTrue(testConfig.getNumAttempts() == 10);
    assertTrue(testConfig.getAllowCancel());
    assertTrue(testConfig.getSummeryPresentation().equals(AssessmentInstance.QMD_ENTRY_SUMMARY_DETAILED));
    // create a survey node
    URL newSurveyUrl = CoursesElementsTest.class.getResource("questionnaire-demo.zip");
    assertNotNull(newSurveyUrl);
    File surveyFile = new File(newSurveyUrl.toURI());
    URI repoEntriesUri2 = UriBuilder.fromUri(getContextURI()).path("repo").path("entries").build();
    HttpPut surveyRepoMethod = conn.createPut(repoEntriesUri2, MediaType.APPLICATION_JSON, true);
    HttpEntity surveyEntity = MultipartEntityBuilder.create().setMode(HttpMultipartMode.BROWSER_COMPATIBLE).addBinaryBody("file", surveyFile, ContentType.APPLICATION_OCTET_STREAM, surveyFile.getName()).addTextBody("filename", "questionnaire-demo.zip").addTextBody("resourcename", "Questionnaire demo").addTextBody("displayname", "Questionnaire demo").build();
    surveyRepoMethod.setEntity(surveyEntity);
    HttpResponse surveyRepoCode = conn.execute(surveyRepoMethod);
    assertTrue(surveyRepoCode.getStatusLine().getStatusCode() == 200 || surveyRepoCode.getStatusLine().getStatusCode() == 201);
    RepositoryEntryVO newSurveyVO = conn.parse(surveyRepoCode, RepositoryEntryVO.class);
    assertNotNull(newSurveyVO);
    Long surveyKey = newSurveyVO.getKey();
    RepositoryEntry surveyRE = RepositoryManager.getInstance().lookupRepositoryEntry(surveyKey);
    assertNotNull(surveyRE);
    assertNotNull(surveyRE.getOlatResource());
    assertEquals("Questionnaire demo", surveyRE.getDisplayname());
    URI newSurveyUri = getElementsUri(course).path("survey").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "9").queryParam("shortTitle", "Survey-0").queryParam("longTitle", "Survey-long-0").queryParam("objectives", "Survey-objectives-0").queryParam("surveyResourceableId", surveyKey).build();
    HttpPut newSurveyMethod = conn.createPut(newSurveyUri, MediaType.APPLICATION_JSON, true);
    HttpResponse newSurveyCode = conn.execute(newSurveyMethod);
    assertTrue(newSurveyCode.getStatusLine().getStatusCode() == 200 || newSurveyCode.getStatusLine().getStatusCode() == 201);
    CourseNodeVO surveyNode = conn.parse(newSurveyCode, CourseNodeVO.class);
    assertNotNull(surveyNode);
    assertNotNull(surveyNode.getId());
    assertEquals(surveyNode.getShortTitle(), "Survey-0");
    assertEquals(surveyNode.getParentId(), course.getEditorRootNodeId());
    // configure survey node
    URI surveykConfigUri = getElementsUri(course).path("survey/" + surveyNode.getId() + "/configuration").queryParam("allowCancel", Boolean.TRUE).queryParam("allowNavigation", Boolean.TRUE).queryParam("allowSuspend", Boolean.TRUE).queryParam("sequencePresentation", AssessmentInstance.QMD_ENTRY_SEQUENCE_ITEM).queryParam("showNavigation", Boolean.TRUE).queryParam("showQuestionTitle", Boolean.TRUE).queryParam("showSectionsOnly", Boolean.TRUE).build();
    HttpPut surveyConfigMethod = conn.createPut(surveykConfigUri, MediaType.APPLICATION_JSON, true);
    HttpResponse surveyConfigCode = conn.execute(surveyConfigMethod);
    assertTrue(surveyConfigCode.getStatusLine().getStatusCode() == 200 || surveyConfigCode.getStatusLine().getStatusCode() == 201);
    EntityUtils.consume(surveyConfigCode.getEntity());
    HttpGet getSurveyConfig = conn.createGet(surveykConfigUri, MediaType.APPLICATION_JSON, true);
    surveyConfigCode = conn.execute(getSurveyConfig);
    assertTrue(surveyConfigCode.getStatusLine().getStatusCode() == 200 || surveyConfigCode.getStatusLine().getStatusCode() == 201);
    SurveyConfigVO surveyConfig = conn.parse(surveyConfigCode, SurveyConfigVO.class);
    assertNotNull(surveyConfig);
    assertTrue(surveyConfig.getAllowCancel());
    // create an external page node
    URI newTUUri = getElementsUri(course).path("externalpage").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "10").queryParam("shortTitle", "ExternalPage-0").queryParam("longTitle", "ExternalPage-long-0").queryParam("objectives", "ExternalPage-objectives-0").queryParam("url", "http://www.olat.org").build();
    HttpPut newTUMethod = conn.createPut(newTUUri, MediaType.APPLICATION_JSON, true);
    HttpResponse newTUCode = conn.execute(newTUMethod);
    assertEquals(200, newTUCode.getStatusLine().getStatusCode());
    CourseNodeVO tuNode = conn.parse(newTUCode, CourseNodeVO.class);
    assertNotNull(tuNode);
    assertNotNull(tuNode.getId());
    assertEquals(tuNode.getShortTitle(), "ExternalPage-0");
    assertEquals(tuNode.getLongTitle(), "ExternalPage-long-0");
    assertEquals(tuNode.getLearningObjectives(), "ExternalPage-objectives-0");
    assertEquals(tuNode.getParentId(), course.getEditorRootNodeId());
    // summary check
    ICourse realCourse = CourseFactory.loadCourse(course.getKey());
    TreeNode realRoot = realCourse.getEditorTreeModel().getRootNode();
    assertEquals(11, realRoot.getChildCount());
    // structure
    CourseEditorTreeNode child = (CourseEditorTreeNode) realRoot.getChildAt(0);
    CourseNode childNode = child.getCourseNode();
    assertTrue(childNode instanceof STCourseNode);
    // single page
    child = (CourseEditorTreeNode) realRoot.getChildAt(1);
    childNode = child.getCourseNode();
    assertTrue(childNode instanceof SPCourseNode);
    // folder
    child = (CourseEditorTreeNode) realRoot.getChildAt(2);
    childNode = child.getCourseNode();
    assertTrue(childNode instanceof BCCourseNode);
    // forum
    child = (CourseEditorTreeNode) realRoot.getChildAt(3);
    childNode = child.getCourseNode();
    assertTrue(childNode instanceof FOCourseNode);
    // task
    child = (CourseEditorTreeNode) realRoot.getChildAt(4);
    childNode = child.getCourseNode();
    assertTrue(childNode instanceof TACourseNode);
    // assessment
    child = (CourseEditorTreeNode) realRoot.getChildAt(5);
    childNode = child.getCourseNode();
    assertTrue(childNode instanceof MSCourseNode);
    // contact
    child = (CourseEditorTreeNode) realRoot.getChildAt(6);
    childNode = child.getCourseNode();
    assertTrue(childNode instanceof COCourseNode);
    // enrollment
    child = (CourseEditorTreeNode) realRoot.getChildAt(7);
    childNode = child.getCourseNode();
    assertTrue(childNode instanceof ENCourseNode);
    // test
    child = (CourseEditorTreeNode) realRoot.getChildAt(8);
    childNode = child.getCourseNode();
    assertTrue(childNode instanceof IQTESTCourseNode);
    // survey
    child = (CourseEditorTreeNode) realRoot.getChildAt(9);
    childNode = child.getCourseNode();
    assertTrue(childNode instanceof IQSURVCourseNode);
    // external page
    child = (CourseEditorTreeNode) realRoot.getChildAt(10);
    childNode = child.getCourseNode();
    assertTrue(childNode instanceof TUCourseNode);
    // attach file to task
    child = (CourseEditorTreeNode) realRoot.getChildAt(4);
    childNode = child.getCourseNode();
    URI attachTaskFileUri = getElementsUri(course).path("task").path(childNode.getIdent()).path("file").queryParam("filename", "singlepage.html").build();
    HttpPut taskFileMethod = conn.createPut(attachTaskFileUri, MediaType.APPLICATION_JSON, true);
    conn.addMultipart(taskFileMethod, page.getName(), page);
    HttpResponse taskFileCode = conn.execute(taskFileMethod);
    assertEquals(200, taskFileCode.getStatusLine().getStatusCode());
    String taskFolderPath = TACourseNode.getTaskFolderPathRelToFolderRoot(realCourse, childNode);
    OlatRootFolderImpl taskFolder = new OlatRootFolderImpl(taskFolderPath, null);
    VFSLeaf singleFile = (VFSLeaf) taskFolder.resolve("/" + "singlepage.html");
    assertNotNull(singleFile);
}
Also used : HttpEntity(org.apache.http.HttpEntity) IQSURVCourseNode(org.olat.course.nodes.IQSURVCourseNode) CourseNodeVO(org.olat.restapi.support.vo.CourseNodeVO) TestConfigVO(org.olat.restapi.support.vo.elements.TestConfigVO) HttpGet(org.apache.http.client.methods.HttpGet) CourseEditorTreeNode(org.olat.course.tree.CourseEditorTreeNode) ICourse(org.olat.course.ICourse) FOCourseNode(org.olat.course.nodes.FOCourseNode) RepositoryEntry(org.olat.repository.RepositoryEntry) URI(java.net.URI) HttpPut(org.apache.http.client.methods.HttpPut) URL(java.net.URL) TaskConfigVO(org.olat.restapi.support.vo.elements.TaskConfigVO) ENCourseNode(org.olat.course.nodes.ENCourseNode) CourseVO(org.olat.restapi.support.vo.CourseVO) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) TreeNode(org.olat.core.gui.components.tree.TreeNode) CourseEditorTreeNode(org.olat.course.tree.CourseEditorTreeNode) STCourseNode(org.olat.course.nodes.STCourseNode) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) MSCourseNode(org.olat.course.nodes.MSCourseNode) FOCourseNode(org.olat.course.nodes.FOCourseNode) ENCourseNode(org.olat.course.nodes.ENCourseNode) CourseNode(org.olat.course.nodes.CourseNode) COCourseNode(org.olat.course.nodes.COCourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) STCourseNode(org.olat.course.nodes.STCourseNode) MSCourseNode(org.olat.course.nodes.MSCourseNode) BCCourseNode(org.olat.course.nodes.BCCourseNode) SPCourseNode(org.olat.course.nodes.SPCourseNode) IQSURVCourseNode(org.olat.course.nodes.IQSURVCourseNode) TUCourseNode(org.olat.course.nodes.TUCourseNode) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) COCourseNode(org.olat.course.nodes.COCourseNode) TUCourseNode(org.olat.course.nodes.TUCourseNode) VFSLeaf(org.olat.core.util.vfs.VFSLeaf) HttpResponse(org.apache.http.HttpResponse) TACourseNode(org.olat.course.nodes.TACourseNode) SPCourseNode(org.olat.course.nodes.SPCourseNode) GroupVO(org.olat.restapi.support.vo.GroupVO) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) RepositoryEntryVO(org.olat.restapi.support.vo.RepositoryEntryVO) BCCourseNode(org.olat.course.nodes.BCCourseNode) File(java.io.File) SurveyConfigVO(org.olat.restapi.support.vo.elements.SurveyConfigVO) Test(org.junit.Test)

Example 2 with TaskConfigVO

use of org.olat.restapi.support.vo.elements.TaskConfigVO in project OpenOLAT by OpenOLAT.

the class CourseElementWebService method getTaskConfiguration.

/**
 * Retrieves configuration of the task course node
 * @response.representation.200.qname {http://www.example.com}surveyConfigVO
 * @response.representation.200.mediaType application/xml, application/json
 * @response.representation.200.doc The course node configuration
 * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO}
 * @response.representation.401.doc The roles of the authenticated user are not sufficient
 * @response.representation.404.doc The course or task node not found
 * @param courseId
 * @param nodeId
 * @return the task course node configuration
 */
@GET
@Path("task/{nodeId}/configuration")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getTaskConfiguration(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @Context HttpServletRequest httpRequest) {
    if (!isAuthor(httpRequest)) {
        return Response.serverError().status(Status.UNAUTHORIZED).build();
    }
    TaskConfigVO config = new TaskConfigVO();
    ICourse course = CoursesWebService.loadCourse(courseId);
    CourseNode courseNode = getParentNode(course, nodeId);
    ModuleConfiguration moduleConfig = courseNode.getModuleConfiguration();
    // build configuration with fallback to default values
    Boolean isAssignmentEnabled = (Boolean) moduleConfig.get(TACourseNode.CONF_TASK_ENABLED);
    config.setIsAssignmentEnabled(isAssignmentEnabled == null ? Boolean.TRUE : isAssignmentEnabled);
    String taskAssignmentType = moduleConfig.getStringValue(TACourseNode.CONF_TASK_TYPE);
    config.setTaskAssignmentType(taskAssignmentType == null ? TaskController.TYPE_MANUAL : taskAssignmentType);
    String taskAssignmentText = moduleConfig.getStringValue(TACourseNode.CONF_TASK_TEXT);
    config.setTaskAssignmentText(taskAssignmentText == null ? "" : taskAssignmentText);
    Boolean isTaskPreviewEnabled = moduleConfig.get(TACourseNode.CONF_TASK_PREVIEW) == null ? Boolean.FALSE : moduleConfig.getBooleanEntry(TACourseNode.CONF_TASK_PREVIEW);
    config.setIsTaskPreviewEnabled(isTaskPreviewEnabled);
    Boolean isTaskDeselectEnabled = moduleConfig.getBooleanEntry(TACourseNode.CONF_TASK_DESELECT);
    config.setIsTaskDeselectEnabled(isTaskDeselectEnabled == null ? Boolean.FALSE : isTaskDeselectEnabled);
    Boolean onlyOneUserPerTask = (Boolean) moduleConfig.get(TACourseNode.CONF_TASK_SAMPLING_WITH_REPLACEMENT);
    config.setOnlyOneUserPerTask(onlyOneUserPerTask == null ? Boolean.TRUE : onlyOneUserPerTask);
    Boolean isDropboxEnabled = (Boolean) moduleConfig.get(TACourseNode.CONF_DROPBOX_ENABLED);
    config.setIsDropboxEnabled(isDropboxEnabled == null ? Boolean.TRUE : isDropboxEnabled);
    Boolean isDropboxConfirmationMailEnabled = (Boolean) moduleConfig.get(TACourseNode.CONF_DROPBOX_ENABLEMAIL);
    config.setIsDropboxConfirmationMailEnabled(isDropboxConfirmationMailEnabled == null ? Boolean.FALSE : isDropboxConfirmationMailEnabled);
    String dropboxConfirmationText = moduleConfig.getStringValue(TACourseNode.CONF_DROPBOX_CONFIRMATION);
    config.setDropboxConfirmationText(dropboxConfirmationText == null ? "" : dropboxConfirmationText);
    Boolean isReturnboxEnabled = (Boolean) moduleConfig.get(TACourseNode.CONF_RETURNBOX_ENABLED);
    config.setIsReturnboxEnabled(isReturnboxEnabled == null ? Boolean.TRUE : isReturnboxEnabled);
    Boolean isScoringEnabled = (Boolean) moduleConfig.get(TACourseNode.CONF_SCORING_ENABLED);
    config.setIsScoringEnabled(isScoringEnabled == null ? Boolean.TRUE : isScoringEnabled);
    Boolean isScoringGranted = (Boolean) moduleConfig.get(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD);
    config.setIsScoringGranted(isScoringGranted == null ? Boolean.FALSE : isScoringGranted);
    Float minScore = (Float) moduleConfig.get(MSCourseNode.CONFIG_KEY_SCORE_MIN);
    config.setMinScore(minScore);
    Float maxScore = (Float) moduleConfig.get(MSCourseNode.CONFIG_KEY_SCORE_MAX);
    config.setMaxScore(maxScore);
    Boolean isPassingGranted = (Boolean) moduleConfig.get(MSCourseNode.CONFIG_KEY_HAS_PASSED_FIELD);
    config.setIsPassingGranted(isPassingGranted == null ? Boolean.FALSE : isPassingGranted);
    Float passingScoreThreshold = (Float) moduleConfig.get(MSCourseNode.CONFIG_KEY_PASSED_CUT_VALUE);
    config.setPassingScoreThreshold(passingScoreThreshold);
    Boolean hasCommentField = (Boolean) moduleConfig.get(MSCourseNode.CONFIG_KEY_HAS_COMMENT_FIELD);
    config.setHasCommentField(hasCommentField == null ? Boolean.FALSE : hasCommentField);
    String commentForUser = moduleConfig.getStringValue(MSCourseNode.CONFIG_KEY_INFOTEXT_USER);
    config.setCommentForUser(commentForUser == null ? "" : commentForUser);
    String commentForCoaches = moduleConfig.getStringValue(MSCourseNode.CONFIG_KEY_INFOTEXT_COACH);
    config.setCommentForCoaches(commentForCoaches == null ? "" : commentForCoaches);
    Boolean isSolutionEnabled = (Boolean) moduleConfig.get(TACourseNode.CONF_SOLUTION_ENABLED);
    config.setIsSolutionEnabled(isSolutionEnabled == null ? Boolean.TRUE : isSolutionEnabled);
    // get the conditions
    List<ConditionExpression> lstConditions = courseNode.getConditionExpressions();
    for (ConditionExpression cond : lstConditions) {
        String id = cond.getId();
        String expression = cond.getExptressionString();
        if (id.equals(TACourseNode.ACCESS_TASK))
            config.setConditionTask(expression);
        else if (// TACourseNode uses "drop" instead the static ACCESS_DROPBOX, very bad!
        id.equals("drop"))
            config.setConditionDropbox(expression);
        else if (id.equals(TACourseNode.ACCESS_RETURNBOX))
            config.setConditionReturnbox(expression);
        else if (id.equals(TACourseNode.ACCESS_SCORING))
            config.setConditionScoring(expression);
        else if (id.equals(TACourseNode.ACCESS_SOLUTION))
            config.setConditionSolution(expression);
    }
    return Response.ok(config).build();
}
Also used : TaskConfigVO(org.olat.restapi.support.vo.elements.TaskConfigVO) ModuleConfiguration(org.olat.modules.ModuleConfiguration) ConditionExpression(org.olat.course.condition.interpreter.ConditionExpression) ICourse(org.olat.course.ICourse) CourseNode(org.olat.course.nodes.CourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) STCourseNode(org.olat.course.nodes.STCourseNode) MSCourseNode(org.olat.course.nodes.MSCourseNode) AbstractFeedCourseNode(org.olat.course.nodes.AbstractFeedCourseNode) IQSURVCourseNode(org.olat.course.nodes.IQSURVCourseNode) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 3 with TaskConfigVO

use of org.olat.restapi.support.vo.elements.TaskConfigVO in project openolat by klemens.

the class CoursesElementsTest method testCreateCoursePut.

@Test
public void testCreateCoursePut() throws IOException, URISyntaxException {
    assertTrue(conn.login("administrator", "openolat"));
    // create an empty course
    URI uri = getCoursesUri().queryParam("shortTitle", "course3").queryParam("title", "course3 long name").build();
    HttpPut method = conn.createPut(uri, MediaType.APPLICATION_JSON, true);
    HttpResponse response = conn.execute(method);
    assertEquals(200, response.getStatusLine().getStatusCode());
    CourseVO course = conn.parse(response, CourseVO.class);
    assertNotNull(course);
    assertNotNull(course.getKey());
    assertNotNull(course.getEditorRootNodeId());
    try {
        ICourse savedCourse = CourseFactory.loadCourse(course.getKey());
        assertNotNull(savedCourse);
    } catch (Exception e) {
        assertTrue(false);
    }
    // create a learning group
    GroupVO groupVo = new GroupVO();
    groupVo.setName("hello");
    groupVo.setDescription("hello description");
    groupVo.setMinParticipants(new Integer(-1));
    groupVo.setMaxParticipants(new Integer(-1));
    URI newGroupUri = getCoursesUri().path(course.getKey().toString()).path("groups").build();
    HttpPut newGrpMethod = conn.createPut(newGroupUri, MediaType.APPLICATION_JSON, true);
    conn.addJsonEntity(newGrpMethod, groupVo);
    HttpResponse newGrpCode = conn.execute(newGrpMethod);
    assertEquals(200, newGrpCode.getStatusLine().getStatusCode());
    GroupVO group = conn.parse(newGrpCode, GroupVO.class);
    assertNotNull(group);
    assertNotNull(group.getKey());
    // create an structure node
    URI newStructureUri = getElementsUri(course).path("structure").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "0").queryParam("shortTitle", "Structure-0").queryParam("longTitle", "Structure-long-0").queryParam("objectives", "Structure-objectives-0").build();
    HttpPut newStructureMethod = conn.createPut(newStructureUri, MediaType.APPLICATION_JSON, true);
    HttpResponse newStructureCode = conn.execute(newStructureMethod);
    assertTrue(newStructureCode.getStatusLine().getStatusCode() == 200 || newStructureCode.getStatusLine().getStatusCode() == 201);
    CourseNodeVO structureNode = conn.parse(newStructureCode, CourseNodeVO.class);
    assertNotNull(structureNode);
    assertNotNull(structureNode.getId());
    assertEquals(structureNode.getShortTitle(), "Structure-0");
    assertEquals(structureNode.getLongTitle(), "Structure-long-0");
    assertEquals(structureNode.getLearningObjectives(), "Structure-objectives-0");
    assertEquals(structureNode.getParentId(), course.getEditorRootNodeId());
    // create single page
    URL pageUrl = CoursesElementsTest.class.getResource("singlepage.html");
    assertNotNull(pageUrl);
    File page = new File(pageUrl.toURI());
    URI newPageUri = getElementsUri(course).path("singlepage").build();
    HttpPut newPageMethod = conn.createPut(newPageUri, MediaType.APPLICATION_JSON, true);
    HttpEntity newPageEntity = MultipartEntityBuilder.create().setMode(HttpMultipartMode.BROWSER_COMPATIBLE).addBinaryBody("file", page, ContentType.APPLICATION_OCTET_STREAM, page.getName()).addTextBody("filename", page.getName()).addTextBody("parentNodeId", course.getEditorRootNodeId()).addTextBody("position", "1").addTextBody("shortTitle", "Single-Page-0").addTextBody("longTitle", "Single-Page-long-0").addTextBody("objectives", "Single-Page-objectives-0").build();
    newPageMethod.setEntity(newPageEntity);
    HttpResponse newPageCode = conn.execute(newPageMethod);
    assertTrue(newPageCode.getStatusLine().getStatusCode() == 200 || newPageCode.getStatusLine().getStatusCode() == 201);
    CourseNodeVO pageNode = conn.parse(newPageCode, CourseNodeVO.class);
    assertNotNull(pageNode);
    assertNotNull(pageNode.getId());
    assertEquals(pageNode.getShortTitle(), "Single-Page-0");
    assertEquals(pageNode.getLongTitle(), "Single-Page-long-0");
    assertEquals(pageNode.getLearningObjectives(), "Single-Page-objectives-0");
    assertEquals(structureNode.getParentId(), course.getEditorRootNodeId());
    // create a folder node
    URI newFolderUri = getElementsUri(course).path("folder").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "2").queryParam("shortTitle", "Folder-0").queryParam("longTitle", "Folder-long-0").queryParam("objectives", "Folder-objectives-0").build();
    HttpPut newFolderMethod = conn.createPut(newFolderUri, MediaType.APPLICATION_JSON, true);
    HttpResponse newFolderCode = conn.execute(newFolderMethod);
    assertTrue(newFolderCode.getStatusLine().getStatusCode() == 200 || newFolderCode.getStatusLine().getStatusCode() == 201);
    CourseNodeVO folderNode = conn.parse(newFolderCode, CourseNodeVO.class);
    assertNotNull(folderNode);
    assertNotNull(folderNode.getId());
    assertEquals(folderNode.getShortTitle(), "Folder-0");
    assertEquals(folderNode.getLongTitle(), "Folder-long-0");
    assertEquals(folderNode.getLearningObjectives(), "Folder-objectives-0");
    assertEquals(folderNode.getParentId(), course.getEditorRootNodeId());
    // create a forum node
    URI newForumUri = getElementsUri(course).path("forum").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "3").queryParam("shortTitle", "Forum-0").queryParam("longTitle", "Forum-long-0").queryParam("objectives", "Forum-objectives-0").build();
    HttpPut newForumMethod = conn.createPut(newForumUri, MediaType.APPLICATION_JSON, true);
    HttpResponse newForumCode = conn.execute(newForumMethod);
    assertTrue(newForumCode.getStatusLine().getStatusCode() == 200 || newForumCode.getStatusLine().getStatusCode() == 201);
    CourseNodeVO forumNode = conn.parse(newForumCode, CourseNodeVO.class);
    assertNotNull(forumNode);
    assertNotNull(forumNode.getId());
    assertEquals(forumNode.getShortTitle(), "Forum-0");
    assertEquals(forumNode.getLongTitle(), "Forum-long-0");
    assertEquals(forumNode.getLearningObjectives(), "Forum-objectives-0");
    assertEquals(forumNode.getParentId(), course.getEditorRootNodeId());
    // create a task node
    URI newTaskUri = getElementsUri(course).path("task").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "4").queryParam("shortTitle", "Task-0").queryParam("longTitle", "Task-long-0").queryParam("objectives", "Task-objectives-0").queryParam("points", "25").queryParam("text", "A very difficult test").build();
    HttpPut newTaskMethod = conn.createPut(newTaskUri, MediaType.APPLICATION_JSON, true);
    HttpResponse newTaskCode = conn.execute(newTaskMethod);
    assertTrue(newTaskCode.getStatusLine().getStatusCode() == 200 || newTaskCode.getStatusLine().getStatusCode() == 201);
    CourseNodeVO taskNode = conn.parse(newTaskCode, CourseNodeVO.class);
    assertNotNull(taskNode);
    assertNotNull(taskNode.getId());
    assertEquals(taskNode.getShortTitle(), "Task-0");
    assertEquals(taskNode.getLongTitle(), "Task-long-0");
    assertEquals(taskNode.getLearningObjectives(), "Task-objectives-0");
    assertEquals(taskNode.getParentId(), course.getEditorRootNodeId());
    // add task configuration
    URI taskConfigUri = getElementsUri(course).path("task/" + taskNode.getId() + "/configuration").queryParam("enableAssignment", Boolean.FALSE).queryParam("enableScoring", Boolean.TRUE).queryParam("grantScoring", Boolean.TRUE).queryParam("scoreMin", new Float(1.5)).queryParam("scoreMax", 10).build();
    HttpPut taskConfigMethod = conn.createPut(taskConfigUri, MediaType.APPLICATION_JSON, true);
    HttpResponse taskConfigCode = conn.execute(taskConfigMethod);
    assertTrue(taskConfigCode.getStatusLine().getStatusCode() == 200 || taskConfigCode.getStatusLine().getStatusCode() == 201);
    EntityUtils.consume(taskConfigCode.getEntity());
    HttpGet getTaskConfig = conn.createGet(taskConfigUri, MediaType.APPLICATION_JSON, true);
    taskConfigCode = conn.execute(getTaskConfig);
    assertTrue(taskConfigCode.getStatusLine().getStatusCode() == 200 || taskConfigCode.getStatusLine().getStatusCode() == 201);
    TaskConfigVO taskConfig = conn.parse(taskConfigCode, TaskConfigVO.class);
    assertNotNull(taskConfig);
    // default is true
    assertTrue(!taskConfig.getIsAssignmentEnabled());
    assertTrue(taskConfig.getIsScoringEnabled() & taskConfig.getIsScoringGranted());
    assertTrue(taskConfig.getMinScore().floatValue() == 1.5);
    assertTrue(taskConfig.getMaxScore().floatValue() == 10);
    // create an assessment node
    URI newAssessmentUri = getElementsUri(course).path("assessment").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "5").queryParam("shortTitle", "Assessment-0").queryParam("longTitle", "Assessment-long-0").queryParam("objectives", "Assessment-objectives-0").build();
    HttpPut newAssessmentMethod = conn.createPut(newAssessmentUri, MediaType.APPLICATION_JSON, true);
    HttpResponse newAssessmentCode = conn.execute(newAssessmentMethod);
    assertTrue(newAssessmentCode.getStatusLine().getStatusCode() == 200 || newAssessmentCode.getStatusLine().getStatusCode() == 201);
    CourseNodeVO assessmentNode = conn.parse(newAssessmentCode, CourseNodeVO.class);
    assertNotNull(assessmentNode);
    assertNotNull(assessmentNode.getId());
    assertEquals(assessmentNode.getShortTitle(), "Assessment-0");
    assertEquals(assessmentNode.getLongTitle(), "Assessment-long-0");
    assertEquals(assessmentNode.getLearningObjectives(), "Assessment-objectives-0");
    assertEquals(assessmentNode.getParentId(), course.getEditorRootNodeId());
    // create an contact node
    URI newContactUri = getElementsUri(course).path("contact").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "6").queryParam("shortTitle", "Contact-0").queryParam("longTitle", "Contact-long-0").queryParam("objectives", "Contact-objectives-0").build();
    HttpPut newContactMethod = conn.createPut(newContactUri, MediaType.APPLICATION_JSON, true);
    HttpResponse newContactCode = conn.execute(newContactMethod);
    assertEquals(200, newContactCode.getStatusLine().getStatusCode());
    CourseNodeVO contactNode = conn.parse(newContactCode, CourseNodeVO.class);
    assertNotNull(contactNode);
    assertNotNull(contactNode.getId());
    assertEquals(contactNode.getShortTitle(), "Contact-0");
    assertEquals(contactNode.getLongTitle(), "Contact-long-0");
    assertEquals(contactNode.getLearningObjectives(), "Contact-objectives-0");
    assertEquals(contactNode.getParentId(), course.getEditorRootNodeId());
    // try to create an invalid enrollment node
    URI newENUri = getElementsUri(course).path("enrollment").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "7").queryParam("shortTitle", "Enrollment-0").queryParam("longTitle", "Enrollment-long-0").queryParam("objectives", "Enrollment-objectives-0").build();
    HttpPut newENMethod = conn.createPut(newENUri, MediaType.APPLICATION_JSON, true);
    HttpResponse newENCode = conn.execute(newENMethod);
    assertEquals(406, newENCode.getStatusLine().getStatusCode());
    EntityUtils.consume(newENCode.getEntity());
    // create an enrollment node
    newENUri = getElementsUri(course).path("enrollment").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "7").queryParam("shortTitle", "Enrollment-0").queryParam("longTitle", "Enrollment-long-0").queryParam("objectives", "Enrollment-objectives-0").queryParam("groups", group.getKey().toString()).queryParam("cancelEnabled", "true").build();
    newENMethod = conn.createPut(newENUri, MediaType.APPLICATION_JSON, true);
    newENCode = conn.execute(newENMethod);
    assertEquals(200, newENCode.getStatusLine().getStatusCode());
    CourseNodeVO enNode = conn.parse(newENCode, CourseNodeVO.class);
    assertNotNull(enNode);
    assertNotNull(enNode.getId());
    assertEquals(enNode.getShortTitle(), "Enrollment-0");
    assertEquals(enNode.getLongTitle(), "Enrollment-long-0");
    assertEquals(enNode.getLearningObjectives(), "Enrollment-objectives-0");
    assertEquals(enNode.getParentId(), course.getEditorRootNodeId());
    // create a test node
    URL qtiDemoUrl = CoursesElementsTest.class.getResource("qti-demo.zip");
    assertNotNull(qtiDemoUrl);
    File qtiFile = new File(qtiDemoUrl.toURI());
    Assert.assertEquals(7518, qtiFile.length());
    URI repoEntriesUri = UriBuilder.fromUri(getContextURI()).path("repo/entries").build();
    HttpPut qtiRepoMethod = conn.createPut(repoEntriesUri, MediaType.APPLICATION_JSON, true);
    HttpEntity entity = MultipartEntityBuilder.create().setMode(HttpMultipartMode.BROWSER_COMPATIBLE).addBinaryBody("file", qtiFile, ContentType.APPLICATION_OCTET_STREAM, qtiFile.getName()).addTextBody("filename", "qti-demo.zip").addTextBody("resourcename", "QTI demo").addTextBody("displayname", "QTI demo").build();
    qtiRepoMethod.setEntity(entity);
    HttpResponse qtiRepoCode = conn.execute(qtiRepoMethod);
    int qtiHttpCode = qtiRepoCode.getStatusLine().getStatusCode();
    assertTrue(qtiHttpCode == 200 || qtiHttpCode == 201);
    RepositoryEntryVO newTestVO = conn.parse(qtiRepoCode, RepositoryEntryVO.class);
    assertNotNull(newTestVO);
    Long key = newTestVO.getKey();
    RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(key);
    assertNotNull(re);
    assertNotNull(re.getOlatResource());
    assertEquals("QTI demo", re.getDisplayname());
    URI newTestUri = getElementsUri(course).path("test").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "8").queryParam("shortTitle", "Test-0").queryParam("longTitle", "Test-long-0").queryParam("objectives", "Test-objectives-0").queryParam("testResourceableId", key).build();
    HttpPut newTestMethod = conn.createPut(newTestUri, MediaType.APPLICATION_JSON, true);
    HttpResponse newTestCode = conn.execute(newTestMethod);
    assertTrue(newTestCode.getStatusLine().getStatusCode() == 200 || newTestCode.getStatusLine().getStatusCode() == 201);
    CourseNodeVO testNode = conn.parse(newTestCode, CourseNodeVO.class);
    assertNotNull(testNode);
    assertNotNull(testNode.getId());
    assertEquals(testNode.getShortTitle(), "Test-0");
    assertEquals(testNode.getParentId(), course.getEditorRootNodeId());
    // configure test node
    URI testConfigUri = getElementsUri(course).path("test/" + testNode.getId() + "/configuration").queryParam("allowCancel", Boolean.TRUE).queryParam("allowNavigation", Boolean.TRUE).queryParam("allowSuspend", Boolean.TRUE).queryParam("numAttempts", 10).queryParam("sequencePresentation", AssessmentInstance.QMD_ENTRY_SEQUENCE_ITEM).queryParam("showNavigation", Boolean.TRUE).queryParam("showQuestionTitle", Boolean.TRUE).queryParam("showResultsAfterFinish", Boolean.TRUE).queryParam("showResultsDependendOnDate", Boolean.TRUE).queryParam("showResultsOnHomepage", key).queryParam("showScoreInfo", Boolean.TRUE).queryParam("showScoreProgress", Boolean.TRUE).queryParam("showSectionsOnly", Boolean.TRUE).queryParam("summaryPresentation", AssessmentInstance.QMD_ENTRY_SUMMARY_DETAILED).queryParam("startDate", // new Date(1280444400))
    new Long(1280444400)).queryParam("endDate", // new Date(1293667200))
    new Long(1293667200)).build();
    HttpPut testConfigMethod = conn.createPut(testConfigUri, MediaType.APPLICATION_JSON, true);
    HttpResponse testConfigCode = conn.execute(testConfigMethod);
    assertTrue(testConfigCode.getStatusLine().getStatusCode() == 200 || testConfigCode.getStatusLine().getStatusCode() == 201);
    EntityUtils.consume(testConfigCode.getEntity());
    HttpGet getTestConfig = conn.createGet(testConfigUri, MediaType.APPLICATION_JSON, true);
    testConfigCode = conn.execute(getTestConfig);
    assertTrue(testConfigCode.getStatusLine().getStatusCode() == 200 || testConfigCode.getStatusLine().getStatusCode() == 201);
    TestConfigVO testConfig = conn.parse(testConfigCode, TestConfigVO.class);
    assertTrue(testConfig.getNumAttempts() == 10);
    assertTrue(testConfig.getAllowCancel());
    assertTrue(testConfig.getSummeryPresentation().equals(AssessmentInstance.QMD_ENTRY_SUMMARY_DETAILED));
    // create a survey node
    URL newSurveyUrl = CoursesElementsTest.class.getResource("questionnaire-demo.zip");
    assertNotNull(newSurveyUrl);
    File surveyFile = new File(newSurveyUrl.toURI());
    URI repoEntriesUri2 = UriBuilder.fromUri(getContextURI()).path("repo").path("entries").build();
    HttpPut surveyRepoMethod = conn.createPut(repoEntriesUri2, MediaType.APPLICATION_JSON, true);
    HttpEntity surveyEntity = MultipartEntityBuilder.create().setMode(HttpMultipartMode.BROWSER_COMPATIBLE).addBinaryBody("file", surveyFile, ContentType.APPLICATION_OCTET_STREAM, surveyFile.getName()).addTextBody("filename", "questionnaire-demo.zip").addTextBody("resourcename", "Questionnaire demo").addTextBody("displayname", "Questionnaire demo").build();
    surveyRepoMethod.setEntity(surveyEntity);
    HttpResponse surveyRepoCode = conn.execute(surveyRepoMethod);
    assertTrue(surveyRepoCode.getStatusLine().getStatusCode() == 200 || surveyRepoCode.getStatusLine().getStatusCode() == 201);
    RepositoryEntryVO newSurveyVO = conn.parse(surveyRepoCode, RepositoryEntryVO.class);
    assertNotNull(newSurveyVO);
    Long surveyKey = newSurveyVO.getKey();
    RepositoryEntry surveyRE = RepositoryManager.getInstance().lookupRepositoryEntry(surveyKey);
    assertNotNull(surveyRE);
    assertNotNull(surveyRE.getOlatResource());
    assertEquals("Questionnaire demo", surveyRE.getDisplayname());
    URI newSurveyUri = getElementsUri(course).path("survey").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "9").queryParam("shortTitle", "Survey-0").queryParam("longTitle", "Survey-long-0").queryParam("objectives", "Survey-objectives-0").queryParam("surveyResourceableId", surveyKey).build();
    HttpPut newSurveyMethod = conn.createPut(newSurveyUri, MediaType.APPLICATION_JSON, true);
    HttpResponse newSurveyCode = conn.execute(newSurveyMethod);
    assertTrue(newSurveyCode.getStatusLine().getStatusCode() == 200 || newSurveyCode.getStatusLine().getStatusCode() == 201);
    CourseNodeVO surveyNode = conn.parse(newSurveyCode, CourseNodeVO.class);
    assertNotNull(surveyNode);
    assertNotNull(surveyNode.getId());
    assertEquals(surveyNode.getShortTitle(), "Survey-0");
    assertEquals(surveyNode.getParentId(), course.getEditorRootNodeId());
    // configure survey node
    URI surveykConfigUri = getElementsUri(course).path("survey/" + surveyNode.getId() + "/configuration").queryParam("allowCancel", Boolean.TRUE).queryParam("allowNavigation", Boolean.TRUE).queryParam("allowSuspend", Boolean.TRUE).queryParam("sequencePresentation", AssessmentInstance.QMD_ENTRY_SEQUENCE_ITEM).queryParam("showNavigation", Boolean.TRUE).queryParam("showQuestionTitle", Boolean.TRUE).queryParam("showSectionsOnly", Boolean.TRUE).build();
    HttpPut surveyConfigMethod = conn.createPut(surveykConfigUri, MediaType.APPLICATION_JSON, true);
    HttpResponse surveyConfigCode = conn.execute(surveyConfigMethod);
    assertTrue(surveyConfigCode.getStatusLine().getStatusCode() == 200 || surveyConfigCode.getStatusLine().getStatusCode() == 201);
    EntityUtils.consume(surveyConfigCode.getEntity());
    HttpGet getSurveyConfig = conn.createGet(surveykConfigUri, MediaType.APPLICATION_JSON, true);
    surveyConfigCode = conn.execute(getSurveyConfig);
    assertTrue(surveyConfigCode.getStatusLine().getStatusCode() == 200 || surveyConfigCode.getStatusLine().getStatusCode() == 201);
    SurveyConfigVO surveyConfig = conn.parse(surveyConfigCode, SurveyConfigVO.class);
    assertNotNull(surveyConfig);
    assertTrue(surveyConfig.getAllowCancel());
    // create an external page node
    URI newTUUri = getElementsUri(course).path("externalpage").queryParam("parentNodeId", course.getEditorRootNodeId()).queryParam("position", "10").queryParam("shortTitle", "ExternalPage-0").queryParam("longTitle", "ExternalPage-long-0").queryParam("objectives", "ExternalPage-objectives-0").queryParam("url", "http://www.olat.org").build();
    HttpPut newTUMethod = conn.createPut(newTUUri, MediaType.APPLICATION_JSON, true);
    HttpResponse newTUCode = conn.execute(newTUMethod);
    assertEquals(200, newTUCode.getStatusLine().getStatusCode());
    CourseNodeVO tuNode = conn.parse(newTUCode, CourseNodeVO.class);
    assertNotNull(tuNode);
    assertNotNull(tuNode.getId());
    assertEquals(tuNode.getShortTitle(), "ExternalPage-0");
    assertEquals(tuNode.getLongTitle(), "ExternalPage-long-0");
    assertEquals(tuNode.getLearningObjectives(), "ExternalPage-objectives-0");
    assertEquals(tuNode.getParentId(), course.getEditorRootNodeId());
    // summary check
    ICourse realCourse = CourseFactory.loadCourse(course.getKey());
    TreeNode realRoot = realCourse.getEditorTreeModel().getRootNode();
    assertEquals(11, realRoot.getChildCount());
    // structure
    CourseEditorTreeNode child = (CourseEditorTreeNode) realRoot.getChildAt(0);
    CourseNode childNode = child.getCourseNode();
    assertTrue(childNode instanceof STCourseNode);
    // single page
    child = (CourseEditorTreeNode) realRoot.getChildAt(1);
    childNode = child.getCourseNode();
    assertTrue(childNode instanceof SPCourseNode);
    // folder
    child = (CourseEditorTreeNode) realRoot.getChildAt(2);
    childNode = child.getCourseNode();
    assertTrue(childNode instanceof BCCourseNode);
    // forum
    child = (CourseEditorTreeNode) realRoot.getChildAt(3);
    childNode = child.getCourseNode();
    assertTrue(childNode instanceof FOCourseNode);
    // task
    child = (CourseEditorTreeNode) realRoot.getChildAt(4);
    childNode = child.getCourseNode();
    assertTrue(childNode instanceof TACourseNode);
    // assessment
    child = (CourseEditorTreeNode) realRoot.getChildAt(5);
    childNode = child.getCourseNode();
    assertTrue(childNode instanceof MSCourseNode);
    // contact
    child = (CourseEditorTreeNode) realRoot.getChildAt(6);
    childNode = child.getCourseNode();
    assertTrue(childNode instanceof COCourseNode);
    // enrollment
    child = (CourseEditorTreeNode) realRoot.getChildAt(7);
    childNode = child.getCourseNode();
    assertTrue(childNode instanceof ENCourseNode);
    // test
    child = (CourseEditorTreeNode) realRoot.getChildAt(8);
    childNode = child.getCourseNode();
    assertTrue(childNode instanceof IQTESTCourseNode);
    // survey
    child = (CourseEditorTreeNode) realRoot.getChildAt(9);
    childNode = child.getCourseNode();
    assertTrue(childNode instanceof IQSURVCourseNode);
    // external page
    child = (CourseEditorTreeNode) realRoot.getChildAt(10);
    childNode = child.getCourseNode();
    assertTrue(childNode instanceof TUCourseNode);
    // attach file to task
    child = (CourseEditorTreeNode) realRoot.getChildAt(4);
    childNode = child.getCourseNode();
    URI attachTaskFileUri = getElementsUri(course).path("task").path(childNode.getIdent()).path("file").queryParam("filename", "singlepage.html").build();
    HttpPut taskFileMethod = conn.createPut(attachTaskFileUri, MediaType.APPLICATION_JSON, true);
    conn.addMultipart(taskFileMethod, page.getName(), page);
    HttpResponse taskFileCode = conn.execute(taskFileMethod);
    assertEquals(200, taskFileCode.getStatusLine().getStatusCode());
    String taskFolderPath = TACourseNode.getTaskFolderPathRelToFolderRoot(realCourse, childNode);
    OlatRootFolderImpl taskFolder = new OlatRootFolderImpl(taskFolderPath, null);
    VFSLeaf singleFile = (VFSLeaf) taskFolder.resolve("/" + "singlepage.html");
    assertNotNull(singleFile);
}
Also used : HttpEntity(org.apache.http.HttpEntity) IQSURVCourseNode(org.olat.course.nodes.IQSURVCourseNode) CourseNodeVO(org.olat.restapi.support.vo.CourseNodeVO) TestConfigVO(org.olat.restapi.support.vo.elements.TestConfigVO) HttpGet(org.apache.http.client.methods.HttpGet) CourseEditorTreeNode(org.olat.course.tree.CourseEditorTreeNode) ICourse(org.olat.course.ICourse) FOCourseNode(org.olat.course.nodes.FOCourseNode) RepositoryEntry(org.olat.repository.RepositoryEntry) URI(java.net.URI) HttpPut(org.apache.http.client.methods.HttpPut) URL(java.net.URL) TaskConfigVO(org.olat.restapi.support.vo.elements.TaskConfigVO) ENCourseNode(org.olat.course.nodes.ENCourseNode) CourseVO(org.olat.restapi.support.vo.CourseVO) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) TreeNode(org.olat.core.gui.components.tree.TreeNode) CourseEditorTreeNode(org.olat.course.tree.CourseEditorTreeNode) STCourseNode(org.olat.course.nodes.STCourseNode) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) MSCourseNode(org.olat.course.nodes.MSCourseNode) FOCourseNode(org.olat.course.nodes.FOCourseNode) ENCourseNode(org.olat.course.nodes.ENCourseNode) CourseNode(org.olat.course.nodes.CourseNode) COCourseNode(org.olat.course.nodes.COCourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) STCourseNode(org.olat.course.nodes.STCourseNode) MSCourseNode(org.olat.course.nodes.MSCourseNode) BCCourseNode(org.olat.course.nodes.BCCourseNode) SPCourseNode(org.olat.course.nodes.SPCourseNode) IQSURVCourseNode(org.olat.course.nodes.IQSURVCourseNode) TUCourseNode(org.olat.course.nodes.TUCourseNode) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) COCourseNode(org.olat.course.nodes.COCourseNode) TUCourseNode(org.olat.course.nodes.TUCourseNode) VFSLeaf(org.olat.core.util.vfs.VFSLeaf) HttpResponse(org.apache.http.HttpResponse) TACourseNode(org.olat.course.nodes.TACourseNode) SPCourseNode(org.olat.course.nodes.SPCourseNode) GroupVO(org.olat.restapi.support.vo.GroupVO) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) RepositoryEntryVO(org.olat.restapi.support.vo.RepositoryEntryVO) BCCourseNode(org.olat.course.nodes.BCCourseNode) File(java.io.File) SurveyConfigVO(org.olat.restapi.support.vo.elements.SurveyConfigVO) Test(org.junit.Test)

Example 4 with TaskConfigVO

use of org.olat.restapi.support.vo.elements.TaskConfigVO in project openolat by klemens.

the class CourseElementWebService method getTaskConfiguration.

/**
 * Retrieves configuration of the task course node
 * @response.representation.200.qname {http://www.example.com}surveyConfigVO
 * @response.representation.200.mediaType application/xml, application/json
 * @response.representation.200.doc The course node configuration
 * @response.representation.200.example {@link org.olat.restapi.support.vo.Examples#SAMPLE_COURSENODEVO}
 * @response.representation.401.doc The roles of the authenticated user are not sufficient
 * @response.representation.404.doc The course or task node not found
 * @param courseId
 * @param nodeId
 * @return the task course node configuration
 */
@GET
@Path("task/{nodeId}/configuration")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getTaskConfiguration(@PathParam("courseId") Long courseId, @PathParam("nodeId") String nodeId, @Context HttpServletRequest httpRequest) {
    if (!isAuthor(httpRequest)) {
        return Response.serverError().status(Status.UNAUTHORIZED).build();
    }
    TaskConfigVO config = new TaskConfigVO();
    ICourse course = CoursesWebService.loadCourse(courseId);
    CourseNode courseNode = getParentNode(course, nodeId);
    ModuleConfiguration moduleConfig = courseNode.getModuleConfiguration();
    // build configuration with fallback to default values
    Boolean isAssignmentEnabled = (Boolean) moduleConfig.get(TACourseNode.CONF_TASK_ENABLED);
    config.setIsAssignmentEnabled(isAssignmentEnabled == null ? Boolean.TRUE : isAssignmentEnabled);
    String taskAssignmentType = moduleConfig.getStringValue(TACourseNode.CONF_TASK_TYPE);
    config.setTaskAssignmentType(taskAssignmentType == null ? TaskController.TYPE_MANUAL : taskAssignmentType);
    String taskAssignmentText = moduleConfig.getStringValue(TACourseNode.CONF_TASK_TEXT);
    config.setTaskAssignmentText(taskAssignmentText == null ? "" : taskAssignmentText);
    Boolean isTaskPreviewEnabled = moduleConfig.get(TACourseNode.CONF_TASK_PREVIEW) == null ? Boolean.FALSE : moduleConfig.getBooleanEntry(TACourseNode.CONF_TASK_PREVIEW);
    config.setIsTaskPreviewEnabled(isTaskPreviewEnabled);
    Boolean isTaskDeselectEnabled = moduleConfig.getBooleanEntry(TACourseNode.CONF_TASK_DESELECT);
    config.setIsTaskDeselectEnabled(isTaskDeselectEnabled == null ? Boolean.FALSE : isTaskDeselectEnabled);
    Boolean onlyOneUserPerTask = (Boolean) moduleConfig.get(TACourseNode.CONF_TASK_SAMPLING_WITH_REPLACEMENT);
    config.setOnlyOneUserPerTask(onlyOneUserPerTask == null ? Boolean.TRUE : onlyOneUserPerTask);
    Boolean isDropboxEnabled = (Boolean) moduleConfig.get(TACourseNode.CONF_DROPBOX_ENABLED);
    config.setIsDropboxEnabled(isDropboxEnabled == null ? Boolean.TRUE : isDropboxEnabled);
    Boolean isDropboxConfirmationMailEnabled = (Boolean) moduleConfig.get(TACourseNode.CONF_DROPBOX_ENABLEMAIL);
    config.setIsDropboxConfirmationMailEnabled(isDropboxConfirmationMailEnabled == null ? Boolean.FALSE : isDropboxConfirmationMailEnabled);
    String dropboxConfirmationText = moduleConfig.getStringValue(TACourseNode.CONF_DROPBOX_CONFIRMATION);
    config.setDropboxConfirmationText(dropboxConfirmationText == null ? "" : dropboxConfirmationText);
    Boolean isReturnboxEnabled = (Boolean) moduleConfig.get(TACourseNode.CONF_RETURNBOX_ENABLED);
    config.setIsReturnboxEnabled(isReturnboxEnabled == null ? Boolean.TRUE : isReturnboxEnabled);
    Boolean isScoringEnabled = (Boolean) moduleConfig.get(TACourseNode.CONF_SCORING_ENABLED);
    config.setIsScoringEnabled(isScoringEnabled == null ? Boolean.TRUE : isScoringEnabled);
    Boolean isScoringGranted = (Boolean) moduleConfig.get(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD);
    config.setIsScoringGranted(isScoringGranted == null ? Boolean.FALSE : isScoringGranted);
    Float minScore = (Float) moduleConfig.get(MSCourseNode.CONFIG_KEY_SCORE_MIN);
    config.setMinScore(minScore);
    Float maxScore = (Float) moduleConfig.get(MSCourseNode.CONFIG_KEY_SCORE_MAX);
    config.setMaxScore(maxScore);
    Boolean isPassingGranted = (Boolean) moduleConfig.get(MSCourseNode.CONFIG_KEY_HAS_PASSED_FIELD);
    config.setIsPassingGranted(isPassingGranted == null ? Boolean.FALSE : isPassingGranted);
    Float passingScoreThreshold = (Float) moduleConfig.get(MSCourseNode.CONFIG_KEY_PASSED_CUT_VALUE);
    config.setPassingScoreThreshold(passingScoreThreshold);
    Boolean hasCommentField = (Boolean) moduleConfig.get(MSCourseNode.CONFIG_KEY_HAS_COMMENT_FIELD);
    config.setHasCommentField(hasCommentField == null ? Boolean.FALSE : hasCommentField);
    String commentForUser = moduleConfig.getStringValue(MSCourseNode.CONFIG_KEY_INFOTEXT_USER);
    config.setCommentForUser(commentForUser == null ? "" : commentForUser);
    String commentForCoaches = moduleConfig.getStringValue(MSCourseNode.CONFIG_KEY_INFOTEXT_COACH);
    config.setCommentForCoaches(commentForCoaches == null ? "" : commentForCoaches);
    Boolean isSolutionEnabled = (Boolean) moduleConfig.get(TACourseNode.CONF_SOLUTION_ENABLED);
    config.setIsSolutionEnabled(isSolutionEnabled == null ? Boolean.TRUE : isSolutionEnabled);
    // get the conditions
    List<ConditionExpression> lstConditions = courseNode.getConditionExpressions();
    for (ConditionExpression cond : lstConditions) {
        String id = cond.getId();
        String expression = cond.getExptressionString();
        if (id.equals(TACourseNode.ACCESS_TASK))
            config.setConditionTask(expression);
        else if (// TACourseNode uses "drop" instead the static ACCESS_DROPBOX, very bad!
        id.equals("drop"))
            config.setConditionDropbox(expression);
        else if (id.equals(TACourseNode.ACCESS_RETURNBOX))
            config.setConditionReturnbox(expression);
        else if (id.equals(TACourseNode.ACCESS_SCORING))
            config.setConditionScoring(expression);
        else if (id.equals(TACourseNode.ACCESS_SOLUTION))
            config.setConditionSolution(expression);
    }
    return Response.ok(config).build();
}
Also used : TaskConfigVO(org.olat.restapi.support.vo.elements.TaskConfigVO) ModuleConfiguration(org.olat.modules.ModuleConfiguration) ConditionExpression(org.olat.course.condition.interpreter.ConditionExpression) ICourse(org.olat.course.ICourse) CourseNode(org.olat.course.nodes.CourseNode) TACourseNode(org.olat.course.nodes.TACourseNode) STCourseNode(org.olat.course.nodes.STCourseNode) MSCourseNode(org.olat.course.nodes.MSCourseNode) AbstractFeedCourseNode(org.olat.course.nodes.AbstractFeedCourseNode) IQSURVCourseNode(org.olat.course.nodes.IQSURVCourseNode) IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

ICourse (org.olat.course.ICourse)4 CourseNode (org.olat.course.nodes.CourseNode)4 IQSURVCourseNode (org.olat.course.nodes.IQSURVCourseNode)4 IQTESTCourseNode (org.olat.course.nodes.IQTESTCourseNode)4 MSCourseNode (org.olat.course.nodes.MSCourseNode)4 STCourseNode (org.olat.course.nodes.STCourseNode)4 TACourseNode (org.olat.course.nodes.TACourseNode)4 TaskConfigVO (org.olat.restapi.support.vo.elements.TaskConfigVO)4 File (java.io.File)2 IOException (java.io.IOException)2 URI (java.net.URI)2 URISyntaxException (java.net.URISyntaxException)2 URL (java.net.URL)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 HttpEntity (org.apache.http.HttpEntity)2 HttpResponse (org.apache.http.HttpResponse)2 HttpGet (org.apache.http.client.methods.HttpGet)2 HttpPut (org.apache.http.client.methods.HttpPut)2