private static void addRepresentation(PropertyDefinitionSimple p, StringBuilder bld) { bld.append(p.getName()).append(p.getType().name()); }
public Property createPropertySimple(PropertyDefinitionSimple propDefSimple, AugeasNode node) throws AugeasRhqException { Object value; value = node.getValue(); return new PropertySimple(propDefSimple.getName(), value); }
public void updateSimple(AugeasNode parentNode, PropertyDefinitionSimple propDef, Property prop, int seq) throws AugeasRhqException { PropertySimple simpleProp = null; AugeasNode node; if (prop instanceof PropertyList) { PropertyList lst = (PropertyList) prop; List<Property> props = lst.getList(); simpleProp = (PropertySimple) props.get(seq - 1); } if (prop instanceof PropertyMap) { PropertyMap map = (PropertyMap) prop; simpleProp = (PropertySimple) map.get(propDef.getName()); } List<AugeasNode> nodes = tree.matchRelative(parentNode, propDef.getName()); if (nodes.isEmpty()) { node = tree.createNode(parentNode, propDef.getName(), null, 1); } else node = nodes.get(0); node.setValue(simpleProp.getStringValue()); }
protected Property createPropertySimple(PropertyDefinitionSimple propDefSimple, Augeas augeas, AugeasNode node) { Object value; if (propDefSimple.getType() == PropertySimpleType.LONG_STRING) { List<String> childPaths = augeas.match(node.getPath()); if (childPaths.isEmpty()) { return null; } StringBuilder propValue = new StringBuilder(); for (String childPath : childPaths) { String childValue = augeas.get(childPath); propValue.append(childValue).append("\n"); } // Chop the final newline char. propValue.deleteCharAt(propValue.length() - 1); value = propValue.toString(); } else { value = toPropertyValue(propDefSimple, augeas, node); } return new PropertySimple(propDefSimple.getName(), value); }
LOG.debug(resource + " in " + baseResource + ": option source expression for property " + pds.getName() + " and target configuration of " + foundResource + " not found"); LOG.warn(resource + " in " + baseResource + ": option source expression for property " + pds.getName() + " and target configuration does not point to a list"); return false; if (ps == null) { LOG.warn(resource + " in " + baseResource + ": option source expression for property " + pds.getName() + " and target configuration does not have a map element " + subPropName); return false;
@Override public String toString() { return "SimpleProperty[" + getName() + "] (Type: " + getType() + ")" + ((getPropertyGroupDefinition() != null) ? ("(Group: " + getPropertyGroupDefinition().getName() + ")") : ""); } }
@NotNull private HtmlSelectBooleanCheckbox createInputOverrideForSimpleProperty( PropertyDefinitionSimple propertyDefinitionSimple) { HtmlSelectBooleanCheckbox input = FacesComponentUtility.createComponent(HtmlSelectBooleanCheckbox.class, this.config); // Find the actual property corresponding to this property def, and use that to create the component id. Property property = this.propertyMap.get(propertyDefinitionSimple.getName()); if (property != null) { // add suffix to prevent collision with value input identifier for property String propertyId = PropertyIdGeneratorUtility.getIdentifier(property, getListIndex(), "override"); input.setId(propertyId); Boolean shouldOverride = ((PropertySimple) property).getOverride(); FacesComponentUtility.setOverride(input, (shouldOverride != null && shouldOverride)); } setInputOverrideExpression(input, propertyDefinitionSimple.getName()); return input; }
if (pd instanceof PropertyDefinitionSimple) { PropertyDefinitionSimple pds = (PropertyDefinitionSimple) pd; sender.getConfigDefinition().put(pds.getName(),pds.getType().name());
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; }
private static void adaptPropertySimple(PropertySimple source, PropertySimple target, PropertyDefinitionSimple definition, Object parent, boolean adaptReadonlyProperties) { if (adaptReadonlyProperties || !definition.isReadOnly()) { if (target == null) { target = new PropertySimple(); target.setName(definition.getName()); add(parent, target); } target.setStringValue(source.getStringValue()); } }
LOG.warn("Option source expression for property " + pds.getName() + " and target configuration contains no ':'"); return;
protected void setNode(PropertyDefinition propDef, AbstractPropertyMap parentPropMap, Augeas augeas, AugeasNode parentNode) { String propName = getAugeasPathRelativeToParent(propDef, parentNode, augeas); AugeasNode node = (propName.equals(".")) ? parentNode : new AugeasNode(parentNode, propName); if (isPropertyDefined(propDef, parentPropMap)) { // The property *is* defined, which means we either need to add or update the corresponding node in the // Augeas tree. if (propDef instanceof PropertyDefinitionSimple) { PropertyDefinitionSimple propDefSimple = (PropertyDefinitionSimple) propDef; PropertySimple propSimple = parentPropMap.getSimple(propDefSimple.getName()); setNodeFromPropertySimple(augeas, node, propDefSimple, propSimple); } else if (propDef instanceof PropertyDefinitionMap) { PropertyDefinitionMap propDefMap = (PropertyDefinitionMap) propDef; PropertyMap propMap = parentPropMap.getMap(propDefMap.getName()); setNodeFromPropertyMap(propDefMap, propMap, augeas, node); } else if (propDef instanceof PropertyDefinitionList) { PropertyDefinitionList propDefList = (PropertyDefinitionList) propDef; PropertyList propList = parentPropMap.getList(propDefList.getName()); setNodeFromPropertyList(propDefList, propList, augeas, node); } else { throw new IllegalStateException("Unsupported PropertyDefinition subclass: " + propDef.getClass().getName()); } } else { // The property *is not* defined - remove the corresponding node from the Augeas tree if it exists. removeNodeIfItExists(augeas, node); } }
/** * 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"); } }
input.getAttributes().put("ondblclick", "//" + propertyDefinitionSimple.getName());
private int addNewMap(AbstractConfigurationComponent config) { String listName = config.getListName(); PropertyDefinitionMap mapDefinition = (PropertyDefinitionMap) config.getConfigurationDefinition() .getPropertyDefinitionList(listName).getMemberDefinition(); String mapName = mapDefinition.getName(); PropertyMap newMap = new PropertyMap(mapName); for (PropertyDefinition mapMemberDefinition : mapDefinition.getOrderedPropertyDefinitions()) { PropertyDefinitionSimple simpleDefinition = (PropertyDefinitionSimple) mapMemberDefinition; newMap.put(new PropertySimple(simpleDefinition.getName(), (simpleDefinition.isRequired()) ? "" : null)); } PropertyList list = config.getConfiguration().getList(listName); list.add(newMap); return list.getList().size() - 1; }
String defaultValue = listMemberDefinitionSimple.getDefaultValue(); if (defaultValue != null || listMemberDefinitionSimple.isRequired()) { PropertySimple listSimple = new PropertySimple(listMemberDefinitionSimple.getName(), defaultValue); ((PropertyList) property).add(listSimple);
PropertySimple propertySimple = this.propertyMap.getSimple(propertyDefinitionSimple.getName()); ValueExpression propertyValueExpression = createPropertyValueExpression(propertySimple.getName(), this.valueExpressionFormat);