Search in sources :

Example 1 with DocumentFieldReadonlyException

use of de.metas.ui.web.window.exceptions.DocumentFieldReadonlyException in project metasfresh-webui-api by metasfresh.

the class HUEditorRowAttributes method processChange.

private void processChange(final JSONDocumentChangedEvent event) {
    if (JSONDocumentChangedEvent.JSONOperation.replace == event.getOperation()) {
        final String attributeName = event.getPath();
        if (isReadonly(attributeName)) {
            throw new DocumentFieldReadonlyException(attributeName, event.getValue());
        }
        final I_M_Attribute attribute = attributesStorage.getAttributeByValueKeyOrNull(attributeName);
        final Object value = convertFromJson(attribute, event.getValue());
        attributesStorage.setValue(attribute, value);
    } else {
        throw new IllegalArgumentException("Unknown operation: " + event);
    }
}
Also used : DocumentFieldReadonlyException(de.metas.ui.web.window.exceptions.DocumentFieldReadonlyException) I_M_Attribute(org.compiere.model.I_M_Attribute)

Aggregations

DocumentFieldReadonlyException (de.metas.ui.web.window.exceptions.DocumentFieldReadonlyException)1 I_M_Attribute (org.compiere.model.I_M_Attribute)1