view src/main/java/de/mpiwg/web/books/SortBooksByEditor.java @ 105:16a0796e3871 default tip

remove "console.log" from general.js
author Calvin Yeh <cyeh@mpipw-berlin.mpg.com>
date Fri, 29 Sep 2017 16:18:02 +0200
parents a7e9c1f8edb4
children
line wrap: on
line source

package de.mpiwg.web.books;

import java.util.Comparator;

import org.apache.log4j.Logger;

import de.mpiwg.gazetteer.db.DBBook;


public class SortBooksByEditor implements Comparator<DBBook>{

	public int compare(DBBook o1, DBBook o2) {

		if(o1.getCurrentSectionVersion() == null && o2.getCurrentSectionVersion() == null) {
			return o1.getId().compareTo(o2.getId());	
		} else if (o1.getCurrentSectionVersion() == null) {
			return -1;
		} else if (o2.getCurrentSectionVersion() == null){
			return 1;
		} else {
			return o1.getCurrentSectionVersion().getEditor().compareTo(o2.getCurrentSectionVersion().getEditor());
		}
	}
	
}