*
* @throws EMFUserError
*/
private void importLovs(boolean overwrite) throws EMFUserError {
logger.debug("IN");
SbiLov exportedLov = null;
try {
List exportedLovs = importer.getAllExportedSbiObjects(sessionExpDB, "SbiLov", null);
Iterator iterSbiLovs = exportedLovs.iterator();
while (iterSbiLovs.hasNext()) {
exportedLov = (SbiLov) iterSbiLovs.next();
Integer oldId = exportedLov.getLovId();
Integer existingLovId = null;
Map lovIdAss = metaAss.getLovIDAssociation();
Set lovIdAssSet = lovIdAss.keySet();
if (lovIdAssSet.contains(oldId) && !overwrite) {
metaLog.log("Exported lov " + exportedLov.getName() + " not inserted"
+ " because it has the same label of an existing lov");
continue;
} else {
existingLovId = (Integer) lovIdAss.get(oldId);
}
if (existingLovId != null) {
logger.info("The lov with label:[" + exportedLov.getLabel() + "] is just present. It will be updated.");
metaLog.log("The lov with label = [" + exportedLov.getLabel() + "] will be updated.");
SbiLov existinglov = ImportUtilities.modifyExistingSbiLov(exportedLov, sessionCurrDB, existingLovId, getUserAssociation().getDsExportedToUserLabel());
ImportUtilities.associateWithExistingEntities(existinglov, exportedLov, sessionCurrDB, importer, metaAss);
sessionCurrDB.update(existinglov);
} else {
SbiLov newlov = ImportUtilities.makeNewSbiLov(exportedLov, getUserAssociation().getDsExportedToUserLabel());
ImportUtilities.associateWithExistingEntities(newlov, exportedLov, sessionCurrDB, importer, metaAss);
sessionCurrDB.save(newlov);
metaLog.log("Inserted new lov " + newlov.getName());
Integer newId = newlov.getLovId();
metaAss.insertCoupleLov(oldId, newId);
}
}
} catch (Exception e) {
if (exportedLov != null) {