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.panels;
20
21 import org.apache.syncope.client.console.layout.UserFormLayoutInfo;
22 import org.apache.syncope.client.console.rest.AnyTypeRestClient;
23 import org.apache.syncope.client.console.rest.UserRestClient;
24 import org.apache.syncope.client.console.wizards.any.UserWizardBuilder;
25 import org.apache.syncope.client.ui.commons.wizards.AjaxWizard;
26 import org.apache.syncope.common.lib.AnyOperations;
27 import org.apache.syncope.common.lib.to.UserRequestForm;
28 import org.apache.syncope.common.lib.to.UserTO;
29 import org.apache.syncope.common.lib.types.AnyTypeKind;
30 import org.apache.wicket.PageReference;
31 import org.apache.wicket.spring.injection.annot.SpringBean;
32
33 public class UserRequestFormDetails extends MultilevelPanel.SecondLevel {
34
35 private static final long serialVersionUID = -8847854414429745216L;
36
37 @SpringBean
38 protected AnyTypeRestClient anyTypeRestClient;
39
40 @SpringBean
41 protected UserRestClient userRestClient;
42
43 public UserRequestFormDetails(final PageReference pageRef, final UserRequestForm formTO) {
44 super(MultilevelPanel.SECOND_LEVEL_ID);
45
46 final UserTO newUserTO;
47 final UserTO previousUserTO;
48 if (formTO.getUserUR() == null) {
49 newUserTO = formTO.getUserTO();
50 previousUserTO = null;
51 } else if (formTO.getUserTO() == null) {
52
53 previousUserTO = new UserTO();
54 previousUserTO.setKey(formTO.getUserUR().getKey());
55 newUserTO = AnyOperations.patch(previousUserTO, formTO.getUserUR());
56 } else {
57 formTO.getUserTO().setKey(formTO.getUserUR().getKey());
58 newUserTO = AnyOperations.patch(formTO.getUserTO(), formTO.getUserUR());
59 previousUserTO = formTO.getUserTO();
60 }
61
62 add(new UserWizardBuilder(
63 previousUserTO,
64 newUserTO,
65 anyTypeRestClient.read(AnyTypeKind.USER.name()).getClasses(),
66 new UserFormLayoutInfo(),
67 userRestClient,
68 pageRef).
69 build(AjaxWizard.Mode.READONLY));
70 }
71 }