private void cloneNotificationGroup(String notificationGroupName) { if (notificationGroupName == null) { return; } try { NotificationGroupsDao notificationGroupsDao = new NotificationGroupsDao(false); NotificationGroup notificationGroup = notificationGroupsDao.getNotificationGroupByName(notificationGroupName); List<NotificationGroup> allNotificationGroups = notificationGroupsDao.getAllDatabaseObjectsInTable(); notificationGroupsDao.close(); if ((notificationGroup != null) && (notificationGroup.getName() != null)) { Set<String> allNotificationGroupNames = new HashSet<>(); for (NotificationGroup currentNotificationGroup : allNotificationGroups) { if (currentNotificationGroup.getName() != null) allNotificationGroupNames.add(currentNotificationGroup.getName()); } NotificationGroup clonedNotificationGroup = NotificationGroup.copy(notificationGroup); clonedNotificationGroup.setId(-1); String clonedAlterName = StatsAggHtmlFramework.createCloneName( notificationGroup.getName(), allNotificationGroupNames); clonedNotificationGroup.setName(clonedAlterName); clonedNotificationGroup.setUppercaseName(clonedAlterName.toUpperCase()); NotificationGroupsLogic notificationGroupsLogic = new NotificationGroupsLogic(); notificationGroupsLogic.alterRecordInDatabase(clonedNotificationGroup); } } catch (Exception e) { logger.error(e.toString() + System.lineSeparator() + StackTrace.getStringFromStackTrace(e)); } }