@ SuppressWarnings ( "unchecked" ) public void addDoc ( Map < String , Object > jsonFields , String collName , String docId ) { if ( ! mCollections . containsKey ( collName ) ) { // add new collection log . debug ( "Added collection " + collName ) ; mCollections . put ( collName , new ConcurrentHashMap < String , Map < String , Object > > ( ) ) ; } Map < String , Map < String , Object > > collection = mCollections . get ( collName ) ; Map < String , Object > fields ; if ( jsonFields . get ( DdpMessageField . FIELDS ) == null ) { fields = new ConcurrentHashMap <> ( ) ; } else { fields = ( Map < String , Object > ) jsonFields . get ( DdpMessageField . FIELDS ) ; } collection . put ( docId , fields ) ; if ( BuildConfig . DEBUG ) { log . debug ( "Added docid " + docId + " to collection " + collName ) ; } }
Handles adding a document to collection . Override if you want to use your own collection data store .