Package org.olat.core.util.bulk

Examples of org.olat.core.util.bulk.BulkActionModule


        GenericObjectArrayTableDataModel feedbackDataModel = new GenericObjectArrayTableDataModel(rowsFeedbackStep, numOfLines);
       
        UserManager um = UserManager.getInstance();
        Manager secMgr = ManagerFactory.getManager();
       
        BulkActionModule bam = new BulkActionModule();
        BulkAction ba = (BulkAction) bulkActions.get(bulkType);

        // TODO: as:b may be add additional class hierarchy (ask pb !!!)
        if ((ba instanceof BulkActionSetNodeScore)){
          ((BulkActionSetNodeScore) ba).setCourseNode((AssessableCourseNode)currentCourseNode);
        }else if ((ba instanceof BulkActionSetNodePassed)){
          ((BulkActionSetNodePassed) ba).setCourseNode((AssessableCourseNode)currentCourseNode);
        }else if ((ba instanceof BulkActionSetNodeUserComment)){
          ((BulkActionSetNodeUserComment) ba).setCourseNode((AssessableCourseNode)currentCourseNode);
        }
       
        List identitiesAndTheirAssessments = new ArrayList(feedbackDataModel.getRowCount());
        // read values from the column which the user has defined as olat key (e.g. username)
        // and add them to a list.
        for(int i = 0; i < feedbackDataModel.getRowCount(); i ++ ){
          String val = (String) feedbackDataModel.getValueAt(i, selectedColForOlatKey);
          val = val.trim();
          String assessment = (String) feedbackDataModel.getValueAt(i, colForBulk);
          Identity identity = null;

          if (selectedOlatKey == 0){ // username
              identity = secMgr.findIdentityByName(val);
          }else if (selectedOlatKey == 1) { // email
            identity = um.findIdentityByEmail(val);
          }
          identitiesAndTheirAssessments.add(new Object[]{identity,assessment});
        }
        List bulkResults = bam.apply(identitiesAndTheirAssessments, ba);
       
        // add the bulk results to the data model
        for(int i = 0; i < feedbackDataModel.getRowCount(); i++ ){           
          Object[] feedback = (Object[]) bulkResults.get(i);
          feedbackDataModel.setValueAt(feedback[2],i, numOfValPerLine);
View Full Code Here


        GenericObjectArrayTableDataModel sepValFinModel = new GenericObjectArrayTableDataModel(rowsFourthStep, numOfLines);
         
        UserManager um = UserManager.getInstance();
        Manager secMgr = ManagerFactory.getManager();
       
        BulkActionModule bam = new BulkActionModule();
        BulkAction ba = (BulkAction) bulkActions.get(bulk);
        List identities = new ArrayList(sepValFinModel.getRowCount());
       
        // read values from the column which the user has defined as olat key (e.g. username)
        // and add them to a list.
        for(int i = 0; i < sepValFinModel.getRowCount(); i ++ ){
          String val = (String) sepValFinModel.getValueAt(i, selectedColForOlatKey);
          val = val.trim();
          Identity identity = null;

          if (selectedOlatKey == 0) { // matrikelnumber
            Map<String, String> searchValue = new HashMap<String, String>();
            searchValue.put(UserConstants.INSTITUTIONALUSERIDENTIFIER, val);
            List identitiesFoundByInst = ManagerFactory.getManager().getIdentitiesByPowerSearch(null, searchValue, true, null, null, null, null, null, null);
            //FIXME:as:b error handling if there is more than one identity found by institutionalUserIdentifier
            // see also in BulkAssessmentWizardController
            if (identitiesFoundByInst.size() == 1){
              identity = (Identity) identitiesFoundByInst.get(0);
            }
          }else if (selectedOlatKey == 1){ // username
              identity = secMgr.findIdentityByName(val);
          }else if (selectedOlatKey == 2) { // email
            identity = um.findIdentityByEmail(val);
          }
          identities.add(identity);
        }
        // get results from the user chosen bulk action for every identity
        List bulkResults = bam.apply(identities, ba);
        // add the bulk results to the data model
        for(int i = 0; i < sepValFinModel.getRowCount(); i++ ){
          String result = (String) bulkResults.get(i);
          sepValFinModel.setValueAt(result,i,colForBulk);
        }
View Full Code Here

TOP

Related Classes of org.olat.core.util.bulk.BulkActionModule

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.