|
|
|
@ -36,6 +36,8 @@ import java.util.TreeSet;
|
|
|
|
|
*/
|
|
|
|
|
class ServiceCapabilitiesReportGenerator {
|
|
|
|
|
|
|
|
|
|
private static final String NEW_LINE = System.lineSeparator();
|
|
|
|
|
|
|
|
|
|
private final InitializrService initializrService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -64,29 +66,29 @@ class ServiceCapabilitiesReportGenerator {
|
|
|
|
|
private String generateHelp(String url, InitializrServiceMetadata metadata) {
|
|
|
|
|
String header = "Capabilities of " + url;
|
|
|
|
|
StringBuilder report = new StringBuilder();
|
|
|
|
|
report.append(repeat("=", header.length()) + System.lineSeparator());
|
|
|
|
|
report.append(header + System.lineSeparator());
|
|
|
|
|
report.append(repeat("=", header.length()) + System.lineSeparator());
|
|
|
|
|
report.append(System.lineSeparator());
|
|
|
|
|
report.append(repeat("=", header.length()) + NEW_LINE);
|
|
|
|
|
report.append(header + NEW_LINE);
|
|
|
|
|
report.append(repeat("=", header.length()) + NEW_LINE);
|
|
|
|
|
report.append(NEW_LINE);
|
|
|
|
|
reportAvailableDependencies(metadata, report);
|
|
|
|
|
report.append(System.lineSeparator());
|
|
|
|
|
report.append(NEW_LINE);
|
|
|
|
|
reportAvailableProjectTypes(metadata, report);
|
|
|
|
|
report.append(System.lineSeparator());
|
|
|
|
|
report.append(NEW_LINE);
|
|
|
|
|
reportDefaults(report, metadata);
|
|
|
|
|
return report.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void reportAvailableDependencies(InitializrServiceMetadata metadata,
|
|
|
|
|
StringBuilder report) {
|
|
|
|
|
report.append("Available dependencies:" + System.lineSeparator());
|
|
|
|
|
report.append("-----------------------" + System.lineSeparator());
|
|
|
|
|
report.append("Available dependencies:" + NEW_LINE);
|
|
|
|
|
report.append("-----------------------" + NEW_LINE);
|
|
|
|
|
List<Dependency> dependencies = getSortedDependencies(metadata);
|
|
|
|
|
for (Dependency dependency : dependencies) {
|
|
|
|
|
report.append(dependency.getId() + " - " + dependency.getName());
|
|
|
|
|
if (dependency.getDescription() != null) {
|
|
|
|
|
report.append(": " + dependency.getDescription());
|
|
|
|
|
}
|
|
|
|
|
report.append(System.lineSeparator());
|
|
|
|
|
report.append(NEW_LINE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -98,8 +100,8 @@ class ServiceCapabilitiesReportGenerator {
|
|
|
|
|
|
|
|
|
|
private void reportAvailableProjectTypes(InitializrServiceMetadata metadata,
|
|
|
|
|
StringBuilder report) {
|
|
|
|
|
report.append("Available project types:" + System.lineSeparator());
|
|
|
|
|
report.append("------------------------" + System.lineSeparator());
|
|
|
|
|
report.append("Available project types:" + NEW_LINE);
|
|
|
|
|
report.append("------------------------" + NEW_LINE);
|
|
|
|
|
SortedSet<Entry<String, ProjectType>> entries = new TreeSet<>(
|
|
|
|
|
Comparator.comparing(Entry::getKey));
|
|
|
|
|
entries.addAll(metadata.getProjectTypes().entrySet());
|
|
|
|
@ -112,7 +114,7 @@ class ServiceCapabilitiesReportGenerator {
|
|
|
|
|
if (type.isDefaultType()) {
|
|
|
|
|
report.append(" (default)");
|
|
|
|
|
}
|
|
|
|
|
report.append(System.lineSeparator());
|
|
|
|
|
report.append(NEW_LINE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -132,13 +134,13 @@ class ServiceCapabilitiesReportGenerator {
|
|
|
|
|
|
|
|
|
|
private void reportDefaults(StringBuilder report,
|
|
|
|
|
InitializrServiceMetadata metadata) {
|
|
|
|
|
report.append("Defaults:" + System.lineSeparator());
|
|
|
|
|
report.append("---------" + System.lineSeparator());
|
|
|
|
|
report.append("Defaults:" + NEW_LINE);
|
|
|
|
|
report.append("---------" + NEW_LINE);
|
|
|
|
|
List<String> defaultsKeys = new ArrayList<>(metadata.getDefaults().keySet());
|
|
|
|
|
Collections.sort(defaultsKeys);
|
|
|
|
|
for (String defaultsKey : defaultsKeys) {
|
|
|
|
|
String defaultsValue = metadata.getDefaults().get(defaultsKey);
|
|
|
|
|
report.append(defaultsKey + ": " + defaultsValue + System.lineSeparator());
|
|
|
|
|
report.append(defaultsKey + ": " + defaultsValue + NEW_LINE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|