1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.syncope.client.console.tasks;
20
21 import java.util.Iterator;
22 import org.apache.syncope.client.console.panels.MultilevelPanel;
23 import org.apache.syncope.client.console.rest.TaskRestClient;
24 import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
25 import org.apache.syncope.common.lib.to.PropagationTaskTO;
26 import org.apache.syncope.common.lib.types.AnyTypeKind;
27 import org.apache.wicket.PageReference;
28
29 public abstract class AnyPropagationTaskDirectoryPanel extends PropagationTaskDirectoryPanel {
30
31 private static final long serialVersionUID = -6784307338127527803L;
32
33 private final AnyTypeKind anyTypeKind;
34
35 private final String entityKey;
36
37 protected AnyPropagationTaskDirectoryPanel(
38 final TaskRestClient restClient,
39 final BaseModal<?> baseModal,
40 final MultilevelPanel multiLevelPanelRef,
41 final AnyTypeKind anyTypeKind,
42 final String entityKey,
43 final PageReference pageRef) {
44
45 super(restClient, baseModal, multiLevelPanelRef, null, pageRef);
46 this.anyTypeKind = anyTypeKind;
47 this.entityKey = entityKey;
48 }
49
50 @Override
51 protected PropagationTasksProvider dataProvider() {
52 return new AnyPropagationTasksProvider(rows);
53 }
54
55 protected class AnyPropagationTasksProvider extends PropagationTasksProvider {
56
57 private static final long serialVersionUID = 8975514657807398110L;
58
59 public AnyPropagationTasksProvider(final int paginatorRows) {
60 super(paginatorRows);
61 }
62
63 @Override
64 public long size() {
65 return restClient.count(anyTypeKind, entityKey, taskType);
66 }
67
68 @Override
69 public Iterator<PropagationTaskTO> iterator(final long first, final long count) {
70 int page = ((int) first / paginatorRows);
71 return restClient.listPropagationTasks(
72 anyTypeKind, entityKey, (page < 0 ? 0 : page) + 1, paginatorRows, getSort()).
73 iterator();
74 }
75 }
76 }