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.AbstarctDaoConstant
  - - 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, VoiceDeviceDao

      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, updateEntityPS2`

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

      `CONTRACT_OBJECT_SUPPORT, CONTRACT_SUPPORT, ENTITY_SUPPORT, entitySpecAttrDirectory, entitySpecDirectory, filterWeightComparator, userId`

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

      `cacheFilter, cacheJoin, cacheOrderBy, cachePaged, cachePS, cacheWhat, con, getByIdPS, mid, moduleId, orderByPattern, tableName`

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

      `ERROR, SQL_CALC_FOUND_ROWS, SQL_DELETE, SQL_DISTINCT, SQL_EQ, SQL_EQCS, SQL_FROM, SQL_GROUP, SQL_IN, SQL_INSERT, SQL_LIMIT, SQL_ON_DUPLICATE_KEY_UPDATE, SQL_ORDER, SQL_SELECT, SQL_SET, SQL_UPDATE, SQL_VALUES, SQL_WHERE`

  - ### 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, 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 Directory<T>` | `getTypeDir()`
    `protected java.util.List<java.lang.String>` | `getValues()`
    `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)`
    `protected int` | `setExtraParams(D device, java.sql.PreparedStatement ps, int idx)`
    `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

      `checkEntityAttribute, checkEntitySpecAttrDelete, filterInit, filterJoin, filterToPS, getAllEntityAttributes, getAttribute, getEntityAttribute, getEntityAttributes, getEntitySpecAttrDirectory, getEntitySpecDirectory, getEntityTableName, getEntityValueForIds, 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, getPeriod, getSQLOrder, getTableName, list, listImpl, listImplPS, listImplPS, processException, setStatementParam`

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

      `getSQLOrder`

    - ### 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 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,
                                                                                    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

      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

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

    - #### setExtraParams

          protected int setExtraParams(D device,
                                       java.sql.PreparedStatement ps,
                                       int idx)
                                throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getValues

          protected java.util.List<java.lang.String> getValues()

    - #### 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`