Mercurial > hg > LGServices
annotate src/main/java/de/mpiwg/web/search/SortSectionByBookYear.java @ 94:d0dcbe8254f5
New Feature: Add book year and edition year in section searching page, also prevent from book not existing exception
| author | Calvin Yeh <cyeh@mpipw-berlin.mpg.com> |
|---|---|
| date | Mon, 03 Jul 2017 23:43:44 +0200 |
| parents | |
| children |
| rev | line source |
|---|---|
|
94
d0dcbe8254f5
New Feature: Add book year and edition year in section searching page, also prevent from book not existing exception
Calvin Yeh <cyeh@mpipw-berlin.mpg.com>
parents:
diff
changeset
|
1 package de.mpiwg.web.search; |
|
d0dcbe8254f5
New Feature: Add book year and edition year in section searching page, also prevent from book not existing exception
Calvin Yeh <cyeh@mpipw-berlin.mpg.com>
parents:
diff
changeset
|
2 |
|
d0dcbe8254f5
New Feature: Add book year and edition year in section searching page, also prevent from book not existing exception
Calvin Yeh <cyeh@mpipw-berlin.mpg.com>
parents:
diff
changeset
|
3 import de.mpiwg.gazetteer.db.DBSection; |
|
d0dcbe8254f5
New Feature: Add book year and edition year in section searching page, also prevent from book not existing exception
Calvin Yeh <cyeh@mpipw-berlin.mpg.com>
parents:
diff
changeset
|
4 |
|
d0dcbe8254f5
New Feature: Add book year and edition year in section searching page, also prevent from book not existing exception
Calvin Yeh <cyeh@mpipw-berlin.mpg.com>
parents:
diff
changeset
|
5 import java.util.Comparator; |
|
d0dcbe8254f5
New Feature: Add book year and edition year in section searching page, also prevent from book not existing exception
Calvin Yeh <cyeh@mpipw-berlin.mpg.com>
parents:
diff
changeset
|
6 |
|
d0dcbe8254f5
New Feature: Add book year and edition year in section searching page, also prevent from book not existing exception
Calvin Yeh <cyeh@mpipw-berlin.mpg.com>
parents:
diff
changeset
|
7 |
|
d0dcbe8254f5
New Feature: Add book year and edition year in section searching page, also prevent from book not existing exception
Calvin Yeh <cyeh@mpipw-berlin.mpg.com>
parents:
diff
changeset
|
8 public class SortSectionByBookYear implements Comparator<DBSection>{ |
|
d0dcbe8254f5
New Feature: Add book year and edition year in section searching page, also prevent from book not existing exception
Calvin Yeh <cyeh@mpipw-berlin.mpg.com>
parents:
diff
changeset
|
9 |
|
d0dcbe8254f5
New Feature: Add book year and edition year in section searching page, also prevent from book not existing exception
Calvin Yeh <cyeh@mpipw-berlin.mpg.com>
parents:
diff
changeset
|
10 public int compare(DBSection o1, DBSection o2) { |
|
d0dcbe8254f5
New Feature: Add book year and edition year in section searching page, also prevent from book not existing exception
Calvin Yeh <cyeh@mpipw-berlin.mpg.com>
parents:
diff
changeset
|
11 |
|
d0dcbe8254f5
New Feature: Add book year and edition year in section searching page, also prevent from book not existing exception
Calvin Yeh <cyeh@mpipw-berlin.mpg.com>
parents:
diff
changeset
|
12 if(o1.getBook() == null || o2.getBook() == null){ |
|
d0dcbe8254f5
New Feature: Add book year and edition year in section searching page, also prevent from book not existing exception
Calvin Yeh <cyeh@mpipw-berlin.mpg.com>
parents:
diff
changeset
|
13 return o1.getName().compareTo(o2.getName()); |
|
d0dcbe8254f5
New Feature: Add book year and edition year in section searching page, also prevent from book not existing exception
Calvin Yeh <cyeh@mpipw-berlin.mpg.com>
parents:
diff
changeset
|
14 } |
|
d0dcbe8254f5
New Feature: Add book year and edition year in section searching page, also prevent from book not existing exception
Calvin Yeh <cyeh@mpipw-berlin.mpg.com>
parents:
diff
changeset
|
15 return o1.getBook().getBookYear().compareTo(o2.getBook().getBookYear()); |
|
d0dcbe8254f5
New Feature: Add book year and edition year in section searching page, also prevent from book not existing exception
Calvin Yeh <cyeh@mpipw-berlin.mpg.com>
parents:
diff
changeset
|
16 } |
|
d0dcbe8254f5
New Feature: Add book year and edition year in section searching page, also prevent from book not existing exception
Calvin Yeh <cyeh@mpipw-berlin.mpg.com>
parents:
diff
changeset
|
17 |
|
d0dcbe8254f5
New Feature: Add book year and edition year in section searching page, also prevent from book not existing exception
Calvin Yeh <cyeh@mpipw-berlin.mpg.com>
parents:
diff
changeset
|
18 } |
