[kune-commits] r1657 - in trunk/src/main: java/cc/kune/core/client/state java/cc/kune/core/server/i18n java/cc/kune/core/server/i18n/impl java/cc/kune/core/server/manager java/cc/kune/core/server/manager/impl java/cc/kune/core/server/notifier java/cc/kune/core/server/rpc java/cc/kune/core/shared/domain/dto java/cc/kune/domain java/cc/kune/wave/client java/cc/kune/wave/server/kspecific java/org java/org/waveprotocol/box java/org/waveprotocol/wave/client/wavepanel resources

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Mon Jan 9 16:37:07 CET 2012


Author: vjrj_
Date: 2012-01-09 16:37:06 +0100 (Mon, 09 Jan 2012)
New Revision: 1657

Removed:
   trunk/src/main/java/org/ourproject/
   trunk/src/main/java/org/waveprotocol/box/server/
   trunk/src/main/java/org/waveprotocol/box/webclient/
   trunk/src/main/java/org/waveprotocol/wave/client/wavepanel/impl/
Modified:
   trunk/src/main/java/cc/kune/core/client/state/Session.java
   trunk/src/main/java/cc/kune/core/client/state/SessionExpirationManager.java
   trunk/src/main/java/cc/kune/core/server/i18n/I18nTranslationServiceMultiLang.java
   trunk/src/main/java/cc/kune/core/server/i18n/impl/I18nTranslationServiceDefault.java
   trunk/src/main/java/cc/kune/core/server/manager/Manager.java
   trunk/src/main/java/cc/kune/core/server/manager/impl/DefaultManager.java
   trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java
   trunk/src/main/java/cc/kune/core/server/notifier/NotifySender.java
   trunk/src/main/java/cc/kune/core/server/notifier/NotifySenderDefault.java
   trunk/src/main/java/cc/kune/core/server/notifier/NotifyService.java
   trunk/src/main/java/cc/kune/core/server/rpc/SocialNetworkRPC.java
   trunk/src/main/java/cc/kune/core/shared/domain/dto/EmailNotificationFrequency.java
   trunk/src/main/java/cc/kune/domain/Container.java
   trunk/src/main/java/cc/kune/domain/Revision.java
   trunk/src/main/java/cc/kune/domain/User.java
   trunk/src/main/java/cc/kune/wave/client/KuneStagesProvider.java
   trunk/src/main/java/cc/kune/wave/client/KuneStagesProvider.java.seg
   trunk/src/main/java/cc/kune/wave/server/kspecific/WaveEmailNotifier.java
   trunk/src/main/resources/assembly.xml
Log:
Some Notification fixes and clean up.
NEW - # 185: Implement notification levels (hourly and daily) similar to Google Wave 
http://kune.ourproject.org/issues/ticket/185

Modified: trunk/src/main/java/cc/kune/core/client/state/Session.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/Session.java	2012-01-08 23:06:53 UTC (rev 1656)
+++ trunk/src/main/java/cc/kune/core/client/state/Session.java	2012-01-09 15:37:06 UTC (rev 1657)
@@ -65,7 +65,7 @@
   long ANON_SESSION_DURATION = A_DAY;
   long ANON_SESSION_DURATION_AFTER_REG = A_DAY * 365;
   long SESSION_DURATION = A_DAY * 14; // two weeks login session duration
-  // long SESSION_DURATION = 1000;
+  // long SESSION_DURATION = 100; // For test
 
   String USERHASH = "k007userHash";
 

Modified: trunk/src/main/java/cc/kune/core/client/state/SessionExpirationManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/SessionExpirationManager.java	2012-01-08 23:06:53 UTC (rev 1656)
+++ trunk/src/main/java/cc/kune/core/client/state/SessionExpirationManager.java	2012-01-09 15:37:06 UTC (rev 1657)
@@ -26,6 +26,9 @@
     eventBus.addHandler(SessionExpiredEvent.getType(), new SessionExpiredEvent.SessionExpiredHandler() {
       @Override
       public void onSessionExpired(final SessionExpiredEvent event) {
+        if (session.isLogged()) {
+          session.signOut();
+        }
         NotifyUser.info(i18n.t("Please sign in again"));
       }
     });

