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

Commit

Permalink
duplicate dashboard check flow updated, removed ignore case (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
nameisaravind authored Apr 4, 2022
1 parent e4dbe1f commit 758dbf8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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

0 comments on commit 758dbf8

Please sign in to comment.