@Override public Object put(String key, Object value) { set(key, value); return value; }
@Override @SuppressWarnings("unchecked") protected Object transformToSource(Object o) { List<Map<String, Object>> valueList = new ArrayList<>(); if (o instanceof Map) { ((Map<String, List<String>>) o).forEach((key, value) -> valueList.add(Context.create() .set(KEY, key) .set(VALUE, value))); } return valueList; } }
@Override @SuppressWarnings("unchecked") protected Object transformToSource(Object o) { List<Map<String, Object>> valueList = new ArrayList<>(); if (o instanceof Map) { ((Map<String, String>) o).forEach((key, value) -> valueList.add(Context.create() .set(KEY, key) .set(VALUE, value))); } return valueList; }
/** * Sets the given value (its string representation), mit limits this to <tt>limit</tt> characters. * * @param key the key to which the value should be associated * @param value the value which string representation should be put into the context * @param limit the maximal number of characters to put into the map. Everything after that will be discarded */ public void putLimited(String key, Object value, int limit) { set(key, Strings.limit(value, limit)); }
@Override protected void createEntity(SQLEntity entity, EntityDescriptor ed) throws Exception { Context insertData = Context.create(); for (Property p : ed.getProperties()) { if (!SQLEntity.ID.getName().equals(p.getName())) { insertData.set(p.getPropertyName(), p.getValueForDatasource(OMA.class, entity)); } } if (ed.isVersioned()) { insertData.set(VERSION, 1); } Row keys = getDatabase(ed.getRealm()).insertRow(ed.getRelationName(), insertData); loadCreatedId(entity, keys); entity.setVersion(1); }