From bbfb27a04d62dff5c5361c7a263da12883095182 Mon Sep 17 00:00:00 2001 From: Emil Ivov Date: Tue, 9 May 2006 14:26:01 +0000 Subject: [PATCH] Working on persistency of contact lists. added UIDs to groups. (necessary when storing CLs to disks) --- .../contactlist/MetaContactGroupImpl.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/net/java/sip/communicator/impl/contactlist/MetaContactGroupImpl.java b/src/net/java/sip/communicator/impl/contactlist/MetaContactGroupImpl.java index 8aa9c6b34..0eaf50700 100644 --- a/src/net/java/sip/communicator/impl/contactlist/MetaContactGroupImpl.java +++ b/src/net/java/sip/communicator/impl/contactlist/MetaContactGroupImpl.java @@ -39,6 +39,11 @@ public class MetaContactGroupImpl */ private Vector protoGroups = new Vector(); + /** + * An id uniquely identifying the meta contact group in this contact list. + */ + private String groupUID = null; + /** * The name of the group (fixed for root groups since it won't show). */ @@ -57,8 +62,42 @@ public class MetaContactGroupImpl * @param groupName the name of the group to create */ MetaContactGroupImpl(String groupName) + { + this(groupName, null); + } + + /** + * Creates an instance of the root meta contact group assigning it the + * specified meta contact uid. This constructor MUST NOT be used for nothing + * purposes else but restoring contacts extracted from the contactlist.xml + * + * @param groupName the name of the group to create + * @param metaUID a UID that has been stored earlier or null when a new + * UID needs to be created. + */ + MetaContactGroupImpl(String groupName, String metaUID) { this.groupName = groupName; + + //create a new uid if necessary + if(metaUID == null) + metaUID = String.valueOf( System.currentTimeMillis()) + + String.valueOf(hashCode()); + + this.groupUID = metaUID; + } + + + /** + * Returns a String identifier (the actual contents is left to + * implementations) that uniquely represents this MetaContact in + * the containing MetaContactList + * + * @return a String uniquely identifying this meta contact. + */ + public String getMetaUID() + { + return groupUID; } /**