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.Optional;
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 LinkedAccountStatusPanel extends RemoteObjectPanel {
34
35 private static final long serialVersionUID = 7662852503618434902L;
36
37 @SpringBean
38 protected ReconStatusUtils reconStatusUtils;
39
40 protected final String resource;
41
42 protected final String anyTypeKey;
43
44 protected final String connObjectKeyValue;
45
46 public LinkedAccountStatusPanel(
47 final String resource,
48 final String anyTypeKey,
49 final String connObjectKeyValue) {
50
51 this.resource = resource;
52 this.anyTypeKey = anyTypeKey;
53 this.connObjectKeyValue = connObjectKeyValue;
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 Optional<ReconStatus> status = reconStatusUtils.getReconStatus(anyTypeKey, connObjectKeyValue, resource);
65
66 return status.map(reconStatus -> Pair.of(reconStatus.getOnSyncope(), reconStatus.getOnResource())).orElse(null);
67 }
68 }