*
* @throws EMFUserError
*/
private void importFunctRoles() throws EMFUserError {
logger.debug("IN");
SbiFuncRole functrole = null;
try {
List exportedFunctRoles = importer.getAllExportedSbiObjects(sessionExpDB, "SbiFuncRole", null);
Iterator iterSbiFunctRoles = exportedFunctRoles.iterator();
while (iterSbiFunctRoles.hasNext()) {
functrole = (SbiFuncRole) iterSbiFunctRoles.next();
// get ids of exported role, function and state associzted
Integer functid = functrole.getId().getFunction().getFunctId();
Integer roleid = functrole.getId().getRole().getExtRoleId();
Integer stateid = functrole.getId().getState().getValueId();
// get association of roles and paruses
Map functIdAss = metaAss.getFunctIDAssociation();
Map roleIdAss = metaAss.getRoleIDAssociation();
// try to get from association the id associate to the exported
// metadata
Integer newFunctid = (Integer) functIdAss.get(functid);
Integer newRoleid = (Integer) roleIdAss.get(roleid);
// build a new SbiFuncRole
SbiFuncRole newFunctRole = ImportUtilities.makeNewSbiFunctRole(functrole, newFunctid, newRoleid);
// get sbidomain of the current system
String stateCd = functrole.getStateCd();
Map uniqueDom = new HashMap();
uniqueDom.put("valuecd", stateCd);
uniqueDom.put("domaincd", SpagoBIConstants.PERMISSION_ON_FOLDER);
SbiDomains existDom = (SbiDomains) importer.checkExistence(uniqueDom, sessionCurrDB, new SbiDomains());
if (existDom != null) {
newFunctRole.getId().setState(existDom);
newFunctRole.setStateCd(existDom.getValueCd());
}
// check if the association between metadata already exist
Map unique = new HashMap();
unique.put("stateid", existDom.getValueId());
unique.put("roleid", newRoleid);
unique.put("functionid", newFunctid);
Object existObj = importer.checkExistence(unique, sessionCurrDB, new SbiFuncRole());
if (existObj == null) {
sessionCurrDB.save(newFunctRole);
metaLog.log("Inserted new association between function "
+ functrole.getId().getFunction().getName() + " and role "
+ functrole.getId().getRole().getName());