[kune-commits] r1400 - in trunk/src: main/java/cc/kune/barters/server main/java/cc/kune/blogs/server main/java/cc/kune/chat/server main/java/cc/kune/core/server/content main/java/cc/kune/core/server/init main/java/cc/kune/core/server/rpc main/java/cc/kune/core/server/state main/java/cc/kune/core/server/xmpp main/java/cc/kune/domain main/java/cc/kune/meets/server main/java/cc/kune/wiki/server test/java/cc/kune/core/server test/java/cc/kune/core/server/xmpp test/java/org/ourproject/kune/chat/server

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Thu Jun 9 17:15:55 CEST 2011


Author: vjrj_
Date: 2011-06-09 17:15:55 +0200 (Thu, 09 Jun 2011)
New Revision: 1400

Added:
   trunk/src/test/java/cc/kune/core/server/xmpp/
   trunk/src/test/java/cc/kune/core/server/xmpp/XmppManagerDefaultTest.java
Removed:
   trunk/src/test/java/cc/kune/core/server/xmpp/XmppManagerDefaultTest.java
   trunk/src/test/java/org/ourproject/kune/chat/server/managers/
Modified:
   trunk/src/main/java/cc/kune/barters/server/BarterServerTool.java
   trunk/src/main/java/cc/kune/blogs/server/BlogServerTool.java
   trunk/src/main/java/cc/kune/chat/server/ChatManagerDefault.java
   trunk/src/main/java/cc/kune/core/server/content/ContentManager.java
   trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
   trunk/src/main/java/cc/kune/core/server/init/DatabaseInitializer.java
   trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java
   trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java
   trunk/src/main/java/cc/kune/core/server/state/StateServiceDefault.java
   trunk/src/main/java/cc/kune/core/server/xmpp/XmppManager.java
   trunk/src/main/java/cc/kune/core/server/xmpp/XmppManagerDefault.java
   trunk/src/main/java/cc/kune/domain/Content.java
   trunk/src/main/java/cc/kune/meets/server/MeetingServerTool.java
   trunk/src/main/java/cc/kune/wiki/server/WikiServerTool.java
Log:
chatroom creation check and content modification fix

Modified: trunk/src/main/java/cc/kune/barters/server/BarterServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/barters/server/BarterServerTool.java	2011-06-09 12:25:38 UTC (rev 1399)
+++ trunk/src/main/java/cc/kune/barters/server/BarterServerTool.java	2011-06-09 15:15:55 UTC (rev 1400)
@@ -143,7 +143,7 @@
     content.setLanguage(user.getLanguage());
     content.setTypeId(TYPE_BARTER);
     content.setStatus(ContentStatus.publishedOnline);
-    contentManager.save(user, content);
+    contentManager.save(content);
     return group;
   }
 

Modified: trunk/src/main/java/cc/kune/blogs/server/BlogServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/server/BlogServerTool.java	2011-06-09 12:25:38 UTC (rev 1399)
+++ trunk/src/main/java/cc/kune/blogs/server/BlogServerTool.java	2011-06-09 15:15:55 UTC (rev 1400)
@@ -135,7 +135,7 @@
     content.setTypeId(TYPE_POST);
     content.setStatus(ContentStatus.publishedOnline);
 
-    contentManager.save(user, content);
+    contentManager.save(content);
     return group;
   }
 

Modified: trunk/src/main/java/cc/kune/chat/server/ChatManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/server/ChatManagerDefault.java	2011-06-09 12:25:38 UTC (rev 1399)
+++ trunk/src/main/java/cc/kune/chat/server/ChatManagerDefault.java	2011-06-09 15:15:55 UTC (rev 1400)
@@ -37,8 +37,10 @@
     final String groupShortName = parentToken.getGroup();
     final String userShortName = user.getShortName();
     final ChatConnection connection = xmppManager.login(userShortName, user.getPassword(), userHash);
-    xmppManager.createRoom(connection, roomName, userShortName + userHash, subject);
-    xmppManager.disconnect(connection);
+    if (!xmppManager.existRoom(connection, roomName)) {
+      xmppManager.createRoom(connection, roomName, userShortName + userHash, subject);
+      xmppManager.disconnect(connection);
+    }
     try {
       return creationService.createFolder(groupManager.findByShortName(groupShortName),
           ContentUtils.parseId(parentToken.getFolder()), roomName, user.getLanguage(),

Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContentManager.java	2011-06-09 12:25:38 UTC (rev 1399)
+++ trunk/src/main/java/cc/kune/core/server/content/ContentManager.java	2011-06-09 15:15:55 UTC (rev 1400)
@@ -68,7 +68,7 @@
 
   Content renameContent(User user, Long contentId, String newName) throws DefaultException;
 
-  Content save(User user, Content content);
+  Content save(Content content);
 
   Content save(User editor, Content content, String body);
 

Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java	2011-06-09 12:25:38 UTC (rev 1399)
+++ trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java	2011-06-09 15:15:55 UTC (rev 1400)
@@ -139,7 +139,7 @@
     }
     revision.setBody(body);
     newContent.addRevision(revision);
-    return persist(newContent);
+    return save(newContent);
   }
 
   private MultiFieldQueryParser createMultiFieldParser() {
@@ -233,16 +233,19 @@
       final String author = content.getAuthors().get(0).getShortName();
       kuneWaveManager.setTitle(getWaveRef(content), newTitle, author);
     }
+    setModifiedTime(content);
     return content;
   }
 
   @Override