Modified: trunk/src/main/java/cc/kune/core/server/i18n/I18nTranslationServiceMultiLang.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/i18n/I18nTranslationServiceMultiLang.java	2012-01-08 23:06:53 UTC (rev 1656)
+++ trunk/src/main/java/cc/kune/core/server/i18n/I18nTranslationServiceMultiLang.java	2012-01-09 15:37:06 UTC (rev 1657)
@@ -17,4 +17,16 @@
    * @return text translated in the specified language
    */
   public String tWithNT(I18nLanguage lang, final String text, final String noteForTranslators);
+
+  /**
+   * Use [%s] to reference the String parameter.
+   * 
+   * Also adds [%NT noteForTranslators] at the end of text. This tag is later
+   * renderer in the translator panel to inform translator how to do this
+   * translation
+   * 
+   */
+  public String tWithNT(I18nLanguage lang, final String text, final String noteForTranslators,
+      final String... args);
+
 }

Modified: trunk/src/main/java/cc/kune/core/server/i18n/impl/I18nTranslationServiceDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/i18n/impl/I18nTranslationServiceDefault.java	2012-01-08 23:06:53 UTC (rev 1656)
+++ trunk/src/main/java/cc/kune/core/server/i18n/impl/I18nTranslationServiceDefault.java	2012-01-09 15:37:06 UTC (rev 1657)
@@ -19,6 +19,7 @@
  */
 package cc.kune.core.server.i18n.impl;
 
+import cc.kune.common.client.utils.Pair;
 import cc.kune.common.shared.i18n.I18nTranslationService;
 import cc.kune.common.shared.utils.TextUtils;
 import cc.kune.core.server.UserSessionManager;
@@ -65,6 +66,19 @@
   }
 
   /**
+   * Use [%s] to reference the string parameter
+   * 
+   */
+  // @PMD:REVIEWED:ShortMethodName: by vjrj on 21/05/09 13:50
+  private String t(final I18nLanguage lang, final Pair<String, String> pair, final String... args) {
+    String translation = tWithNT(lang, pair.getLeft(), pair.getRight());
+    for (final String arg : args) {
+      translation = translation.replaceFirst("\\[%s\\]", arg);
+    }
+    return decodeHtml(translation);
+  }
+
+  /**
    * If the text is not in the db, it stores the text pending for translation.
    * 
    * Warning: text is escaped as html before insert in the db. Don't use html
@@ -89,6 +103,12 @@
     return decodeHtml(translation);
   }
 
+  @Override
+  public String tWithNT(final I18nLanguage lang, final String text, final String noteForTranslators,
+      final String... args) {
+    return t(lang, Pair.create(text, noteForTranslators), args);
+  }
+
   /**
    * If the text is not in the db, it stores the text pending for translation.
    * 

Modified: trunk/src/main/java/cc/kune/core/server/manager/Manager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/Manager.java	2012-01-08 23:06:53 UTC (rev 1656)
+++ trunk/src/main/java/cc/kune/core/server/manager/Manager.java	2012-01-09 15:37:06 UTC (rev 1657)
@@ -21,28 +21,25 @@
 
 import org.apache.lucene.search.BooleanClause;
 
-
 public interface Manager<T, X> {
 
-    void clear();
+  T find(X id);
 
-    T find(X id);
+  T merge(T entity);
 
-    T merge(T entity);
+  T persist(T entity);
 
-    T persist(T entity);
+  void reIndex();
 
-    void reIndex();
+  void remove(T entity);
 
-    void remove(T entity);
+  SearchResult<T> search(final String query, final String[] fields, final BooleanClause.Occur[] flags,
+      final Integer firstResult, final Integer maxResults);
 
-    SearchResult<T> search(final String query, final String[] fields, final BooleanClause.Occur[] flags,
-            final Integer firstResult, final Integer maxResults);
+  SearchResult<T> search(final String[] queries, final String[] fields,
+      final BooleanClause.Occur[] flags, final Integer firstResult, final Integer maxResults);
 
-    SearchResult<T> search(final String[] queries, final String[] fields, final BooleanClause.Occur[] flags,
-            final Integer firstResult, final Integer maxResults);
+  SearchResult<T> search(final String[] queries, final String[] fields, final Integer firstResult,
+      final Integer maxResults);
 
-    SearchResult<T> search(final String[] queries, final String[] fields, final Integer firstResult,
-            final Integer maxResults);
-
 }

Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/DefaultManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/DefaultManager.java	2012-01-08 23:06:53 UTC (rev 1656)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/DefaultManager.java	2012-01-09 15:37:06 UTC (rev 1657)
@@ -49,10 +49,6 @@
     log = LogFactory.getLog(entityClass);
   }
 
-  public void clear() {
-    getEntityManager().clear();
-  }
-
   /**
    * use carefully!!!
    */
