view src/main/java/de/mpiwg/gazetteer/bo/LGTopicSectionRelation.java @ 48:13555aff1f88

new: multiple full text searching. topics and tasks improvement.
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Thu, 21 Jan 2016 11:56:30 +0100
parents 9dbbbfd474f4
children
line wrap: on
line source

package de.mpiwg.gazetteer.bo;

import java.io.Serializable;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.json.JSONArray;

import cl.maps.duplex.DuplexKey;
import de.mpiwg.gazetteer.dataverse.DataverseUtils;
import de.mpiwg.gazetteer.db.DBBook;
import de.mpiwg.gazetteer.db.DBSection;
import de.mpiwg.gazetteer.utils.DBService;
import de.mpiwg.gazetteer.utils.DataProvider;


@Entity
@Table(name="TopicSectionRelation")
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
public class LGTopicSectionRelation extends DBEntry implements Cloneable, Serializable {
	private static final long serialVersionUID = 7805209462045170778L;

	@Column(name="topicId")
	private Long topicId;
	
	@Column(name="sectionId")
	private Long sectionId;
	
	@Column(name="bookId")
	private String bookId;

	
	
	@Transient
	private boolean transientDataLoaded = false;
	

	@Transient
	private LGTopic topic;
	
	public void loadTransientData(){
		
		this.topic = DataProvider.getInstance().getTopic(topicId);
	
		this.transientDataLoaded = true;
		
	}
	
	
	
	public boolean isEmpty() {
		if (topicId != null && sectionId != null) {
			return true;
		} else {
			return false;
		}
	}

	
	public Long getTopicId() {
		return topicId;
	}


	public void setTopicId(Long topicId) {
		this.topicId = topicId;
	}

	public Long getSectionId() {
		return sectionId;
	}


	public void setSectionId(Long sectionId) {
		this.sectionId = sectionId;
	}


	public String getBookId() {
		return bookId;
	}


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


	public boolean isTransientDataLoaded() {
		return transientDataLoaded;
	}


	public void setTransientDataLoaded(boolean transientDataLoaded) {
		this.transientDataLoaded = transientDataLoaded;
	}


	public LGTopic getTopic() {
		return topic;
	}



	public void setTopic(LGTopic topic) {
		this.topic = topic;
	}



	public DuplexKey<Long, Long> getKey(){
		return new DuplexKey<Long, Long>(this.topicId, this.sectionId);
	}
	
	@Override
	public String toString(){
		return "LGTopicSectionRelation[topicId=" + topicId.toString() + ", sectionId=" + sectionId.toString() + "]";
	}


	

	
}