+ String soneId = (String) session.getAttribute("Sone.CurrentSone");
+ for (Sone sone : webInterface.core().localSones()) {
+ if (sone.getId().equals(soneId)) {
+ return sone;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Sets the currently logged in Sone.
+ *
+ * @param toadletContext
+ * The toadlet context
+ * @param sone
+ * The Sone to set as currently logged in
+ */
+ protected void setCurrentSone(ToadletContext toadletContext, Sone sone) {
+ Session session = getCurrentSession(toadletContext);
+ if (sone == null) {
+ session.removeAttribute("Sone.CurrentSone");
+ } else {
+ session.setAttribute("Sone.CurrentSone", sone.getId());
+ }