@@ -64,6 +60,10 @@
     return getEntityManager().find(entityClass, primaryKey);
   }
 
+  public void flush() {
+    getEntityManager().flush();
+  }
+
   private EntityManager getEntityManager() {
     return provider.get();
   }

Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java	2012-01-08 23:06:53 UTC (rev 1656)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java	2012-01-09 15:37:06 UTC (rev 1657)
@@ -43,7 +43,6 @@
 import org.waveprotocol.wave.model.wave.ParticipantId;
 import org.waveprotocol.wave.model.waveref.WaveRef;
 
-import cc.kune.common.shared.i18n.I18nTranslationService;
 import cc.kune.common.shared.utils.TextUtils;
 import cc.kune.core.client.errors.DefaultException;
 import cc.kune.core.client.errors.EmailAddressInUseException;
@@ -52,6 +51,7 @@
 import cc.kune.core.client.errors.I18nNotFoundException;
 import cc.kune.core.client.errors.UserRegistrationException;
 import cc.kune.core.client.errors.WrongCurrentPasswordException;
+import cc.kune.core.server.i18n.I18nTranslationServiceMultiLang;
 import cc.kune.core.server.manager.GroupManager;
 import cc.kune.core.server.manager.I18nCountryManager;
 import cc.kune.core.server.manager.I18nLanguageManager;
@@ -86,7 +86,7 @@
   private final ChatProperties chatProperties;
   private final I18nCountryManager countryManager;
   private final GroupManager groupManager;
-  private final I18nTranslationService i18n;
+  private final I18nTranslationServiceMultiLang i18n;
   private final KuneWaveService kuneWaveManager;
   private final I18nLanguageManager languageManager;
   private final NotifyService notifyService;
@@ -101,7 +101,7 @@
   public UserManagerDefault(final Provider<EntityManager> provider, final UserFinder finder,
       final I18nLanguageManager languageManager, final I18nCountryManager countryManager,
       final XmppManager xmppManager, final ChatProperties chatProperties,
-      final I18nTranslationService i18n, final CustomUserRegistrationServlet waveUserRegister,
+      final I18nTranslationServiceMultiLang i18n, final CustomUserRegistrationServlet waveUserRegister,
       final AccountStore waveAccountStore, final KuneWaveService kuneWaveManager,
       final ParticipantUtils participantUtils, final KuneBasicProperties properties,
       final GroupManager groupManager, final NotifyService notifyService) {
@@ -201,13 +201,13 @@
           passwdDigest.getSalt(), language, country, tz);
 
       final String defWave = properties.getWelcomewave();
+      groupManager.createUserGroup(user, wantPersonalHomepage);
       if (defWave != null) {
         welcome = kuneWaveManager.createWave(
             ContentConstants.WELCOME_WAVE_CONTENT_TITLE.replaceAll("\\[%s\\]",
                 properties.getDefaultSiteName()), "", defWave, null,
             participantUtils.of(properties.getAdminShortName()), participantUtils.of(shortName));
       }
-      groupManager.createUserGroup(user, wantPersonalHomepage);
       // Is this necessary? try to remove (used when we were setting the def
       // content
       // contentManager.save(userGroup.getDefaultContent());
@@ -318,6 +318,7 @@
         return null;
       }
     }
