Mercurial > hg > LGServices
view src/main/java/de/mpiwg/gazetteer/db/DBContents.java @ 39:37840afb7b80
new: full text search
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Fri, 04 Dec 2015 14:28:44 +0100 |
parents | |
children | 35ed4e650a53 |
line wrap: on
line source
package de.mpiwg.gazetteer.db; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import de.mpiwg.gazetteer.utils.DBService; public class DBContents implements Comparable<DBContents>{ private Long id; private String bookId; private Integer page; private String content; private DBSection section; // section already contain DBBook private Integer inx = null; // local index for each row private DBCoordinatesBook coordinatesBook = null; private boolean isRemoved = false; public DBContents(ResultSet rs) throws SQLException{ this.id = rs.getLong("id"); this.bookId = rs.getString("books_id"); this.page = rs.getInt("line"); this.content = rs.getString("content"); // set this.section by bookId and page this.section = DBService.getInstance().getSectionByBookIdAndPage(this.bookId, this.page); // set this.coordinatesBook by bookId this.coordinatesBook = DBService.getInstance().getCoordinatesBook(bookId); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getBookId() { return bookId; } public void setBookId(String bookId) { this.bookId = bookId; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public DBSection getSection() { return section; } public void setSection(DBSection section) { this.section = section; } public Integer getPage() { return page; } public void setPage(Integer page) { this.page = page; } public Integer getInx() { return inx; } public void setInx(Integer inx) { this.inx = inx; } public DBCoordinatesBook getCoordinatesBook() { return coordinatesBook; } public void setCoordinatesBook(DBCoordinatesBook coordinatesBook) { this.coordinatesBook = coordinatesBook; } public boolean isRemoved() { return isRemoved; } public void setRemoved(boolean isRemoved) { this.isRemoved = isRemoved; } @Override public int compareTo(DBContents o) { return this.getInx().compareTo(o.getInx()); } }