view src/main/java/de/mpiwg/gazetteer/db/DBSection.java @ 40:35ed4e650a53

bug fixed: full text search when section not found in section_index table. add paginator
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Mon, 07 Dec 2015 17:06:57 +0100
parents 3e62083dbcbf
children 9dbbbfd474f4
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.bo.LGBranch;

public class DBSection implements Comparable<DBSection>{

	private Long id;
	private String name;
	private String text;
	
	private String bookId;
	private DBBook book;
	
	private Integer start_page;
	private Integer end_page;
	
	private List<LGBranch> branches;
	
	/*
	public DBSection(Long id){
		this.id = id;
	}
	
	
	public DBSection(Long id, String name, String bookId){
		this.id = id;
		this.name = name;
		this.bookId = bookId;
	}*/
	
	public DBSection() {
		this.name = "-";
		this.id = null;
		this.bookId = null;
		this.start_page = null;
		this.end_page = null;
	}
	
	public DBSection(ResultSet rs) throws SQLException{
		this.name = rs.getString("name");
		this.id = rs.getLong("id");
		this.bookId = rs.getString("books_id");
		this.start_page = rs.getInt("start_page");
		this.end_page = rs.getInt("end_page");
	}
	
	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	public String getBookId() {
		return bookId;
	}

	public void setBookId(String bookId) {
		this.bookId = bookId;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public DBBook getBook() {
		return book;
	}

	public void setBook(DBBook book) {
		this.book = book;
	}

	public List<LGBranch> getBranches() {
		return branches;
	}

	public void setBranches(List<LGBranch> branches) {
		this.branches = branches;
	}
	
	public Integer getStart_page() {
		return start_page;
	}

	public void setStart_page(Integer start_page) {
		this.start_page = start_page;
	}

	public Integer getEnd_page() {
		return end_page;
	}

	public void setEnd_page(Integer end_page) {
		this.end_page = end_page;
	}

	public String getPages(){
		return this.start_page + " - " + this.end_page;
	}
	
	@Override
	public int compareTo(DBSection o) {
		return this.getName().compareTo(o.getName());
	}
}