Здравствуйте. Есть сущность Карточка мониторинга клиента, есть еще одна сущность расширение динамических атрибутов.
Нужно отобразить таблицу карточек мониторинга в сгруппированном виде.
Группировка должна быть по холдингу.
Проблема в том, что нужно сгруппировать так, чтобы можно было изменять в поле холдинга, а изменялось во всех клиентах входящих в него(его подгруппах).
Вторая сложность - поля которые мы изменяем(например, чистый совокупный оборот на скриншоте) это генерируемые колонки из динамических атрибутов. Пример кода, как генерируются сейчас эти колонки ниже.
@Subscribe
public void onAfterInit(AfterInitEvent event) {
HashMap<ProblemAttributeHolder, MonitoringCard> problemAttributeHolders = problemFactorService.getProblemAttributeHolders(monitoringCardsDc.getItems());
MetaClass aClass = metadata.getClassNN(ProblemAttributeHolder.class);
problemFactorService.getProblemAttributes().forEach(problemAttribute ->
{
monitoringCardsTable.addGeneratedColumn(problemAttribute.getCode(), o -> {
MetaPropertyPath metaPropertyPath = DynamicAttributesUtils.getMetaPropertyPath(aClass, problemAttribute);
Label<String> stringLabel = uiComponents.create(Label.TYPE_STRING);
Object v = null;
for (Map.Entry<ProblemAttributeHolder, MonitoringCard> problemAttributeHolder : problemAttributeHolders.entrySet()) {
if (problemAttributeHolder.getValue().equals(o) &&
problemAttributeHolder.getKey().getValue(DynamicAttributesUtils.encodeAttributeCode(problemAttribute.getCode())) !=null) {
v = problemAttributeHolder.getKey().getValue(DynamicAttributesUtils.encodeAttributeCode(problemAttribute.getCode()));
}
}
Optional.ofNullable(v)
.map(o1 -> DynamicAttributesUtils.getDynamicAttributeValueAsString(metaPropertyPath.getMetaProperty(), o1))
.ifPresent(stringLabel::setValue);
return stringLabel;
});
monitoringCardsTable.getColumn(problemAttribute.getCode()).setEditable(true);
monitoringCardsTable.getColumn(problemAttribute.getCode()).setCaption(problemAttribute.getName());
});
}
Можно ли как то реализовать данный функционал?