01: /**
02: * Copyright 2005, 2006 ToolCafe, Inc. All rights reserved.
03: */package org.columba.mail.connector;
04:
05: import org.columba.addressbook.facade.IContactItem;
06: import org.columba.core.util.NameParser;
07: import org.columba.core.util.NameParser.Name;
08:
09: /**
10: * Utilities to assist with using the addressbook facade
11: * @author Rick Horowitz
12: *
13: */
14: public class FacadeUtil {
15:
16: private static FacadeUtil _instance;
17:
18: public static FacadeUtil getInstance() {
19: if (_instance == null)
20: _instance = new FacadeUtil();
21: return _instance;
22: }
23:
24: private FacadeUtil() {
25: }
26:
27: /**
28: * Initialize the IContactItem with the specified name and emailAddr
29: * @param contactItem The IContactItem to initialize
30: * @param displayName The displayName to
31: * @param emailAddr
32: */
33: public void initContactItem(IContactItem contactItem,
34: String displayName, String emailAddr) {
35:
36: NameParser.Name name = NameParser.getInstance()
37: .parseDisplayName(displayName);
38: contactItem.setEmailAddress(emailAddr);
39: contactItem.setFirstName(name.getFirstName());
40: contactItem.setLastName(name.getLastName());
41: contactItem.setName(name.toString());
42: }
43: }
|