当前位置: 首页>>代码示例>>Java>>正文


Java LineitemDbPersister类代码示例

本文整理汇总了Java中blackboard.persist.gradebook.LineitemDbPersister的典型用法代码示例。如果您正苦于以下问题:Java LineitemDbPersister类的具体用法?Java LineitemDbPersister怎么用?Java LineitemDbPersister使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LineitemDbPersister类属于blackboard.persist.gradebook包,在下文中一共展示了LineitemDbPersister类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeLineitem

import blackboard.persist.gradebook.LineitemDbPersister; //导入依赖的package包/类
/**
    * Removes lineitem. Throws exception if lineitem is not found.
    * 
    * @param _content_id
    * @param _course_id
    * @throws PersistenceException
    * @throws ServletException
    */
   public static void removeLineitem(String _content_id, String _course_id)
    throws PersistenceException, ServletException {
BbPersistenceManager bbPm = PersistenceServiceFactory.getInstance().getDbPersistenceManager();
Container bbContainer = bbPm.getContainer();
ContentDbLoader courseDocumentLoader = ContentDbLoader.Default.getInstance();
LineitemDbPersister linePersister = LineitemDbPersister.Default.getInstance();

Id contentId = new PkId(bbContainer, CourseDocument.DATA_TYPE, _content_id);
Content bbContent = courseDocumentLoader.loadById(contentId);
//check isGradecenter option is ON and thus there should exist associated lineitem object
if (!bbContent.getIsDescribed()) {
    return;
}

Id lineitemId = getLineitem(_content_id, _course_id, true);
linePersister.deleteById(lineitemId);

//Remove bbContentId -> lineitemid pair from the storage
PortalExtraInfo pei = PortalUtil.loadPortalExtraInfo(null, null, LAMS_LINEITEM_STORAGE);
ExtraInfo ei = pei.getExtraInfo();
ei.clearEntry(_content_id);
PortalUtil.savePortalExtraInfo(pei);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:LineitemUtil.java

示例2: gradeCentreLineitemAdd

import blackboard.persist.gradebook.LineitemDbPersister; //导入依赖的package包/类
public static boolean gradeCentreLineitemAdd(BBLineitem lineitem, BBCourse course) throws WebServiceException
{
    try
    {
        Lineitem li = new Lineitem();
        li.setCourseId(CourseDbLoader.Default.getInstance().loadByCourseId(course.getCourseId()).getId());
        //li.setAssessmentLocation(Lineitem.AssessmentLocation.INTERNAL);
        li.setName(lineitem.getName());
        li.setIsAvailable(lineitem.getAvailable());
        li.setPointsPossible(lineitem.getPointsPossible());
        li.setType(lineitem.getType());
        li.setWeight(lineitem.getWeight());
        ((LineitemDbPersister)PersistenceServiceFactory.getInstance().getDbPersistenceManager().getPersister(LineitemDbPersister.TYPE)).persist(li);
    }
    catch(Exception e)
    {
        throw new WebServiceException("Error: Could not add lineitem "+e.toString());
    }
    return true;
}
 
开发者ID:andmar8,项目名称:Blackboard-Java-WebservicesBBHelper,代码行数:21,代码来源:GradeCentreHelper.java

示例3: changeLineitemName

import blackboard.persist.gradebook.LineitemDbPersister; //导入依赖的package包/类
/**
    * Changes lineitem's name. Throws exception if lineitem is not found.
    * 
    * @param _content_id
    * @param _course_id
    * @param newLineitemName
    * @throws PersistenceException
    * @throws ServletException
    * @throws ValidationException
    */
   public static void changeLineitemName(String _content_id, String _course_id, String newLineitemName)
    throws PersistenceException, ServletException, ValidationException {
LineitemDbLoader lineitemLoader = LineitemDbLoader.Default.getInstance();
LineitemDbPersister linePersister = LineitemDbPersister.Default.getInstance();

Id lineitemId = getLineitem(_content_id, _course_id, true);
Lineitem lineitem = lineitemLoader.loadById(lineitemId);
lineitem.setName(newLineitemName);
linePersister.persist(lineitem);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:LineitemUtil.java

示例4: updateLineitemLessonId

import blackboard.persist.gradebook.LineitemDbPersister; //导入依赖的package包/类
/**
    * Changes lineitem's lamsLessonId. Throws exception if lineitem is not found.
    * 
    * @param bbContentId
    * @param courseIdStr
    * @param newLineitemName
    * @throws PersistenceException
    * @throws ServletException
    * @throws ValidationException
    * @throws IOException 
    * @throws SAXException 
    * @throws ParserConfigurationException 
    */
   public static void updateLineitemLessonId(Content bbContent, String courseIdStr, Long newLamsLessonId, String userName)
    throws PersistenceException, ServletException, ValidationException, IOException, ParserConfigurationException, SAXException {
LineitemDbLoader lineitemLoader = LineitemDbLoader.Default.getInstance();
LineitemDbPersister linePersister = LineitemDbPersister.Default.getInstance();

String _content_id = bbContent.getId().toExternalString();

//update only in case grade center is ON
if (bbContent.getIsDescribed()) {

    Id lineitemId = getLineitem(_content_id, courseIdStr, false);
    //in case admin forgot to check "Grade Center Columns and Settings" option on doing course copy/import
    if (lineitemId == null) {
	createLineitem(bbContent, userName);
	
    //in case he checked it and BB created Lineitem object, then just need to update it
    } else {
	Lineitem lineitem = lineitemLoader.loadById(lineitemId);
	lineitem.setAssessmentId(Long.toString(newLamsLessonId), Lineitem.AssessmentLocation.EXTERNAL);
	linePersister.persist(lineitem);

	updateLamsLineitemStorage(bbContent, lineitem);
    }

}

// store internalContentId -> externalContentId. It's used for GradebookServlet. Store it just in case
PortalExtraInfo pei = PortalUtil.loadPortalExtraInfo(null, null, "LamsStorage");
ExtraInfo ei = pei.getExtraInfo();
ei.setValue(_content_id, Long.toString(newLamsLessonId));
PortalUtil.savePortalExtraInfo(pei);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:46,代码来源:LineitemUtil.java

示例5: createLineitem

import blackboard.persist.gradebook.LineitemDbPersister; //导入依赖的package包/类
@SuppressWarnings("deprecation")
   public static void createLineitem(Content bbContent, String userName)
    throws ValidationException, PersistenceException, IOException, ParserConfigurationException, SAXException {
LineitemDbPersister linePersister = LineitemDbPersister.Default.getInstance();
OutcomeDefinitionDbPersister outcomeDefinitionPersister = OutcomeDefinitionDbPersister.Default.getInstance();
OutcomeDefinitionScaleDbLoader outcomeDefinitionScaleLoader = OutcomeDefinitionScaleDbLoader.Default
	.getInstance();
OutcomeDefinitionScaleDbPersister uutcomeDefinitionScaleDbPersister = OutcomeDefinitionScaleDbPersister.Default
	.getInstance();

String title = bbContent.getTitle();
Id courseId = bbContent.getCourseId();
String lamsLessonId = bbContent.getLinkRef();

// Create new Gradebook column for current bbContent
Lineitem lineitem = new Lineitem();
lineitem.setCourseId(courseId);
lineitem.setName(title);
lineitem.setPointsPossible(Constants.GRADEBOOK_POINTS_POSSIBLE);
lineitem.setType(Constants.GRADEBOOK_LINEITEM_TYPE);
lineitem.setIsAvailable(true);
lineitem.setDateAdded();
lineitem.setAssessmentLocation(Lineitem.AssessmentLocation.EXTERNAL);
lineitem.setAssessmentId(lamsLessonId, Lineitem.AssessmentLocation.EXTERNAL);
lineitem.validate();
linePersister.persist(lineitem);

OutcomeDefinition outcomeDefinition = lineitem.getOutcomeDefinition();
outcomeDefinition.setCourseId(courseId);
outcomeDefinition.setPosition(1);

boolean hasLessonScoreOutputs = LineitemUtil.hasLessonScoreOutputs(bbContent, userName);
OutcomeDefinitionScale outcomeDefinitionScale;
if (hasLessonScoreOutputs) {
    outcomeDefinitionScale = outcomeDefinitionScaleLoader.loadByCourseIdAndTitle(courseId,
	    OutcomeDefinitionScale.SCORE);
    outcomeDefinitionScale.setNumericScale(true);
    outcomeDefinitionScale.setPercentageScale(true);
    outcomeDefinition.setScorable(true);
} else {
    outcomeDefinitionScale = outcomeDefinitionScaleLoader.loadByCourseIdAndTitle(courseId,
	    OutcomeDefinitionScale.COMPLETE_INCOMPLETE);
    outcomeDefinitionScale.setNumericScale(false);
    outcomeDefinition.setScorable(false);
}
uutcomeDefinitionScaleDbPersister.persist(outcomeDefinitionScale);
outcomeDefinition.setScale(outcomeDefinitionScale);
outcomeDefinitionPersister.persist(outcomeDefinition);

updateLamsLineitemStorage(bbContent, lineitem);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:52,代码来源:LineitemUtil.java


注:本文中的blackboard.persist.gradebook.LineitemDbPersister类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。