*
* @throws EMFUserError
*/
private void importThresholdValue(boolean overwrite) throws EMFUserError {
logger.debug("IN");
SbiThresholdValue exportedThValue = null;
try {
List exportedThValues = importer.getAllExportedSbiObjects(sessionExpDB, "SbiThresholdValue", null);
Iterator iterSbiThValues = exportedThValues.iterator();
while (iterSbiThValues.hasNext()) {
exportedThValue = (SbiThresholdValue) iterSbiThValues.next();
Integer oldId = exportedThValue.getIdThresholdValue();
Integer existingThValueId = null;
Map thValuesIdAss = metaAss.getTresholdValueIDAssociation();
Set thValuesIdAssSet = thValuesIdAss.keySet();
if (thValuesIdAssSet.contains(oldId) && !overwrite) { // it could have been already inserted
metaLog.log("Exported threshold values " + exportedThValue.getLabel() + " not inserted"
+ " because it has the same label of an existing threshold value");
continue;
} else {
existingThValueId = (Integer) thValuesIdAss.get(oldId);
}
if (existingThValueId != null) {
logger.info("The threshold value with id:[" + exportedThValue.getIdThresholdValue() + "] is just present. It will be updated.");
metaLog.log("The threshold value with code = [" + exportedThValue.getLabel() + "] will be updated.");
SbiThresholdValue existingThValue = ImportUtilities.modifyExistingSbiThresholdValue(exportedThValue, sessionCurrDB, existingThValueId, metaAss,importer);
sessionCurrDB.update(existingThValue);
} else {
SbiThresholdValue newThresholdValue = ImportUtilities.makeNewSbiThresholdValue(exportedThValue, sessionCurrDB, metaAss,importer);
sessionCurrDB.save(newThresholdValue);
metaLog.log("Inserted new Threshold Value " + newThresholdValue.getLabel());
Integer newId = newThresholdValue.getIdThresholdValue();
metaAss.insertCoupleThresholdValue(oldId, newId);
}
}
} catch (Exception e) {