+    final I18nLanguage lang = user.getLanguage();
     if (user.getPassword().equals(passwd)) {
       if (user.getLastLogin() == null) {
         final String userName = user.getShortName();
@@ -325,13 +326,15 @@
         timer.schedule(new TimerTask() {
           @Override
           public void run() {
+            // FIXME: Use notifyService!
             xmppManager.sendMessage(
                 userName,
-                i18n.t(
+                i18n.tWithNT(
+                    lang,
                     "This is the chat window. "
                         + "Here you can communicate with other users of [%s] but also with other users with compatible accounts (like gmail accounts). "
-                        + "Just add some buddy and start to chat.",
-                    i18n.t(properties.getSiteCommonName())));
+                        + "Just add some buddy and start to chat.", "",
+                    i18n.tWithNT(lang, properties.getSiteCommonName(), "")));
           }
         }, 5000);
       }

Modified: trunk/src/main/java/cc/kune/core/server/notifier/NotifySender.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/notifier/NotifySender.java	2012-01-08 23:06:53 UTC (rev 1656)
+++ trunk/src/main/java/cc/kune/core/server/notifier/NotifySender.java	2012-01-09 15:37:06 UTC (rev 1657)
@@ -9,8 +9,8 @@
 public interface NotifySender {
 
   /**
-   * Send a message to the recipients (also translate the subject/body using the
-   * user language)
+   * Send a html message to the recipients (also translate the subject/body
+   * using the user language)
    * 
    * @param notifyType
    *          the notify type (email, etc)
@@ -21,15 +21,17 @@
    *          {@link String.format} args
    * @param isHtml
    *          if the body is html
+   * @param forceSend
+   *          send even this user has "no notifications" selected
    * @param recipients
    *          the recipients
    */
   void send(NotifyType notifyType, FormatedString subject, FormatedString body, boolean isHtml,
-      User... recipients);
+      final boolean forceSend, User... recipients);
 
   /**
-   * Send a message to the recipients (also translate the subject/body using the
-   * user language)
+   * Send a text message to the recipients (also translate the subject/body
+   * using the user language)
    * 
    * @param notifyType
    *          the notify type (email, etc)
@@ -41,6 +43,7 @@
    * @param recipients
    *          the recipients
    */
+  @Deprecated
   void send(NotifyType notifyType, FormatedString subject, FormatedString body, User... recipients);
 
 }

Modified: trunk/src/main/java/cc/kune/core/server/notifier/NotifySenderDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/notifier/NotifySenderDefault.java	2012-01-08 23:06:53 UTC (rev 1656)
+++ trunk/src/main/java/cc/kune/core/server/notifier/NotifySenderDefault.java	2012-01-09 15:37:06 UTC (rev 1657)
@@ -27,28 +27,34 @@
   private final String emailTemplate;
   private final I18nTranslationServiceMultiLang i18n;
   private final MailService mailService;
