Package org.olat.modules.scorm.server.beans

Examples of org.olat.modules.scorm.server.beans.LMSDataFormBean


//         "../sahs_presentation.php?cmd=launchSahs"
//          +"&ref_id="  + olatRefId
//          +"&sahs_id="  + olatSahsId
//      );
      //putting all cmi from the olat storage to the local storage
      LMSDataFormBean lmsDataBean = new LMSDataFormBean();
      lmsDataBean.setItemID(sahs_id);
      lmsDataBean.setLmsAction("get");
      odatahandler = new LMSDataHandler(scormManager, lmsDataBean, scormSettingsHandler);
      LMSResultsBean lmsBean = odatahandler.getResultsBean();
      olatScoCmi.clear();
      String[][] strArr = lmsBean.getCmiStrings();
      String key = "";
View Full Code Here


    //StringBuilder P = new StringBuilder();
    Hashtable ins = core.getTransNew ();
    Hashtable mod = core.getTransMod ();
    core.transBegin();
   
    LMSDataFormBean lmsDataBean = new LMSDataFormBean();
    lmsDataBean.setItemID(olatSahsId);
    //TODO:gs pass the dataBean for use, and do not get it a second time
    lmsDataBean.setNextAction("5");
    lmsDataBean.setLmsAction("update");
    Map cmiData = new HashMap();
   
    //TODO:gs:c make it possible only to update the changed cmi data.
    if (ins.size() > 0){
      Set set = ins.keySet();
      for(Iterator it = set.iterator();it.hasNext();){
        String cmi = (String)it.next();
        olatScoCmi.remove(cmi);
        olatScoCmi.put(cmi,ins.get(cmi));
      }
    }
    if(mod.size() > 0){
      Set set = mod.keySet();
      for(Iterator it = set.iterator();it.hasNext();){
        String cmi = (String)it.next();
        olatScoCmi.remove(cmi);
        olatScoCmi.put(cmi,mod.get(cmi));
      }
    }
    cmiData.putAll(olatScoCmi);
   
    //work around for missing cmi's (needed by reload code, but not used in ilias code)
    if(cmiData.get("cmi.interactions._count") != null && cmiData.get("cmi.interactions._count") != "0"){
      int count = Integer.parseInt((String)cmiData.get("cmi.interactions._count"));
      for(int i=0;i<count;i++){
        //OLAT-4271: check first if cmi.interactions.n.objectives._count exist before putting a default one
        String objectivesCount = (String)cmiData.get("cmi.interactions."+ i +".objectives._count");
        if(!StringHelper.containsNonWhitespace(objectivesCount)) {
          cmiData.put("cmi.interactions."+ i +".objectives._count","0");
        }
      }
    }
    if (isACommit) {
      String rawScore = (String) cmiData.get(SCORE_IDENT);
      if (rawScore != null && !rawScore.equals("")) {
        // we have a score set in this sco.
        // persist
       
        // to prevent problems with bad xmlhttprequest timings
        synchronized(this) { //o_clusterOK by:fj: instance is spawned by the ScormAPIandDisplayController
          scoresProp.put(olatSahsId, rawScore);
          OutputStream os = null;
          try {
            os = new BufferedOutputStream(new FileOutputStream(scorePropsFile));
            scoresProp.store(os, null);
          } catch (IOException e) {
            throw new OLATRuntimeException(this.getClass(), "could not save scorm-properties-file: "+scorePropsFile.getAbsolutePath(), e);
          }
          finally {
            FileUtils.closeSafely(os);
          }
          // notify
          if (apiCallback != null) {
            apiCallback.lmsCommit(olatSahsId, scoresProp);
          }
        }
      }
    }
   
    lmsDataBean.setDataAsMap(cmiData);
    odatahandler = new LMSDataHandler(scormManager, lmsDataBean, scormSettingsHandler);
    odatahandler.updateCMIData(olatSahsId);
    return "true";
  }
View Full Code Here

 
  /**
   * @return a String that points to the last accessed sco itemId
   */
  public String getScormLastAccessedItemId(){
    LMSDataFormBean lmsDataBean = new LMSDataFormBean();
    lmsDataBean.setLmsAction("boot");
    odatahandler = new LMSDataHandler(scormManager, lmsDataBean, scormSettingsHandler);
    LMSResultsBean lmsBean = odatahandler.getResultsBean();
    return lmsBean.getItemID();
  }
View Full Code Here

   * @param itemId
   * @return true if the item is completed
   */
  public boolean isItemCompleted(String itemId){
    //TODO:gs make method faster by caching lmsBean, but when to set out of date?
    LMSDataFormBean lmsDataBean = new LMSDataFormBean();
    lmsDataBean.setItemID(itemId);
    lmsDataBean.setLmsAction("get");
    odatahandler = new LMSDataHandler(scormManager, lmsDataBean, scormSettingsHandler);
    LMSResultsBean lmsBean = odatahandler.getResultsBean();
    return lmsBean.getIsItemCompleted().equals("true");
  }
View Full Code Here

   * @param itemId
   * @return true if item has any not fullfilled preconditions
   */
  public boolean hasItemPrerequisites(String itemId) {
    //TODO:gs make method faster by caching lmsBean, but when to set out of date?
    LMSDataFormBean lmsDataBean = new LMSDataFormBean();
    lmsDataBean.setItemID(itemId);
    lmsDataBean.setLmsAction("get");
    odatahandler = new LMSDataHandler(scormManager, lmsDataBean, scormSettingsHandler);
    LMSResultsBean lmsBean = odatahandler.getResultsBean();
    return lmsBean.getHasPrerequisites().equals("true");
  }
View Full Code Here

 
  /**
   * @return Map containing the recent sco items status
   */
  public Map getScoItemsStatus(){
    LMSDataFormBean lmsDataBean = new LMSDataFormBean();
    lmsDataBean.setLmsAction("boot");
    odatahandler = new LMSDataHandler(scormManager, lmsDataBean, scormSettingsHandler);
    LMSResultsBean lmsBean = odatahandler.getResultsBean();
    String[][] preReqTbl = lmsBean.getPreReqTable();
    Map itemsStatus = new HashMap();
    //put table into map
View Full Code Here

   * @param recentId
   * @return the previos Sco itemId
   */
  public Integer getPreviousSco(String recentId) {
//    TODO:gs make method faster by caching lmsBean, but when to set out of date?
    LMSDataFormBean lmsDataBean = new LMSDataFormBean();
    lmsDataBean.setItemID(recentId);
    lmsDataBean.setLmsAction("get");
    odatahandler = new LMSDataHandler(scormManager, lmsDataBean, scormSettingsHandler);
    LMSResultsBean lmsBean = odatahandler.getResultsBean();
    String[][] pretable = lmsBean.getPreReqTable();
    String previousNavScoId = "-1";
    for(int i=0; i < pretable.length; i++){
View Full Code Here

   * @param recentId
   * @return the next Sco itemId
   */
  public Integer getNextSco(String recentId) {
//    TODO:gs make method faster by chaching lmsBean, but when to set out of date?
    LMSDataFormBean lmsDataBean = new LMSDataFormBean();
    lmsDataBean.setItemID(recentId);
    lmsDataBean.setLmsAction("get");
    odatahandler = new LMSDataHandler(scormManager, lmsDataBean, scormSettingsHandler);
    LMSResultsBean lmsBean = odatahandler.getResultsBean();
    String[][] pretable = lmsBean.getPreReqTable();
    String nextNavScoId = "-1";
    for(int i=0; i < pretable.length; i++){
View Full Code Here

TOP

Related Classes of org.olat.modules.scorm.server.beans.LMSDataFormBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.