37
37
public static class CacheIdentifier
40
NONE, NAME, ORGANISATION, PRIMARY_NUMBER, PRIMARY_EMAIL }
39
public enum Type { NAME, ORGANISATION, PRIMARY_NUMBER, PRIMARY_EMAIL }
42
41
private Type _type;
43
42
private String _detail;
45
protected CacheIdentifier()
51
45
* Obtain a cache identifier. This routine is designed to be as robust
52
46
* as possible (in terms of bad or null detail values), and to return
79
73
public static CacheIdentifier factory( Importer.ContactData contact )
81
CacheIdentifier ret = null;
75
CacheIdentifier identifier = null;
83
77
if( contact.hasName() )
84
ret = factory( CacheIdentifier.Type.NAME,
78
identifier = factory( CacheIdentifier.Type.NAME,
85
79
contact.getName() );
86
if( ret == null && contact.hasPrimaryOrganisation() )
87
ret = factory( CacheIdentifier.Type.ORGANISATION,
80
if( identifier != null ) return identifier;
82
if( contact.hasPrimaryOrganisation() )
83
identifier = factory( CacheIdentifier.Type.ORGANISATION,
88
84
contact.getPrimaryOrganisation() );
89
if( ret == null && contact.hasPrimaryNumber() )
90
ret = factory( CacheIdentifier.Type.PRIMARY_NUMBER,
85
if( identifier != null ) return identifier;
87
if( contact.hasPrimaryNumber() )
88
identifier = factory( CacheIdentifier.Type.PRIMARY_NUMBER,
91
89
contact.getPrimaryNumber() );
92
if( ret == null && contact.hasPrimaryEmail() )
93
ret = factory( CacheIdentifier.Type.PRIMARY_EMAIL,
90
if( identifier != null ) return identifier;
92
if( contact.hasPrimaryEmail() )
93
identifier = factory( CacheIdentifier.Type.PRIMARY_EMAIL,
94
94
contact.getPrimaryEmail() );
95
if( identifier != null ) return identifier;
99
100
protected CacheIdentifier( Type type, String detail )