Skip to content
Snippets Groups Projects
Commit 036e2ffb authored by srosse's avatar srosse
Browse files

CL-431: enhance repository entry API for description

parent b408da3b
No related branches found
No related tags found
No related merge requests found
......@@ -620,7 +620,7 @@ public class RepositoryEntryResource {
}
}
RepositoryEntry reloaded = repositoryManager.setDescriptionAndName(re, vo.getDisplayname(), null,
RepositoryEntry reloaded = repositoryManager.setDescriptionAndName(re, vo.getDisplayname(), vo.getDescription(),
vo.getLocation(), vo.getAuthors(), vo.getExternalId(), vo.getExternalRef(), vo.getManagedFlags(),
lifecycle);
RepositoryEntryVO rvo = ObjectFactory.get(reloaded);
......
......@@ -225,8 +225,8 @@ public class CoursesWebService {
@PUT
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Response createEmptyCourse(@QueryParam("shortTitle") String shortTitle, @QueryParam("title") String title,
@QueryParam("displayName") String displayName, @QueryParam("softKey") String softKey,
@QueryParam("access") Integer access, @QueryParam("membersOnly") Boolean membersOnly,
@QueryParam("displayName") String displayName, @QueryParam("description") String description,
@QueryParam("softKey") String softKey, @QueryParam("access") Integer access, @QueryParam("membersOnly") Boolean membersOnly,
@QueryParam("externalId") String externalId, @QueryParam("externalRef") String externalRef,
@QueryParam("authors") String authors, @QueryParam("location") String location,
@QueryParam("managedFlags") String managedFlags, @QueryParam("sharedFolderSoftKey") String sharedFolderSoftKey,
......@@ -256,9 +256,9 @@ public class CoursesWebService {
}
}
if(copyFrom != null) {
course = copyCourse(copyFrom, ureq, id, shortTitle, title, displayName, softKey, accessInt, membersOnlyBool, authors, location, externalId, externalRef, managedFlags, configVO);
course = copyCourse(copyFrom, ureq, id, shortTitle, title, displayName, description, softKey, accessInt, membersOnlyBool, authors, location, externalId, externalRef, managedFlags, configVO);
} else {
course = createEmptyCourse(id, shortTitle, title, displayName, softKey, accessInt, membersOnlyBool, authors, location, externalId, externalRef, managedFlags, configVO);
course = createEmptyCourse(id, shortTitle, title, displayName, description, softKey, accessInt, membersOnlyBool, authors, location, externalId, externalRef, managedFlags, configVO);
}
if(course == null) {
return Response.serverError().status(Status.NOT_FOUND).build();
......@@ -290,7 +290,7 @@ public class CoursesWebService {
CourseConfigVO configVO = new CourseConfigVO();
ICourse course = createEmptyCourse(ureq.getIdentity(),
courseVo.getTitle(), courseVo.getTitle(), courseVo.getTitle(),
courseVo.getTitle(), courseVo.getTitle(), courseVo.getTitle(), courseVo.getDescription(),
courseVo.getSoftKey(), RepositoryEntry.ACC_OWNERS, false,
courseVo.getAuthors(), courseVo.getLocation(),
courseVo.getExternalId(), courseVo.getExternalRef(), courseVo.getManagedFlags(),
......@@ -401,7 +401,7 @@ public class CoursesWebService {
}
private static ICourse copyCourse(Long copyFrom, UserRequest ureq, Identity initialAuthor, String shortTitle, String longTitle, String displayName,
String softKey, int access, boolean membersOnly, String authors, String location, String externalId, String externalRef,
String description, String softKey, int access, boolean membersOnly, String authors, String location, String externalId, String externalRef,
String managedFlags, CourseConfigVO courseConfigVO) {
//String learningObjectives = name + " (Example of creating a new course)";
......@@ -428,7 +428,10 @@ public class CoursesWebService {
//create new repo entry
String name;
String description = src.getDescription();
if(description == null || description.trim().length() == 0) {
description = src.getDescription();
}
if (courseConfigVO != null && StringHelper.containsNonWhitespace(displayName)) {
name = displayName;
} else {
......@@ -497,7 +500,7 @@ public class CoursesWebService {
* @return
*/
public static ICourse createEmptyCourse(Identity initialAuthor, String shortTitle, String longTitle, CourseConfigVO courseConfigVO) {
return createEmptyCourse(initialAuthor, shortTitle, longTitle, shortTitle, null, RepositoryEntry.ACC_OWNERS, false, null, null, null, null, null, courseConfigVO);
return createEmptyCourse(initialAuthor, shortTitle, longTitle, shortTitle, null, null, RepositoryEntry.ACC_OWNERS, false, null, null, null, null, null, courseConfigVO);
}
/**
......@@ -513,7 +516,7 @@ public class CoursesWebService {
* @return
*/
public static ICourse createEmptyCourse(Identity initialAuthor, String shortTitle, String longTitle, String reDisplayName,
String softKey, int access, boolean membersOnly, String authors, String location,
String description, String softKey, int access, boolean membersOnly, String authors, String location,
String externalId, String externalRef, String managedFlags, CourseConfigVO courseConfigVO) {
String learningObjectives = shortTitle + " (Example of creating a new course)";
......@@ -534,6 +537,7 @@ public class CoursesWebService {
addedEntry.setExternalId(externalId);
addedEntry.setExternalRef(externalRef);
addedEntry.setManagedFlagsString(managedFlags);
addedEntry.setDescription(description);
if(RepositoryEntryManagedFlag.isManaged(addedEntry, RepositoryEntryManagedFlag.membersmanagement)) {
addedEntry.setAllowToLeaveOption(RepositoryEntryAllowToLeaveOptions.never);
} else {
......
......@@ -158,6 +158,7 @@ public class ObjectFactory {
vo.setSoftkey(entry.getSoftkey());
vo.setResourcename(entry.getResourcename());
vo.setDisplayname(entry.getDisplayname());
vo.setDescription(entry.getDescription());
vo.setAuthors(entry.getAuthors());
vo.setLocation(entry.getLocation());
vo.setResourceableId(entry.getResourceableId());
......@@ -187,6 +188,7 @@ public class ObjectFactory {
CourseVO vo = new CourseVO();
vo.setKey(course.getResourceableId());
vo.setDisplayName(re.getDisplayname());
vo.setDescription(re.getDescription());
vo.setTitle(course.getCourseTitle());
vo.setEditorRootNodeId(course.getEditorTreeModel().getRootNode().getIdent());
vo.setSoftKey(re.getSoftkey());
......
......@@ -40,6 +40,7 @@ public class CourseVO {
private Long key;
private String softKey;
private String displayName;
private String description;
private Long repoEntryKey;
@XmlAttribute(name="authors",required=false)
private String authors;
......@@ -166,6 +167,14 @@ public class CourseVO {
this.displayName = displayName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getEditorRootNodeId() {
return editorRootNodeId;
}
......
......@@ -41,6 +41,7 @@ public class RepositoryEntryVO {
private String softkey;
private String resourcename;
private String displayname;
private String description;
@XmlAttribute(name="authors",required=false)
private String authors;
@XmlAttribute(name="location",required=false)
......@@ -93,6 +94,14 @@ public class RepositoryEntryVO {
this.displayname = displayname;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getAuthors() {
return authors;
}
......
......@@ -111,11 +111,11 @@ public class CoursesTest extends OlatJerseyTestCase {
try {
// create course and persist as OLATResourceImpl
admin = BaseSecurityManager.getInstance().findIdentityByName("administrator");
course1 = CoursesWebService.createEmptyCourse(admin, "courses1", "courses1 long name", null, null, RepositoryEntry.ACC_OWNERS, false, null, null, null, null, null, null);
course1 = CoursesWebService.createEmptyCourse(admin, "courses1", "courses1 long name", null, null, null, RepositoryEntry.ACC_OWNERS, false, null, null, null, null, null, null);
externalId = UUID.randomUUID().toString();
externalRef = UUID.randomUUID().toString();
course2 = CoursesWebService.createEmptyCourse(admin, "courses2", "courses2 long name", null, null, RepositoryEntry.ACC_OWNERS, false, null, null, externalId, externalRef, "all", null);
course2 = CoursesWebService.createEmptyCourse(admin, "courses2", "courses2 long name", null, null, null, RepositoryEntry.ACC_OWNERS, false, null, null, externalId, externalRef, "all", null);
dbInstance.commitAndCloseSession();
......@@ -123,7 +123,7 @@ public class CoursesTest extends OlatJerseyTestCase {
re2 = repositoryManager.lookupRepositoryEntry(course2, false);
externalId3 = UUID.randomUUID().toString();
course3 = CoursesWebService.createEmptyCourse(admin, "courses3", "courses3 long name", null, null, RepositoryEntry.ACC_OWNERS, false, null, null, externalId3, null, "all", null);
course3 = CoursesWebService.createEmptyCourse(admin, "courses3", "courses3 long name", null, null, null, RepositoryEntry.ACC_OWNERS, false, null, null, externalId3, null, "all", null);
re3 = repositoryManager.lookupRepositoryEntry(course3, false);
RepositoryEntryLifecycle lifecycle3 = reLifecycleDao.create("course3 lifecycle", UUID.randomUUID().toString(), true, new Date(), new Date());
dbInstance.commit();
......
......@@ -67,7 +67,7 @@ public class EfficiencyStatementTest extends OlatJerseyTestCase {
// create a standalone efficiency statement
Identity admin = BaseSecurityManager.getInstance().findIdentityByName("administrator");
Identity assessedIdentity = JunitTestHelper.createAndPersistIdentityAsRndUser("eff-1");
ICourse course = CoursesWebService.createEmptyCourse(admin, "courses1", "courses1 long name", null, null, RepositoryEntry.ACC_OWNERS, false, null, null, null, null, null, null);
ICourse course = CoursesWebService.createEmptyCourse(admin, "courses1", "courses1 long name", null, null, null, RepositoryEntry.ACC_OWNERS, false, null, null, null, null, null, null);
dbInstance.commitAndCloseSession();
OLATResource resource = course.getCourseEnvironment().getCourseGroupManager().getCourseResource();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment