*
* @throws EMFUserError
*/
private void importBIObjectLinks() throws EMFUserError {
logger.debug("IN");
SbiSubreports objlink = null;
try {
List exportedBIObjectsLinks = importer.getAllExportedSbiObjects(sessionExpDB, "SbiSubreports", null);
Iterator iterSbiObjLinks = exportedBIObjectsLinks.iterator();
while (iterSbiObjLinks.hasNext()) {
objlink = (SbiSubreports) iterSbiObjLinks.next();
// get biobjects
SbiObjects masterBIObj = objlink.getId().getMasterReport();
SbiObjects subBIObj = objlink.getId().getSubReport();
Integer masterid = masterBIObj.getBiobjId();
Integer subid = subBIObj.getBiobjId();
// get association of object
Map biobjIdAss = metaAss.getBIobjIDAssociation();
// try to get from association the id associate to the exported
// metadata
Integer newMasterId = (Integer) biobjIdAss.get(masterid);
Integer newSubId = (Integer) biobjIdAss.get(subid);
// build a new SbiSubreport
// build a new id for the SbiSubreport
SbiSubreportsId sbiSubReportsId = objlink.getId();
SbiSubreportsId newSubReportsId = new SbiSubreportsId();
if (sbiSubReportsId != null) {
SbiObjects master = sbiSubReportsId.getMasterReport();
SbiObjects sub = sbiSubReportsId.getMasterReport();
SbiObjects newMaster = ImportUtilities.makeNewSbiObject(master, newMasterId);
SbiObjects newSub = ImportUtilities.makeNewSbiObject(sub, newSubId);
newSubReportsId.setMasterReport(newMaster);
newSubReportsId.setSubReport(newSub);
}
SbiSubreports newSubReport = new SbiSubreports();
newSubReport.setId(newSubReportsId);
// check if the association between metadata already exist
Map unique = new HashMap();
unique.put("masterid", newMasterId);
unique.put("subid", newSubId);
Object existObj = importer.checkExistence(unique, sessionCurrDB, new SbiSubreports());
if (existObj == null) {
sessionCurrDB.save(newSubReport);
metaLog.log("Inserted new link between master object " + masterBIObj.getLabel()
+ " and sub object " + subBIObj.getLabel());
}