/android/import-contacts

To get this branch, use:
bzr branch http://bzr.ed.am/android/import-contacts

« back to all changes in this revision

Viewing changes to src/am/ed/importcontacts/Importer.java

  • Committer: edam
  • Date: 2012-12-20 12:33:54 UTC
  • Revision ID: tim@ed.am-20121220123354-y1ls9f4awasf53d5
updated TODO and NOTES

Show diffs side-by-side

added added

removed removed

141
141
                protected HashMap< String, PreferredDetail > _numbers = null;
142
142
                protected HashMap< String, PreferredDetail > _emails = null;
143
143
                protected HashMap< String, TypeDetail > _addresses = null;
144
 
                protected HashSet< String > _notes = null;
145
144
 
146
145
                private ContactsCache.CacheIdentifier _cache_identifier = null;
147
146
 
345
344
                        return _addresses;
346
345
                }
347
346
 
348
 
                protected void addNote( String note )
349
 
                {
350
 
                        if( _notes == null ) _notes = new HashSet< String >();
351
 
                        if( !_notes.contains( note ) )
352
 
                                _notes.add( note );
353
 
                }
354
 
 
355
 
                public boolean hasNotes()
356
 
                {
357
 
                        return _notes != null && _notes.size() > 0;
358
 
                }
359
 
 
360
 
                public HashSet< String > getNotes()
361
 
                {
362
 
                        return _notes;
363
 
                }
364
 
 
365
347
                protected void finalise()
366
348
                        throws ContactNotIdentifiableException
367
349
                {
390
372
 
391
373
                        // create a cache identifier from this contact data, which can be
392
374
                        // used to look-up an existing contact
393
 
                        _cache_identifier = ContactsCache.CacheIdentifier.factory( this );
 
375
                        _cache_identifier = ContactsCache.createIdentifier( this );
394
376
                        if( _cache_identifier == null )
395
377
                                throw new ContactNotIdentifiableException();
396
378
                }
759
741
                                importContactAddresses( id, contact.getAddresses() );
760
742
                        if( contact.hasOrganisations() )
761
743
                                importContactOrganisations( id, contact.getOrganisations() );
762
 
                        if( contact.hasNotes() )
763
 
                                importContactNotes( id, contact.getNotes() );
764
744
                }
765
745
                catch( Backend.ContactCreationException e )
766
746
                {
873
853
                }
874
854
        }
875
855
 
876
 
        private void importContactNotes( Long id,
877
 
                HashSet< String > datas )
878
 
                throws ContactCreationException
879
 
        {
880
 
                // add notes
881
 
                Iterator< String > i = datas.iterator();
882
 
                while( i.hasNext() ) {
883
 
                        String note = i.next();
884
 
 
885
 
                        // we don't want to add this note if it exists already or we would
886
 
                        // introduce duplicates
887
 
                        if( _contacts_cache.hasAssociatedNote( id, note ) )
888
 
                                continue;
889
 
 
890
 
                        // add note
891
 
                        _backend.addContactNote( id, note );
892
 
 
893
 
                        // and add this note to the cache to prevent a addition of duplicate
894
 
                        // date from another file
895
 
                        _contacts_cache.addAssociatedNote( id, note );
896
 
                }
897
 
 
898
 
        }
899
 
 
900
856
        synchronized protected void checkAbort() throws AbortImportException
901
857
        {
902
858
                if( _abort ) {