com.github.easydoc.model.Model Maven / Gradle / Ivy
package com.github.easydoc.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.github.easydoc.model.criteria.DocSearchCriteria;
public class Model implements Serializable {
private static final long serialVersionUID = 2L;
private DocTree doctree = new DocTree();
private transient DocTree rawDocs = new DocTree();
public List findDocs(DocSearchCriteria criteria) {
List ret = new ArrayList();
ret.addAll(rawDocs.find(criteria));
ret.addAll(doctree.find(criteria));
return ret;
}
public void addRawDocs(List docs) {
rawDocs.addRoots(docs);
}
public Collection getRawDocs() {
return rawDocs.getRoots();
}
public Map toFreemarkerModel() {
Map ret = new HashMap();
ret.put("doctree", doctree.getRoots());
return ret;
}
public DocTree getDocTree() {
return doctree;
}
@Override
public String toString() {
return String.format("Model [doctree=%s, rawDocs=%s]", doctree, rawDocs);
}
public boolean isEmpty() {
return rawDocs.isEmpty() && doctree.isEmpty();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy