*
* @throws EMFUserError
*/
private void importKpiInstPeriod(boolean overwrite) throws EMFUserError {
logger.debug("IN");
SbiKpiInstPeriod exportedKpiInstPeriod = null;
try {
List exportedKpiInstPeriodList = importer.getAllExportedSbiObjects(sessionExpDB, "SbiKpiInstPeriod", null);
Iterator iterSbiKpiInstPeriod = exportedKpiInstPeriodList.iterator();
while (iterSbiKpiInstPeriod.hasNext()) {
exportedKpiInstPeriod = (SbiKpiInstPeriod) iterSbiKpiInstPeriod.next();
Integer oldId = exportedKpiInstPeriod.getKpiInstPeriodId();
Integer existingKpiInstPeriodId = null;
Map kpiInstPeriodIdAss = metaAss.getKpiInstPeriodIDAssociation();
Set kpiInstPeriodIdAssSet = kpiInstPeriodIdAss.keySet();
if (kpiInstPeriodIdAssSet.contains(oldId) && !overwrite) {
metaLog.log("Exported kpiInstPeriod with id " + exportedKpiInstPeriod.getKpiInstPeriodId() + " and" +
" referencing Periodicity with name "+exportedKpiInstPeriod.getSbiKpiPeriodicity().getName() + "" +
" and kpiInstance with previous id "+ exportedKpiInstPeriod.getSbiKpiInstance().getIdKpiInstance()+" not inserted because it has the same name of an existing resource");
continue;
} else {
existingKpiInstPeriodId = (Integer) kpiInstPeriodIdAss.get(oldId);
}
if (existingKpiInstPeriodId != null) {
logger.info("The kpiInstPeriod with id:[" + exportedKpiInstPeriod.getKpiInstPeriodId() + "] is just present. It will be updated.");
metaLog.log("The kpiInstPeriod referencing periodicity with name = [" + exportedKpiInstPeriod.getSbiKpiPeriodicity().getName() + "] and kpi instance with prev Id [ "+exportedKpiInstPeriod.getSbiKpiInstance().getIdKpiInstance() +" ]will be updated.");
SbiKpiInstPeriod existingKpiInstPeriod = ImportUtilities.modifyExistingSbiKpiInstPeriod(exportedKpiInstPeriod, sessionCurrDB, existingKpiInstPeriodId, metaAss,importer);
sessionCurrDB.update(existingKpiInstPeriod);
} else {
SbiKpiInstPeriod newKpiInstPeriod = ImportUtilities.makeNewSbiKpiInstPeriod(exportedKpiInstPeriod, sessionCurrDB, metaAss, importer);
sessionCurrDB.save(newKpiInstPeriod);
metaLog.log("Inserted new kpiInstPeriod referring to periodicity " + newKpiInstPeriod.getSbiKpiPeriodicity().getName()+" and kpi instance "+newKpiInstPeriod.getSbiKpiInstance().getIdKpiInstance());
Integer newId = newKpiInstPeriod.getKpiInstPeriodId();
metaAss.insertCoupleKpiInstPeriod(oldId, newId);
}
}
} catch (Exception e) {
if (exportedKpiInstPeriod != null) {