public <A, S extends A> SysExpr addUniversalListener( Class<S> argType, In2Out1<Node, A, Do> callback) { final In2Out1<Node, Object, Do> was = universalListener; universalListener = (node, arg) -> { final Do toUndo = was.io(node, arg); if (argType.isInstance(arg) || arg == null) { final Do undo = callback.io(node, (A) arg); return toUndo.doAfter(undo); } return toUndo; }; return this; }
public static void saveStylist(Stylist stylist, String password1, String password2) { System.out.println("Add saveStylist"); if (password1.equals(password2)) { Account acct = new Account(); acct.email = stylist.email; acct.password = password1; acct.type = UserTypes.STYLIST; acct.save(); stylist.acctId = new ObjectId(acct.id.toString()); stylist.save(); Salon salon = Salon.read(stylist.salonKey); String text = "Hi, A stylist how may work at your salon has just created an account with the username " + stylist.username + " you may wish to add them to your list of stylists."; String[] to = {salon.email}; String from = "*****@*****.**"; Email msg = new Email(text, to, from, "Stylist just signed up", "Repinzle"); msg.sendMessage(); Do.login(acct.email, acct.password); View.stylist(stylist.username); } else { stylist("The passwords entered do not match"); } }
public static void saveUser(User user) { String userid = session.get("userid"); String email = session.get("useremail"); User u = User.read(userid); u.realname = user.realname; u.stylistUsername = user.stylistUsername; u.stylist = Stylist.readByUsername(user.stylistUsername); u.save(); Account acct = Account.read(email); Do.login(acct.email, acct.password); View.user(u.userid.toString()); }
@Override public void implementTask() { if (Do.equals(ACTION_INIT_DB)) { mAsyncTaskManager.setupTask(new InitDB(context)); } }