while (iterGrantNodes.hasNext()) {
SbiOrgUnitGrantNodes grantNode = (SbiOrgUnitGrantNodes) iterGrantNodes.next();
Map assGrantNodes = metaAss.getOuGrantNodesAssociation();
SbiOrgUnitGrantNodesId existingGrantNodeId = null;
Set assGrantNodesSet = assGrantNodes.keySet();
if (assGrantNodesSet.contains(grantNode.getId()) && !overwrite) {
metaLog.log("Exported association of grant node with grant id " + grantNode.getId().getGrantId()+ " not inserted"
+ " because already existing into the current database");
continue;
} else {
existingGrantNodeId = (SbiOrgUnitGrantNodesId) assGrantNodes.get(grantNode.getId());
}
if (existingGrantNodeId != null) {
metaLog.log("Exported association of grant node with grant id " + grantNode.getId().getGrantId() + "] will be updated.");
SbiOrgUnitGrantNodes existingGrantNode = ImportUtilities.modifyExistingOuGrantNode(grantNode, sessionCurrDB, existingGrantNodeId);
ImportUtilities.entitiesAssociationsOuGrantNode(existingGrantNode.getId(), grantNode, existingGrantNode, sessionCurrDB, metaAss, importer);
sessionCurrDB.update(existingGrantNode);
} else {
SbiOrgUnitGrantNodes newGrantNode = ImportUtilities.makeNewOuGrantNode(grantNode, sessionCurrDB, metaAss, importer);
sessionCurrDB.save(newGrantNode);
metaLog.log("Inserted new grant node with grant id " + grantNode.getId().getGrantId() );
SbiOrgUnitGrantNodesId newId = newGrantNode.getId();
sessionExpDB.evict(grantNode);
metaAss.insertCoupleIdOuGrantNodesAssociation(grantNode.getId(), newId);
}
}