finishedVC = new VelocityContainer("finished", VELOCITY_ROOT + "/finished.html", trans, this);
backLinkFin = LinkFactory.createLinkBack(finishedVC, this);
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);