Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

duplicate dashboard check flow updated, removed ignore case #268

Merged
merged 1 commit into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>api</artifactId>
<packaging>jar</packaging>
<name>${project.groupId}:${project.artifactId}</name>
<version>3.4.32</version>
<version>3.4.33</version>
<description>Hygieia Rest API Layer</description>
<url>https://github.com/Hygieia/api</url>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections4.IterableUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Expand Down Expand Up @@ -839,7 +840,11 @@ private void duplicateDashboardErrorCheck(Dashboard dashboard) throws HygieiaExc
String compName = dashboard.getConfigurationItemBusAppName();

if(appName != null && !appName.isEmpty() && compName != null && !compName.isEmpty()){
Dashboard existingDashboard = dashboardRepository.findByConfigurationItemBusServNameIgnoreCaseAndConfigurationItemBusAppNameIgnoreCase(appName, compName);
Iterable<Dashboard> dashboards = dashboardRepository.findAllByConfigurationItemBusServNameAndConfigurationItemBusAppName(appName, compName);
Dashboard existingDashboard = null;
if (!IterableUtils.isEmpty(dashboards)) {
existingDashboard = dashboards.iterator().next();
}
if(existingDashboard != null && !existingDashboard.getId().equals(dashboard.getId())){
throw new HygieiaException("Existing Dashboard: " + existingDashboard.getTitle(), HygieiaException.DUPLICATE_DATA);
}
Expand Down