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.status;
20
21 import java.util.List;
22 import org.apache.commons.lang3.tuple.Pair;
23 import org.apache.syncope.client.console.panels.RemoteObjectPanel;
24 import org.apache.syncope.client.console.wizards.any.ConnObjectPanel;
25 import org.apache.syncope.client.ui.commons.Constants;
26 import org.apache.syncope.common.lib.to.ConnObject;
27 import org.apache.syncope.common.lib.to.ReconStatus;
28 import org.apache.wicket.model.IModel;
29 import org.apache.wicket.model.Model;
30 import org.apache.wicket.model.ResourceModel;
31 import org.apache.wicket.spring.injection.annot.SpringBean;
32
33 public class ReconStatusPanel extends RemoteObjectPanel {
34
35 private static final long serialVersionUID = 8000309881812037770L;
36
37 @SpringBean
38 protected ReconStatusUtils reconStatusUtils;
39
40 protected final String resource;
41
42 protected final String anyTypeKey;
43
44 protected final String anyKey;
45
46 public ReconStatusPanel(
47 final String resource,
48 final String anyTypeKey,
49 final String anyKey) {
50
51 this.resource = resource;
52 this.anyTypeKey = anyTypeKey;
53 this.anyKey = anyKey;
54
55 add(new ConnObjectPanel(
56 REMOTE_OBJECT_PANEL_ID,
57 Pair.<IModel<?>, IModel<?>>of(Model.of(Constants.SYNCOPE), new ResourceModel("resource")),
58 getConnObjectTOs(),
59 false));
60 }
61
62 @Override
63 protected Pair<ConnObject, ConnObject> getConnObjectTOs() {
64 List<Pair<String, ReconStatus>> statuses =
65 reconStatusUtils.getReconStatuses(anyTypeKey, anyKey, List.of(resource));
66
67 return statuses.isEmpty()
68 ? null
69 : Pair.of(statuses.get(0).getRight().getOnSyncope(), statuses.get(0).getRight().getOnResource());
70 }
71 }