diff src/main/java/de/mpiwg/gazetteer/bo/LGTopic.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 95bf4ac726e6
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/gazetteer/bo/LGTopic.java	Mon Dec 28 12:54:55 2015 +0100
+++ b/src/main/java/de/mpiwg/gazetteer/bo/LGTopic.java	Thu Jan 21 11:56:30 2016 +0100
@@ -57,6 +57,8 @@
 	@Transient
 	private boolean transientDataLoaded = false;
 	
+	@Transient
+	private Integer numOfSections = 0;
 	
 	
 	public boolean isEmpty() {
@@ -217,8 +219,6 @@
 	}
 
 
-
-
 	public void setContributorsList(List<Long> contributorsList) {
 		this.contributorsList = contributorsList;
 	}
@@ -228,6 +228,27 @@
 		this.transientDataLoaded = transientDataLoaded;
 	}
 	
+
+	
+	public Integer getNumOfSections() {
+		if (numOfSections == 0){
+			// TODO get number of sections in this topic from db table TopicSectionRelation with topicId=this.topicId
+			Long topicId = this.getId();
+			
+			this.setNumOfSections(DataProvider.getInstance().getNumberOfSectionInTopic(topicId));
+			
+		}
+		
+		return numOfSections;
+	}
+
+	public void setNumOfSections(Integer numOfSections) {
+		this.numOfSections = numOfSections;
+	}
+
+
+
+
 	public DuplexKey<Long, Long> getKey(){
 		return new DuplexKey<Long, Long>(this.userId, this.id);
 	}
@@ -236,6 +257,9 @@
 		return nameEn + "(" + nameCh + ", " + namePinyin + ")";
 	}
 
+	
+	
+	
 	@Override
 	public String toString(){
 		return "LGTopic[nameEn=" + nameEn + ", nameCh=" + nameCh + ", namePinyin=" + namePinyin + "]";