<%@ page import="org.crosswire.xml.XMLRepo" %> <%@ page import="org.crosswire.xml.XMLObject" %> <%@ page import="org.crosswire.community.data.User" %> <% User user = (User)session.getAttribute("user"); if (user == null) return; XMLRepo repo = XMLRepo.instance(pageContext); XMLObject users[] = repo.getObjects(new User(user.getID(), null)); for (int surrogateID = 0; true; surrogateID++) { int i; for (i = 0; i < users.length; i++) { User u = (User)users[i]; if (("surrogate"+Integer.toString(surrogateID)).equalsIgnoreCase(u.getID())) break; } if (i == users.length) { User newSurrogate = new User(user.getID(), "surrogate"+Integer.toString(surrogateID)); newSurrogate.setFullName("Surrogate"+Integer.toString(surrogateID)); repo.save(newSurrogate); break; } } %>