+  private final String subjectPrefix;
+  private final UsersOnline usersOnline;
   private final KuneWaveService waveService;
   private final XmppManager xmppManager;
 
   @Inject
   public NotifySenderDefault(final MailService mailService, final KuneWaveService waveService,
       final XmppManager xmppManager, final I18nTranslationServiceMultiLang i18n,
-      final KuneProperties kuneProperties) throws IOException {
+      final UsersOnline usersOnline, final KuneProperties kuneProperties) throws IOException {
     this.mailService = mailService;
     this.waveService = waveService;
     this.xmppManager = xmppManager;
     this.i18n = i18n;
+    this.usersOnline = usersOnline;
     emailTemplate = FileUtils.readFileToString(new File(
         kuneProperties.get(KuneProperties.SITE_EMAIL_TEMPLATE)));
     Preconditions.checkNotNull(emailTemplate);
     Preconditions.checkArgument(TextUtils.notEmpty(emailTemplate));
+    subjectPrefix = new StringBuffer("[").append(kuneProperties.get(KuneProperties.SITE_NAME)).append(
+        "] ").toString();
   }
 
   @Override
   public void send(final NotifyType notifyType, final FormatedString subject, final FormatedString body,
-      final boolean isHtml, final User... recipients) {
+      final boolean isHtml, final boolean forceSend, final User... recipients) {
     for (final User user : recipients) {
       final String username = user.getShortName();
+      subject.setTemplate(subjectPrefix + subject.getTemplate());
       if (subject.shouldBeTranslated()) {
         // Translate per recipient language
         // final String subjectTranslation = i18n.tWithNT(user.getLanguage(),
@@ -68,15 +74,19 @@
       }
       switch (notifyType) {
       case chat:
+        // FIXME seems that html is not sending correctly... check server specs
         xmppManager.sendMessage(username,
             String.format("<b>%s</b>%s", subject.getString(), body.getString()));
         break;
       case email:
-        if (user.getEmailNotifFreq().equals(EmailNotificationFrequency.immediately)) {
-          mailService.send(subject, FormatedString.build(emailTemplate.replace("%s", body.getString())),
-              isHtml, user.getEmail());
-        } else {
-          // TODO: handle other types of notifications frequencies
+        if (forceSend || !usersOnline.isLogged(username)) {
+          if (user.getEmailNotifFreq().equals(EmailNotificationFrequency.immediately)) {
+            mailService.send(subject,
+                FormatedString.build(emailTemplate.replace("%s", body.getString())), isHtml,
+                user.getEmail());
+          } else {
+            // TODO: handle other types of notifications frequencies
+          }
         }
         break;
       case wave:
@@ -90,9 +100,10 @@
   }
 
   @Override
+  @Deprecated
   public void send(final NotifyType notifyType, final FormatedString subject, final FormatedString body,
       final User... dests) {
-    send(notifyType, subject, body, false, dests);
+    send(notifyType, subject, body, false, false, dests);
   }
 
 }

Modified: trunk/src/main/java/cc/kune/core/server/notifier/NotifyService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/notifier/NotifyService.java	2012-01-08 23:06:53 UTC (rev 1656)
+++ trunk/src/main/java/cc/kune/core/server/notifier/NotifyService.java	2012-01-09 15:37:06 UTC (rev 1657)
@@ -79,12 +79,13 @@
       final Collection<User> users) {
     for (final User to : users) {
       sender.send(NotifyType.email, FormatedString.build(subject),
-          helper.groupNotification(groupSender.getShortName(), groupSender.hasLogo(), message), to);
+          helper.groupNotification(groupSender.getShortName(), groupSender.hasLogo(), message), true,
+          true, to);
     }
   }
 
   public void notifyUser(final User to, final Group group, final String subject, final String message) {
     sender.send(NotifyType.email, FormatedString.build(subject),
-        helper.groupNotification(group.getShortName(), group.hasLogo(), message), to);
+        helper.groupNotification(group.getShortName(), group.hasLogo(), message), true, true, to);
   }
 }

Modified: trunk/src/main/java/cc/kune/core/server/rpc/SocialNetworkRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/SocialNetworkRPC.java	2012-01-08 23:06:53 UTC (rev 1656)
+++ trunk/src/main/java/cc/kune/core/server/rpc/SocialNetworkRPC.java	2012-01-09 15:37:06 UTC (rev 1657)
@@ -85,7 +85,8 @@
     checkIsNotPersonalGroup(group);
     final Group groupToAdd = groupManager.findByShortName(groupToAddShortName);
     socialNetworkManager.addGroupToAdmins(userLogged, groupToAdd, group);
-    notifyService.notifyGroup(groupToAdd, group, "Accepted as admin", "You are now admin of this group");
+    notifyService.notifyGroup(groupToAdd, group, "Added as administrator",
+        "You are now admin of this group");
     return generateResponse(userLogged, group);
   }
 
@@ -100,7 +101,7 @@
     checkIsNotPersonalGroup(group);
     final Group groupToAdd = groupManager.findByShortName(groupToAddShortName);
     socialNetworkManager.addGroupToCollabs(userLogged, groupToAdd, group);
-    notifyService.notifyGroup(groupToAdd, group, "Accepted as collaborator",
+    notifyService.notifyGroup(groupToAdd, group, "Added as collaborator",
         "You are now a collaborator of this group");
     return generateResponse(userLogged, group);
   }

