|
|
@ -1,5 +1,5 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Copyright 2012-2018 the original author or authors.
|
|
|
|
* Copyright 2012-2019 the original author or authors.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
@ -66,9 +66,9 @@ class ServiceCapabilitiesReportGenerator {
|
|
|
|
private String generateHelp(String url, InitializrServiceMetadata metadata) {
|
|
|
|
private String generateHelp(String url, InitializrServiceMetadata metadata) {
|
|
|
|
String header = "Capabilities of " + url;
|
|
|
|
String header = "Capabilities of " + url;
|
|
|
|
StringBuilder report = new StringBuilder();
|
|
|
|
StringBuilder report = new StringBuilder();
|
|
|
|
report.append(repeat("=", header.length()) + NEW_LINE);
|
|
|
|
report.append(repeat("=", header.length())).append(NEW_LINE);
|
|
|
|
report.append(header + NEW_LINE);
|
|
|
|
report.append(header).append(NEW_LINE);
|
|
|
|
report.append(repeat("=", header.length()) + NEW_LINE);
|
|
|
|
report.append(repeat("=", header.length())).append(NEW_LINE);
|
|
|
|
report.append(NEW_LINE);
|
|
|
|
report.append(NEW_LINE);
|
|
|
|
reportAvailableDependencies(metadata, report);
|
|
|
|
reportAvailableDependencies(metadata, report);
|
|
|
|
report.append(NEW_LINE);
|
|
|
|
report.append(NEW_LINE);
|
|
|
@ -80,13 +80,13 @@ class ServiceCapabilitiesReportGenerator {
|
|
|
|
|
|
|
|
|
|
|
|
private void reportAvailableDependencies(InitializrServiceMetadata metadata,
|
|
|
|
private void reportAvailableDependencies(InitializrServiceMetadata metadata,
|
|
|
|
StringBuilder report) {
|
|
|
|
StringBuilder report) {
|
|
|
|
report.append("Available dependencies:" + NEW_LINE);
|
|
|
|
report.append("Available dependencies:").append(NEW_LINE);
|
|
|
|
report.append("-----------------------" + NEW_LINE);
|
|
|
|
report.append("-----------------------").append(NEW_LINE);
|
|
|
|
List<Dependency> dependencies = getSortedDependencies(metadata);
|
|
|
|
List<Dependency> dependencies = getSortedDependencies(metadata);
|
|
|
|
for (Dependency dependency : dependencies) {
|
|
|
|
for (Dependency dependency : dependencies) {
|
|
|
|
report.append(dependency.getId() + " - " + dependency.getName());
|
|
|
|
report.append(dependency.getId()).append(" - ").append(dependency.getName());
|
|
|
|
if (dependency.getDescription() != null) {
|
|
|
|
if (dependency.getDescription() != null) {
|
|
|
|
report.append(": " + dependency.getDescription());
|
|
|
|
report.append(": ").append(dependency.getDescription());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
report.append(NEW_LINE);
|
|
|
|
report.append(NEW_LINE);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -100,14 +100,14 @@ class ServiceCapabilitiesReportGenerator {
|
|
|
|
|
|
|
|
|
|
|
|
private void reportAvailableProjectTypes(InitializrServiceMetadata metadata,
|
|
|
|
private void reportAvailableProjectTypes(InitializrServiceMetadata metadata,
|
|
|
|
StringBuilder report) {
|
|
|
|
StringBuilder report) {
|
|
|
|
report.append("Available project types:" + NEW_LINE);
|
|
|
|
report.append("Available project types:").append(NEW_LINE);
|
|
|
|
report.append("------------------------" + NEW_LINE);
|
|
|
|
report.append("------------------------").append(NEW_LINE);
|
|
|
|
SortedSet<Entry<String, ProjectType>> entries = new TreeSet<>(
|
|
|
|
SortedSet<Entry<String, ProjectType>> entries = new TreeSet<>(
|
|
|
|
Comparator.comparing(Entry::getKey));
|
|
|
|
Comparator.comparing(Entry::getKey));
|
|
|
|
entries.addAll(metadata.getProjectTypes().entrySet());
|
|
|
|
entries.addAll(metadata.getProjectTypes().entrySet());
|
|
|
|
for (Entry<String, ProjectType> entry : entries) {
|
|
|
|
for (Entry<String, ProjectType> entry : entries) {
|
|
|
|
ProjectType type = entry.getValue();
|
|
|
|
ProjectType type = entry.getValue();
|
|
|
|
report.append(entry.getKey() + " - " + type.getName());
|
|
|
|
report.append(entry.getKey()).append(" - ").append(type.getName());
|
|
|
|
if (!type.getTags().isEmpty()) {
|
|
|
|
if (!type.getTags().isEmpty()) {
|
|
|
|
reportTags(report, type);
|
|
|
|
reportTags(report, type);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -124,7 +124,7 @@ class ServiceCapabilitiesReportGenerator {
|
|
|
|
report.append(" [");
|
|
|
|
report.append(" [");
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
Map.Entry<String, String> entry = iterator.next();
|
|
|
|
Map.Entry<String, String> entry = iterator.next();
|
|
|
|
report.append(entry.getKey() + ":" + entry.getValue());
|
|
|
|
report.append(entry.getKey()).append(":").append(entry.getValue());
|
|
|
|
if (iterator.hasNext()) {
|
|
|
|
if (iterator.hasNext()) {
|
|
|
|
report.append(", ");
|
|
|
|
report.append(", ");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -134,13 +134,14 @@ class ServiceCapabilitiesReportGenerator {
|
|
|
|
|
|
|
|
|
|
|
|
private void reportDefaults(StringBuilder report,
|
|
|
|
private void reportDefaults(StringBuilder report,
|
|
|
|
InitializrServiceMetadata metadata) {
|
|
|
|
InitializrServiceMetadata metadata) {
|
|
|
|
report.append("Defaults:" + NEW_LINE);
|
|
|
|
report.append("Defaults:").append(NEW_LINE);
|
|
|
|
report.append("---------" + NEW_LINE);
|
|
|
|
report.append("---------").append(NEW_LINE);
|
|
|
|
List<String> defaultsKeys = new ArrayList<>(metadata.getDefaults().keySet());
|
|
|
|
List<String> defaultsKeys = new ArrayList<>(metadata.getDefaults().keySet());
|
|
|
|
Collections.sort(defaultsKeys);
|
|
|
|
Collections.sort(defaultsKeys);
|
|
|
|
for (String defaultsKey : defaultsKeys) {
|
|
|
|
for (String defaultsKey : defaultsKeys) {
|
|
|
|
String defaultsValue = metadata.getDefaults().get(defaultsKey);
|
|
|
|
String defaultsValue = metadata.getDefaults().get(defaultsKey);
|
|
|
|
report.append(defaultsKey + ": " + defaultsValue + NEW_LINE);
|
|
|
|
report.append(defaultsKey).append(": ").append(defaultsValue)
|
|
|
|
|
|
|
|
.append(NEW_LINE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|