PL-7497 IllegalStateException when trying to edit entity with the dynamic attribute

This commit is contained in:
Yuriy Artamonov 2016-07-08 18:04:04 +04:00
parent c90e366468
commit b61a981a45
3 changed files with 10 additions and 5 deletions

View File

@ -687,7 +687,7 @@ public abstract class DesktopAbstractTable<C extends JXTable, E extends Entity>
}
if (e.getDs().getState() == Datasource.State.VALID && e.getDs().getItem() != null) {
if (e.getDs().containsItem(e.getDs().getItem())) {
if (e.getDs().containsItem(e.getDs().getItem().getId())) {
newSelection.add((E) e.getDs().getItem());
}
}
@ -1852,7 +1852,7 @@ public abstract class DesktopAbstractTable<C extends JXTable, E extends Entity>
if (item != null) {
setSelected(Collections.singleton(item));
} else {
setSelected(Collections.<E>emptySet());
setSelected(Collections.emptySet());
}
}

View File

@ -136,8 +136,8 @@ public class EditorWindowDelegate extends WindowDelegate {
if (!PersistenceHelper.isNew(item)
&& !parentDs.getItemsToCreate().contains(item) && !parentDs.getItemsToUpdate().contains(item)
&& parentDs instanceof CollectionDatasource
&& ((CollectionDatasource) parentDs).containsItem(item)) {
item = dataservice.reload(item, ds.getView(), ds.getMetaClass());
&& ((CollectionDatasource) parentDs).containsItem(item.getId())) {
item = dataservice.reload(item, ds.getView(), ds.getMetaClass(), ds.getLoadDynamicAttributes());
if (parentDs instanceof CollectionPropertyDatasourceImpl) {
((CollectionPropertyDatasourceImpl) parentDs).replaceItem(item);
} else {

View File

@ -691,7 +691,12 @@ public class WebLookupField extends WebAbstractOptionsField<CubaComboBox> implem
protected void adoptMissingValue(Object value) {
if (!ObjectUtils.equals(missingValue, value)) {
if (optionsDatasource != null && !optionsDatasource.containsItem(value)) {
Object itemId = null;
if (value instanceof Entity) {
itemId = ((Entity) value).getId();
}
if (optionsDatasource != null && !optionsDatasource.containsItem(itemId)) {
missingValue = value;
} else if (optionsList != null && !optionsList.contains(value)) {
missingValue = value;