1
1
package ch .elexis .omnivore .ui .jobs ;
2
2
3
3
import java .lang .reflect .InvocationTargetException ;
4
- import java .util .Collections ;
4
+ import java .util .List ;
5
5
6
6
import org .eclipse .core .runtime .IProgressMonitor ;
7
7
import org .eclipse .jface .dialogs .ProgressMonitorDialog ;
8
8
import org .eclipse .jface .operation .IRunnableWithProgress ;
9
- import org .eclipse .persistence .config .HintValues ;
10
- import org .eclipse .persistence .config .QueryHints ;
11
9
import org .eclipse .swt .widgets .Shell ;
12
10
13
11
import ch .elexis .core .services .IQuery ;
14
- import ch .elexis .core .services .IQueryCursor ;
12
+ import ch .elexis .core .services .IQuery . COMPARATOR ;
15
13
import ch .elexis .core .ui .util .SWTHelper ;
16
14
import ch .elexis .omnivore .data .Messages ;
17
15
import ch .elexis .omnivore .model .IDocumentHandle ;
@@ -28,15 +26,16 @@ public Object execute(Shell parentShell) {
28
26
29
27
@ Override
30
28
public void run (IProgressMonitor monitor ) throws InvocationTargetException , InterruptedException {
31
- IQuery <IDocumentHandle > qDoc = OmnivoreModelServiceHolder .get ().getQuery (IDocumentHandle .class );
32
-
33
- try (IQueryCursor <IDocumentHandle > docs = qDoc
34
- .executeAsCursor (Collections .singletonMap (QueryHints .MAINTAIN_CACHE , HintValues .TRUE ))) {
35
- monitor .beginTask ("Dateien werden ausgelagert..." , docs .size ());
29
+ monitor .beginTask ("Dateien werden ausgelagert..." , IProgressMonitor .UNKNOWN );
36
30
37
- while (docs .hasNext ()) {
38
- IDocumentHandle docHandle = docs .next ();
31
+ IQuery <IDocumentHandle > qDoc = OmnivoreModelServiceHolder .get ().getQuery (IDocumentHandle .class );
32
+ qDoc .and ("doc" , COMPARATOR .NOT_EQUALS , null );
33
+ qDoc .and ("kontakt" , COMPARATOR .NOT_EQUALS , null );
34
+ qDoc .limit (100 );
39
35
36
+ List <IDocumentHandle > notExported = qDoc .execute ();
37
+ while (!notExported .isEmpty ()) {
38
+ for (IDocumentHandle docHandle : notExported ) {
40
39
if (monitor .isCanceled ())
41
40
return ;
42
41
monitor .subTask ("Datei: " + docHandle .getTitle ());
@@ -46,6 +45,7 @@ public void run(IProgressMonitor monitor) throws InvocationTargetException, Inte
46
45
}
47
46
monitor .worked (1 );
48
47
}
48
+ notExported = qDoc .execute ();
49
49
}
50
50
monitor .done ();
51
51
}
0 commit comments