@@ -0,0 +1,1620 @@
+/**%0A * %0A */%0Apackage org.xcolab.portlets.redballoon;%0A%0Aimport java.io.Serializable;%0A%0Aimport javax.servlet.http.Cookie;%0A%0A/**%0A * @author pdeboer%0A * %0A */%0Apublic class BalloonCookie implements Serializable %7B%0A%09/**%0A%09 * %0A%09 */%0A%09private static final long serialVersionUID = 1L;%0A%09/**%0A%09 * %0A%09 */%0A%09private String email;%0A%09private String uuid;%0A%0A%09public static final String COOKIE_NAME = %22climatecolabBalloonCookie%22;%0A%0A%09/**%0A%09 * %0A%09 */%0A%09public BalloonCookie() %7B%0A%09%7D%0A%0A%09public BalloonCookie(BalloonCookie bc) %7B%0A%09%09if (bc != null) %7B%0A%09%09%09email = bc.email;%0A%09%09%09uuid = bc.uuid;%0A%09%09%7D%0A%09%7D%0A%0A%09/**%0A%09 * @return the email%0A%09 */%0A%09public String getEmail() %7B%0A%09%09return email;%0A%09%7D%0A%0A%09/**%0A%09 * @param email%0A%09 *            the email to set%0A%09 */%0A%09public void setEmail(String email) %7B%0A%09%09this.email = email;%0A%09%7D%0A%0A%09/**%0A%09 * @param uuid%0A%09 *            the uuid to set%0A%09 */%0A%09public void setUuid(String uuid) %7B%0A%09%09this.uuid = uuid;%0A%09%7D%0A%0A%09/**%0A%09 * @return the uuid%0A%09 */%0A%09public String getUuid() %7B%0A%09%09return uuid;%0A%09%7D%0A%0A%09public static BalloonCookie fromCookieArray(Cookie%5B%5D cookies) %7B%0A%09%09for (Cookie c : cookies) %7B%0A%09%09%09if (c.getName().equals(COOKIE_NAME)) %7B%0A%09%09%09%09BalloonCookie bc = new BalloonCookie();%0A%09%09%09%09String%5B%5D vals = c.getValue().split(%22%5C%5C%5C%5C%22);%0A%09%09%09%09if (vals.length %3E 0)%0A%09%09%09%09%09bc.uuid = vals%5B0%5D;%0A%09%09%09%09if (vals.length == 2) %7B%0A%0A%09%09%09%09%09bc.email = vals%5B1%5D;%0A%09%09%09%09%09return bc;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return null;%0A%09%7D%0A%0A%09/**%0A%09 * convenience method for liferay%0A%09 * %0A%09 * @return%0A%09 */%0A%09public String getCookieName() %7B%0A%09%09return COOKIE_NAME;%0A%09%7D%0A%0A%09/*%0A%09 * (non-Javadoc)%0A%09 * %0A%09 * @see java.lang.Object#toString()%0A%09 */%0A%09@Override%0A%09public String toString() %7B%0A%09%09return uuid + (email == null ? %22%22 : %22%5C%5C%22 + email);%0A%09%7D%0A%7D%0A

add cookie