ru.bitel.oss.systems.inventory.resource.server.bean

## Class DeviceDao<D extends Device<D,T>,T extends DeviceType>

- java.lang.Object
- - ru.bitel.common.dao.AbstractDao<B>
  - - ru.bitel.common.dao.AbstractIdDao<E>
    - - ru.bitel.oss.kernel.entity.server.bean.AbstractEntityAttrDao<E>
      - - ru.bitel.oss.kernel.entity.server.bean.AbstractEntityDao<D>
        - - ru.bitel.oss.systems.inventory.resource.server.bean.DeviceDao<D,T>

- All Implemented Interfaces:
    java.lang.AutoCloseable
  Direct Known Subclasses:
    InvDeviceDao, TvDeviceDao

      public abstract class DeviceDao<D extends Device<D,T>,T extends DeviceType>
      extends AbstractEntityDao<D>

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class ru.bitel.oss.kernel.entity.server.bean.AbstractEntityAttrDao

      `AbstractEntityAttrDao.AddressItemModifiedEventListener`

    - ### Nested classes/interfaces inherited from class ru.bitel.common.dao.AbstractDao

      `ru.bitel.common.dao.AbstractDao.ResultSetIterator`

  - ### Field Summary

    - ### Fields inherited from class ru.bitel.oss.kernel.entity.server.bean.AbstractEntityDao

      `getImplPS, insertEntityPS, updateEntityPS`

    - ### Fields inherited from class ru.bitel.oss.kernel.entity.server.bean.AbstractEntityAttrDao

      `entitySpecAttrDirectory, entitySpecDirectory, filterWeightComparator, userId`

    - ### Fields inherited from class ru.bitel.common.dao.AbstractDao

      `cacheFilter, cacheJoin, cacheOrderBy, cachePaged, cachePS, cacheWhat, con, getByIdPS, mid, moduleId, orderByPattern, SQL_CALC_FOUND_ROWS, SQL_DELETE, SQL_EQ, SQL_EQCS, SQL_FROM, SQL_GROUP, SQL_IN, SQL_INSERT, SQL_LIMIT, SQL_ORDER, SQL_SELECT, SQL_SET, SQL_UPDATE, SQL_WHERE, tableName`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DeviceDao(java.sql.Connection con, int mid, int userId, java.lang.String tableName, boolean groupLink)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected int` | `deleteImpl(int id)`
    `static <T extends DeviceType,D extends Device<D,T>> void` | `getFromRS(java.sql.ResultSet rs, ru.bitel.bgbilling.kernel.directory.api.common.Directory<T> deviceTypeDir, T folderType, java.sql.PreparedStatement getGroupsPS, D result)`
    `protected D` | `getFromRSImpl(java.sql.ResultSet rs)`
    `protected D` | `getTreeFromList(java.util.List<D> deviceList, int deviceId)`
    `protected abstract ru.bitel.bgbilling.kernel.directory.api.common.Directory<T>` | `getTypeDir()`
    `java.util.List<D>` | `list(int deviceTypeId, boolean loadDeviceGroupLink)`
    `java.util.List<D>` | `list(java.util.List<FilterEntityAttr> entityFilter, boolean loadDeviceGroupLink)`
    `java.util.List<D>` | `listByType(int deviceTypeId, boolean loadDeviceGroupLink)`
    `java.util.List<D>` | `listByUptimeTime(java.util.Date uptimeTime, java.lang.String orderBy, Page page)`
    `void` | `move(int newParentId, java.util.Set<java.lang.Integer> children)`
    `protected abstract D` | `newDevice()`
    `protected abstract T` | `newDeviceType(int id, java.lang.String title)`
    `D` | `node(java.util.List<FilterEntityAttr> entityFilter, int deviceId, boolean loadDeviceGroupLink)`
    `D` | `node(java.util.List<FilterEntityAttr> entityFilter, int deviceId, java.lang.String filter, boolean loadDeviceGroupLink)`
    `D` | `root(java.lang.String identifier, java.lang.String host, int deviceType, java.util.Set<java.lang.Integer> deviceGroupIds, java.util.List<FilterEntityAttr> entityFilter)` Deprecated.
    `D` | `root(java.lang.String identifier, java.lang.String host, java.util.Set<java.lang.Integer> deviceTypeIds, java.util.Set<java.lang.Integer> deviceGroupIds, java.util.Date dateFrom, java.util.Date dateTo, java.util.Date intersectDateFrom, java.util.Date intersectDateTo, java.util.List<FilterEntityAttr> entityFilter, boolean loadDeviceGroupLink)`
    `void` | `update(D b)` Для обновления вызывать этот метод.
    `protected void` | `updateImpl(D b)` Этот метод каждый реализует сам со своей логикой.
    `void` | `updateUptime(int id, java.lang.String uptime, java.util.Date uptimeTime)`

    - ### Methods inherited from class ru.bitel.oss.kernel.entity.server.bean.AbstractEntityDao

      `getFromRS, getImpl, linkEntity, list, list, listImpl, recycle, unlinkEntity`

    - ### Methods inherited from class ru.bitel.oss.kernel.entity.server.bean.AbstractEntityAttrDao

      `filterInit, filterJoin, filterToPS, getAttribute, getEntityAttributes, getEntitySpecAttrDirectory, getEntitySpecDirectory, getEntityTableName, getFromRS, listImpl, onAddressItemUpdate, updateEntityAttribute, updateEntityAttributes`

    - ### Methods inherited from class ru.bitel.common.dao.AbstractIdDao

      `delete, get, getAndDelete, getAndUpdate`

    - ### Methods inherited from class ru.bitel.common.dao.AbstractDao

      `close, delete, eq, get, getById, getListFromRS, getSQLOrder, getSQLOrder, getTableName, list, listImpl, listImplPS, listImplPS, processException, setStatementParam`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DeviceDao

          public DeviceDao(java.sql.Connection con,
                           int mid,
                           int userId,
                           java.lang.String tableName,
                           boolean groupLink)
                    throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

  - ### Method Detail

    - #### newDevice

          protected abstract D newDevice()

    - #### newDeviceType

          protected abstract T newDeviceType(int id,
                                             java.lang.String title)

    - #### getTypeDir

          protected abstract ru.bitel.bgbilling.kernel.directory.api.common.Directory<T> getTypeDir()
                                                                                             throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### getFromRSImpl

          protected D getFromRSImpl(java.sql.ResultSet rs)
                             throws java.sql.SQLException,
                                    ru.bitel.bgbilling.common.BGException

      Specified by:
        `getFromRSImpl` in class `AbstractEntityDao<D extends Device<D,T>>`
      Throws:
        `java.sql.SQLException`
        `ru.bitel.bgbilling.common.BGException`

    - #### getFromRS

          public static <T extends DeviceType,D extends Device<D,T>> void getFromRS(java.sql.ResultSet rs,
                                                                                    ru.bitel.bgbilling.kernel.directory.api.common.Directory<T> deviceTypeDir,
                                                                                    T folderType,
                                                                                    java.sql.PreparedStatement getGroupsPS,
                                                                                    D result)
                                                                             throws java.sql.SQLException,
                                                                                    ru.bitel.bgbilling.common.BGException

      Throws:
        `java.sql.SQLException`
        `ru.bitel.bgbilling.common.BGException`

    - #### update

          public void update(D b)
                      throws ru.bitel.bgbilling.common.BGException

      Description copied from class: `ru.bitel.common.dao.AbstractDao`
      Для обновления вызывать этот метод.
      Он в свою очередь вызавет updateImpl у конкретного наследника.
      Overrides:
        `update` in class `AbstractEntityDao<D extends Device<D,T>>`
      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### updateImpl

          protected void updateImpl(D b)
                             throws ru.bitel.bgbilling.common.BGException,
                                    java.sql.SQLException

      Description copied from class: `ru.bitel.common.dao.AbstractDao`
      Этот метод каждый реализует сам со своей логикой.
      Для обновления вызывать update.
      Specified by:
        `updateImpl` in class `ru.bitel.common.dao.AbstractDao<D extends Device<D,T>>`
      Parameters:
        `b` - экземпляр модели
      Throws:
        `ru.bitel.bgbilling.common.BGException` - ошибки
        `java.sql.SQLException` - ошибки

    - #### list

          public java.util.List<D> list(java.util.List<FilterEntityAttr> entityFilter,
                                        boolean loadDeviceGroupLink)
                                 throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### list

          public java.util.List<D> list(int deviceTypeId,
                                        boolean loadDeviceGroupLink)
                                 throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### root

          @Deprecated
          public D root(java.lang.String identifier,
                                    java.lang.String host,
                                    int deviceType,
                                    java.util.Set<java.lang.Integer> deviceGroupIds,
                                    java.util.List<FilterEntityAttr> entityFilter)
                             throws ru.bitel.bgbilling.common.BGException

      Deprecated.
      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### root

          public D root(java.lang.String identifier,
                        java.lang.String host,
                        java.util.Set<java.lang.Integer> deviceTypeIds,
                        java.util.Set<java.lang.Integer> deviceGroupIds,
                        java.util.Date dateFrom,
                        java.util.Date dateTo,
                        java.util.Date intersectDateFrom,
                        java.util.Date intersectDateTo,
                        java.util.List<FilterEntityAttr> entityFilter,
                        boolean loadDeviceGroupLink)
                 throws ru.bitel.bgbilling.common.BGException

      Parameters:
        `identifier` -
        `host` -
        `deviceType` - -1 - любой, 0-папка или код типа устройства
        `deviceGroupIds` -
        `entityFilter` -
      Returns:
      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### node

          public D node(java.util.List<FilterEntityAttr> entityFilter,
                        int deviceId,
                        boolean loadDeviceGroupLink)
                 throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### node

          public D node(java.util.List<FilterEntityAttr> entityFilter,
                        int deviceId,
                        java.lang.String filter,
                        boolean loadDeviceGroupLink)
                 throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### getTreeFromList

          protected D getTreeFromList(java.util.List<D> deviceList,
                                      int deviceId)

    - #### move

          public void move(int newParentId,
                           java.util.Set<java.lang.Integer> children)
                    throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### updateUptime

          public void updateUptime(int id,
                                   java.lang.String uptime,
                                   java.util.Date uptimeTime)
                            throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### listByUptimeTime

          public java.util.List<D> listByUptimeTime(java.util.Date uptimeTime,
                                                    java.lang.String orderBy,
                                                    Page page)
                                             throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### listByType

          public java.util.List<D> listByType(int deviceTypeId,
                                              boolean loadDeviceGroupLink)
                                       throws ru.bitel.bgbilling.common.BGException

      Throws:
        `ru.bitel.bgbilling.common.BGException`

    - #### deleteImpl

          protected int deleteImpl(int id)
                            throws ru.bitel.bgbilling.common.BGException

      Overrides:
        `deleteImpl` in class `AbstractEntityDao<D extends Device<D,T>>`
      Throws:
        `ru.bitel.bgbilling.common.BGException`