Modified: trunk/src/main/java/cc/kune/core/shared/domain/dto/EmailNotificationFrequency.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/domain/dto/EmailNotificationFrequency.java	2012-01-08 23:06:53 UTC (rev 1656)
+++ trunk/src/main/java/cc/kune/core/shared/domain/dto/EmailNotificationFrequency.java	2012-01-09 15:37:06 UTC (rev 1657)
@@ -22,8 +22,8 @@
 import com.google.gwt.user.client.rpc.IsSerializable;
 
 public enum EmailNotificationFrequency implements IsSerializable {
-  daily, // at most daily,
-  hourly, // at most hourly
-  immediately, // almost immediately
-  no // I don't need email notifications
+  daily, // at most daily, (not used yet)
+  hourly, // at most hourly (not used yet)
+  immediately, // almost immediately (currently used)
+  no // I don't need email notifications (currently used)
 }

Modified: trunk/src/main/java/cc/kune/domain/Container.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/Container.java	2012-01-08 23:06:53 UTC (rev 1656)
+++ trunk/src/main/java/cc/kune/domain/Container.java	2012-01-09 15:37:06 UTC (rev 1657)
@@ -99,7 +99,7 @@
   private String name;
 
   @IndexedEmbedded(depth = 1, prefix = "owner_")
-  @OneToOne
+  @OneToOne(cascade = CascadeType.ALL)
   private Group owner;
 
   // Parent/Child pattern:

Modified: trunk/src/main/java/cc/kune/domain/Revision.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/Revision.java	2012-01-08 23:06:53 UTC (rev 1656)
+++ trunk/src/main/java/cc/kune/domain/Revision.java	2012-01-09 15:37:06 UTC (rev 1657)
@@ -48,114 +48,114 @@
 @Table(name = "revisions")
 @Indexed
 public class Revision {
-    @Id
-    @GeneratedValue
-    @DocumentId
-    private Long id;
+  // http://www.hibernate.org/112.html
+  @Lob
+  @Column(length = 2147483647)
+  @Field(index = Index.TOKENIZED, store = Store.NO)
+  @FieldBridge(impl = DataFieldBridge.class)
+  char[] body;
 
-    @Field(index = Index.TOKENIZED, store = Store.NO)
-    String title;
+  @ContainedIn
+  @ManyToOne(cascade = CascadeType.ALL)
+  @JoinColumn
+  private Content content;
 
-    // http://www.hibernate.org/112.html
-    @Lob
-    @Column(length = 2147483647)
-    @Field(index = Index.TOKENIZED, store = Store.NO)
-    @FieldBridge(impl = DataFieldBridge.class)
-    char[] body;
+  @Basic(optional = false)
+  private Long createdOn;
 
-    @OneToOne
-    private User editor;
+  @OneToOne
+  private User editor;
 
-    @Basic(optional = false)
-    private Long createdOn;
+  @Id
+  @GeneratedValue
+  @DocumentId
+  private Long id;
 
-    @Version
-    private int version;
+  @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+  private Revision previous;
 
-    @ContainedIn
-    @ManyToOne
-    @JoinColumn
-    private Content content;
+  @Field(index = Index.TOKENIZED, store = Store.NO)
+  String title;
 
-    @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
-    private Revision previous;
+  @Version
+  private int version;
 
-    public Revision() {
-        this(null);
-    }
+  public Revision() {
+    this(null);
+  }
 
-    public Revision(final Content content) {
-        this.content = content;
-        createdOn = System.currentTimeMillis();
-    }
+  public Revision(final Content content) {
+    this.content = content;
+    createdOn = System.currentTimeMillis();
+  }
 
-    public Long getId() {
-        return id;
-    }
+  public char[] getBody() {
+    return body;
+  }
 
-    public void setId(final Long id) {
-        this.id = id;
-    }
+  public Content getContent() {
+    return content;
+  }
 
-    public User getEditor() {
-        return editor;
-    }
+  public Long getCreatedOn() {
+    return createdOn;
+  }
 
-    public void setEditor(final User editor) {
-        this.editor = editor;
-    }
+  public User getEditor() {
+    return editor;
+  }
 
-    public Long getCreatedOn() {
-        return createdOn;
-    }
+  public Long getId() {
+    return id;
+  }
 
-    public void setCreatedOn(final Long modifiedOn) {
-        this.createdOn = modifiedOn;
-    }
+  public Revision getPrevious() {
+    return previous;
+  }
 
-    public int getVersion() {
-        return version;
-    }
+  public String getTitle() {
+    return title;
+  }
 
-    public void setVersion(final int version) {
-        this.version = version;
-    }
+  public int getVersion() {
+    return version;
+  }
 
-    public Revision getPrevious() {
-        return previous;
-    }
+  @Transient
+  public boolean isLast() {
+    return content.getLastRevision().equals(this);
+  }
 
-    public void setPrevious(final Revision previous) {
-        this.previous = previous;
-    }
+  public void setBody(final String body) {
+    this.body = body.toCharArray();
+  }
 
-    public Content getContent() {
-        return content;
-    }
+  public void setContent(final Content content) {
+    this.content = content;
+  }
 
-    public void setContent(final Content content) {
-        this.content = content;
-    }
+  public void setCreatedOn(final Long modifiedOn) {
+    this.createdOn = modifiedOn;
+  }
 
-    public String getTitle() {
-        return title;
-    }
+  public void setEditor(final User editor) {
+    this.editor = editor;
+  }
 
-    public void setTitle(final String title) {
-        this.title = title;
-    }
+  public void setId(final Long id) {
+    this.id = id;
+  }
 
-    public char[] getBody() {
-        return body;
-    }
+  public void setPrevious(final Revision previous) {
+    this.previous = previous;
+  }
 
-    public void setBody(final String body) {
-        this.body = body.toCharArray();
-    }
+  public void setTitle(final String title) {
+    this.title = title;
+  }
 
-    @Transient
-    public boolean isLast() {
-        return content.getLastRevision().equals(this);
-    }
+  public void setVersion(final int version) {
+    this.version = version;
+  }
 
 }

