*
* @throws EMFUserError
*/
private void importAlarmContact(boolean overwrite) throws EMFUserError {
logger.debug("IN");
SbiAlarmContact exportedAlarmContact = null;
try {
List exportedAlarmContacts = importer.getAllExportedSbiObjects(sessionExpDB, "SbiAlarmContact", null);
Iterator iterSbiAlarmContact = exportedAlarmContacts.iterator();
while (iterSbiAlarmContact.hasNext()) {
exportedAlarmContact = (SbiAlarmContact) iterSbiAlarmContact.next();
Integer oldId = exportedAlarmContact.getId();
Integer existingAlarmContactId = null;
Map alarmContactIdAss = metaAss.getAlarmContactIDAssociation();
Set alarmContactIdAssSet = alarmContactIdAss.keySet();
if (alarmContactIdAssSet.contains(oldId) && !overwrite) {
metaLog.log("Exported alarm Contact " + exportedAlarmContact.getName() + " not inserted"
+ " because it has the same label of an existing alarm Contact");
continue;
} else {
existingAlarmContactId = (Integer) alarmContactIdAss.get(oldId);
}
if (existingAlarmContactId != null) {
logger.info("The Alarm Contact with id:[" + exportedAlarmContact.getId() + "] is just present. It will be updated.");
metaLog.log("The Alarm Contact with name = [" + exportedAlarmContact.getName() + "] will be updated.");
SbiAlarmContact existingAlarmContact = ImportUtilities.modifyExistingSbiAlarmContacts(exportedAlarmContact, sessionCurrDB, existingAlarmContactId, metaAss,importer);
sessionCurrDB.update(existingAlarmContact);
} else {
SbiAlarmContact newAlarmContact = ImportUtilities.makeNewSbiAlarmContacts(exportedAlarmContact, sessionCurrDB, metaAss, importer);
sessionCurrDB.save(newAlarmContact);
metaLog.log("Inserted new Alarm Contact " + newAlarmContact.getName());
Integer newId = newAlarmContact.getId();
metaAss.insertCoupleAlarmContact(oldId, newId);
}
}
} catch (Exception e) {
if (exportedAlarmContact != null) {