void sync(int sourceRepoIndex,int destRepoIndex,AuthenticationInfo subject) throws IOException {
  LOG.info("Sync started");
  NotebookAuthorization auth=NotebookAuthorization.getInstance();
  NotebookRepo srcRepo=getRepo(sourceRepoIndex);
  NotebookRepo dstRepo=getRepo(destRepoIndex);
  List<NoteInfo> allSrcNotes=srcRepo.list(subject);
  List<NoteInfo> srcNotes=auth.filterByUser(allSrcNotes,subject);
  List<NoteInfo> dstNotes=dstRepo.list(subject);
  Map<String,List<String>> noteIds=notesCheckDiff(srcNotes,srcRepo,dstNotes,dstRepo,subject);
  List<String> pushNoteIds=noteIds.get(pushKey);
  List<String> pullNoteIds=noteIds.get(pullKey);
  List<String> delDstNoteIds=noteIds.get(delDstKey);
  if (!pushNoteIds.isEmpty()) {
    LOG.info("Notes with the following IDs will be pushed");
    for (    String id : pushNoteIds) {
      LOG.info("ID : " + id);
    }
    pushNotes(subject,pushNoteIds,srcRepo,dstRepo,false);
  }
 else {
    LOG.info("Nothing to push");
  }
  if (!pullNoteIds.isEmpty()) {
    LOG.info("Notes with the following IDs will be pulled");
    for (    String id : pullNoteIds) {
      LOG.info("ID : " + id);
    }
    pushNotes(subject,pullNoteIds,dstRepo,srcRepo,true);
  }
 else {
    LOG.info("Nothing to pull");
  }
  if (!delDstNoteIds.isEmpty()) {
    LOG.info("Notes with the following IDs will be deleted from dest");
    for (    String id : delDstNoteIds) {
      LOG.info("ID : " + id);
    }
    deleteNotes(subject,delDstNoteIds,dstRepo);
  }
 else {
    LOG.info("Nothing to delete from dest");
  }
  LOG.info("Sync ended");
}

void sync ( int sourceRepoIndex , int destRepoIndex , AuthenticationInfo subject ) throws IOException { LOG . info ( "Sync started" ) ; NotebookAuthorization auth = NotebookAuthorization . getInstance ( ) ; NotebookRepo srcRepo = getRepo ( sourceRepoIndex ) ; NotebookRepo dstRepo = getRepo ( destRepoIndex ) ; List < NoteInfo > allSrcNotes = srcRepo . list ( subject ) ; List < NoteInfo > srcNotes = auth . filterByUser ( allSrcNotes , subject ) ; List < NoteInfo > dstNotes = dstRepo . list ( subject ) ; Map < String , List < String > > noteIds = notesCheckDiff ( srcNotes , srcRepo , dstNotes , dstRepo , subject ) ; List < String > pushNoteIds = noteIds . get ( pushKey ) ; List < String > pullNoteIds = noteIds . get ( pullKey ) ; List < String > delDstNoteIds = noteIds . get ( delDstKey ) ; if ( ! pushNoteIds . isEmpty ( ) ) { LOG . info ( "Notes with the following IDs will be pushed" ) ; for ( String id : pushNoteIds ) { LOG . info ( "ID : " + id ) ; } pushNotes ( subject , pushNoteIds , srcRepo , dstRepo , false ) ; } else { LOG . info ( "Nothing to push" ) ; } if ( ! pullNoteIds . isEmpty ( ) ) { LOG . info ( "Notes with the following IDs will be pulled" ) ; for ( String id : pullNoteIds ) { LOG . info ( "ID : " + id ) ; } pushNotes ( subject , pullNoteIds , dstRepo , srcRepo , true ) ; } else { LOG . info ( "Nothing to pull" ) ; } if ( ! delDstNoteIds . isEmpty ( ) ) { LOG . info ( "Notes with the following IDs will be deleted from dest" ) ; for ( String id : delDstNoteIds ) { LOG . info ( "ID : " + id ) ; } deleteNotes ( subject , delDstNoteIds , dstRepo ) ; } else { LOG . info ( "Nothing to delete from dest" ) ; } LOG . info ( "Sync ended" ) ; }
copies new / updated notes from source to destination storage