-  public Content save(final User editor, final Content content) {
+  public Content save(final Content content) {
+    setModifiedTime(content);
     return persist(content);
   }
 
   @Override
   public Content save(final User editor, final Content content, final String body) {
+    setModifiedTime(content);
     final Revision revision = new Revision(content);
     revision.setEditor(editor);
     revision.setTitle(content.getTitle());
@@ -304,9 +307,12 @@
   @Override
   public void setModifiedOn(final Content content, final long lastModifiedTime) {
     content.setModifiedOn(lastModifiedTime);
-    // persist(content);//
   }
 
+  private void setModifiedTime(final Content content) {
+    setModifiedOn(content, System.currentTimeMillis());
+  }
+
   @Override
   public void setPublishedOn(final User user, final Long contentId, final Date publishedOn)
       throws DefaultException {

Modified: trunk/src/main/java/cc/kune/core/server/init/DatabaseInitializer.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/init/DatabaseInitializer.java	2011-06-09 12:25:38 UTC (rev 1399)
+++ trunk/src/main/java/cc/kune/core/server/init/DatabaseInitializer.java	2011-06-09 15:15:55 UTC (rev 1400)
@@ -50,167 +50,171 @@
 import com.google.inject.persist.Transactional;
 
 public class DatabaseInitializer {
-    private final ContentManager contentManager;
-    private final I18nCountryManager countryManager;
-    private final GroupManager groupManager;
-    private final KuneWaveManager kuneWaveManager;
-    private final I18nLanguageManager languageManager;
-    private final LicenseManager licenseManager;
-    private final DatabaseProperties properties;
-    private final I18nTranslationManager translationManager;
-    private final UserManager userManager;
+  private final ContentManager contentManager;
+  private final I18nCountryManager countryManager;
+  private final GroupManager groupManager;
+  private final KuneWaveManager kuneWaveManager;
+  private final I18nLanguageManager languageManager;
+  private final LicenseManager licenseManager;
+  private final DatabaseProperties properties;
+  private final I18nTranslationManager translationManager;
+  private final UserManager userManager;
 
-    @Inject
-    public DatabaseInitializer(final DatabaseProperties properties, final UserManager userManager,
-            final GroupManager groupManager, final LicenseManager licenseManager,
-            final I18nLanguageManager languageManager, final I18nCountryManager countryManager,
-            final I18nTranslationManager translationManager, final ContentManager contentManager,
-            final KuneWaveManager kuneWaveManager) {
-        this.properties = properties;
-        this.userManager = userManager;
-        this.groupManager = groupManager;
-        this.licenseManager = licenseManager;
-        this.languageManager = languageManager;
-        this.countryManager = countryManager;
-        this.translationManager = translationManager;
-        this.contentManager = contentManager;
-        this.kuneWaveManager = kuneWaveManager;
-    }
+  @Inject
+  public DatabaseInitializer(final DatabaseProperties properties, final UserManager userManager,
+      final GroupManager groupManager, final LicenseManager licenseManager,
+      final I18nLanguageManager languageManager, final I18nCountryManager countryManager,
+      final I18nTranslationManager translationManager, final ContentManager contentManager,
+      final KuneWaveManager kuneWaveManager) {
+    this.properties = properties;
+    this.userManager = userManager;
+    this.groupManager = groupManager;
+    this.licenseManager = licenseManager;
+    this.languageManager = languageManager;
+    this.countryManager = countryManager;
+    this.translationManager = translationManager;
+    this.contentManager = contentManager;
+    this.kuneWaveManager = kuneWaveManager;
+  }
 
-    private void createDefUsersGroup() throws Exception, UserMustBeLoggedException {
-        final String adminName = properties.getAdminUserName();
-        final String adminShortName = properties.getAdminShortName();
-        final String adminEmail = properties.getAdminEmail();
-        final String adminPassword = properties.getAdminPassword();
+  private void createDefUsersGroup() throws Exception, UserMustBeLoggedException {
+    final String adminName = properties.getAdminUserName();
+    final String adminShortName = properties.getAdminShortName();
+    final String adminEmail = properties.getAdminEmail();
+    final String adminPassword = properties.getAdminPassword();
 
-        final PasswordDigest passwdDigest = new PasswordDigest(adminPassword.toCharArray());
-        userManager.createWaveAccount(adminShortName, passwdDigest);
-        final User user = new User(adminShortName, adminName, adminEmail, adminPassword, passwdDigest.getDigest(),
-                passwdDigest.getSalt(), languageManager.findByCode("en"), countryManager.findByCode("GB"),
-                TimeZone.getDefault());
-        groupManager.createUserGroup(user, false);
-        final User dummyUser = new User("dummy", "dummy user", "example at example.com", adminPassword,
-                passwdDigest.getDigest(), passwdDigest.getSalt(), languageManager.findByCode("en"),
-                countryManager.findByCode("GB"), TimeZone.getDefault());
-        groupManager.createUserGroup(dummyUser, false);
+    final PasswordDigest passwdDigest = new PasswordDigest(adminPassword.toCharArray());
+    userManager.createWaveAccount(adminShortName, passwdDigest);
+    final User user = new User(adminShortName, adminName, adminEmail, adminPassword,
+        passwdDigest.getDigest(), passwdDigest.getSalt(), languageManager.findByCode("en"),
+        countryManager.findByCode("GB"), TimeZone.getDefault());
+    groupManager.createUserGroup(user, false);
+    final User dummyUser = new User("dummy", "dummy user", "example at example.com", adminPassword,
+        passwdDigest.getDigest(), passwdDigest.getSalt(), languageManager.findByCode("en"),
+        countryManager.findByCode("GB"), TimeZone.getDefault());
+    groupManager.createUserGroup(dummyUser, false);
 
-        final String siteName = properties.getDefaultSiteName();
-        final String siteShortName = properties.getDefaultSiteShortName();
-        final String defaultLicenseId = properties.getDefaultLicense();
-        final License defaultLicense = licenseManager.findByShortName(defaultLicenseId);
+    final String siteName = properties.getDefaultSiteName();
+    final String siteShortName = properties.getDefaultSiteShortName();
+    final String defaultLicenseId = properties.getDefaultLicense();
+    final License defaultLicense = licenseManager.findByShortName(defaultLicenseId);
 
-        final Group siteGroup = new Group(siteShortName, siteName, defaultLicense, GroupType.PROJECT);
-        groupManager.createGroup(siteGroup, user, ContentConstants.INITIAL_CONTENT.replaceAll("\\[%s\\]", siteName));
+    final Group siteGroup = new Group(siteShortName, siteName, defaultLicense, GroupType.PROJECT);
+    groupManager.createGroup(siteGroup, user,
+        ContentConstants.INITIAL_CONTENT.replaceAll("\\[%s\\]", siteName));
 
-        final Content defaultContent = siteGroup.getDefaultContent();
-        contentManager.setStatus(defaultContent.getId(), ContentStatus.publishedOnline);
-        contentManager.save(user, defaultContent);
+    final Content defaultContent = siteGroup.getDefaultContent();
+    contentManager.setStatus(defaultContent.getId(), ContentStatus.publishedOnline);
+    contentManager.save(defaultContent);
 
-        userManager.reIndex();
-        groupManager.reIndex();
+    userManager.reIndex();
+    groupManager.reIndex();
 
-    }
+  }
 
-    private void createLicenses() {
-        // FIXME: Add CC RDF info (seems CC is working on new forms to add
-        // license metadata)
-        License license = new License("by-v3.0", "Creative Commons Attribution", "None",
-                "http://creativecommons.org/licenses/by/3.0/", true, false, false, "", "images/lic/by80x15.png");
-        licenseManager.persist(license);
-        license = new License("by-sa-v3.0", "Creative Commons Attribution-ShareAlike", "None",
-                "http://creativecommons.org/licenses/by-sa/3.0/", true, true, false, "", "images/lic/bysa80x15.png");
-        licenseManager.persist(license);
-        license = new License("by-nd-v3.0", "Creative Commons Attribution-NoDerivs", "None",
-                "http://creativecommons.org/licenses/by-nd/3.0/", true, false, false, "", "images/lic/bynd80x15.png");
-        licenseManager.persist(license);
-        license = new License("by-nc-v3.0", "Creative Commons Attribution-NonCommercial", "None",
-                "http://creativecommons.org/licenses/by-nc/3.0/", true, false, false, "", "images/lic/bync80x15.png");
-        licenseManager.persist(license);
-        license = new License("by-nc-sa-v3.0", "Creative Commons Attribution-NonCommercial-ShareAlike", "None",
-                "http://creativecommons.org/licenses/by-nc-sa/3.0/", true, false, false, "",
-                "images/lic/byncsa80x15.png");
-        licenseManager.persist(license);
-        license = new License("by-nc-nd-v3.0", "Creative Commons Attribution-NonCommercial-NoDerivs", "None",
-                "http://creativecommons.org/licenses/by-nc-nd/3.0/", true, false, false, "",
-                "images/lic/byncnd80x15.png");
-        licenseManager.persist(license);
-        license = new License(
-                "gfdl-v1-3",
-                "GNU Free Documentation License",
-                "The GNU Free Documentation License (GNU FDL or simply GFDL) is a copyleft license for free documentation, giving readers the rights to copy, redistribute and modify a work and requires all copies and derivatives to be available under the same license.",
-                "http://www.gnu.org/copyleft/fdl.html", false, true, false, "", "images/lic/gnu-fdl.gif");
-        licenseManager.persist(license);
-        license = new License(
-                "fal",
-                "Free Art License",
-                "The Free Art license is a French copyleft license for works of art. It authorises the user to freely copy, spread, and transform creative works while respecting the author's rights.",
-                "http://artlibre.org/licence/lal/en/", false, true, false, "", "images/lic/fal-license.gif");
-        licenseManager.persist(license);
-        license = new License(
-                "gpl-v3",
-                "GNU General Public License",
-                "This license grant the recipients of a computer program the rights of the free software definition and uses copyleft to ensure the freedoms are preserved, even when the work is changed or added to.",
-                "http://www.gnu.org/licenses/gpl.html", false, true, false, "", "images/lic/gnu-gpl.gif");
-        licenseManager.persist(license);
-    }
+  private void createLicenses() {
+    // FIXME: Add CC RDF info (seems CC is working on new forms to add
+    // license metadata)
+    License license = new License("by-v3.0", "Creative Commons Attribution", "None",
+        "http://creativecommons.org/licenses/by/3.0/", true, false, false, "", "images/lic/by80x15.png");
+    licenseManager.persist(license);
+    license = new License("by-sa-v3.0", "Creative Commons Attribution-ShareAlike", "None",
+        "http://creativecommons.org/licenses/by-sa/3.0/", true, true, false, "",
+        "images/lic/bysa80x15.png");
+    licenseManager.persist(license);
+    license = new License("by-nd-v3.0", "Creative Commons Attribution-NoDerivs", "None",
+        "http://creativecommons.org/licenses/by-nd/3.0/", true, false, false, "",
+        "images/lic/bynd80x15.png");
+    licenseManager.persist(license);
+    license = new License("by-nc-v3.0", "Creative Commons Attribution-NonCommercial", "None",
+        "http://creativecommons.org/licenses/by-nc/3.0/", true, false, false, "",
+        "images/lic/bync80x15.png");
+    licenseManager.persist(license);
+    license = new License("by-nc-sa-v3.0", "Creative Commons Attribution-NonCommercial-ShareAlike",
+        "None", "http://creativecommons.org/licenses/by-nc-sa/3.0/", true, false, false, "",
+        "images/lic/byncsa80x15.png");
+    licenseManager.persist(license);
+    license = new License("by-nc-nd-v3.0", "Creative Commons Attribution-NonCommercial-NoDerivs",
+        "None", "http://creativecommons.org/licenses/by-nc-nd/3.0/", true, false, false, "",
+        "images/lic/byncnd80x15.png");
+    licenseManager.persist(license);
+    license = new License(
+        "gfdl-v1-3",
+        "GNU Free Documentation License",
+        "The GNU Free Documentation License (GNU FDL or simply GFDL) is a copyleft license for free documentation, giving readers the rights to copy, redistribute and modify a work and requires all copies and derivatives to be available under the same license.",
+        "http://www.gnu.org/copyleft/fdl.html", false, true, false, "", "images/lic/gnu-fdl.gif");
+    licenseManager.persist(license);
+    license = new License(
+        "fal",
+        "Free Art License",
+        "The Free Art license is a French copyleft license for works of art. It authorises the user to freely copy, spread, and transform creative works while respecting the author's rights.",
+        "http://artlibre.org/licence/lal/en/", false, true, false, "", "images/lic/fal-license.gif");
+    licenseManager.persist(license);
+    license = new License(
+        "gpl-v3",
+        "GNU General Public License",
+        "This license grant the recipients of a computer program the rights of the free software definition and uses copyleft to ensure the freedoms are preserved, even when the work is changed or added to.",
+        "http://www.gnu.org/licenses/gpl.html", false, true, false, "", "images/lic/gnu-gpl.gif");
+    licenseManager.persist(license);
+  }
 
-    public void createOthers() {
-        final I18nLanguage english = new I18nLanguage(Long.valueOf(1819), "en", "ltr", "English", "", "", "en", "eng",
-                "eng", false, "", "", "", "c == 1 ? 1 : 2", null, "L", "MMM d\\, yyyy");
-        final I18nLanguage spanish = new I18nLanguage(Long.valueOf(5889), "es", "ltr", "Spanish", "", "", "es", "spa",
-                "spa", true, "Español", "", "", "c == 1 ? 1 : 2", null, "L", "dd/MM/yyyy");
-        languageManager.persist(english);
-        languageManager.persist(spanish);
-        final I18nCountry gb = new I18nCountry(Long.valueOf(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom",
-                "western", ",");
-        countryManager.persist(gb);
-        final I18nTranslation test = new I18nTranslation("test", english, "test");
-        translationManager.persist(test);
-    }
+  public void createOthers() {
+    final I18nLanguage english = new I18nLanguage(Long.valueOf(1819), "en", "ltr", "English", "", "",
+        "en", "eng", "eng", false, "", "", "", "c == 1 ? 1 : 2", null, "L", "MMM d\\, yyyy");
+    final I18nLanguage spanish = new I18nLanguage(Long.valueOf(5889), "es", "ltr", "Spanish", "", "",
+        "es", "spa", "spa", true, "Español", "", "", "c == 1 ? 1 : 2", null, "L", "dd/MM/yyyy");
+    languageManager.persist(english);
+    languageManager.persist(spanish);
+    final I18nCountry gb = new I18nCountry(Long.valueOf(75), "GB", "GBP", ".", "£%n", "", ".",
+        "United Kingdom", "western", ",");
+    countryManager.persist(gb);
+    final I18nTranslation test = new I18nTranslation("test", english, "test");
+    translationManager.persist(test);
+  }
 
-    private void createProperties() {
-        // final PropertyGroup groupProps = new PropertyGroup(Group.PROPS_ID);
-        // final PropertyGroup userProps = new PropertyGroup(User.PROPS_ID);
-        // propGroupManager.persist(userProps);
-        // propGroupManager.persist(groupProps);
-        // final PropertySubgroup userXmppProps = new
-        // PropertySubgroup("user-xmpp");
-        // propSubgroupManager.persist(userXmppProps);
+  private void createProperties() {
+    // final PropertyGroup groupProps = new PropertyGroup(Group.PROPS_ID);
+    // final PropertyGroup userProps = new PropertyGroup(User.PROPS_ID);
+    // propGroupManager.persist(userProps);
+    // propGroupManager.persist(groupProps);
+    // final PropertySubgroup userXmppProps = new
+    // PropertySubgroup("user-xmpp");
+    // propSubgroupManager.persist(userXmppProps);
 
-        // final Property colorProp = new Property("xmpp_color",
-        // "Choose your color", Property.Type.STRING, true, "blue",
-        // userProps, userXmppProps);
-        // final ArrayList<String> subValues = new ArrayList<String>();
-        // subValues.add(SubscriptionMode.autoAcceptAll.toString());
-        // subValues.add(SubscriptionMode.autoRejectAll.toString());
-        // subValues.add(SubscriptionMode.manual.toString());
-        // final Property subProp = new Property("xmpp_subcriptionmode",
-        // "New buddies options", Property.Type.ENUM, true,
-        // SubscriptionMode.manual.toString(), subValues, userProps,
-        // userXmppProps);
-        // final Property unanavProp = new
-        // Property("xmpp_unanavailableitemsvisible",
-        // "Show unavailable buddies",
-        // Property.Type.BOOL, true, Boolean.toString(true), userProps,
-        // userXmppProps);
-        // propertyManager.persist(colorProp);
-        // propertyManager.persist(subProp);
-        // propertyManager.persist(unanavProp);
-    }
+    // final Property colorProp = new Property("xmpp_color",
+    // "Choose your color", Property.Type.STRING, true, "blue",
+    // userProps, userXmppProps);
+    // final ArrayList<String> subValues = new ArrayList<String>();
+    // subValues.add(SubscriptionMode.autoAcceptAll.toString());
+    // subValues.add(SubscriptionMode.autoRejectAll.toString());
+    // subValues.add(SubscriptionMode.manual.toString());
+    // final Property subProp = new Property("xmpp_subcriptionmode",
+    // "New buddies options", Property.Type.ENUM, true,
+    // SubscriptionMode.manual.toString(), subValues, userProps,
+    // userXmppProps);
+    // final Property unanavProp = new
+    // Property("xmpp_unanavailableitemsvisible",
+    // "Show unavailable buddies",
+    // Property.Type.BOOL, true, Boolean.toString(true), userProps,
+    // userXmppProps);
+    // propertyManager.persist(colorProp);
+    // propertyManager.persist(subProp);
+    // propertyManager.persist(unanavProp);
+  }
 
-    public void initConditional() throws Exception {
-        try {
-            groupManager.getSiteDefaultGroup();
-        } catch (final NoResultException e) {
-            initDatabase();
-        }
+  public void initConditional() throws Exception {
+    try {
+      groupManager.getSiteDefaultGroup();
+    } catch (final NoResultException e) {
+      initDatabase();
     }
+  }
 
-    @Transactional
-    public void initDatabase() throws Exception {
-        createOthers();
-        createLicenses();
-        createProperties();
-        createDefUsersGroup();
-    }
+  @Transactional
+  public void initDatabase() throws Exception {
+    createOthers();
+    createLicenses();
+    createProperties();
+    createDefUsersGroup();
+  }
 }

Modified: trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java	2011-06-09 12:25:38 UTC (rev 1399)
+++ trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java	2011-06-09 15:15:55 UTC (rev 1400)
@@ -48,126 +48,127 @@
 
 @Singleton
 public class GroupRPC implements RPC, GroupService {
-    private final ContentManager contentManager;
-    private final GroupManager groupManager;
-    private final I18nTranslationService i18n;
-    private final KuneWaveManagerDefault kuneWaveManager;
-    private final Mapper mapper;
-    private final Provider<UserSession> userSessionProvider;
+  private final ContentManager contentManager;
+  private final GroupManager groupManager;
+  private final I18nTranslationService i18n;
+  private final KuneWaveManagerDefault kuneWaveManager;
+  private final Mapper mapper;
+  private final Provider<UserSession> userSessionProvider;
 
-    @Inject
-    public GroupRPC(final Provider<UserSession> userSessionProvider, final GroupManager groupManager,
-            final ContentManager contentManager, final Mapper mapper, final KuneWaveManagerDefault kuneWaveManager,
-            final I18nTranslationService i18n) {
-        this.userSessionProvider = userSessionProvider;
-        this.groupManager = groupManager;
-        this.contentManager = contentManager;
-        this.mapper = mapper;
-        this.kuneWaveManager = kuneWaveManager;
-        this.i18n = i18n;
-    }
+  @Inject
+  public GroupRPC(final Provider<UserSession> userSessionProvider, final GroupManager groupManager,
+      final ContentManager contentManager, final Mapper mapper,
+      final KuneWaveManagerDefault kuneWaveManager, final I18nTranslationService i18n) {
+    this.userSessionProvider = userSessionProvider;
+    this.groupManager = groupManager;
+    this.contentManager = contentManager;
+    this.mapper = mapper;
+    this.kuneWaveManager = kuneWaveManager;
+    this.i18n = i18n;
+  }
 
-    @Override
-    @Authenticated
-    @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
-    @Transactional
-    public void changeDefLicense(final String userHash, final StateToken groupToken, final LicenseDTO license) {
-        final User user = getUserLogged();
-        final Group group = groupManager.findByShortName(groupToken.getGroup());
-        groupManager.changeDefLicense(user, group, license.getShortName());
-    }
+  @Override
+  @Authenticated
+  @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
+  @Transactional
+  public void changeDefLicense(final String userHash, final StateToken groupToken,
+      final LicenseDTO license) {
+    final User user = getUserLogged();
+    final Group group = groupManager.findByShortName(groupToken.getGroup());
+    groupManager.changeDefLicense(user, group, license.getShortName());
+  }
 
-    @Override
-    @Authenticated
-    @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
-    @Transactional
-    public void changeGroupWsTheme(final String userHash, final StateToken groupToken, final String theme)
-            throws DefaultException {
-        final User user = getUserLogged();
-        final Group group = groupManager.findByShortName(groupToken.getGroup());
-        groupManager.changeWsTheme(user, group, theme);
-    }
+  @Override
+  @Authenticated
+  @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
+  @Transactional
+  public void changeGroupWsTheme(final String userHash, final StateToken groupToken, final String theme)
+      throws DefaultException {
+    final User user = getUserLogged();
+    final Group group = groupManager.findByShortName(groupToken.getGroup());
+    groupManager.changeWsTheme(user, group, theme);
+  }
 
-    @Override
-    @Authenticated
-    @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
-    @Transactional
-    public GroupDTO clearGroupBackImage(final String userHash, final StateToken token) {
-        final Group group = groupManager.findByShortName(token.getGroup());
-        groupManager.clearGroupBackImage(group);
-        return mapper.map(group, GroupDTO.class);
-    }
+  @Override
+  @Authenticated
+  @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
+  @Transactional
+  public GroupDTO clearGroupBackImage(final String userHash, final StateToken token) {
+    final Group group = groupManager.findByShortName(token.getGroup());
+    groupManager.clearGroupBackImage(group);
+    return mapper.map(group, GroupDTO.class);
+  }
 
-    @Override
-    @Authenticated
-    @Transactional(rollbackOn = DefaultException.class)
-    public StateToken createNewGroup(final String userHash, final GroupDTO groupDTO, final String publicDesc,
-            final String tags, final String[] enabledTools) throws DefaultException {
-        final User user = getUserLogged();
-        final Group group = mapper.map(groupDTO, Group.class);
-        final Group newGroup = groupManager.createGroup(group, user, publicDesc);
-        // This is necessary?
-        contentManager.save(user, newGroup.getDefaultContent());
-        // contentManager.setTags(user, defContentId, tags);
-        return newGroup.getDefaultContent().getStateToken();
-    };
+  @Override
+  @Authenticated
+  @Transactional(rollbackOn = DefaultException.class)
+  public StateToken createNewGroup(final String userHash, final GroupDTO groupDTO,
+      final String publicDesc, final String tags, final String[] enabledTools) throws DefaultException {
+    final User user = getUserLogged();
+    final Group group = mapper.map(groupDTO, Group.class);
+    final Group newGroup = groupManager.createGroup(group, user, publicDesc);
+    // This is necessary?
+    contentManager.save(newGroup.getDefaultContent());
+    // contentManager.setTags(user, defContentId, tags);
+    return newGroup.getDefaultContent().getStateToken();
+  };
 
-    @Override
-    @Authenticated(mandatory = false)
-    @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Viewer)
-    public GroupDTO getGroup(final String userHash, final StateToken groupToken) {
-        final Group group = groupManager.findByShortName(groupToken.getGroup());
-        return mapper.map(group, GroupDTO.class);
-    }
+  @Override
+  @Authenticated(mandatory = false)
+  @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Viewer)
+  public GroupDTO getGroup(final String userHash, final StateToken groupToken) {
+    final Group group = groupManager.findByShortName(groupToken.getGroup());
+    return mapper.map(group, GroupDTO.class);
+  }
 
-    private User getUserLogged() {
-        final UserSession userSession = getUserSession();
-        final User user = userSession.getUser();
-        return user;
-    }
+  private User getUserLogged() {
+    final UserSession userSession = getUserSession();
+    final User user = userSession.getUser();
+    return user;
+  }
 
-    private UserSession getUserSession() {
-        return userSessionProvider.get();
-    }
+  private UserSession getUserSession() {
+    return userSessionProvider.get();
+  }
 
-    @Override
-    @Authenticated
-    @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
-    @Transactional
-    public GroupDTO setGroupBackImage(final String userHash, final StateToken token) {
-        final Group group = groupManager.findByShortName(token.getGroup());
-        final Content content = contentManager.find(ContentUtils.parseId(token.getDocument()));
-        groupManager.setGroupBackImage(group, content);
-        return mapper.map(group, GroupDTO.class);
-    }
+  @Override
+  @Authenticated
+  @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
+  @Transactional
+  public GroupDTO setGroupBackImage(final String userHash, final StateToken token) {
+    final Group group = groupManager.findByShortName(token.getGroup());
+    final Content content = contentManager.find(ContentUtils.parseId(token.getDocument()));
+    groupManager.setGroupBackImage(group, content);
+    return mapper.map(group, GroupDTO.class);
+  }
 
-    @Override
-    @Authenticated(mandatory = true)
-    @Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
-    @Transactional
-    public void setGroupNewMembersJoiningPolicy(final String userHash, final StateToken token,
-            final AdmissionType admissionPolicy) {
-        final Group group = groupManager.findByShortName(token.getGroup());
-        group.setAdmissionType(AdmissionType.valueOf(admissionPolicy.toString()));
-    }
+  @Override
+  @Authenticated(mandatory = true)
+  @Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
+  @Transactional
+  public void setGroupNewMembersJoiningPolicy(final String userHash, final StateToken token,
+      final AdmissionType admissionPolicy) {
+    final Group group = groupManager.findByShortName(token.getGroup());
+    group.setAdmissionType(AdmissionType.valueOf(admissionPolicy.toString()));
+  }
 
-    @Override
-    @Authenticated(mandatory = true)
-    @Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
-    @Transactional
-    public void setSocialNetworkVisibility(final String userHash, final StateToken token,
-            final SocialNetworkVisibility visibility) {
-        final Group group = groupManager.findByShortName(token.getGroup());
-        group.getSocialNetwork().setVisibility(visibility);
-    }
+  @Override
+  @Authenticated(mandatory = true)
+  @Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
+  @Transactional
+  public void setSocialNetworkVisibility(final String userHash, final StateToken token,
+      final SocialNetworkVisibility visibility) {
+    final Group group = groupManager.findByShortName(token.getGroup());
+    group.getSocialNetwork().setVisibility(visibility);
+  }
 
-    @Override
-    @Authenticated
-    @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
-    @Transactional
-    public void setToolEnabled(final String userHash, final StateToken groupToken, final String toolName,
-            final boolean enabled) {
-        groupManager.setToolEnabled(getUserLogged(), groupToken.getGroup(), toolName, enabled);
-    }
+  @Override
+  @Authenticated
+  @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
+  @Transactional
+  public void setToolEnabled(final String userHash, final StateToken groupToken, final String toolName,
+      final boolean enabled) {
+    groupManager.setToolEnabled(getUserLogged(), groupToken.getGroup(), toolName, enabled);
+  }
 
 }

Modified: trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java	2011-06-09 12:25:38 UTC (rev 1399)
+++ trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java	2011-06-09 15:15:55 UTC (rev 1400)
@@ -61,143 +61,145 @@
 @Singleton
 public class UserRPC implements RPC, UserService {
 
-    private final ContentManager contentManager;
-    private final GroupManager groupManager;
-    private final I18nTranslationService i18n;
-    private final Mapper mapper;
-    private final Provider<SessionService> sessionServiceProvider;
-    private final UserInfoService userInfoService;
-    private final UserManager userManager;
-    private final Provider<UserSession> userSessionProvider;
-    private final Boolean useSocketIO;
-    private final CustomWaveClientServlet waveClientServlet;
-    private final SessionManager waveSessionManager;
+  private final ContentManager contentManager;
+  private final GroupManager groupManager;
+  private final I18nTranslationService i18n;
+  private final Mapper mapper;
+  private final Provider<SessionService> sessionServiceProvider;
+  private final UserInfoService userInfoService;
+  private final UserManager userManager;
+  private final Provider<UserSession> userSessionProvider;
+  private final Boolean useSocketIO;
+  private final CustomWaveClientServlet waveClientServlet;
+  private final SessionManager waveSessionManager;
 
-    @Inject
-    public UserRPC(final Provider<SessionService> sessionServiceProvider,
-            final Provider<UserSession> userSessionProvider, final UserManager userManager,
-            @Named(CoreSettings.USE_SOCKETIO) final Boolean useSocketIO, final GroupManager groupManager,
-            final UserInfoService userInfoService, final Mapper mapper, final SessionManager waveSessionManager,
-            final CustomWaveClientServlet waveClientServlet, final I18nTranslationService i18n,
-            final ContentManager contentManager) {
-        this.sessionServiceProvider = sessionServiceProvider;
-        this.userSessionProvider = userSessionProvider;
-        this.userManager = userManager;
-        this.useSocketIO = useSocketIO;
-        this.groupManager = groupManager;
-        this.userInfoService = userInfoService;
-        this.mapper = mapper;
-        this.waveSessionManager = waveSessionManager;
-        this.waveClientServlet = waveClientServlet;
-        this.i18n = i18n;
-        this.contentManager = contentManager;
-    }
+  @Inject
+  public UserRPC(final Provider<SessionService> sessionServiceProvider,
+      final Provider<UserSession> userSessionProvider, final UserManager userManager,
+      @Named(CoreSettings.USE_SOCKETIO) final Boolean useSocketIO, final GroupManager groupManager,
+      final UserInfoService userInfoService, final Mapper mapper,
+      final SessionManager waveSessionManager, final CustomWaveClientServlet waveClientServlet,
+      final I18nTranslationService i18n, final ContentManager contentManager) {
+    this.sessionServiceProvider = sessionServiceProvider;
+    this.userSessionProvider = userSessionProvider;
+    this.userManager = userManager;
+    this.useSocketIO = useSocketIO;
+    this.groupManager = groupManager;
+    this.userInfoService = userInfoService;
+    this.mapper = mapper;
+    this.waveSessionManager = waveSessionManager;
+    this.waveClientServlet = waveClientServlet;
+    this.i18n = i18n;
+    this.contentManager = contentManager;
+  }
 
-    @Override
-    @Transactional(rollbackOn = DefaultException.class)
-    public void createUser(final UserDTO userDTO, final boolean wantPersonalHomepage) throws DefaultException {
-        final User user = userManager.createUser(userDTO.getShortName(), userDTO.getName(), userDTO.getEmail(),
-                userDTO.getPassword(), userDTO.getLanguage().getCode(), userDTO.getCountry().getCode(),
-                userDTO.getTimezone().getId());
-        final Group userGroup = groupManager.createUserGroup(user, wantPersonalHomepage);
-        // Is this necessary? try to remove (used when we were setting the def
-        // content
-        contentManager.save(user, userGroup.getDefaultContent());
-    }
+  @Override
+  @Transactional(rollbackOn = DefaultException.class)
+  public void createUser(final UserDTO userDTO, final boolean wantPersonalHomepage)
+      throws DefaultException {
+    final User user = userManager.createUser(userDTO.getShortName(), userDTO.getName(),
+        userDTO.getEmail(), userDTO.getPassword(), userDTO.getLanguage().getCode(),
+        userDTO.getCountry().getCode(), userDTO.getTimezone().getId());
+    final Group userGroup = groupManager.createUserGroup(user, wantPersonalHomepage);
+    // Is this necessary? try to remove (used when we were setting the def
+    // content
+    contentManager.save(userGroup.getDefaultContent());
+  }
 
-    @Override
-    @Authenticated
-    @Transactional
-    @Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
-    public String getUserAvatarBaser64(final String userHash, final StateToken userToken) throws DefaultException {
-        final UserSession userSession = getUserSession();
-        final User user = userSession.getUser();
-        final Group userGroup = user.getUserGroup();
-        if (!userGroup.getShortName().equals(userToken.getGroup())) {
-            throw new AccessViolationException();
-        }
-        if (userGroup.hasLogo()) {
-            return Base64.encodeBytes(userGroup.getLogo());
-        } else {
-            throw new DefaultException("Unexpected programatic exception (user has no logo)");
-        }
+  @Override
+  @Authenticated
+  @Transactional
+  @Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
+  public String getUserAvatarBaser64(final String userHash, final StateToken userToken)
+      throws DefaultException {
+    final UserSession userSession = getUserSession();
+    final User user = userSession.getUser();
+    final Group userGroup = user.getUserGroup();
+    if (!userGroup.getShortName().equals(userToken.getGroup())) {
+      throw new AccessViolationException();
     }
-
-    private UserSession getUserSession() {
-        return userSessionProvider.get();
+    if (userGroup.hasLogo()) {
+      return Base64.encodeBytes(userGroup.getLogo());
+    } else {
+      throw new DefaultException("Unexpected programatic exception (user has no logo)");
     }
+  }
 
-    @Override
-    @Authenticated(mandatory = true)
-    public WaveClientParams getWaveClientParameters(final String userHash) {
-        final HttpSession sessionFromToken = waveSessionManager.getSessionFromToken(userHash);
-        final JSONObject sessionJson = waveClientServlet.getSessionJson(sessionFromToken);
-        final JSONObject clientFlags = new JSONObject(); // waveClientServlet.getClientFlags();
-        return new WaveClientParams(sessionJson.toString(), clientFlags.toString(), useSocketIO);
-    }
+  private UserSession getUserSession() {
+    return userSessionProvider.get();
+  }
 
-    private UserInfoDTO loadUserInfo(final User user) throws DefaultException {
-        final UserInfo userInfo = userInfoService.buildInfo(user, getUserSession().getHash());
-        return mapper.map(userInfo, UserInfoDTO.class);
-    }
+  @Override
+  @Authenticated(mandatory = true)
+  public WaveClientParams getWaveClientParameters(final String userHash) {
+    final HttpSession sessionFromToken = waveSessionManager.getSessionFromToken(userHash);
+    final JSONObject sessionJson = waveClientServlet.getSessionJson(sessionFromToken);
+    final JSONObject clientFlags = new JSONObject(); // waveClientServlet.getClientFlags();
+    return new WaveClientParams(sessionJson.toString(), clientFlags.toString(), useSocketIO);
+  }
 
-    @Override
-    @Transactional
-    public UserInfoDTO login(final String nickOrEmail, final String passwd, final String waveToken)
-            throws DefaultException {
-        // final SessionService sessionService = sessionServiceProvider.get();
-        // sessionService.getNewSession();
-        final User user = userManager.login(nickOrEmail, passwd);
-        return loginUser(user, waveToken);
-    }
+  private UserInfoDTO loadUserInfo(final User user) throws DefaultException {
+    final UserInfo userInfo = userInfoService.buildInfo(user, getUserSession().getHash());
+    return mapper.map(userInfo, UserInfoDTO.class);
+  }
 
-    private UserInfoDTO loginUser(final User user, final String waveToken) throws DefaultException {
-        if (user != null) {
-            // Maybe use terracotta.org for http session clustering
-            getUserSession().login(user, waveToken);
-            return loadUserInfo(user);
-        } else {
-            throw new UserAuthException();
-        }
-    };
+  @Override
+  @Transactional
+  public UserInfoDTO login(final String nickOrEmail, final String passwd, final String waveToken)
+      throws DefaultException {
+    // final SessionService sessionService = sessionServiceProvider.get();
+    // sessionService.getNewSession();
+    final User user = userManager.login(nickOrEmail, passwd);
+    return loginUser(user, waveToken);
+  }
 
-    @Override
-    @Authenticated
-    @Transactional
-    public void logout(final String userHash) throws DefaultException {
-        getUserSession().logout();
-        // FIXME final SessionService sessionService =
-        // sessionServiceProvider.get();
-        // FIXME sessionService.getNewSession();
+  private UserInfoDTO loginUser(final User user, final String waveToken) throws DefaultException {
+    if (user != null) {
+      // Maybe use terracotta.org for http session clustering
+      getUserSession().login(user, waveToken);
+      return loadUserInfo(user);
+    } else {
+      throw new UserAuthException();
     }
+  };
 
-    @Override
-    @Authenticated(mandatory = false)
-    @Transactional
-    public void onlyCheckSession(final String userHash) throws DefaultException {
-        // Do nothing @Authenticated checks user session
-    }
+  @Override
+  @Authenticated
+  @Transactional
+  public void logout(final String userHash) throws DefaultException {
+    getUserSession().logout();
+    // FIXME final SessionService sessionService =
+    // sessionServiceProvider.get();
+    // FIXME sessionService.getNewSession();
+  }
 
-    @Override
-    @Authenticated
-    @Transactional
-    public UserInfoDTO reloadUserInfo(final String userHash) throws DefaultException {
-        final UserSession userSession = getUserSession();
-        final User user = userSession.getUser();
-        return loadUserInfo(user);
-    }
+  @Override
+  @Authenticated(mandatory = false)
+  @Transactional
+  public void onlyCheckSession(final String userHash) throws DefaultException {
+    // Do nothing @Authenticated checks user session
+  }
 
-    @Override
-    @Authenticated(mandatory = true)
-    @Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
-    @Transactional
-    public void setBuddiesVisibility(final String userHash, final StateToken groupToken,
-            final UserSNetVisibility visibility) {
-        final UserSession userSession = getUserSession();
-        final User user = userSession.getUser();
-        if (!groupToken.getGroup().equals(user.getShortName())) {
-            throw new AccessViolationException();
-        }
-        user.setSNetVisibility(visibility);
+  @Override
+  @Authenticated
+  @Transactional
+  public UserInfoDTO reloadUserInfo(final String userHash) throws DefaultException {
+    final UserSession userSession = getUserSession();
+    final User user = userSession.getUser();
+    return loadUserInfo(user);
+  }
+
+  @Override
+  @Authenticated(mandatory = true)
+  @Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
+  @Transactional
+  public void setBuddiesVisibility(final String userHash, final StateToken groupToken,
+      final UserSNetVisibility visibility) {
+    final UserSession userSession = getUserSession();
+    final User user = userSession.getUser();
+    if (!groupToken.getGroup().equals(user.getShortName())) {
+      throw new AccessViolationException();
     }
+    user.setSNetVisibility(visibility);
+  }
 }

Modified: trunk/src/main/java/cc/kune/core/server/state/StateServiceDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/state/StateServiceDefault.java	2011-06-09 12:25:38 UTC (rev 1399)
+++ trunk/src/main/java/cc/kune/core/server/state/StateServiceDefault.java	2011-06-09 15:15:55 UTC (rev 1400)
@@ -114,7 +114,8 @@
         // Well we "cache" the last modified time of waves in db (w'll find
         // another way to do it better in the future with db persitence of
         // waves)
-        contentManager.setModifiedOn(content, wavelet.getLastModifiedTime());
+        // FIXME, how to do this
+        // contentManager.setModifiedOn(content, wavelet.getLastModifiedTime());
         // contentManager.save(userLogged, content, currentContent);
         state.setTitle(wavelet.getTitle());
         state.setIsParticipant(userLogged != User.UNKNOWN_USER ? kuneWaveManager.isParticipant(wavelet,

Modified: trunk/src/main/java/cc/kune/core/server/xmpp/XmppManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/xmpp/XmppManager.java	2011-06-09 12:25:38 UTC (rev 1399)
+++ trunk/src/main/java/cc/kune/core/server/xmpp/XmppManager.java	2011-06-09 15:15:55 UTC (rev 1400)
@@ -31,6 +31,8 @@
 
   void disconnect(ChatConnection connection);
 
+  boolean existRoom(ChatConnection conn, String roomName);
+
   Collection<RosterEntry> getRoster(ChatConnection connection);
 
   Room joinRoom(ChatConnection connection, String roomName, String alias);

Modified: trunk/src/main/java/cc/kune/core/server/xmpp/XmppManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/xmpp/XmppManagerDefault.java	2011-06-09 12:25:38 UTC (rev 1399)
+++ trunk/src/main/java/cc/kune/core/server/xmpp/XmppManagerDefault.java	2011-06-09 15:15:55 UTC (rev 1400)
@@ -99,6 +99,7 @@
     final XmppConnection xConn = (XmppConnection) conn;
     final MultiUserChat muc = new MultiUserChat(xConn.getConn(), getRoomName(roomName));
     try {
+
       muc.destroy("Room removed by kune server", "");
     } catch (final XMPPException e) {
       throw new ChatException(e);
@@ -112,6 +113,14 @@
 
   }
 
+  @Override
+  public boolean existRoom(final ChatConnection conn, final String roomName) {
+    final XmppConnection xConn = (XmppConnection) conn;
+    final MultiUserChat muc = new MultiUserChat(xConn.getConn(), getRoomName(roomName));
+    final Iterator<String> occupants = muc.getOccupants();
+    return occupants != null;
+  }
+
   private String getRoomName(final String room) {
     return room + "@" + chatProperties.getRoomHost();
   }

Modified: trunk/src/main/java/cc/kune/domain/Content.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/Content.java	2011-06-09 12:25:38 UTC (rev 1399)
+++ trunk/src/main/java/cc/kune/domain/Content.java	2011-06-09 15:15:55 UTC (rev 1400)
@@ -143,6 +143,7 @@
     translations = new ArrayList<ContentTranslation>();
     authors = new ArrayList<User>();
     createdOn = System.currentTimeMillis();
+    modifiedOn = System.currentTimeMillis();
     lastRevision = new Revision(this);
     accessLists = null;
     status = ContentStatus.editingInProgress;

Modified: trunk/src/main/java/cc/kune/meets/server/MeetingServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/meets/server/MeetingServerTool.java	2011-06-09 12:25:38 UTC (rev 1399)
+++ trunk/src/main/java/cc/kune/meets/server/MeetingServerTool.java	2011-06-09 15:15:55 UTC (rev 1400)
@@ -132,7 +132,7 @@
     content.setLanguage(user.getLanguage());
     content.setTypeId(TYPE_MEETING);
     content.setStatus(ContentStatus.publishedOnline);
-    contentManager.save(user, content);
+    contentManager.save(content);
     return group;
   }
 

Modified: trunk/src/main/java/cc/kune/wiki/server/WikiServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/wiki/server/WikiServerTool.java	2011-06-09 12:25:38 UTC (rev 1399)
+++ trunk/src/main/java/cc/kune/wiki/server/WikiServerTool.java	2011-06-09 15:15:55 UTC (rev 1400)
@@ -135,7 +135,7 @@
     content.setTypeId(TYPE_WIKIPAGE);
     content.setStatus(ContentStatus.publishedOnline);
 
-    contentManager.save(user, content);
+    contentManager.save(content);
     return group;
   }
 

Copied: trunk/src/test/java/cc/kune/core/server/xmpp (from rev 1395, trunk/src/test/java/org/ourproject/kune/chat/server/managers)

Deleted: trunk/src/test/java/cc/kune/core/server/xmpp/XmppManagerDefaultTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/chat/server/managers/XmppManagerDefaultTest.java	2011-05-15 22:23:33 UTC (rev 1395)
+++ trunk/src/test/java/cc/kune/core/server/xmpp/XmppManagerDefaultTest.java	2011-06-09 15:15:55 UTC (rev 1400)
@@ -1,119 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.chat.server.managers;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import cc.kune.core.server.integration.IntegrationTestHelper;
-import cc.kune.core.server.xmpp.ChatConnection;
-import cc.kune.core.server.xmpp.ChatException;
-import cc.kune.core.server.xmpp.Room;
-import cc.kune.core.server.xmpp.RoomListener;
-import cc.kune.core.server.xmpp.XmppManager;
-
-import com.google.inject.Inject;
-
-public class XmppManagerDefaultTest {
-  public static class OutputListener implements RoomListener {
-    private int hits;
-    private final String name;
-
-    public OutputListener(final String name) {
-      this.name = name;
-      this.hits = 0;
-    }
-
-    public int getHits() {
-      return hits;
-    }
-
-    @Override
-    public void onMessage(final String from, final String to, final String body) {
-      log.debug("Al listener " + name + "ha llegado: ");
-      log.debug(from + "- " + to + ": " + body);
-      hits++;
-    }
-
-  }
-
-  static Log log = LogFactory.getLog(XmppManagerDefaultTest.class);
-
-  @Inject
-  XmppManager manager;
-
-  @Before
-  public void init() {
-    IntegrationTestHelper.createInjector().injectMembers(this);
-  }
-
-  @Ignore
-  public void testBroadcast() {
-    final String roomName = "roomName";
-    final ChatConnection conn1 = manager.login("testUser1", "easy1", "test");
-    final ChatConnection conn2 = manager.login("testUser2", "easy2", "test");
-    final Room room1 = manager.createRoom(conn1, roomName, "user1Alias");
-    final OutputListener listener1 = new OutputListener("1");
-    room1.setListener(listener1);
-    final Room room2 = manager.joinRoom(conn2, roomName, "user2Alias");
-    final OutputListener listener2 = new OutputListener("2");
-    room2.setListener(listener2);
-
-    manager.sendMessage(room1, "usuario1 dice uno");
-    manager.sendMessage(room2, "usuario2 dice dos");
-    manager.sendMessage(room1, "usuario1 dice tres");
-    manager.sendMessage(room2, "usuario2 dice cuatro");
-    try {
-      Thread.sleep(4000);
-    } catch (final InterruptedException e) {
-      e.printStackTrace();
-    }
-    assertEquals(4, listener1.getHits());
-    assertEquals(4, listener2.getHits());
-  }
-
-  @Test
-  public void testConnection() {
-    final ChatConnection handler1 = manager.login("admin", "easyeasy", "test");
-    assertNotNull(handler1);
-  }
-
-  @Test
-  public void testGetRoster() {
-    final ChatConnection handler = manager.login("admin", "easyeasy", "test");
-    assertNotNull(manager.getRoster(handler));
-  }
-
-  @Test
-  public void testSendMessage() {
-    manager.sendMessage("admin", "test message");
-  }
-
-  @Test(expected = ChatException.class)
-  public void testUserDontExist() {
-    manager.login("user", "password", "test");
-  }
-}

Copied: trunk/src/test/java/cc/kune/core/server/xmpp/XmppManagerDefaultTest.java (from rev 1399, trunk/src/test/java/org/ourproject/kune/chat/server/managers/XmppManagerDefaultTest.java)
===================================================================
--- trunk/src/test/java/cc/kune/core/server/xmpp/XmppManagerDefaultTest.java	                        (rev 0)
+++ trunk/src/test/java/cc/kune/core/server/xmpp/XmppManagerDefaultTest.java	2011-06-09 15:15:55 UTC (rev 1400)
@@ -0,0 +1,122 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.core.server.xmpp;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import cc.kune.core.server.integration.IntegrationTestHelper;
+
+import com.google.inject.Inject;
+
+public class XmppManagerDefaultTest {
+  public static class OutputListener implements RoomListener {
+    private int hits;
+    private final String name;
+
+    public OutputListener(final String name) {
+      this.name = name;
+      this.hits = 0;
+    }
+
+    public int getHits() {
+      return hits;
+    }
+
+    @Override
+    public void onMessage(final String from, final String to, final String body) {
+      log.debug("Al listener " + name + "ha llegado: ");
+      log.debug(from + "- " + to + ": " + body);
+      hits++;
+    }
+
+  }
+
+  static Log log = LogFactory.getLog(XmppManagerDefaultTest.class);
+
+  @Inject
+  XmppManager manager;
+
+  @Before
+  public void init() {
+    IntegrationTestHelper.createInjector().injectMembers(this);
+  }
+
+  @Ignore
+  public void testBroadcast() {
+    final String roomName = "roomName";
+    final ChatConnection conn1 = manager.login("testUser1", "easy1", "test");
+    final ChatConnection conn2 = manager.login("testUser2", "easy2", "test");
+    final Room room1 = manager.createRoom(conn1, roomName, "user1Alias", "subject");
+    final OutputListener listener1 = new OutputListener("1");
+    room1.setListener(listener1);
+    final Room room2 = manager.joinRoom(conn2, roomName, "user2Alias");
+    final OutputListener listener2 = new OutputListener("2");
+    room2.setListener(listener2);
+
+    manager.sendMessage(room1, "usuario1 dice uno");
+    manager.sendMessage(room2, "usuario2 dice dos");
+    manager.sendMessage(room1, "usuario1 dice tres");
+    manager.sendMessage(room2, "usuario2 dice cuatro");
+    try {
+      Thread.sleep(4000);
+    } catch (final InterruptedException e) {
+      e.printStackTrace();
+    }
+    assertEquals(4, listener1.getHits());
+    assertEquals(4, listener2.getHits());
+  }
+
+  @Test
+  public void testConnection() {
+    final ChatConnection handler1 = manager.login("admin", "easyeasy", "test");
+    assertNotNull(handler1);
+  }
+
+  @Test
+  public void testCreateRoom() {
+    final ChatConnection handler1 = manager.login("admin", "easyeasy", "test");
+    if (!manager.existRoom(handler1, "test-room")) {
+      manager.createRoom(handler1, "test-room", "alias", "Always the same room");
+    }
+  }
+
+  @Test
+  public void testGetRoster() {
+    final ChatConnection handler = manager.login("admin", "easyeasy", "test");
+    assertNotNull(manager.getRoster(handler));
+  }
+
+  @Test
+  public void testSendMessage() {
+    manager.sendMessage("admin", "test message");
+  }
+
+  @Test(expected = ChatException.class)
+  public void testUserDontExist() {
+    manager.login("user", "password", "test");
+  }
+}




More information about the kune-commits mailing list