logger.debug("IN");
try {
List exportedObjPars = importer.getFilteredExportedSbiObjects(sessionExpDB, "SbiObjPar", "sbiObject.biobjId", exportedBIObjectId);
Iterator iterSbiObjPar = exportedObjPars.iterator();
while (iterSbiObjPar.hasNext()) {
SbiObjPar objpar = (SbiObjPar) iterSbiObjPar.next();
SbiParameters param = objpar.getSbiParameter();
SbiObjects biobj = objpar.getSbiObject();
Integer oldParamId = param.getParId();
Integer oldBIObjId = biobj.getBiobjId();
Map assBIObj = metaAss.getBIobjIDAssociation();
Map assParams = metaAss.getParameterIDAssociation();
Integer newParamId = (Integer) assParams.get(oldParamId);
Integer newBIObjId = (Integer) assBIObj.get(oldBIObjId);
if (newParamId != null) {
SbiParameters newParam = ImportUtilities.makeNewSbiParameter(param, newParamId);
objpar.setSbiParameter(newParam);
}
if (newBIObjId != null) {
SbiObjects newObj = ImportUtilities.makeNewSbiObject(biobj, newBIObjId);
objpar.setSbiObject(newObj);
}
Integer oldId = objpar.getObjParId();
// check if the association already exist
Map uniqueMap = new HashMap();
uniqueMap.put("biobjid", newBIObjId);
uniqueMap.put("paramid", newParamId);
uniqueMap.put("urlname", objpar.getParurlNm());
Object existObj = importer.checkExistence(uniqueMap, sessionCurrDB, new SbiObjPar());
if (existObj != null) {
metaLog.log("Exported association between object " + objpar.getSbiObject().getName() + " "
+ " and parameter " + objpar.getSbiParameter().getName() + " with url name "
+ objpar.getParurlNm() + " not inserted"
+ " because already existing into the current database");
continue;
}
SbiObjPar newObjpar = ImportUtilities.makeNewSbiObjpar(objpar);
sessionCurrDB.save(newObjpar);
metaLog.log("Inserted new biobject parameter with " + newObjpar.getParurlNm() + " for biobject "
+ newObjpar.getSbiObject().getName());
Integer newId = newObjpar.getObjParId();
sessionExpDB.evict(objpar);
metaAss.insertCoupleObjpar(oldId, newId);
}
} catch (HibernateException he) {
logger.error("Error while inserting object ", he);