diff --git a/documents/api-reference.ods b/documents/api-reference.ods index f3635a6..6a14368 100644 Binary files a/documents/api-reference.ods and b/documents/api-reference.ods differ diff --git a/pom.xml b/pom.xml index 3babdc0..41f0cb4 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ info.supercharge.api supercharge.info-api - 6.1.0 + 6.2.0 diff --git a/service-dao/pom.xml b/service-dao/pom.xml index 7b349fa..204aede 100644 --- a/service-dao/pom.xml +++ b/service-dao/pom.xml @@ -3,7 +3,7 @@ info.supercharge.api supercharge.info-api - 6.1.0 + 6.2.0 4.0.0 diff --git a/service-dao/src/main/java/com/redshiftsoft/tesla/dao/site/SiteDAO.java b/service-dao/src/main/java/com/redshiftsoft/tesla/dao/site/SiteDAO.java index db609c1..93326dd 100644 --- a/service-dao/src/main/java/com/redshiftsoft/tesla/dao/site/SiteDAO.java +++ b/service-dao/src/main/java/com/redshiftsoft/tesla/dao/site/SiteDAO.java @@ -3,6 +3,8 @@ import com.google.common.collect.Maps; import com.redshiftsoft.tesla.dao.BaseDAO; + +import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.support.GeneratedKeyHolder; import org.springframework.jdbc.support.KeyHolder; import org.springframework.stereotype.Component; @@ -75,4 +77,9 @@ public void delete(int siteId) { addressDAO.delete(site.getAddress().getId()); getJdbcTemplate().update("DELETE FROM site WHERE site_id=?", siteId); } + + public List getDistinctHosts() { + String SQL = "SELECT DISTINCT facility_name FROM site WHERE facility_name IS NOT NULL ORDER BY facility_name"; + return getJdbcTemplate().queryForList(SQL, String.class); + } } diff --git a/service-war/pom.xml b/service-war/pom.xml index 5bac331..905c83d 100644 --- a/service-war/pom.xml +++ b/service-war/pom.xml @@ -3,7 +3,7 @@ info.supercharge.api supercharge.info-api - 6.1.0 + 6.2.0 4.0.0 diff --git a/service-war/src/main/java/com/redshiftsoft/tesla/web/mvc/siteadmin/SiteEditController.java b/service-war/src/main/java/com/redshiftsoft/tesla/web/mvc/siteadmin/SiteEditController.java index 1b70e28..204dc3d 100644 --- a/service-war/src/main/java/com/redshiftsoft/tesla/web/mvc/siteadmin/SiteEditController.java +++ b/service-war/src/main/java/com/redshiftsoft/tesla/web/mvc/siteadmin/SiteEditController.java @@ -131,6 +131,7 @@ private JsonResponse handleEdit(User user, Site site, SiteEditDTO.NotifyEnum not Site oldSite = siteDAO.getById(site.getId()); SiteStatus oldSiteStatus = oldSite.getStatus(); + int oldStallCount = oldSite.getStallCount(); boolean changes = siteDiffLogger.record(user, oldSite, site); if (!changes) { @@ -141,7 +142,7 @@ private JsonResponse handleEdit(User user, Site site, SiteEditDTO.NotifyEnum not messages.add(format("UPDATED site '%s'", site.getName())); siteDAO.update(site); - if (oldSiteStatus != site.getStatus() && !SiteEditDTO.NotifyEnum.no.equals(notify)) { + if ((oldSiteStatus != site.getStatus() || oldStallCount != site.getStallCount()) && !SiteEditDTO.NotifyEnum.no.equals(notify)) { ChangeLogEdit changeLogEdit = ChangeLogEdit.toPersist(site.getId(), ChangeType.UPDATE, site.getStatus(), Instant.now(), Instant.now(), SiteEditDTO.NotifyEnum.yes.equals(notify), user.getId(), site.getStallCount()); if (changeLogDAO.getSiteList(site.getId()).isEmpty()) { changeLogEdit.setChangeType(ChangeType.ADD); @@ -282,4 +283,20 @@ public List listChangeEdits(@RequestParam int siteId) { } + // - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // + // get distinct list of hosts (facilityName) across all sites + // + // - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @PreAuthorize("hasAnyRole('editor')") + @RequestMapping(method = RequestMethod.GET, value = "/allHosts") + @ResponseBody + @Transactional + public List allHosts() { + return siteDAO.getDistinctHosts().stream() + .collect(Collectors.toList()); + } + + } diff --git a/web-scrape/pom.xml b/web-scrape/pom.xml index 5580943..1dfd320 100644 --- a/web-scrape/pom.xml +++ b/web-scrape/pom.xml @@ -3,7 +3,7 @@ info.supercharge.api supercharge.info-api - 6.1.0 + 6.2.0 4.0.0