@CliCommand(value = UNREGISTER_APPLICATION, help = "Unregister an application") public String unregister( @CliOption(mandatory = true, key = { "", "name" }, help = "name of the application to unregister") String name, @CliOption(mandatory = true, key = { "type" }, help = "type of the application to unregister") ApplicationType type, @CliOption(key = { "version" }, help = "the version application to unregister") String version) { appRegistryOperations().unregister(name, type, version); List<AppRegistrationResource> appRegistrations = findAllAppsByNameAndType(name, type); Optional<AppRegistrationResource> defaultApp = appRegistrations.stream() .filter(a -> a.getDefaultVersion() == true).findFirst(); if (!CollectionUtils.isEmpty(appRegistrations) && !defaultApp.isPresent()) { String appVersions = appRegistrations.stream().map(app -> app.getVersion()) .collect(Collectors.joining(", ", "(", ")")); return String.format("Successfully unregistered application '%s' with type '%s'. " + "Please select new default version from: %s", name, type, appVersions); } return String.format("Successfully unregistered application '%s' with type '%s'.", name, type); }
@CliCommand(value = UNREGISTER_APPLICATION, help = "Unregister an application") public String unregister( @CliOption(mandatory = true, key = { "", "name" }, help = "name of the application to unregister") String name, @CliOption(mandatory = true, key = { "type" }, help = "type of the application to unregister") ApplicationType type, @CliOption(key = { "version" }, help = "the version application to unregister") String version) { appRegistryOperations().unregister(name, type, version); List<AppRegistrationResource> appRegistrations = findAllAppsByNameAndType(name, type); Optional<AppRegistrationResource> defaultApp = appRegistrations.stream() .filter(a -> a.getDefaultVersion() == true).findFirst(); if (!CollectionUtils.isEmpty(appRegistrations) && !defaultApp.isPresent()) { String appVersions = appRegistrations.stream().map(app -> app.getVersion()) .collect(Collectors.joining(", ", "(", ")")); return String.format("Successfully unregistered application '%s' with type '%s'. " + "Please select new default version from: %s", name, type, appVersions); } return String.format("Successfully unregistered application '%s' with type '%s'.", name, type); }
@CliCommand(value = UNREGISTER_APPLICATION, help = "Unregister an application") public String unregister( @CliOption(mandatory = true, key = { "", "name" }, help = "name of the application to unregister") String name, @CliOption(mandatory = true, key = { "type" }, help = "type of the application to unregister") ApplicationType type) { appRegistryOperations().unregister(name, type, null); return String.format(("Successfully unregistered application '%s' with type '%s'"), name, type); } }