Modified: trunk/src/main/java/cc/kune/domain/User.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/User.java	2012-01-08 23:06:53 UTC (rev 1656)
+++ trunk/src/main/java/cc/kune/domain/User.java	2012-01-09 15:37:06 UTC (rev 1657)
@@ -128,7 +128,7 @@
   @NotNull
   private TimeZone timezone;
 
-  @OneToOne(cascade = CascadeType.REMOVE)
+  @OneToOne(cascade = CascadeType.ALL)
   private Group userGroup;
 
   public User() {

Modified: trunk/src/main/java/cc/kune/wave/client/KuneStagesProvider.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/KuneStagesProvider.java	2012-01-08 23:06:53 UTC (rev 1656)
+++ trunk/src/main/java/cc/kune/wave/client/KuneStagesProvider.java	2012-01-09 15:37:06 UTC (rev 1657)
@@ -57,6 +57,7 @@
 import org.waveprotocol.wave.model.wave.ParticipantId;
 import org.waveprotocol.wave.model.waveref.WaveRef;
 
+import cc.kune.common.client.log.Log;
 import cc.kune.common.shared.i18n.I18nTranslationService;
 
 import com.google.gwt.dom.client.Element;
@@ -270,15 +271,27 @@
       wave = null;
     }
     if (three != null) {
+      try {
         three.getEditActions().stopEditing();
+      } catch (final Exception e) {
+        Log.info("Some exception stoping editing", e);
+      }
       three = null;
     }
     if (two != null) {
+      try {
       two.getConnector().close();
+      } catch (final Exception e) {
+        Log.info("Some exception closing connector", e);
+      }
       two = null;
     }
     if (one != null) {
+      try {
       one.getWavePanel().destroy();
+      } catch (final Exception e) {
+        Log.info("Some exception destroying panel", e);
+      }
       one = null;
     }
     closed = true;

Modified: trunk/src/main/java/cc/kune/wave/client/KuneStagesProvider.java.seg
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/KuneStagesProvider.java.seg	2012-01-08 23:06:53 UTC (rev 1656)
+++ trunk/src/main/java/cc/kune/wave/client/KuneStagesProvider.java.seg	2012-01-09 15:37:06 UTC (rev 1657)
@@ -57,6 +57,7 @@
 import org.waveprotocol.wave.model.wave.ParticipantId;
 import org.waveprotocol.wave.model.waveref.WaveRef;
 
