Skip to content

Commit 6d3088e

Browse files
committed
Added accept() method that can be used to filter downloads in the SharePoint class
1 parent e31ff64 commit 6d3088e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/javaxt/azure/graph/sync/SharePoint.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ public void run(){
170170
}
171171
}
172172
}, startDate.getDate(), _interval);
173+
console.log("Starting sync at " + startDate.getDate());
173174

174175
}
175176

@@ -373,7 +374,21 @@ private void downloadFolder(String relPath,
373374
private javaxt.io.File downloadFile(javaxt.azure.graph.SharePoint.Item item,
374375
javaxt.io.Directory localCache) throws Exception {
375376

377+
//Set local file path
376378
javaxt.io.File file = new javaxt.io.File(localCache, item.getName());
379+
380+
381+
//Apply filter
382+
boolean accept = true;
383+
try {
384+
accept = accept(file);
385+
}
386+
catch(Exception e){
387+
}
388+
if (!accept) return null;
389+
390+
391+
//Download file
377392
int maxAttempts = 5;
378393
for (int i=0; i<5; i++){
379394
try {
@@ -409,6 +424,17 @@ private javaxt.io.File downloadFile(javaxt.azure.graph.SharePoint.Item item,
409424
}
410425

411426

427+
//**************************************************************************
428+
//** accept
429+
//**************************************************************************
430+
/** This method is called before a file is downloaded. This method can be
431+
* safely overridden to prevent specific files from being downloaded.
432+
*/
433+
public boolean accept(javaxt.io.File file){
434+
return true;
435+
}
436+
437+
412438
//**************************************************************************
413439
//** notify
414440
//**************************************************************************

0 commit comments

Comments
 (0)