public String getDeprecatedKey(String key) { PropertyDefinition def = get(key); if (def == null) { return null; } return StringUtils.defaultIfEmpty(def.deprecatedKey(), null); } }
public void start() { Loggers.get(RenameDeprecatedPropertyKeys.class).info("Rename deprecated property keys"); for (PropertyDefinition definition : definitions.getAll()) { if (!Strings.isNullOrEmpty(definition.deprecatedKey())) { dao.renamePropertyKey(definition.deprecatedKey(), definition.key()); } } } }
private PropertyDefinitions add(PropertyDefinition definition, String defaultCategory) { if (!definitions.containsKey(definition.key())) { definitions.put(definition.key(), definition); String category = StringUtils.defaultIfBlank(definition.category(), defaultCategory); categories.put(definition.key(), new Category(category)); String subcategory = StringUtils.defaultIfBlank(definition.subCategory(), category); subcategories.put(definition.key(), new SubCategory(subcategory)); if (!StringUtils.isEmpty(definition.deprecatedKey()) && !definition.deprecatedKey().equals(definition.key())) { deprecatedKeys.put(definition.deprecatedKey(), definition.key()); } } return this; }
private void addDefinition(PropertyDefinition definition, ListDefinitionsWsResponse.Builder wsResponse) { String key = definition.key(); Settings.Definition.Builder builder = wsResponse.addDefinitionsBuilder() .setKey(key) .setType(Settings.Type.valueOf(definition.type().name())) .setMultiValues(definition.multiValues()); ofNullable(emptyToNull(definition.deprecatedKey())).ifPresent(builder::setDeprecatedKey); ofNullable(emptyToNull(definition.name())).ifPresent(builder::setName); ofNullable(emptyToNull(definition.description())).ifPresent(builder::setDescription); String category = propertyDefinitions.getCategory(key); ofNullable(emptyToNull(category)).ifPresent(builder::setCategory); String subCategory = propertyDefinitions.getSubCategory(key); ofNullable(emptyToNull(subCategory)).ifPresent(builder::setSubCategory); ofNullable(emptyToNull(definition.defaultValue())).ifPresent(builder::setDefaultValue); List<String> options = definition.options(); if (!options.isEmpty()) { builder.addAllOptions(options); } List<PropertyFieldDefinition> fields = definition.fields(); if (!fields.isEmpty()) { fields.forEach(fieldDefinition -> addField(fieldDefinition, builder)); } }
public String getDeprecatedKey(String key) { PropertyDefinition def = get(key); if (def == null) { return null; } return StringUtils.defaultIfEmpty(def.deprecatedKey(), null); } }
public String getDeprecatedKey(String key) { PropertyDefinition def = get(key); if (def == null) { return null; } return StringUtils.defaultIfEmpty(def.deprecatedKey(), null); } }
public void start() { Loggers.get(RenameDeprecatedPropertyKeys.class).info("Rename deprecated property keys"); for (PropertyDefinition definition : definitions.getAll()) { if (!Strings.isNullOrEmpty(definition.deprecatedKey())) { dao.renamePropertyKey(definition.deprecatedKey(), definition.key()); } } } }
private PropertyDefinitions add(PropertyDefinition definition, String defaultCategory) { if (!definitions.containsKey(definition.key())) { definitions.put(definition.key(), definition); String category = StringUtils.defaultIfBlank(definition.category(), defaultCategory); categories.put(definition.key(), new Category(category)); String subcategory = StringUtils.defaultIfBlank(definition.subCategory(), category); subcategories.put(definition.key(), new SubCategory(subcategory)); if (!Strings.isNullOrEmpty(definition.deprecatedKey()) && !definition.deprecatedKey().equals(definition.key())) { deprecatedKeys.put(definition.deprecatedKey(), definition.key()); } } return this; }
private PropertyDefinitions add(PropertyDefinition definition, String defaultCategory) { if (!definitions.containsKey(definition.key())) { definitions.put(definition.key(), definition); String category = StringUtils.defaultIfBlank(definition.category(), defaultCategory); categories.put(definition.key(), new Category(category)); String subcategory = StringUtils.defaultIfBlank(definition.subCategory(), category); subcategories.put(definition.key(), new SubCategory(subcategory)); if (!StringUtils.isEmpty(definition.deprecatedKey()) && !definition.deprecatedKey().equals(definition.key())) { deprecatedKeys.put(definition.deprecatedKey(), definition.key()); } } return this; }
private void addDefinition(PropertyDefinition definition, ListDefinitionsWsResponse.Builder wsResponse) { String key = definition.key(); Settings.Definition.Builder builder = wsResponse.addDefinitionsBuilder() .setKey(key) .setType(Settings.Type.valueOf(definition.type().name())) .setMultiValues(definition.multiValues()); setNullable(emptyToNull(definition.deprecatedKey()), builder::setDeprecatedKey); setNullable(emptyToNull(definition.name()), builder::setName); setNullable(emptyToNull(definition.description()), builder::setDescription); String category = propertyDefinitions.getCategory(key); setNullable(emptyToNull(category), builder::setCategory); String subCategory = propertyDefinitions.getSubCategory(key); setNullable(emptyToNull(subCategory), builder::setSubCategory); setNullable(emptyToNull(definition.defaultValue()), builder::setDefaultValue); List<String> options = definition.options(); if (!options.isEmpty()) { builder.addAllOptions(options); } List<PropertyFieldDefinition> fields = definition.fields(); if (!fields.isEmpty()) { fields.forEach(fieldDefinition -> addField(fieldDefinition, builder)); } }