List Info

Thread: Duplicated groups and contacts




Duplicated groups and contacts
user name
2006-09-21 20:44:02
Hi Emil,

after Damian committed the implementation of Jabber two problems occurred in the GUI. One of them was that some contacts were shown two times and others not at all. This was a problem of indexing the contact list in the case when we have contacts that are contained directly in the root group. I've fixed this problem.

Another problem was that some groups were duplicated. I've debugged the problem and I found that it comes from the MclStorageManager in the method processGroupXmlNode. This method should load all contacts and groups for an account. The problem is that the meta contact group is created in the beginning before checking if it contains a proto group for the given account, thus if there are no proto groups for the given account an empty meta group is created and added in the contact list. I have fixed that in the following way:


The code was:

//create the meta group
        ;           ;     currentMetaGroup = mclServiceImpl
 ;           ;           ;     .loadStoredMetaContactGroup(parentGroup
      ;           ;           ;           ;           ;      , groupMetaUID
     ;           ;           ;           ;           ;       , groupDisplayName);


//extract and load one by one all proto groups in this meta group.
      ;      Node protoGroupsNode = XMLUtils.findChild(
  ;           ;   groupNode, PROTO_GROUPS_NODE_NAME);

          ;  NodeList protoGroups = protoGroupsNode.getChildNodes();

 &nbsp;   ; &nbsp; &nbsp; &nbsp; for (int i = 0; i < protoGroups.getLength(); i++)
&nbsp; &nbsp; &nbsp; &nbsp;   ;  {
 &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   Node currentProtoGroupNode = protoGroups.item(i);

 &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; if (currentProtoGroupNode.getNodeType() != Node.ELEMENT_NODE)
 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   continue;

 &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; String groupAccountID = XMLUtils.getAttribute(
 &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  currentProtoGroupNode, ACCOUNT_ID_ATTR_NAME);

   ; &nbsp; &nbsp; &nbsp; &nbsp;   if (!accountID.equals(groupAccountID))
   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp;  continue;

.....................



And now is:

//extract and load one by one all proto groups in this meta group.
&nbsp; &nbsp;   ; &nbsp; &nbsp;  Node protoGroupsNode = XMLUtils.findChild(
  ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; groupNode, PROTO_GROUPS_NODE_NAME);

&nbsp; &nbsp; &nbsp; &nbsp;   ;  NodeList protoGroups = protoGroupsNode.getChildNodes();

 &nbsp;   ; &nbsp; &nbsp; &nbsp; for (int i = 0; i < protoGroups.getLength(); i++)
&nbsp; &nbsp; &nbsp; &nbsp;   ;  {
 &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   Node currentProtoGroupNode = protoGroups.item(i);

 &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; if (currentProtoGroupNode.getNodeType() != Node.ELEMENT_NODE)
 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   continue;

 &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; String groupAccountID = XMLUtils.getAttribute(
 &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  currentProtoGroupNode, ACCOUNT_ID_ATTR_NAME);

   ; &nbsp; &nbsp; &nbsp; &nbsp;   if (!accountID.equals(groupAccountID)) {
 &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp;  continue;
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; }
 &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   else {
 &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp;
  if(currentMetaGroup == null) {
 &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp;  //create the meta group
&nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; currentMetaGroup = mclServiceImpl
 ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; .loadStoredMetaContactGroup(parentGroup
&nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp;  , groupMetaUID
 &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; , groupDisplayName);
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; }
 &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; }

Do you want me to commit changes I've made or you prefer handling the issue yourself?

Regards,
Yana
Duplicated groups and contacts
user name
2006-09-21 23:55:40
Array
Duplicated groups and contacts
user name
2006-09-22 06:39:43
Array
Duplicated groups and contacts
user name
2006-09-22 08:20:23
Array
[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )