o = getObjectWithType(propertyDefinition, propertyDefinition.getDefaultValue()); } else { o = getObjectWithType(propertyDefinition, property.getStringValue());
PropertySimple loadHandlePropertySimple(PropertyDefinitionSimple propDef, Object valueObject) { PropertySimple propertySimple; String name = propDef.getName(); if (valueObject != null) { // Property is non-null -> return it. if (valueObject instanceof Map) { // If this is a map and no single type, get the EXPRESSION_VALUE Object o = ((Map) valueObject).get("EXPRESSION_VALUE"); propertySimple = new PropertySimple(name, o); } else { propertySimple = new PropertySimple(name, valueObject); } } else { // property is null? Check if it is required if (propDef.isRequired()) { String defaultValue = ((PropertyDefinitionSimple) propDef).getDefaultValue(); propertySimple = new PropertySimple(name, defaultValue); } else { // Not required and null -> return null propertySimple = new PropertySimple(name, null); } } return propertySimple; }
/** * Copies the parameters of an OperationDefinition into to an object that can be * returned to a REST-client, so that this knows which fields are to be filled in, * of which type they are and which ones are required * @param def OperationsDefinition to "copy" * @param definitionRest The definition to fill in */ private void copyParamsForDefinition(OperationDefinition def, OperationDefinitionRest definitionRest) { ConfigurationDefinition cd = def.getParametersConfigurationDefinition(); if (cd==null) { return; } for (Map.Entry<String,PropertyDefinition> entry : cd.getPropertyDefinitions().entrySet()) { PropertyDefinition pd = entry.getValue(); if (pd instanceof PropertyDefinitionSimple) { PropertyDefinitionSimple pds = (PropertyDefinitionSimple) pd; SimplePropDef prop = new SimplePropDef(); prop.setName(pds.getName()); prop.setRequired(pds.isRequired()); prop.setType(pds.getType()); prop.setDefaultValue(pds.getDefaultValue()); definitionRest.addParam(prop); } log.debug("copyParams: " + pd.getName() + " not yet supported"); } }
if (propertyDefinition.isRequired()) { if (normalizeRequiredDefaults) { value = ((PropertyDefinitionSimple) propertyDefinition).getDefaultValue(); value = ((PropertyDefinitionSimple) propertyDefinition).getDefaultValue();
String defaultValue = ((PropertyDefinitionSimple) propertyDefinition).getDefaultValue(); if (defaultValue != null || propertyDefinition.isRequired()) { property = new PropertySimple(propertyDefinition.getName(), defaultValue); String defaultValue = listMemberDefinitionSimple.getDefaultValue(); if (defaultValue != null || listMemberDefinitionSimple.isRequired()) { PropertySimple listSimple = new PropertySimple(listMemberDefinitionSimple.getName(),
val = null; } else { val = configDef.getPropertyDefinitionSimple(simplePropertyName).getDefaultValue();
existingPDS.setDefaultValue(newPDS.getDefaultValue());
if (pro.getStringValue() == null || (pro.getStringValue() != null && pro.getStringValue().equals("null"))) { String p = context.getResourceType().getResourceConfigurationDefinition().getDefaultTemplate().getConfiguration().getSimpleValue(key); log.debug("Using default value for " + key + " value: " + def.getDefaultValue()); switch (def.getType()) { case INTEGER: {