本文整理汇总了Java中blackboard.data.course.Course类的典型用法代码示例。如果您正苦于以下问题:Java Course类的具体用法?Java Course怎么用?Java Course使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Course类属于blackboard.data.course包,在下文中一共展示了Course类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import blackboard.data.course.Course; //导入依赖的package包/类
/**
* Starts preview lesson on LAMS server. Launches it.
*/
private void start(HttpServletRequest request, HttpServletResponse response, Context ctx) throws IOException, ServletException, PersistenceException, ParseException, ValidationException, ParserConfigurationException, SAXException {
BbPersistenceManager bbPm = PersistenceServiceFactory.getInstance().getDbPersistenceManager();
//store newly created LAMS lesson
User user = ctx.getUser();
BlackboardUtil.storeBlackboardContent(request, response, user);
// constuct strReturnUrl
String courseIdStr = request.getParameter("course_id");
String contentIdStr = request.getParameter("content_id");
// internal Blackboard IDs for the course and parent content item
Id courseId = bbPm.generateId(Course.DATA_TYPE, courseIdStr);
Id folderId = bbPm.generateId(CourseDocument.DATA_TYPE, contentIdStr);
String returnUrl = PlugInUtil.getEditableContentReturnURL(folderId, courseId);
request.setAttribute("returnUrl", returnUrl);
request.getRequestDispatcher("/modules/startLessonSuccess.jsp").forward(request, response);
}
示例2: getAuditLog
import blackboard.data.course.Course; //导入依赖的package包/类
/**
* Displays an audit log of when students were added/removed to/from groups
* for a single course.
*
* @param request the request from the remote client.
* @param response the response to be returned to the remote client.
* @return the data model and view of it to be rendered.
* @throws UnsupportedEncodingException if the US-ASCII character set is
* not supported, and as such URL elements cannot be encoded.
*/
@RequestMapping("/index")
public ModelAndView getAuditLog(final HttpServletRequest request, final HttpServletResponse response)
throws UnsupportedEncodingException {
final Context context = ContextManagerFactory.getInstance().getContext();
final ModelAndView modelAndView = new ModelAndView("auditLog");
final Course course = context.getCourse();
final List<EnrolmentChangePart> pendingChange = new ArrayList<EnrolmentChangePart>();
pendingChange.addAll(this.getEnrolmentChangePartDao().getByCourse(course));
Collections.sort(pendingChange);
modelAndView.addObject("activities", PlugInUtil.getUri(PLUGIN_VENDOR_ID,
PLUGIN_ID, "activities?course_id="
+ URLEncoder.encode(course.getId().getExternalString(), US_ASCII)));
modelAndView.addObject("mergedCourses", PlugInUtil.getUri(PLUGIN_VENDOR_ID,
PLUGIN_ID, "mergedCourses?course_id="
+ URLEncoder.encode(course.getId().getExternalString(), US_ASCII)));
modelAndView.addObject("changes", pendingChange);
return modelAndView;
}
示例3: getActivities
import blackboard.data.course.Course; //导入依赖的package包/类
/**
* Displays a list of activities related to a course in Learn.
*
* @param request the request from the remote client.
* @param response the response to be returned to the remote client.
* @return the data model and view of it to be rendered.
* @throws UnsupportedEncodingException if the US-ASCII character set is
* not supported, and as such URL elements cannot be encoded.
*/
@RequestMapping("/activities")
public ModelAndView getActivities(final HttpServletRequest request, final HttpServletResponse response)
throws UnsupportedEncodingException {
final Context context = ContextManagerFactory.getInstance().getContext();
final ModelAndView modelAndView = new ModelAndView("activities");
final Course course = context.getCourse();
final List<Activity> activities = getActivityDao().getByCourseLearnId(course.getId());
modelAndView.addObject("activities", activities);
modelAndView.addObject("auditLog", PlugInUtil.getUri(PLUGIN_VENDOR_ID,
PLUGIN_ID, "index?course_id="
+ URLEncoder.encode(course.getId().getExternalString(), US_ASCII)));
modelAndView.addObject("mergedCourses", PlugInUtil.getUri(PLUGIN_VENDOR_ID,
PLUGIN_ID, "mergedCourses?course_id="
+ URLEncoder.encode(course.getId().getExternalString(), US_ASCII)));
return modelAndView;
}
示例4: getMergedCourses
import blackboard.data.course.Course; //导入依赖的package包/类
/**
* Displays details of merged courses that are brought into this course.
*
* @param request the request from the remote client.
* @param response the response to be returned to the remote client.
* @return the data model and view of it to be rendered.
* @throws SQLException if there was a problem accessing the database.
* @throws UnsupportedEncodingException if the US-ASCII character set is
* not supported, and as such URL elements cannot be encoded.
*/
@RequestMapping("/mergedCourses")
public ModelAndView getMergedCourses(final HttpServletRequest request, final HttpServletResponse response)
throws UnsupportedEncodingException, SQLException {
final Context context = ContextManagerFactory.getInstance().getContext();
final ModelAndView modelAndView = new ModelAndView("mergedCourses");
final Course course = context.getCourse();
final LearnCourseCode courseCode = new LearnCourseCode(course.getCourseId());
final List<LearnCourseCode> mergedCourseCodes = new ArrayList<LearnCourseCode>();
mergedCourseCodes.addAll(this.getMergedCoursesService().getMergedCourses(courseCode));
// XXX: Resolve JTA activities here.
modelAndView.addObject("activities", PlugInUtil.getUri(PLUGIN_VENDOR_ID,
PLUGIN_ID, "activities?course_id="
+ URLEncoder.encode(course.getId().getExternalString(), US_ASCII)));
modelAndView.addObject("auditLog", PlugInUtil.getUri(PLUGIN_VENDOR_ID,
PLUGIN_ID, "index?course_id="
+ URLEncoder.encode(course.getId().getExternalString(), US_ASCII)));
modelAndView.addObject("mergedCourseCodes", mergedCourseCodes);
return modelAndView;
}
示例5: emailMemberships
import blackboard.data.course.Course; //导入依赖的package包/类
public List<MailException> emailMemberships()
throws PersistenceException {
if (this.unsafeMemberships.isEmpty()) {
return Collections.EMPTY_LIST;
}
final List<MailException> mailErrors = new ArrayList<MailException>();
for (Course course: this.unsafeMemberships.keySet()) {
final Collection<GroupMembership> memberships = this.unsafeMemberships.get(course);
final SimpleMailMessage message = this.buildMessage(course, memberships);
if (null != message) {
try {
this.mailSender.send(message);
} catch(MailException e) {
mailErrors.add(e);
}
}
}
return mailErrors;
}
示例6: getInstructorAddresses
import blackboard.data.course.Course; //导入依赖的package包/类
private Collection<String> getInstructorAddresses(final Course course)
throws KeyNotFoundException, PersistenceException {
final Set<String> emailAddresses = new HashSet<String>();
for (CourseMembership membership: this.courseMembershipLoader.loadByCourseIdAndInstructorFlag(course.getId())) {
final User user = this.userLoader.loadById(membership.getUserId());
assert null != user;
if (null == user.getEmailAddress()) {
log.info("No e-mail address listed for instructor "
+ user.getGivenName() + " "
+ user.getFamilyName() + " ("
+ user.getUserName() + ").");
continue;
}
emailAddresses.add(user.getEmailAddress());
}
return emailAddresses;
}
示例7: buildCourseGroup
import blackboard.data.course.Course; //导入依赖的package包/类
/**
* Constructs a new course group and returns it.
*
* @param course the course that the group will belong to.
* @param groupName the name of the group.
* @return the new group.
*/
public Group buildCourseGroup(final Course course, final String groupName,
final FormattedText description) {
assert null != course;
assert null != groupName;
assert null != description;
// Create the new group
final Group group = new Group();
group.setCourseId(course.getId());
group.setTitle(groupName);
group.setIsAvailable(false);
group.setSelfEnrolledAllowed(false);
group.setDescription(description);
return group;
}
示例8: createContent
import blackboard.data.course.Course; //导入依赖的package包/类
public void createContent(String title, String inputHtml, String sCourseId, String sParentId) throws PersistenceException, ValidationException {
// okay from here down
// retrieve the Db persistence manager from the persistence service
BbPersistenceManager bbPm = PersistenceServiceFactory.getInstance().getDbPersistenceManager();
// create a course document and set all desired attributes
Content content = new Content();
content.setTitle( title );
FormattedText text = new FormattedText( inputHtml , FormattedText.Type.HTML );
content.setBody( text );
content.setContentHandler( "resource/x-bb-document" );
// ... set additional attributes ...
// these attributes of content require valid Ids... create and set them
Id courseId = bbPm.generateId( Course.DATA_TYPE, sCourseId );
Id parentId = bbPm.generateId( Content.DATA_TYPE, sParentId );
content.setCourseId( courseId );
content.setParentId( parentId );
// retrieve the content persister and persist the content item
ContentDbPersister persister = (ContentDbPersister) bbPm.getPersister( ContentDbPersister.TYPE );
persister.persist( content );
}
示例9: getAdminCourses
import blackboard.data.course.Course; //导入依赖的package包/类
private Iterable<Command> getAdminCourses()
{
try
{
List<Course> courses = CourseDbLoader.Default.getInstance().loadAllByServiceLevel( ServiceLevel.FULL );
Set<Command> commands = Sets.newTreeSet();
for ( Course course : courses )
{
String url = String.format( ADMIN_COURSE_URL_TEMPLATE, course.getId().toExternalString() );
url = FramesetUtil.getTabGroupUrl(blackboard.data.navigation.Tab.TabType.courses, url);
SimpleCommand command = new SimpleCommand( course.getTitle(), url, Category.COURSE );
commands.add( command );
}
return commands;
}
catch ( PersistenceException e )
{
throw new PersistenceRuntimeException( e );
}
}
示例10: getMyCourses
import blackboard.data.course.Course; //导入依赖的package包/类
private Iterable<Command> getMyCourses( User user )
{
try
{
List<Course> courses = CourseDbLoader.Default.getInstance().loadByUserId( user.getId() );
Set<Command> commands = Sets.newTreeSet();
for ( Course course : courses )
{
String url = String.format( My_COURSE_URL_TEMPLATE, course.getId().toExternalString() );
url = FramesetUtil.getTabGroupUrl(blackboard.data.navigation.Tab.TabType.courses, url);
SimpleCommand command = new SimpleCommand( course.getTitle(), url, Category.COURSE );
commands.add( command );
}
return commands;
}
catch ( PersistenceException e )
{
throw new PersistenceRuntimeException( e );
}
}
示例11: parseValue
import blackboard.data.course.Course; //导入依赖的package包/类
@Override
public String parseValue(String value) {
B2Context b2Context = this.getService().getB2Context();
Course course = b2Context.getContext().getCourse();
Content content = b2Context.getContext().getContent();
if ((course != null) && (content != null)) {
String url = this.getEndpoint();
String contentId = content.getId().toExternalString();
if (!content.getContentHandler().equals(Utils.getResourceHandle(b2Context, null))) {
contentId += ":" + b2Context.getRequestParameter(Constants.TOOL_ID, "");
}
url = url.replaceAll("\\{link_id\\}", contentId);
value = value.replaceAll("\\$LtiLink.custom.url", url);
}
return value;
}
示例12: getSettingsString
import blackboard.data.course.Course; //导入依赖的package包/类
protected String getSettingsString(B2Context b2Context, String contextId) {
String settingsString;
try {
String settingPrefix = Constants.TOOL_PARAMETER_PREFIX + "." + this.getService().getTool().getId() + "." + Constants.SERVICE_PARAMETER_PREFIX + "." + this.getService().getId() + ".custom";
BbPersistenceManager bbPm = PersistenceServiceFactory.getInstance().getDbPersistenceManager();
Id id = bbPm.generateId(Course.DATA_TYPE, contextId);
b2Context.setContext(Resource.initContext(id, Id.UNSET_ID));
b2Context.setIgnoreContentContext(true);
settingsString = b2Context.getSetting(false, true, settingPrefix, "");
} catch (PersistenceException e) {
Logger.getLogger(ContextSetting.class.getName()).log(Level.SEVERE, null, e);
settingsString = "";
}
return settingsString;
}
示例13: setSettingsString
import blackboard.data.course.Course; //导入依赖的package包/类
private boolean setSettingsString(B2Context b2Context, String contextId, String custom) {
boolean ok = true;
try {
String settingPrefix = Constants.TOOL_PARAMETER_PREFIX + "." + this.getService().getTool().getId() + "." + Constants.SERVICE_PARAMETER_PREFIX + "." + this.getService().getId() + ".custom";
BbPersistenceManager bbPm = PersistenceServiceFactory.getInstance().getDbPersistenceManager();
Id id = bbPm.generateId(Course.DATA_TYPE, contextId);
b2Context.setContext(Resource.initContext(id, Id.UNSET_ID));
b2Context.setIgnoreContentContext(true);
b2Context.setSetting(false, true, settingPrefix, custom);
b2Context.persistSettings(false, true);
} catch (PersistenceException e) {
Logger.getLogger(ContextSetting.class.getName()).log(Level.SEVERE, null, e);
ok = false;
}
return ok;
}
示例14: parseValue
import blackboard.data.course.Course; //导入依赖的package包/类
@Override
public String parseValue(String value) {
Course course = this.getService().getB2Context().getContext().getCourse();
if (course != null) {
String url = this.getEndpoint();
url = url.replaceAll("\\{context_type\\}", "CourseSection");
url = url.replaceAll("\\{context_id\\}", course.getId().toExternalString());
url = url.replaceAll("\\{vendor_code\\}", this.getService().getB2Context().getVendorId());
url = url.replaceAll("\\{product_code\\}", this.getService().getTool().getId());
value = value.replaceAll("\\$ToolProxyBinding.custom.url", url);
}
return value;
}
示例15: initContext
import blackboard.data.course.Course; //导入依赖的package包/类
public static Context initContext(String course, String content) {
Id courseId = Id.UNSET_ID;
Id contentId = Id.UNSET_ID;
try {
if (course != null) {
courseId = Id.generateId(Course.DATA_TYPE, course);
}
if (content != null) {
contentId = Id.generateId(Content.DATA_TYPE, content);
}
} catch (PersistenceException e) {
}
return initContext(courseId, contentId);
}