diff --git a/src/fr/devinsy/statoolinfos/core/Service.java b/src/fr/devinsy/statoolinfos/core/Service.java index b2b6ad2..0355119 100644 --- a/src/fr/devinsy/statoolinfos/core/Service.java +++ b/src/fr/devinsy/statoolinfos/core/Service.java @@ -34,8 +34,20 @@ import fr.devinsy.statoolinfos.properties.PathPropertyList; public class Service extends PathPropertyList { private static final long serialVersionUID = 3629841771102288863L; + + public enum Status + { + OK, + WARNING, + ALERT, + ERROR, + OVER, + UNKNOWN + } + private Organization organization; private File inputFile; + private URL inputURL; /** @@ -152,6 +164,21 @@ public class Service extends PathPropertyList return result; } + /** + * Gets the license name. + * + * @return the license name + */ + public String getLicenseName() + { + String result; + + result = get("software.license.name"); + + // + return result; + } + /** * Gets the logo URL. * @@ -197,6 +224,36 @@ public class Service extends PathPropertyList return this.organization; } + /** + * Gets the software license name. + * + * @return the software license name + */ + public String getSoftwareLicenseName() + { + String result; + + result = get("software.license.name"); + + // + return result; + } + + /** + * Gets the software license webpage. + * + * @return the software license webpage + */ + public String getSoftwareLicenseWebpage() + { + String result; + + result = get("software.license.url"); + + // + return result; + } + /** * Gets the software name. * @@ -212,6 +269,51 @@ public class Service extends PathPropertyList return result; } + /** + * Gets the software source website. + * + * @return the software source website + */ + public String getSoftwareSourceWebsite() + { + String result; + + result = get("software.source.url"); + + // + return result; + } + + /** + * Gets the software version. + * + * @return the software version + */ + public String getSoftwareVersion() + { + String result; + + result = get("software.version"); + + // + return result; + } + + /** + * Gets the software website. + * + * @return the software website + */ + public String getSoftwareWebsite() + { + String result; + + result = get("software.website"); + + // + return result; + } + /** * Gets the start date. * @@ -227,6 +329,61 @@ public class Service extends PathPropertyList return result; } + /** + * Gets the status. + * + * @return the status + */ + public Status getStatus() + { + Status result; + + String value = get("service.status", "service.status.level"); + + if ((StringUtils.isBlank(value)) || (StringUtils.equals(value, "unknonw"))) + { + result = Status.UNKNOWN; + } + else if (StringUtils.equalsAnyIgnoreCase(value, "ON", "OK")) + { + result = Status.OK; + } + else if (StringUtils.equalsAnyIgnoreCase(value, "alert")) + { + result = Status.ALERT; + } + else if (StringUtils.equalsAnyIgnoreCase(value, "error", "KO", "broken")) + { + result = Status.ERROR; + } + else if (StringUtils.equalsAnyIgnoreCase(value, "over", "terminated", "closed")) + { + result = Status.OVER; + } + else + { + result = Status.UNKNOWN; + } + + // + return result; + } + + /** + * Gets the status description. + * + * @return the status description + */ + public String getStatusDescription() + { + String result; + + result = get("service.status.description"); + + // + return result; + } + public String getTechnicalDocWebsite() { String result; diff --git a/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java b/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java index 3b47959..0b9bb98 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java +++ b/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java @@ -121,6 +121,14 @@ public class Htmlizer StatoolInfosUtils.copyRessource(source + "statoolinfos-logo.jpg", new File(targetDirectory, "logo.jpg")); StatoolInfosUtils.copyRessource(source + "statoolinfos-logo.ico", new File(targetDirectory, "favicon.ico")); + // + StatoolInfosUtils.copyRessource(source + "status-ok.png", targetDirectory); + StatoolInfosUtils.copyRessource(source + "status-warning.png", targetDirectory); + StatoolInfosUtils.copyRessource(source + "status-alert.png", targetDirectory); + StatoolInfosUtils.copyRessource(source + "status-error.png", targetDirectory); + StatoolInfosUtils.copyRessource(source + "status-over.png", targetDirectory); + StatoolInfosUtils.copyRessource(source + "status-void.png", targetDirectory); + // File color = new File(targetDirectory, "circle-icons/color"); color.mkdirs(); @@ -136,6 +144,12 @@ public class Htmlizer StatoolInfosUtils.copyRessource(source + "circle-icons/color/contacts.png", color); StatoolInfosUtils.copyRessource(source + "circle-icons/mono/contacts.png", mono); + StatoolInfosUtils.copyRessource(source + "circle-icons/color/cruise.png", color); + StatoolInfosUtils.copyRessource(source + "circle-icons/mono/cruise.png", mono); + + StatoolInfosUtils.copyRessource(source + "circle-icons/color/dev.png", color); + StatoolInfosUtils.copyRessource(source + "circle-icons/mono/dev.png", mono); + StatoolInfosUtils.copyRessource(source + "circle-icons/color/document.png", color); StatoolInfosUtils.copyRessource(source + "circle-icons/mono/document.png", mono); diff --git a/src/fr/devinsy/statoolinfos/htmlize/ServicePage.java b/src/fr/devinsy/statoolinfos/htmlize/ServicePage.java index d1b0ed9..d25b01e 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/ServicePage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/ServicePage.java @@ -64,9 +64,12 @@ public class ServicePage data.setEscapedContent("serviceURL", service.getWebsite()); data.setAttribute("serviceURL", "href", service.getWebsite()); - data.setContent("serviceStartDate", service.getStartDate()); - data.setContent("serviceEndDate", service.getEndDate()); - data.setEscapedContent("serviceDescription", service.getDescription()); + data.setContent("serviceDescription", StringUtils.defaultIfBlank(service.getDescription(), "n/a")); + data.setContent("serviceStartDate", StringUtils.defaultIfBlank(service.getStartDate(), "n/a")); + data.setContent("serviceEndDate", StringUtils.defaultIfBlank(service.getEndDate(), "n/a")); + + data.setAttribute("serviceStatusImg", "src", "status-" + service.getStatus().toString().toLowerCase() + ".png"); + data.setAttribute("serviceStatusImg", "title", StringUtils.defaultIfBlank(service.getStatusDescription(), service.getStatus().toString())); data.setAttribute("rawLink", "href", organization.getTechnicalName() + "-" + service.getTechnicalName() + ".properties"); @@ -129,6 +132,30 @@ public class ServicePage data.getIdData("registrationClientImg").getAttribute("class").setMode(DisplayMode.REPLACE); } + // + data.setContent("softwareName", StringUtils.defaultIfBlank(service.getSoftwareName(), "n/a")); + data.setContent("softwareVersion", StringUtils.defaultIfBlank(service.getSoftwareVersion(), "n/a")); + data.setContent("softwareLicenseName", StringUtils.defaultIfBlank(service.getSoftwareLicenseName(), "n/a")); + if (StringUtils.isNotBlank(service.getSoftwareWebsite())) + { + data.setAttribute("softwareWebsiteLink", "href", service.getSoftwareWebsite()); + data.setAttribute("softwareWebsiteLinkImg", "class", ""); + data.getIdData("softwareWebsiteLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE); + } + if (StringUtils.isNotBlank(service.getSoftwareLicenseWebpage())) + { + data.setAttribute("softwareLicenseLink", "href", service.getSoftwareLicenseWebpage()); + data.setAttribute("softwareLicenseLinkImg", "class", ""); + data.getIdData("softwareLicenseLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE); + } + if (StringUtils.isNotBlank(service.getSoftwareSourceWebsite())) + { + data.setAttribute("softwareSourceLink", "href", service.getSoftwareSourceWebsite()); + data.setAttribute("softwareSourceLinkImg", "class", ""); + data.getIdData("softwareSourceLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE); + } + + // String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/service.xhtml", data).toString(); BreadcrumbTrail trail = new BreadcrumbTrail(); diff --git a/src/fr/devinsy/statoolinfos/htmlize/service.xhtml b/src/fr/devinsy/statoolinfos/htmlize/service.xhtml index 4ffd74f..069abc7 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/service.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/service.xhtml @@ -11,33 +11,42 @@
-