Package ru.bgcrm.dao

Class ParamValueDAO

java.lang.Object
ru.bgcrm.dao.CommonDAO
ru.bgcrm.dao.ParamValueDAO
Direct Known Subclasses:
ParamValueDAOWrapper, PonParamValueDAO

public class ParamValueDAO extends CommonDAO
  • Field Details

    • history

      protected boolean history
    • PARAM_ADDRESS_FIELD_QUARTER

      public static final String PARAM_ADDRESS_FIELD_QUARTER
      See Also:
    • PARAM_ADDRESS_FIELD_STREET

      public static final String PARAM_ADDRESS_FIELD_STREET
      See Also:
    • PARAM_ADDRESS_FIELD_FLAT

      public static final String PARAM_ADDRESS_FIELD_FLAT
      See Also:
    • PARAM_ADDRESS_FIELDS

      public static final Set<String> PARAM_ADDRESS_FIELDS
  • Constructor Details

    • ParamValueDAO

      public ParamValueDAO(Connection con)
    • ParamValueDAO

      public ParamValueDAO(Connection con, boolean history, int userId)
  • Method Details

    • getParamAddressFirst

      public ParameterAddressValue getParamAddressFirst(int id, int paramId)
    • getParamAddress

      public ParameterAddressValue getParamAddress(int id, int paramId, int position) throws BGException
      Возвращает адресный параметр объекта.
      Parameters:
      id - - код объекта.
      paramId - - код параметра.
      position - - позиция, начиная от 1, если в параметре установлены несколько значений.
      Throws:
      BGException
    • getParamAddress

      public SortedMap<Integer,ParameterAddressValue> getParamAddress(int id, int paramId) throws BGException
      Возвращает значения адресного параметра объекта, ключ SortedMap - позиция, значение - значение на позиции.
      Parameters:
      id - - код объекта.
      paramId - - код параметра.
      Throws:
      BGException
    • getParamAddressExt

      public SortedMap<Integer,ParameterAddressValue> getParamAddressExt(int id, int paramId, boolean loadDirs) throws BGException
      Возвращает значения адресного параметра объекта, ключ SortedMap - позиция, значение - значение на позиции.
      Parameters:
      id - - код объекта.
      paramId - - код параметра.
      loadDirs - - признак необходимости загрузить справочники, чтобы был корректно заполнен ParameterAddressValue.getHouse()/
      Throws:
      BGException
    • getParamAddressExt

      public SortedMap<Integer,ParameterAddressValue> getParamAddressExt(int id, int paramId, boolean loadDirs, String formatName) throws BGException
      Возвращает значения адресного параметра объекта, ключ SortedMap - позиция, значение - значение на позиции.
      Parameters:
      id - - код объекта.
      paramId - - код параметра.
      loadDirs - - признак необходимости загрузить справочники, чтобы был корректно заполнен ParameterAddressValue.getHouse().
      formatName - - наименование формата адреса из конфигурации, с помощью которого форматировать значение адреса.
      Throws:
      BGException
    • getParamFileFirst

      public FileData getParamFileFirst(int id, int paramId)
    • getParamFile

      public FileData getParamFile(int id, int paramId, int position)
    • getParamFilesByPositions

      public List<FileData> getParamFilesByPositions(int objectId, int paramId, String sqlPositions) throws BGException
      Throws:
      BGException
    • getParamFile

      public FileData getParamFile(int id, int paramId, int position, int version) throws BGException
      Throws:
      BGException
    • getParamFile

      public SortedMap<String,FileData> getParamFile(int id, int paramId) throws BGException
      Throws:
      BGException
    • getParamDate

      public Date getParamDate(int id, int paramId) throws BGException
      Throws:
      BGException
    • getParamDateTime

      public Date getParamDateTime(int id, int paramId) throws BGException
      Throws:
      BGException
    • getParamText

      public String getParamText(int id, int paramId) throws BGException
      Throws:
      BGException
    • getParamBlob

      public String getParamBlob(int id, int paramId) throws BGException
      Throws:
      BGException
    • getParamBoolean

      public boolean getParamBoolean(int id, int paramId) throws BGException
      Throws:
      BGException
    • getParamNumber

      public BigDecimal getParamNumber(int id, int paramId) throws BGException
      Throws:
      BGException
    • getParamEmail

      public ParameterEmailValue getParamEmail(int id, int paramId, int position) throws BGException
      Throws:
      BGException
    • getParamEmail

      public SortedMap<Integer,ParameterEmailValue> getParamEmail(int id, int paramId) throws BGException
      Throws:
      BGException
    • getParamPhone

      public ParameterPhoneValue getParamPhone(int id, int paramId) throws BGException
      Throws:
      BGException
    • getParameterPhoneValueItems

      @NotNull public @NotNull List<ParameterPhoneValueItem> getParameterPhoneValueItems(int id, int paramId) throws BGException
      Throws:
      BGException
    • getParamListWithTitles

      public List<IdTitle> getParamListWithTitles(int id, int paramId) throws BGException
      Throws:
      BGException
    • getParamListWithTitlesAndComments

      public List<IdTitleComment> getParamListWithTitlesAndComments(int id, int paramId) throws BGException
      Throws:
      BGException
    • getParamListCountWithTitles

      public List<IdTitle> getParamListCountWithTitles(int id, int paramId) throws BGException
      Throws:
      BGException
    • getParamListCountWithTitlesAndCount

      public List<ParameterListCountValue> getParamListCountWithTitlesAndCount(int objectId, int paramId) throws BGException
      Throws:
      BGException
    • getParamListCountWithTitlesAndValues

      public List<ParameterListCountValue> getParamListCountWithTitlesAndValues(int id, int paramId) throws BGException
      Throws:
      BGException
    • getObjectIdAndParamIdByLineId

      public Pair<Integer,Integer> getObjectIdAndParamIdByLineId(int lineId)
    • getParamObjectList

      public List<Integer> getParamObjectList(int id, int paramId) throws BGException
      Throws:
      BGException
    • getParamListCount

      @Deprecated public Map<Integer,ParameterListCountValue> getParamListCount(int id, int paramId) throws BGException
      Deprecated.
      Throws:
      BGException
    • getParamList

      @NotNull public @NotNull Set<Integer> getParamList(int id, int paramId) throws BGException
      Throws:
      BGException
    • getParamListWithComments

      public Map<Integer,String> getParamListWithComments(int id, int paramId) throws BGException
      Throws:
      BGException
    • getParamTree

      public Set<String> getParamTree(int id, int paramId) throws BGException
      Throws:
      BGException
    • updateParamText

      public void updateParamText(int id, int paramId, String value) throws BGException
      Throws:
      BGException
    • updateParamBlob

      public void updateParamBlob(int id, int paramId, String value) throws BGException
      Throws:
      BGException
    • updateParamBoolean

      public void updateParamBoolean(int id, int paramId, boolean value) throws BGException
      Throws:
      BGException
    • updateParamNumber

      public void updateParamNumber(int id, int paramId, BigDecimal value) throws BGException
      Throws:
      BGException
    • updateParamEmail

      public void updateParamEmail(int id, int paramId, int position, ParameterEmailValue value) throws BGException
      Обновляет/добавляет/удаляет значения параметра типа EMail.
      Parameters:
      id - - код сущности в БД.
      paramId - - код параметра.
      position - - позиция значения, начинается с 1, 0 - добавить новое значение с позицией MAX+1.
      value - - значение, null - удаление параметра на указанной позиции, если position>0; иначе - удаление всех значений.
      Throws:
      BGException
    • addElement

      public int addElement(int id, int paramId, boolean isInvertId) throws BGException
      Throws:
      BGException
    • updatePosition

      public void updatePosition(List<Integer> lineIds) throws BGException
      Throws:
      BGException
    • saveElement

      public void saveElement(int id, int paramId, int lineId) throws BGException
      Throws:
      BGException
    • deleteElement

      public void deleteElement(int id, int paramId, int lineId) throws BGException
      Throws:
      BGException
    • updateParamList

      public void updateParamList(int id, int paramId, Map<Integer,String> values) throws BGException
      Throws:
      BGException
    • updateParamList

      public void updateParamList(int id, int paramId, Set<Integer> values) throws BGException
      Throws:
      BGException
    • updateParamListCount

      public void updateParamListCount(int id, int paramId, Map<Integer,Double> values, Map<Integer,String> valuesComments) throws BGException
      Throws:
      BGException
    • updateParamFile

      public void updateParamFile(int id, int paramId, int position, int version, String comment, FileData fileData) throws BGException
      Throws:
      BGException
    • updateParamAddress

      public void updateParamAddress(int id, int paramId, int position, ParameterAddressValue value) throws BGException
      Обновляет/добавляет/удаляет значения адресного параметра.
      Parameters:
      id - - код сущности в БД.
      paramId - - код параметра.
      position - - позиция значения, начинается с 1, 0 - добавить новое значение с позицией MAX+1.
      value - - значение, null - удаление параметра на указанной позиции, если position>0; иначе - удаление всех значений.
      Throws:
      BGException
    • updateParamsAddressOnHouseUpdate

      public void updateParamsAddressOnHouseUpdate(int houseId) throws BGException
      Throws:
      BGException
    • updateParamPhone

      public void updateParamPhone(int id, int paramId, ParameterPhoneValue value) throws BGException
      Throws:
      BGException
    • updateParamDate

      public void updateParamDate(int id, int paramId, Date value) throws BGException
      Throws:
      BGException
    • updateParamDateTime

      public void updateParamDateTime(int id, int paramId, Date value) throws BGException
      Throws:
      BGException
    • deleteParams

      public void deleteParams(String objectType, int id) throws SQLException
      Throws:
      SQLException
    • objectIdInvert

      public void objectIdInvert(String objectType, int currentObjectId) throws SQLException
      Throws:
      SQLException
    • copyParams

      public void copyParams(int fromObjectId, int toObjectId, String copyMapping) throws BGException
      Throws:
      BGException
    • copyParams

      public void copyParams(int fromObjectId, int toObjectId, Collection<Integer> paramIds) throws BGException
      Throws:
      BGException
    • copyParam

      public void copyParam(int fromObjectId, int toObjectId, int paramId) throws BGException
      Throws:
      BGException
    • copyParam

      public void copyParam(int fromObjectId, int fromParamId, int toObjectId, int toParamId) throws BGException
      Throws:
      BGException
    • isParameterFilled

      public boolean isParameterFilled(int id, Parameter param) throws BGException
      Проверяет заполненость параметра для объекта с кодом id.
      Throws:
      BGException
    • loadParameters

      public List<ParameterValuePair> loadParameters(List<Parameter> paramList, int id, boolean offEncription) throws BGException
      Загрузка значений в список параметров.
      Throws:
      BGException
    • getProcessFilledParamIds

      public Set<Integer> getProcessFilledParamIds(int id) throws BGException
      Получить список Id заполненных параметров процесса
      Parameters:
      id - - id процесса
      Throws:
      BGException
    • loadParameterValue

      public void loadParameterValue(ParameterValuePair param, int objectId, boolean offEncription) throws BGException
      Throws:
      BGException
    • updateParamValueMap

      public void updateParamValueMap(Map<Integer,ParameterValuePair> paramMap, String type, Collection<Integer> ids, int objectId, boolean offEncription) throws BGException
      Загрузка значений параметров определённого типа.
      Throws:
      BGException
    • paramSelectQuery

      public static void paramSelectQuery(String paramRef, String linkColumn, StringBuilder selectPart, StringBuilder joinPart, boolean addColumnValueAlias)
      Добавляет в запрос выборку параметра.
      Parameters:
      addColumnValueAlias - - добавляет в запрос алиас колонки, например в запросе param_79.value AS param_79_value добавит строку " AS param_79_value"
    • getParameterAddressValueFromRs

      public static ParameterAddressValue getParameterAddressValueFromRs(ResultSet rs) throws BGException
      Throws:
      BGException
    • getParameterAddressValueFromRs

      public static ParameterAddressValue getParameterAddressValueFromRs(ResultSet rs, String prefix) throws BGException
      Throws:
      BGException
    • getParameterAddressValueFromRs

      public static ParameterAddressValue getParameterAddressValueFromRs(ResultSet rs, String prefix, boolean loadDirs, String formatName) throws BGException
      Throws:
      BGException
    • paramValueFilter

      public boolean paramValueFilter(String expression, int objectId, Map valuesCache) throws BGException
      Фильтр сущности по значению параметра, пока поддерживается только значение вида param::cityId in 1,2,3 param::value in 1,2,3
      Throws:
      BGException
    • getParamJoinFilters

      public static String getParamJoinFilters(String expression, String objectId) throws BGException
      * Добавление INNER JOIN фильтров по параметрам, пока поддерживается только значение вида для списковых. param::value in 1,2,3
      Throws:
      BGException
    • updateParamTree

      public void updateParamTree(int id, int paramId, Set<String> values) throws BGException
      Throws:
      BGException
    • getParamTreeWithTitles

      public List<TreeTitle> getParamTreeWithTitles(int id, int paramId) throws BGException
      Throws:
      BGException
    • getParamListAsBool

      public boolean getParamListAsBool(int objectId, int paramId) throws BGException
      Зачитывание листового параметра как bool значение. Считается что значения листового параметра имеют следующий вид: 1=Нет (false) 2=Да (true)
      Throws:
      BGException
    • updateParamListAsBool

      public void updateParamListAsBool(int objectId, int paramId, boolean value) throws BGException
      Обновление листового параметра представенного как bool значение. Считается что значения листового параметра имеют следующий вид: 1=Нет (false) 2=Да (true)
      Throws:
      BGException
    • searchObjectByParameterPhone

      public Set<Integer> searchObjectByParameterPhone(int parameterId, ParameterPhoneValue parameterPhoneValue) throws SQLException
      Функция поиска объектов по значениям связанного телефонного параметра
      Parameters:
      parameterId - - ID параметра
      parameterPhoneValue - - набор телефонов для поиска
      Throws:
      SQLException
    • searchObjectByParameterAddress

      public Set<Integer> searchObjectByParameterAddress(int parameterId, ParameterAddressValue parameterAddressValue) throws SQLException
      Функция поиска объектов по значениям связанного адресного параметра
      Parameters:
      parameterId - - ID параметра
      parameterAddressValue - - значение адресного параметра
      Throws:
      SQLException
    • searchObjectByParameterText

      public Set<Integer> searchObjectByParameterText(int parameterId, String parameterTextValue) throws BGException
      Throws:
      BGException
    • searchObjectByDateParam

      @NotNull public @NotNull Set<Integer> searchObjectByDateParam(int paramId, @NotNull @NotNull LocalDate date) throws BGException
      Throws:
      BGException
    • searchObjectByDateAndMonth

      @NotNull public @NotNull Map<Integer,LocalDate> searchObjectByDateAndMonth(int paramId, @NotNull @NotNull LocalDate date) throws BGException
      Throws:
      BGException
    • searchObjectByFilledParams

      public Set<Integer> searchObjectByFilledParams(List<Parameter> parameters)
    • buildSearchByFilledParamsQuery

      protected String buildSearchByFilledParamsQuery(List<Parameter> parameters)