Class BGEditorInfoBase

java.lang.Object
ru.bitel.bgbilling.kernel.editor.server.bean.BGEditorInfoBase
All Implemented Interfaces:
BGEditorInfo

public abstract class BGEditorInfoBase extends Object implements BGEditorInfo
Базовый класс серверных диалогов (редакторов) - по аналогии с BGTableInfoBase.
Наследник обязан определить раскладку (getLayout()) и сохранение (save(BGUEditorParams)). По умолчанию: текущие значения берутся из значений по умолчанию раскладки, справочник поля - из статического набора значений раскладки, валидация проверяет обязательные поля. Всё это можно переопределить/расширить.
  • Field Details

    • userId

      protected int userId
    • connection

      protected Connection connection
    • componentId

      protected int componentId
  • Constructor Details

    • BGEditorInfoBase

      public BGEditorInfoBase()
  • Method Details

    • setUserId

      public void setUserId(int userId)
      Specified by:
      setUserId in interface BGEditorInfo
    • setConnection

      public void setConnection(Connection connection)
      Specified by:
      setConnection in interface BGEditorInfo
    • setComponentId

      public void setComponentId(int componentId)
      Description copied from interface: BGEditorInfo
      Идентификатор компонента (модуль/плагин), который запросил диалог - для таблиц вида "<таблица>_"
      Specified by:
      setComponentId in interface BGEditorInfo
    • getConnection

      protected Connection getConnection()
    • getComponentId

      protected int getComponentId()
      Идентификатор компонента (модуль/плагин), запросившего диалог; для таблиц вида "<таблица>_"
    • getEditorTitle

      public String getEditorTitle()
      Description copied from interface: BGEditorInfo
      Заголовок диалога
      Specified by:
      getEditorTitle in interface BGEditorInfo
    • getLayout

      public List<BGUEditorField> getLayout() throws ru.bitel.bgbilling.common.BGException
      Description copied from interface: BGEditorInfo
      Раскладка параметров диалога
      Specified by:
      getLayout in interface BGEditorInfo
      Throws:
      ru.bitel.bgbilling.common.BGException
    • getValues

      public List<ru.bitel.bgbilling.common.model.KeyValue> getValues(BGUEditorParams editorParams) throws ru.bitel.bgbilling.common.BGException
      Загрузка текущих значений полей. По умолчанию - значения по умолчанию раскладки.
      Specified by:
      getValues in interface BGEditorInfo
      Throws:
      ru.bitel.bgbilling.common.BGException
    • getDirectory

      public List<ru.bitel.bgbilling.common.model.KeyValue> getDirectory(BGUEditorField field, BGUEditorParams editorParams) throws ru.bitel.bgbilling.common.BGException
      Загрузка справочника для поля. По умолчанию - статический набор значений раскладки.
      Specified by:
      getDirectory in interface BGEditorInfo
      Throws:
      ru.bitel.bgbilling.common.BGException
    • validate

      public List<ru.bitel.bgbilling.common.model.KeyValue> validate(BGUEditorParams editorParams) throws ru.bitel.bgbilling.common.BGException
      Валидация параметров. По умолчанию проверяются обязательные поля. Возврат name→сообщение об ошибке (пустой список - ошибок нет).
      Specified by:
      validate in interface BGEditorInfo
      Throws:
      ru.bitel.bgbilling.common.BGException
    • save

      public abstract String save(BGUEditorParams editorParams) throws ru.bitel.bgbilling.common.BGException
      Description copied from interface: BGEditorInfo
      Сохранение результата. Возврат результата (например, id объекта)
      Specified by:
      save in interface BGEditorInfo
      Throws:
      ru.bitel.bgbilling.common.BGException
    • value

      protected String value(BGUEditorParams editorParams, String name)
    • value

      protected String value(BGUEditorParams editorParams, String name, String defaultValue)
    • valueInt

      protected int valueInt(BGUEditorParams editorParams, String name)
    • valueInt

      protected int valueInt(BGUEditorParams editorParams, String name, int defaultValue)
    • valueBoolean

      protected boolean valueBoolean(BGUEditorParams editorParams, String name)
    • valueBoolean

      protected boolean valueBoolean(BGUEditorParams editorParams, String name, boolean defaultValue)
    • valueDecimal

      protected BigDecimal valueDecimal(BGUEditorParams editorParams, String name)
    • valueDecimal

      protected BigDecimal valueDecimal(BGUEditorParams editorParams, String name, BigDecimal defaultValue)
    • objectId

      protected int objectId(BGUEditorParams editorParams)
      Идентификатор объекта, редактируемого диалогом
    • contractId

      protected int contractId(BGUEditorParams editorParams)
      Идентификатор контракта контекста
    • param

      protected String param(BGUEditorParams editorParams, String name)
      Дополнительный параметр из параметров запроса
    • param

      protected String param(BGUEditorParams editorParams, String name, String defaultValue)
    • getContext

      protected ru.bitel.bgbilling.kernel.container.managed.ServerContext getContext()
    • getDirectory

      protected <K extends Id> Directory<K> getDirectory(Class<K> clazz, int moduleId) throws ru.bitel.bgbilling.common.BGException
      Throws:
      ru.bitel.bgbilling.common.BGException
    • getUserInfoDirectory

      protected Directory<UserInfo> getUserInfoDirectory() throws ru.bitel.bgbilling.common.BGException
      Throws:
      ru.bitel.bgbilling.common.BGException
    • addValidationError

      protected ru.bitel.bgbilling.common.model.KeyValue addValidationError(String name, String message)
      Добавление ошибки валидации (имя поля→сообщение)
    • optValueSet

      protected Optional<ru.bitel.bgbilling.common.model.KeyValue> optValueSet(BGUEditorField field, String value)