finalintsyncedFolderId=(int)DbHelper.insertSyncedFolder(folder,context);//It will return -1 if there is an error, like an already existing folder with same value
if(syncedFolderId<=0){
Timber.v("insertion of syncedFolder for %s failed: %s ",folder.getRemoteFolder(),syncedFolderId);
returnfalse;
}
folder.setId(syncedFolderId);
returntrue;
}
/**
* Split content of a folder: subfolder on one side are added into the iterator loop
* while subfiles are added to result list
* @param iterator iterator intance over list of SyncedFolder
* @param folder the SyncFolder which own the content
* @param dirContent Content to sort
* @return List of subfiles to scan or empty list if nothing
finalSyncedFoldersubSyncedFolder=newSyncedFolder(folder,fileName+FileUtils.PATH_SEPARATOR,0L,"");//Need to set lastModified to 0 to handle it on next iteration
iterator.add(subSyncedFolder);
iterator.previous();
}elseif(folder.isToSync()&&!skipFile(file)){
Timber.v("added %s into list of file to scan",fileName);
result.add(file);
}
}
returnresult;
}
/**
* List of file to scan
* @return List<File> or List<RemoteFile> is expected based on implementations
*/
publicList<T>getContentToScan(){
returncontentToScan;
}
/**
* Share the list of syncedFolder's ID for syncedFolder which has content to scan