Class DocumentDao
java.lang.Object
ru.bitel.common.dao.AbstarctDaoConstant
ru.bitel.common.dao.AbstractDao<Document>
ru.bitel.bgbilling.plugins.documents.server.bean.DocumentDao
- All Implemented Interfaces:
java.lang.AutoCloseable
public class DocumentDao extends ru.bitel.common.dao.AbstractDao<Document>
DAO (Data Access Object - объект доступа к данным) для работы с документами.
Класс осуществляет вставку/обновление/удаление документов в БД.
-
Nested Class Summary
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.common.dao.AbstractDao
cacheFilter, cacheJoin, cacheOrderBy, cachePaged, cachePS, cacheWhat, getByIdPS, moduleId, orderByPattern, tableNameFields inherited from class ru.bitel.common.dao.AbstarctDaoConstant
ERROR, fields, 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 Description DocumentDao(java.sql.Connection con) -
Method Summary
Modifier and Type Method Description voiddeleteDocument(int id)Удаление документа из БД по его коду.DocumentgetDocument(int id)java.util.List<Document>getDocumentList(int contractId, java.lang.String title, Period period)Возвращает список документов договора с учетом фильтра.intgetDocumentOwnerId(int documentId)Возвращает код договора по коду документа.protected DocumentgetFromRS(java.sql.ResultSet rs)protected voidupdateImpl(Document document)Вставка/Обновление документа в БД.Methods inherited from class ru.bitel.common.dao.AbstractDao
close, delete, deleteImpl, eq, get, getById, getImpl, getListFromRS, getPeriod, getQueryById, getSQLOrder, getTableName, list, list, listImpl, listImpl, listImplPS, listImplPS, ormFromResultSet, ormUpdateImpl, ormUpdateImpl, ormUpdateImpl, ormUpdateImpl, processException, recycle, setStatementParam, updateMethods inherited from class ru.bitel.common.dao.AbstarctDaoConstant
getSQLOrderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
DocumentDao
public DocumentDao(java.sql.Connection con)
-
-
Method Details
-
updateImpl
protected void updateImpl(Document document) throws ru.bitel.bgbilling.common.BGException, java.sql.SQLExceptionВставка/Обновление документа в БД. Если документ вставляется, то в бин заносится id вставленной записи.- Specified by:
updateImplin classru.bitel.common.dao.AbstractDao<Document>- Throws:
ru.bitel.bgbilling.common.BGExceptionjava.sql.SQLException
-
getDocumentList
public java.util.List<Document> getDocumentList(int contractId, java.lang.String title, Period period) throws ru.bitel.bgbilling.common.BGExceptionВозвращает список документов договора с учетом фильтра. Фильтр включает в себя название документа (либо его часть), и период, когда был добавлен документ к договору. Код договора обязателен!- Parameters:
contractId- код договораtitle- название документа (либо часть названия)period- период- Returns:
- список документов договора
- Throws:
ru.bitel.bgbilling.common.BGException
-
deleteDocument
public void deleteDocument(int id) throws ru.bitel.bgbilling.common.BGExceptionУдаление документа из БД по его коду. При этом автоматически средствами БД очищается история изменения статусов данного документа.- Parameters:
id- код документа- Throws:
ru.bitel.bgbilling.common.BGExceptionjava.sql.SQLException
-
getDocumentOwnerId
public int getDocumentOwnerId(int documentId) throws ru.bitel.bgbilling.common.BGExceptionВозвращает код договора по коду документа. ИСпользуется при проверке принадлежности определенного документа определенному договору- Parameters:
documentId- код документа- Returns:
- код договора
- Throws:
ru.bitel.bgbilling.common.BGException
-
getDocument
- Throws:
ru.bitel.bgbilling.common.BGException
-
getFromRS
protected Document getFromRS(java.sql.ResultSet rs) throws java.sql.SQLException, ru.bitel.bgbilling.common.BGException- Specified by:
getFromRSin classru.bitel.common.dao.AbstractDao<Document>- Throws:
java.sql.SQLExceptionru.bitel.bgbilling.common.BGException
-