changes in keyword data provider to match new params

This commit is contained in:
Emil Siverhall 2012-02-27 13:42:11 +01:00
parent a29ca62bae
commit e21b6c7039

@ -5,6 +5,7 @@ import java.util.Iterator;
import org.apache.wicket.spring.injection.annot.SpringBean;
import se.su.dsv.scipro.data.dao.interfaces.Dao;
import se.su.dsv.scipro.data.dao.interfaces.Dao.SortableParams.Sort;
import se.su.dsv.scipro.dataproviders.SortSpecifier;
import se.su.dsv.scipro.dataproviders.SortableDataProvider;
import se.su.dsv.scipro.match.dao.interfaces.KeywordDao;
@ -15,29 +16,34 @@ public class KeywordsDataProvider extends SortableDataProvider<Keyword>{
private static final long serialVersionUID = 1L;
private KeywordType keywordType = null;
@SpringBean
protected KeywordDao keywordDao;
private KeywordDao.Params params;
@Override
protected Dao<Keyword> getDao() {
return keywordDao;
}
public KeywordsDataProvider(final SortSpecifier sortSpecifier, KeywordType keywordType) {
public KeywordsDataProvider(KeywordType keywordType, boolean includeDeleted) {
this(null, keywordType, includeDeleted);
}
public KeywordsDataProvider(final SortSpecifier sortSpecifier, KeywordType keywordType, boolean includeDeleted) {
super(sortSpecifier, Keyword.class);
this.keywordType = keywordType;
params = new KeywordDao.Params();
params.setIncludeDeleted(includeDeleted);
params.setType(keywordType);
}
public Iterator<Keyword> iterator(int first, int count) {
Iterator<Keyword> iter = keywordDao.getKeywords(keywordType, true).iterator();
Iterator<Keyword> iter = keywordDao.getKeywordList(params).iterator();
return iter;
}
@Override
public int size() {
return keywordDao.getKeywords(keywordType, true).size();
return keywordDao.getKeywordList(params).size();
}
}