/** * Returns attribute values from the provided {@link AttributeValueSet} or * <code>null</code> if the provided {@link AttributeValueSet} is <code>null</code>. */ public static Map<String, Object> getAttributeValues( AttributeValueSet attributeValueSet) { return attributeValueSet != null ? attributeValueSet.getAttributeValues() : null; }
/** * Adds an {@link AttributeValueSet} to this collection replacing its label and * description. This method may sometimes be useful because {@link AttributeValueSet}s * are immutable with respect to their label and description. * * @param id unique identifier of the {@link AttributeValueSet} within the collection. * @param attributeValueSet {@link AttributeValueSet} to be added * @param newLabel new label for the {@link AttributeValueSet} * @param newDescription new description for the {@link AttributeValueSet} */ public void addAttributeValueSet(String id, AttributeValueSet attributeValueSet, String newLabel, String newDescription) { final AttributeValueSet newAttributeValueSet = new AttributeValueSet(newLabel, newDescription, attributeValueSet.baseAttributeValueSet); newAttributeValueSet.overridenAttributeValues .putAll(attributeValueSet.overridenAttributeValues); addAttributeValueSet(id, newAttributeValueSet); }
return baseAttributeValueSet.getAttributeValue(key);
@Override public String toString() { final StringBuilder b = new StringBuilder(); b.append("AttributeValueSet ["); boolean first = true; for (Map.Entry<String, Object> e : getAttributeValues().entrySet()) { if (!first) b.append(", "); b.append(e.getKey() != null ? e.getKey() : "null"); b.append('='); b.append(e.getValue() != null ? e.getValue().toString() : "null"); first = false; } b.append("]"); return b.toString(); } }
/** * Returns attribute values defined by this {@link AttributeValueSet} and all other * {@link AttributeValueSet}s that this set is based on. The returned map is * independent of this {@link AttributeValueSet}, so any modifications to that map * will not be reflected in this {@link AttributeValueSet}. */ public Map<String, Object> getAttributeValues() { final Map<String, Object> result = Maps.newHashMap(); if (baseAttributeValueSet != null) { result.putAll(baseAttributeValueSet.getAttributeValues()); } result.putAll(overridenAttributeValues); return result; }
private Map<String, Object> getAttributes() { Map<String, Object> result = AttributeValueSet .getAttributeValues(getAttributeSets().getAttributeValueSet(attributeSetId, true)); if (result == null) { result = Maps.newHashMap(); } return result; }
if (defaultAttributeValueSet != null) initAttributes.putAll(defaultAttributeValueSet.getAttributeValues());
AttributeValueSets avs = AttributeValueSets.deserialize(attributeXmls[0].open()); AttributeValueSet defaultSet = avs.getDefaultAttributeValueSet(); initAttributes.putAll(defaultSet.getAttributeValues()); } catch (Exception e) { throw new SolrException(ErrorCode.SERVER_ERROR,