}
}// OU hierarchy SbiOrgUnitHierarchies
List exportedSbiOuHierList = importer.getAllExportedSbiObjects(sessionExpDB, "SbiOrgUnitHierarchies", null);
Iterator iterOUHierVal = exportedSbiOuHierList.iterator();
while (iterOUHierVal.hasNext()) {
SbiOrgUnitHierarchies ouHierVal = (SbiOrgUnitHierarchies) iterOUHierVal.next();
// check if the association already exist
Map uniqueMap = new HashMap();
String label = ouHierVal.getLabel();
String company = ouHierVal.getCompany();
uniqueMap.put("label", label);
uniqueMap.put("company", company);
Object existObj = importer.checkExistence(uniqueMap, sessionCurrDB, new SbiOrgUnitHierarchies());
if (existObj != null) {
SbiOrgUnitHierarchies dsCurr = (SbiOrgUnitHierarchies) existObj;
metaAss.insertCoupleIdOuHierarchyAssociation(ouHierVal.getId(), dsCurr.getId());
metaLog.log("Found an existing ou hierarchy " + dsCurr.getName() + " with "
+ "the same label of one exported ou hierarchy");
}
/*
String label = ouHierVal.getLabel();
Object existObj = importer.checkExistence(label, sessionCurrDB, new SbiOrgUnitHierarchies());
if (existObj != null) {
SbiOrgUnitHierarchies dsCurr = (SbiOrgUnitHierarchies) existObj;
metaAss.insertCoupleIdOuHierarchyAssociation(ouHierVal.getId(), dsCurr.getId());
metaLog.log("Found an existing ou hierarchy " + dsCurr.getName() + " with "
+ "the same label of one exported ou hierarchy");
}
*/
}// OU node SbiOrgUnitNodes
List exportedSbiOrgUnitNodeList = importer.getAllExportedSbiObjects(sessionExpDB, "SbiOrgUnitNodes", null);
Iterator iterOUNodeVal = exportedSbiOrgUnitNodeList.iterator();
while (iterOUNodeVal.hasNext()) {
SbiOrgUnitNodes ouVal = (SbiOrgUnitNodes) iterOUNodeVal.next();
// check if the association already exist
Map uniqueMap = new HashMap();
Map ouAss = metaAss.getOuAssociation();
Map hierAss = metaAss.getOuHierarchiesAssociation();
if(ouVal.getSbiOrgUnit() != null){
Integer newOuId = (Integer)ouAss.get(ouVal.getSbiOrgUnit().getId());
uniqueMap.put("ouId", newOuId);
Integer newHierId = (Integer)hierAss.get(ouVal.getSbiOrgUnitHierarchies().getId());
uniqueMap.put("hierarchyId", newHierId);
}
Object existObj = importer.checkExistence(uniqueMap, sessionCurrDB, new SbiOrgUnitNodes());
if (existObj != null) {
SbiOrgUnitNodes dsCurr = (SbiOrgUnitNodes) existObj;
metaAss.insertCoupleIdOuNodeAssociation(ouVal.getNodeId(), dsCurr.getNodeId());
metaLog.log("Found an existing ou node " + dsCurr.getNodeId() + " with "
+ "the same organizational unit and hierarchy of one exported ou node");
}
}// OU grants SbiOrgUnitGrant
List exportedSbiOUGrantList = importer.getAllExportedSbiObjects(sessionExpDB, "SbiOrgUnitGrant", null);
Iterator iterOUGrantVal = exportedSbiOUGrantList.iterator();
while (iterOUGrantVal.hasNext()) {
SbiOrgUnitGrant ouGrantVal = (SbiOrgUnitGrant) iterOUGrantVal.next();
String label = ouGrantVal.getLabel();
Object existObj = importer.checkExistence(label, sessionCurrDB, new SbiOrgUnitGrant());
if (existObj != null) {
SbiOrgUnitGrant dsCurr = (SbiOrgUnitGrant) existObj;
metaAss.insertCoupleIdOuGrantAssociation(ouGrantVal.getId(), dsCurr.getId());
metaLog.log("Found an existing ou grant " + dsCurr.getId() + " with "
+ "the same label of one exported ou grant");
}
}// OU grant nodes SbiOrgUnitGrantNodes
List exportedSbiOUGrantNodeList = importer.getAllExportedSbiObjects(sessionExpDB, "SbiOrgUnitGrantNodes", null);
Iterator iterOUGrantNodesVal = exportedSbiOUGrantNodeList.iterator();
while (iterOUGrantNodesVal.hasNext()) {
SbiOrgUnitGrantNodes ouGrantNode = (SbiOrgUnitGrantNodes) iterOUGrantNodesVal.next();
Map uniqueMap = new HashMap();
Map nodeAss = metaAss.getOuNodeAssociation();
Map miAss = metaAss.getModelInstanceIDAssociation();
Map grantAss = metaAss.getOuGrantAssociation();
if(ouGrantNode.getId() != null){
Integer newGrantId = (Integer)grantAss.get(ouGrantNode.getId().getGrantId());
uniqueMap.put("grantId", newGrantId );
Integer newNodeId = (Integer)nodeAss.get(ouGrantNode.getId().getNodeId());
uniqueMap.put("nodeId", newNodeId);
Integer newMiId = (Integer)miAss.get(ouGrantNode.getId().getKpiModelInstNodeId());
uniqueMap.put("modelInstId", newMiId);
}
Object existObj = importer.checkExistence(uniqueMap, sessionCurrDB, new SbiOrgUnitGrantNodes());
if (existObj != null) {
SbiOrgUnitGrantNodes dsCurr = (SbiOrgUnitGrantNodes) existObj;
metaAss.insertCoupleIdOuGrantNodesAssociation(ouGrantNode.getId(), dsCurr.getId());
metaLog.log("Found an existing ou grant node with grant id " + dsCurr.getId().getGrantId() + " with "
+ "the same id of one exported ou grant node");
}
}
logger.debug("OUT");
}