+import cc.kune.common.client.log.Log;
 import cc.kune.common.shared.i18n.I18nTranslationService;
 
 import com.google.gwt.dom.client.Element;
@@ -270,15 +271,27 @@
       wave = null;
     }
     if (three != null) {
+      try {
         three.getEditActions().stopEditing();
+      } catch (final Exception e) {
+        Log.info("Some exception stoping editing", e);
+      }
       three = null;
     }
     if (two != null) {
+      try {
       two.getConnector().close();
+      } catch (final Exception e) {
+        Log.info("Some exception closing connector", e);
+      }
       two = null;
     }
     if (one != null) {
+      try {
       one.getWavePanel().destroy();
+      } catch (final Exception e) {
+        Log.info("Some exception destroying panel", e);
+      }
       one = null;
     }
     closed = true;

Modified: trunk/src/main/java/cc/kune/wave/server/kspecific/WaveEmailNotifier.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/kspecific/WaveEmailNotifier.java	2012-01-08 23:06:53 UTC (rev 1656)
+++ trunk/src/main/java/cc/kune/wave/server/kspecific/WaveEmailNotifier.java	2012-01-09 15:37:06 UTC (rev 1657)
@@ -23,7 +23,6 @@
 import cc.kune.core.server.mail.FormatedString;
 import cc.kune.core.server.notifier.NotifySender;
 import cc.kune.core.server.notifier.NotifyType;
-import cc.kune.core.server.notifier.UsersOnline;
 import cc.kune.core.server.properties.KuneBasicProperties;
 import cc.kune.domain.User;
 import cc.kune.domain.finders.UserFinder;
@@ -38,8 +37,8 @@
 
   @Inject
   public WaveEmailNotifier(final WaveBus waveBus, final NotifySender notifyService,
-      final UsersOnline usersOnline, final KuneBasicProperties basicProperties,
-      final ParticipantUtils partUtils, final UserFinder userFinder) {
+      final KuneBasicProperties basicProperties, final ParticipantUtils partUtils,
+      final UserFinder userFinder) {
     waveBus.subscribe(new Subscriber() {
       @Override
       public void waveletCommitted(final WaveletName waveletName, final HashedVersion version) {
@@ -62,15 +61,13 @@
               final String address = participant.getAddress();
               if (partUtils.isLocal(address)) {
                 final String userName = partUtils.getAddressName(address);
-                // FIXME only for testing
                 try {
                   final User user = userFinder.findByShortName(userName);
-                  if (!usersOnline.isLogged(userName)) {
-                    notifyService.send(NotifyType.email, FormatedString.build("You have a new message"),
-                        body, true, user);
-                    notifyService.send(NotifyType.chat, FormatedString.build("New message"), body, true,
-                        user);
-                  }
+                  notifyService.send(NotifyType.email, FormatedString.build("You have a new message"),
+                      body, true, false, user);
+                  // notifyService.send(NotifyType.chat,
+                  // FormatedString.build("New message"), body, true,
+                  // user);
                 } catch (final NoResultException e) {
                   // Seems is not a local user
                 }

Modified: trunk/src/main/resources/assembly.xml
===================================================================
--- trunk/src/main/resources/assembly.xml	2012-01-08 23:06:53 UTC (rev 1656)
+++ trunk/src/main/resources/assembly.xml	2012-01-09 15:37:06 UTC (rev 1657)
@@ -16,11 +16,11 @@
     </dependencySet>
   </dependencySets>
   <fileSets>
-    <fileSet>
+    <!-- <fileSet> -->
       <!-- ${module.groupId}-${module.artifactId}-${module.version}.${module.extension} -->
-      <directory>target/kune-0.1.0-SNAPSHOT/ws/</directory>
+      <!-- <directory>target/kune-0.1.0-SNAPSHOT/ws/</directory>
       <outputDirectory>META-INF/resources/ws</outputDirectory>
-    </fileSet>
+    </fileSet>-->
     <fileSet>
       <directory>${project.basedir}/src/main/webapp/</directory>
       <outputDirectory>META-INF/resources/webapp</outputDirectory>




More information about the kune-commits mailing list