public BooleanValue convertToInternal(int attrid, Attribute<?> object) { if (object instanceof UnspecifiedTypeAttribute){ return new BooleanValue(attrid, ((UnspecifiedTypeAttribute) object).asBoolean()); } BooleanAttribute attr = (BooleanAttribute)object; return new BooleanValue(attrid, attr.getValue() ); } }
public FloatValue convertToInternal(int attrid, Attribute<?> object) { if (object instanceof UnspecifiedTypeAttribute) { return new FloatValue(attrid, ((UnspecifiedTypeAttribute)object).asFloat() ); } FloatAttribute attr = (FloatAttribute) object; return new FloatValue(attrid, attr.getValue() ); } }
public StringValue convertToInternal(int attrid, Attribute<?> object) { return new StringValue(attrid, ((UnspecifiedTypeAttribute)object).getValue() ); } }
/** * Perform the search conversion for this attr, if it exists */ private void deriveSearchAttrs(CardinalAttributeMap<IAttribute> attrs, String name, Attribute<?> value) { SearchConverter<? extends IAttribute> conversion = searchConversions.get(name); if (conversion == null) { return; } int attrId = getAttrDefs().getAttrId( conversion.getDerivedAttrName(), conversion.getInboundClass() ); String str; if (value instanceof NonIndexStringAttribute){ str = ((NonIndexStringAttribute)value).getValue(); } else { str = ((UnspecifiedTypeAttribute)value).getValue(); } IAttribute internal = conversion.convertStringToInternal(attrId, str); attrs.put(attrId, internal); }
/** * FIXME: This is duplicate of code from RecordConverter. There is notable overlap. * Get IAttribute to give to database, given external types (beans?) */ private IAttribute getIAttribute(String name, Attribute<?> value) { int attrId = getAttrDefs().getAttrId(name); // Attribute must exist AttrType type = AttrDefinitionMgr.getAttrType(attrId); if (type == AttrType.enumExclusiveValue){ // enumDef must also exist EnumDefinition enumDef = getAttrDefs().getEnumDefForAttrId(attrId); String str = ((UnspecifiedTypeAttribute)value).getValue(); return enumDef.getEnumValue(str, attrId); } else { return ConversionFactory.getInstance().convert(attrId, value); } }