@Override public void register(String store, String key, KeyInformation information, TransactionHandle tx) throws StorageException { Class<?> dataType = information.getDataType(); Mapping map = Mapping.getMapping(information); Preconditions.checkArgument(map==Mapping.DEFAULT || AttributeUtil.isString(dataType), "Specified illegal mapping [%s] for data type [%s]",map,dataType); }
@Override public boolean supports(KeyInformation information) { Class<?> dataType = information.getDataType(); Mapping mapping = Mapping.getMapping(information); if (Number.class.isAssignableFrom(dataType) || dataType == Geoshape.class) { if (mapping==Mapping.DEFAULT) return true; } else if (AttributeUtil.isString(dataType)) { if (mapping==Mapping.DEFAULT || mapping==Mapping.STRING || mapping==Mapping.TEXT) return true; } return false; }
@Override public boolean supports(KeyInformation information) { Class<?> dataType = information.getDataType(); Mapping mapping = Mapping.getMapping(information); if (Number.class.isAssignableFrom(dataType) || dataType == Geoshape.class) { if (mapping==Mapping.DEFAULT) return true; } else if (AttributeUtil.isString(dataType)) { if (mapping==Mapping.DEFAULT || mapping==Mapping.STRING || mapping==Mapping.TEXT) return true; } return false; }
@Override public boolean supports(KeyInformation information, TitanPredicate titanPredicate) { Class<?> dataType = information.getDataType(); Mapping mapping = Mapping.getMapping(information); if (mapping!=Mapping.DEFAULT && !AttributeUtil.isString(dataType)) return false; if (Number.class.isAssignableFrom(dataType)) { if (titanPredicate instanceof Cmp) return true; } else if (dataType == Geoshape.class) { return titanPredicate == Geo.WITHIN; } else if (AttributeUtil.isString(dataType)) { switch(mapping) { case DEFAULT: case TEXT: return titanPredicate == Text.CONTAINS || titanPredicate == Text.CONTAINS_PREFIX || titanPredicate == Text.CONTAINS_REGEX; case STRING: return titanPredicate == Cmp.EQUAL || titanPredicate==Cmp.NOT_EQUAL || titanPredicate==Text.REGEX || titanPredicate==Text.PREFIX; } } return false; }
@Override public boolean supports(KeyInformation information, TitanPredicate titanPredicate) { Class<?> dataType = information.getDataType(); Mapping mapping = Mapping.getMapping(information); if (mapping!=Mapping.DEFAULT && !AttributeUtil.isString(dataType)) return false; if (Number.class.isAssignableFrom(dataType)) { if (titanPredicate instanceof Cmp) return true; } else if (dataType == Geoshape.class) { return titanPredicate == Geo.WITHIN; } else if (AttributeUtil.isString(dataType)) { switch(mapping) { case DEFAULT: case TEXT: return titanPredicate == Text.CONTAINS || titanPredicate == Text.CONTAINS_PREFIX; // || titanPredicate == Text.CONTAINS_REGEX; case STRING: return titanPredicate == Cmp.EQUAL || titanPredicate==Cmp.NOT_EQUAL || titanPredicate==Text.PREFIX; // || titanPredicate==Text.REGEX } } return false; }
} else if (AttributeUtil.isString(add.value)) { String str = (String) add.value; Mapping mapping = Mapping.getMapping(storename,add.key,informations); Field field; switch(mapping) {
XContentBuilder mapping = null; Class<?> dataType = information.getDataType(); Mapping map = Mapping.getMapping(information); Preconditions.checkArgument(map==Mapping.DEFAULT || AttributeUtil.isString(dataType), "Specified illegal mapping [%s] for data type [%s]",map,dataType);
return numericFilter(key, (Cmp) titanPredicate, (Number) value); } else if (value instanceof String) { Mapping map = Mapping.getMapping(informations.get(key)); if ((map==Mapping.DEFAULT || map==Mapping.TEXT) && !titanPredicate.toString().startsWith("CONTAINS")) throw new IllegalArgumentException("Text mapped string values only support CONTAINS queries and not: " + titanPredicate);
Mapping map = Mapping.getMapping(informations.get(key)); if ((map==Mapping.DEFAULT || map==Mapping.TEXT) && !titanPredicate.toString().startsWith("CONTAINS")) throw new IllegalArgumentException("Text mapped string values only support CONTAINS queries and not: " + titanPredicate);