@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; KeyValueEntity that = (KeyValueEntity) o; Object id = getId(); Object thatId = that.getId(); if (id != null && thatId != null) return id.equals(thatId); return Objects.equals(uuid, that.uuid); }
@Override public int hashCode() { Object id = getId(); if (id != null) return id.hashCode(); return uuid.hashCode(); }
protected void afterLoadValues(Map<String, Object> params, ValueLoadContext context, List<KeyValueEntity> entities) { ds.detachListener(ds.data.values()); ds.data.clear(); boolean hasEnumerations = ds.metaClass.getOwnProperties().stream() .anyMatch(p -> p.getRange().isEnum()); if (!hasEnumerations) { for (KeyValueEntity entity : entities) { ds.data.put(entity.getId(), entity); ds.attachListener(entity); entity.setMetaClass(ds.metaClass); } } else { List<MetaProperty> enumProperties = getEnumProperties(ds.metaClass); for (KeyValueEntity entity : entities) { convertEnumValues(entity, enumProperties); ds.data.put(entity.getId(), entity); ds.attachListener(entity); entity.setMetaClass(ds.metaClass); } } }
@Override protected void loadData(Map<String, Object> params) { Collection<KeyValueEntity> entities = getEntities(params); detachListener(data.values()); data.clear(); if (entities != null) { for (KeyValueEntity entity : entities) { data.put(entity.getId(), entity); attachListener(entity); entity.setMetaClass(metaClass); } } } }
@Override protected void loadData(Map<String, Object> params) { Collection<KeyValueEntity> entities = getEntities(params); detachListener(data.values()); data.clear(); if (entities != null) { for (KeyValueEntity entity : entities) { data.put(entity.getId(), entity); attachListener(entity); entity.setMetaClass(metaClass); } } } }
@Override protected void loadData(Map<String, Object> params) { Collection<KeyValueEntity> entities = getEntities(params); detachListener(data.values()); data.clear(); if (entities != null) { for (KeyValueEntity entity : entities) { data.put(entity.getId(), entity); attachListener(entity); entity.setMetaClass(metaClass); } } } }