public static PolicyConfigSummary policyConfigSummary(BrooklynRestResourceUtils utils, EntityLocal entity, Policy policy, ConfigKey<?> config) { String applicationUri = "/v1/applications/" + entity.getApplicationId(); String entityUri = applicationUri + "/entities/" + entity.getId(); String policyUri = entityUri + "/policies/" + policy.getId(); Map<String, URI> links = ImmutableMap.<String, URI>builder() .put("self", URI.create(policyUri + "/config/" + config.getName())) .put("application", URI.create(applicationUri)) .put("entity", URI.create(entityUri)) .put("policy", URI.create(policyUri)) .build(); return new PolicyConfigSummary(config.getName(), config.getTypeName(), config.getDescription(), PolicyConfigResource.getStringValueForDisplay(utils, policy, config.getDefaultValue()), config.isReconfigurable(), links); }
protected EntityConfigSummary(ConfigKey<?> config, String label, Double priority, Map<String, URI> links) { super(config.getName(), config.getTypeName(), config.getDescription(), JsonUtils.toJsonable(config.getDefaultValue()), config.isReconfigurable(), label, priority); this.links = links==null ? null : ImmutableMap.copyOf(links); }
protected ConfigSummary(ConfigKey<?> config) { this.name = config.getName(); this.type = config.getTypeName(); this.description = config.getDescription(); this.reconfigurable = config.isReconfigurable(); /* Use String, to guarantee it is serializable; otherwise get: * No serializer found for class brooklyn.policy.autoscaling.AutoScalerPolicy$3 and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: java.util.ArrayList[9]->brooklyn.rest.domain.PolicyConfigSummary["defaultValue"]) * at org.codehaus.jackson.map.ser.impl.UnknownSerializer.failForEmpty(UnknownSerializer.java:52) */ this.defaultValue = (config.getDefaultValue() == null) ? null : config.getDefaultValue().toString(); this.label = null; this.priority = null; }
.toList(); } else { this.type = config.getTypeName(); this.defaultValue = (config.getDefaultValue() == null) ? null : JsonUtils.toJsonable(config.getDefaultValue()); this.possibleValues = null;
ConfigKey key = entry.getKey(); Object value = entry.getValue(); Class<?> type = (key.getType() != null) ? key.getType() : rebindContext.loadClass(key.getTypeName()); if (memento.getEntityReferenceConfigs().contains(entry.getKey())) { value = MementoTransformer.transformIdsToEntities(rebindContext, value, type, true);