Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Creative commons Attribution-NonCommercial license. http://creativecommons.org/licenses/by-nc/2.5/au/deed.en_GB NO WARRANTY IS GIVEN OR IMPLIED, USE AT YOUR OWN RISK.
 
 package base.jee.servlet;
 
Display people search form and people search results.
public class PeopleServlet extends BaseServlet {
	private static final long serialVersionUID = 1L;
	public PeopleServlet(JeeBase jeethrows IOException {
		super(jee);
	}
	@SuppressWarnings("unchecked")
	public void doGet(String tokenUser uHttpServletRequest requestHttpServletResponse responsethrows ServletExceptionIOException {
		String error = null;
		String success = null;
			throw new PermissionException(SearchPeople.class.getSimpleName(), u"You do not have permission to search people.".);
		}
		if(request.getParameter("created_person") != null) {
			List<Personr = .getAPI().getPerson(u, UUID.fromString(request.getParameter("created_person")));
			if(r.size() > 0) {
				if(r.get(0).getCreated() != null && r.get(0).getCreated().getTime() + 60000 > new Date().getTime()) {
					success = "Created account for " + r.get(0).getDisplayName() + ".";
				}
			}
		}
		List<Personpeople = null;
		String q = request.getParameter("q");
		if(q == null) { q = ""; }
		q = q.trim();
		if(q.length() > 0) {
			people = .getAPI().searchPeople(urequest.getParameter("q"));
		}
		ST page = .getPage(u"people");
		if(q.length() == 0) {
			page.add("q"null);
else {
			page.add("q"q);
		}
		page.add("people"people);
		page.add("group_manager"u.hasRole(.));
		page.add("error"error);
		page.add("success"success);
		page.add("breadcrumbs"new Breadcrumb("People search"null));
		response.getWriter().write(page.render());
	}
New to GrepCode? Check out our FAQ X