Commit 4ab73f72 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Get group properties from group provider. JM-1416. Reviewer=Gabriel

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@10627 b35dd754-fafc-0310-a699-88a17e54d16e
parent 47566b10
......@@ -68,6 +68,11 @@ public class ClearspaceGroupProvider implements GroupProvider {
}
}
public Collection<String> getSharedGroupsNames() {
// Return all social group names since every social group is a shared group
return getGroupNames();
}
public Collection<String> getGroupNames() {
try {
String path = URL_PREFIX + "socialGroupNames";
......
......@@ -262,6 +262,11 @@ public class DefaultGroupProvider implements GroupProvider {
return count;
}
public Collection<String> getSharedGroupsNames() {
// Get the list of shared groups from the database
return Group.getSharedGroupsNames();
}
public Collection<String> getGroupNames() {
List<String> groupNames = new ArrayList<String>();
Connection con = null;
......
......@@ -71,7 +71,7 @@ public class Group implements Cacheable, Externalizable {
*
* @return the name of the groups that are shared groups.
*/
static Set<String> getSharedGroupsNames() {
public static Set<String> getSharedGroupsNames() {
Set<String> groupNames = new HashSet<String>();
Connection con = null;
PreparedStatement pstmt = null;
......@@ -148,28 +148,28 @@ public class Group implements Cacheable, Externalizable {
// Check if we have to create or update some properties
for (Map.Entry<String, String> property : properties.entrySet()) {
// If the DB contains this property
if (properties.containsKey(property.getKey())) {
if (this.properties.containsKey(property.getKey())) {
// then check if we need to update it
if (!property.getValue().equals(properties.get(property.getKey()))) {
if (!property.getValue().equals(this.properties.get(property.getKey()))) {
// update the properties map
properties.put(property.getKey(), property.getValue());
this.properties.put(property.getKey(), property.getValue());
// and the DB
updateProperty(property.getKey(), property.getValue());
}
} // else we need to add it
else {
// add to the properties map
properties.put(property.getKey(), property.getValue());
this.properties.put(property.getKey(), property.getValue());
// and insert it to the DB
insertProperty(property.getKey(), property.getValue());
}
}
// Check if we have to delete some properties
for (String oldPropName : properties.keySet()) {
for (String oldPropName : this.properties.keySet()) {
if (!properties.containsKey(oldPropName)) {
// delete it from the property map
properties.remove(oldPropName);
this.properties.remove(oldPropName);
// delete it from the DB
deleteProperty(oldPropName);
}
......
......@@ -373,7 +373,7 @@ public class GroupManager {
synchronized(SHARED_GROUPS_KEY.intern()) {
groupNames = (Collection<String>)groupMetaCache.get(SHARED_GROUPS_KEY);
if (groupNames == null) {
groupNames = Group.getSharedGroupsNames();
groupNames = provider.getSharedGroupsNames();
groupMetaCache.put(SHARED_GROUPS_KEY, groupNames);
}
}
......
......@@ -104,6 +104,13 @@ public interface GroupProvider {
*/
Collection<String> getGroupNames();
/**
* Returns an unmodifiable Collection of all shared groups in the system.
*
* @return unmodifiable Collection of all shared groups in the system.
*/
Collection<String> getSharedGroupsNames();
/**
* Returns the Collection of all groups in the system.
*
......
......@@ -232,6 +232,11 @@ public class JDBCGroupProvider implements GroupProvider {
return count;
}
public Collection<String> getSharedGroupsNames() {
// Get the list of shared groups from the database
return Group.getSharedGroupsNames();
}
public Collection<String> getGroupNames() {
List<String> groupNames = new ArrayList<String>();
Connection con = null;
......
......@@ -144,6 +144,11 @@ public class LdapGroupProvider implements GroupProvider {
return this.groupCount;
}
public Collection<String> getSharedGroupsNames() {
// Get the list of shared groups from the database
return Group.getSharedGroupsNames();
}
public Collection<String> getGroupNames() {
return getGroupNames(-1, -1);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment