@Override public NonIndexStringAttribute next(String attrName) { return new NonIndexStringAttribute(attrName, nextShortPostcode()); }
@Override synchronized public String convertToInternal(int attrid, Object object) throws AttributeException { NonIndexStringAttribute attr = (NonIndexStringAttribute) object; String postcode = attr.getValue(); GeoInformation result = converter.lookupShort(postcode); if (result == null) { result = converter.lookupFull(postcode); } if (result == null){ throw new AttributeException("Unable to lookup postcode for: " + attr.getName() + "=" + postcode); } return result.getTown(); }
/** * Adds the internal representation of attr, to the index object. */ private void addInternalAttribute(StandaloneWWIndexData index, Attribute<?> attr) { String name = attr.getName(); if (attr instanceof NonIndexedAttribute){ // NOTE: Only String supported so far. NonIndexStringAttribute str = (NonIndexStringAttribute) attr; int attrid = getAttrDefs().getAttrId(name, str.getClass()); index.setNonIndexString(attrid, str.getValue()); } else { IAttribute attribute = getIAttribute(name, attr); if (attribute==null){ log.error("null attr: " + attr.toString()); attribute = getIAttribute(name, attr); // was for debugging only } index.getAttributeMap().putAttr(attribute); } }
/** * 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); }
public NonIndexStringAttribute convert(String name, IAttribute attribute) { return new NonIndexStringAttribute(name, ((StringValue) attribute).getValue() ); }
@Override synchronized public EcefVector convertToInternal(int attrid, Object object) throws AttributeException { NonIndexStringAttribute attr = (NonIndexStringAttribute) object; String postcode = attr.getValue(); GeoInformation result = converter.lookupShort(postcode); if (result == null) { result = converter.lookupFull(postcode); } if (result == null){ throw new AttributeException("Unable to lookup postcode for: " + attr.getName() + "=" + postcode); } return EcefVector.fromDegs(attrid, result.getLatitude(), result.getLongitude()); }
@Override public Attribute<?> getAttribute() { return new NonIndexStringAttribute( getName(), getValue() ); } }
public NonIndexStringAttribute next(String attrName) { return new NonIndexStringAttribute(attrName, getGen().nextFullPostcode()); }
public NonIndexStringAttribute next(String attrName) { return new NonIndexStringAttribute(attrName, getGen().nextShortPostcode()); }
public void convertInternalToRecord(RecordImpl record, StandaloneWWIndexData index) { record.setTitle(index.getDescription()); for (IAttribute attr : index.getAttributeMap()) { String name = getAttrDefs().getAttrName(attr.getAttrId()); if (name == null) { throw new IndexerException("Indexer Error. buildRecord " + attr.getAttrId() + " not Found"); } if (attr instanceof EnumValue){ EnumValue enumValue = (EnumValue) attr; EnumDefinition def = getAttrDefs().getEnumDef(enumValue.getEnumDefId()); record.getAttributes().put(name, ConversionFactory.getInstance().convert(name, def, enumValue)); } else { record.getAttributes().put(name, ConversionFactory.getInstance().convert(name, attr)); } } // now do non index attrs TIntObjectHashMap<String> map = index.getNonIndexAttrs(); TIntObjectIterator<String> iterator = map.iterator(); for (int i = map.size(); i-- > 0;) { iterator.advance(); String name = getAttrDefs().getAttrName(iterator.key()); NonIndexStringAttribute value = new NonIndexStringAttribute(name, iterator.value()); record.getAttributes().put(name, value ); // new NonIndexStringAttribute(name, iterator.value() ) ); } }