diff --git a/src/fr/devinsy/statoolinfos/core/OrganizationComparator.java b/src/fr/devinsy/statoolinfos/core/OrganizationComparator.java index 0321b2c..f7cc770 100644 --- a/src/fr/devinsy/statoolinfos/core/OrganizationComparator.java +++ b/src/fr/devinsy/statoolinfos/core/OrganizationComparator.java @@ -16,6 +16,7 @@ public class OrganizationComparator implements Comparator { NAME, SERVICE_COUNT, + REVERSE_SERVICE_COUNT, USER_COUNT } @@ -77,11 +78,23 @@ public class OrganizationComparator implements Comparator { default: case NAME: - result = CompareUtils.compare(getName(alpha), getName(bravo)); + result = CompareUtils.compareIgnoreCase(getName(alpha), getName(bravo)); break; case SERVICE_COUNT: result = CompareUtils.compare(getServiceCount(alpha), getServiceCount(bravo)); + if (result == 0) + { + result = CompareUtils.compareIgnoreCase(getName(alpha), getName(bravo)); + } + break; + + case REVERSE_SERVICE_COUNT: + result = -CompareUtils.compare(getServiceCount(alpha), getServiceCount(bravo)); + if (result == 0) + { + result = CompareUtils.compareIgnoreCase(getName(alpha), getName(bravo)); + } break; case USER_COUNT: diff --git a/src/fr/devinsy/statoolinfos/core/Organizations.java b/src/fr/devinsy/statoolinfos/core/Organizations.java index 671cddc..8af871a 100644 --- a/src/fr/devinsy/statoolinfos/core/Organizations.java +++ b/src/fr/devinsy/statoolinfos/core/Organizations.java @@ -87,6 +87,21 @@ public class Organizations extends ArrayList return result; } + /** + * Sort by reverse service count. + * + * @return the organizations + */ + public Organizations sortByReverseServiceCount() + { + Organizations result; + + result = sort(OrganizationComparator.Sorting.REVERSE_SERVICE_COUNT); + + // + return result; + } + /** * Sort by service count. * @@ -101,5 +116,4 @@ public class Organizations extends ArrayList // return result; } - } diff --git a/src/fr/devinsy/statoolinfos/core/ServiceComparator.java b/src/fr/devinsy/statoolinfos/core/ServiceComparator.java index cdc4145..b297dd6 100644 --- a/src/fr/devinsy/statoolinfos/core/ServiceComparator.java +++ b/src/fr/devinsy/statoolinfos/core/ServiceComparator.java @@ -15,7 +15,8 @@ public class ServiceComparator implements Comparator public enum Sorting { NAME, - USER_COUNT + USER_COUNT, + REVERSE_USER_COUNT } private Sorting sorting; @@ -76,11 +77,23 @@ public class ServiceComparator implements Comparator { default: case NAME: - result = CompareUtils.compare(getName(alpha), getName(bravo)); + result = CompareUtils.compareIgnoreCase(getName(alpha), getName(bravo)); break; case USER_COUNT: result = CompareUtils.compare(getUserCount(alpha), getUserCount(bravo)); + if (result == 0) + { + result = CompareUtils.compareIgnoreCase(getName(alpha), getName(bravo)); + } + break; + + case REVERSE_USER_COUNT: + result = -CompareUtils.compare(getUserCount(alpha), getUserCount(bravo)); + if (result == 0) + { + result = CompareUtils.compareIgnoreCase(getName(alpha), getName(bravo)); + } break; } } diff --git a/src/fr/devinsy/statoolinfos/htmlize/FederationPage.java b/src/fr/devinsy/statoolinfos/htmlize/FederationPage.java index 10221bc..5eaabae 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/FederationPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/FederationPage.java @@ -62,7 +62,7 @@ public class FederationPage data.setContent("serviceCount", federation.getServiceCount()); int index = 0; - for (Organization organization : federation.getOrganizations().sortByServiceCount().reverse()) + for (Organization organization : federation.getOrganizations().sortByReverseServiceCount()) { data.setAttribute("organizationListLine", index, "organizationListLineNameLink", "href", organization.getTechnicalName() + ".xhtml"); data.setAttribute("organizationListLine", index, "organizationListLineLogo", "src", organization.getTechnicalName() + "-logo.png"); diff --git a/src/fr/devinsy/statoolinfos/htmlize/PropertiesFilesPage.java b/src/fr/devinsy/statoolinfos/htmlize/PropertiesFilesPage.java index 012f9b0..4699e80 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/PropertiesFilesPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/PropertiesFilesPage.java @@ -66,7 +66,7 @@ public class PropertiesFilesPage // int index = 0; - for (PropertiesFileStat stat : stats) + for (PropertiesFileStat stat : stats.sortByName()) { data.setAttribute("fileListLine", index, "fileListLineNameLink", "href", stat.getLocalName()); data.setEscapedContent("fileListLine", index, "fileListLineNameLink", stat.getLocalName()); diff --git a/src/fr/devinsy/statoolinfos/htmlize/PropertyStatsPage.java b/src/fr/devinsy/statoolinfos/htmlize/PropertyStatsPage.java index 616dc9d..6bdb998 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/PropertyStatsPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/PropertyStatsPage.java @@ -75,7 +75,7 @@ public class PropertyStatsPage data.setContent("fileCount", stats.getFileCount()); int index = 0; - for (PropertyStat stat : stats.getList().sortByFilledCount().reverse()) + for (PropertyStat stat : stats.getList().sortByReverseFilledCount()) { data.setEscapedContent("propertyLine", index, "propertyLinePath", stat.getPath()); data.setContent("propertyLine", index, "propertyLineBlankCount", stat.getBlankCount()); @@ -92,7 +92,7 @@ public class PropertyStatsPage data.setContent("fileCountF", federationStats.getFileCount()); index = 0; - for (PropertyStat stat : federationStats.getList().sortByFilledCount().reverse()) + for (PropertyStat stat : federationStats.getList().sortByReverseFilledCount()) { data.setEscapedContent("propertyLineF", index, "propertyLinePathF", stat.getPath()); data.setContent("propertyLineF", index, "propertyLineBlankCountF", stat.getBlankCount()); @@ -109,7 +109,7 @@ public class PropertyStatsPage data.setContent("fileCountO", organizationsStats.getFileCount()); index = 0; - for (PropertyStat stat : organizationsStats.getList().sortByFilledCount().reverse()) + for (PropertyStat stat : organizationsStats.getList().sortByReverseFilledCount()) { data.setEscapedContent("propertyLineO", index, "propertyLinePathO", stat.getPath()); data.setContent("propertyLineO", index, "propertyLineBlankCountO", stat.getBlankCount()); @@ -126,7 +126,7 @@ public class PropertyStatsPage data.setContent("fileCountS", servicesStats.getFileCount()); index = 0; - for (PropertyStat stat : servicesStats.getList().sortByFilledCount().reverse()) + for (PropertyStat stat : servicesStats.getList().sortByReverseFilledCount()) { data.setEscapedContent("propertyLineS", index, "propertyLinePathS", stat.getPath()); data.setContent("propertyLineS", index, "propertyLineBlankCountS", stat.getBlankCount()); diff --git a/src/fr/devinsy/statoolinfos/htmlize/ServicesPage.java b/src/fr/devinsy/statoolinfos/htmlize/ServicesPage.java index 1d243fd..20fe6af 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/ServicesPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/ServicesPage.java @@ -57,7 +57,7 @@ public class ServicesPage data.setContent("serviceCount", services.size()); int index = 0; - for (Service service : services) + for (Service service : services.sortByName()) { data.setAttribute("serviceListLine", index, "serviceListLineLogo", "src", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-logo.png"); data.setEscapedContent("serviceListLine", index, "serviceListLineNameValue", service.getName()); diff --git a/src/fr/devinsy/statoolinfos/htmlize/SoftwaresPage.java b/src/fr/devinsy/statoolinfos/htmlize/SoftwaresPage.java index f83780f..8770459 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/SoftwaresPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/SoftwaresPage.java @@ -57,7 +57,7 @@ public class SoftwaresPage data.setContent("softwareCount", stats.size()); int index = 0; - for (SoftwareStat stat : stats) + for (SoftwareStat stat : stats.sortByName()) { data.setEscapedContent("softwareListLine", index, "softwareListLineNameLink", stat.getName()); data.setAttribute("softwareListLine", index, "softwareListLineNameLink", "href", "software-" + stat.getTechnicalName() + ".xhtml"); diff --git a/src/fr/devinsy/statoolinfos/htmlize/propertyStats.xhtml b/src/fr/devinsy/statoolinfos/htmlize/propertyStats.xhtml index a2d4f1c..ea2b273 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/propertyStats.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/propertyStats.xhtml @@ -20,11 +20,11 @@ - - - - - + + + + + diff --git a/src/fr/devinsy/statoolinfos/stats/properties/PropertyStatComparator.java b/src/fr/devinsy/statoolinfos/stats/properties/PropertyStatComparator.java index 9d8ebe2..1b2f577 100644 --- a/src/fr/devinsy/statoolinfos/stats/properties/PropertyStatComparator.java +++ b/src/fr/devinsy/statoolinfos/stats/properties/PropertyStatComparator.java @@ -16,7 +16,8 @@ public class PropertyStatComparator implements Comparator { PATH, BLANK_COUNT, - FILLED_COUNT + FILLED_COUNT, + REVERSE_FILLED_COUNT } private Sorting sorting; @@ -88,6 +89,14 @@ public class PropertyStatComparator implements Comparator case FILLED_COUNT: result = CompareUtils.compare(getFilledCount(alpha), getFilledCount(bravo)); break; + + case REVERSE_FILLED_COUNT: + result = -CompareUtils.compare(getFilledCount(alpha), getFilledCount(bravo)); + if (result == 0) + { + result = CompareUtils.compare(getPath(alpha), getPath(bravo)); + } + break; } } diff --git a/src/fr/devinsy/statoolinfos/stats/properties/PropertyStatList.java b/src/fr/devinsy/statoolinfos/stats/properties/PropertyStatList.java index 98d3ad7..319206a 100644 --- a/src/fr/devinsy/statoolinfos/stats/properties/PropertyStatList.java +++ b/src/fr/devinsy/statoolinfos/stats/properties/PropertyStatList.java @@ -87,6 +87,11 @@ public class PropertyStatList extends ArrayList return result; } + /** + * Sort by filled count. + * + * @return the property stat list + */ public PropertyStatList sortByFilledCount() { PropertyStatList result; @@ -111,4 +116,19 @@ public class PropertyStatList extends ArrayList // return result; } + + /** + * Sort by reverse filled count. + * + * @return the property stat list + */ + public PropertyStatList sortByReverseFilledCount() + { + PropertyStatList result; + + result = sort(PropertyStatComparator.Sorting.REVERSE_FILLED_COUNT); + + // + return result; + } } diff --git a/src/fr/devinsy/statoolinfos/stats/softwares/SoftwareStatComparator.java b/src/fr/devinsy/statoolinfos/stats/softwares/SoftwareStatComparator.java index 5cebfb1..de00760 100644 --- a/src/fr/devinsy/statoolinfos/stats/softwares/SoftwareStatComparator.java +++ b/src/fr/devinsy/statoolinfos/stats/softwares/SoftwareStatComparator.java @@ -117,7 +117,7 @@ public class SoftwareStatComparator implements Comparator } else { - result = source.getCategory().getName(); + result = source.getName(); } // diff --git a/src/fr/devinsy/statoolinfos/util/CompareUtils.java b/src/fr/devinsy/statoolinfos/util/CompareUtils.java index 52e92d4..d65a64a 100644 --- a/src/fr/devinsy/statoolinfos/util/CompareUtils.java +++ b/src/fr/devinsy/statoolinfos/util/CompareUtils.java @@ -216,6 +216,25 @@ public class CompareUtils return result; } + /** + * Compare ignore case. + * + * @param alpha + * the alpha + * @param bravo + * the bravo + * @return the int + */ + public static int compareIgnoreCase(final String alpha, final String bravo) + { + int result; + + result = StringUtils.compareIgnoreCase(alpha, bravo); + + // + return result; + } + /** * Compare reverse. *
PathFilled CountFile %Blank CountFile %CheminRemplis%Vides%