Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

NXP-9026: Use business delegate

  • Loading branch information...
commit f5f2fc7b01f42ef18036003bddfe62a50bb5b972 1 parent 98f95b4
Arnaud Kervern akervern authored
38 ...user-registration-web/src/main/java/org/nuxeo/ecm/user/registration/actions/UserRegistrationActions.java
@@ -45,7 +45,6 @@
45 45 import org.nuxeo.ecm.webapp.documentsLists.DocumentsListsManager;
46 46 import org.nuxeo.ecm.webapp.helpers.EventNames;
47 47 import org.nuxeo.ecm.webapp.helpers.ResourcesAccessor;
48   -import org.nuxeo.runtime.api.Framework;
49 48
50 49 @Name("userRegistrationActions")
51 50 @Scope(ScopeType.CONVERSATION)
@@ -55,8 +54,6 @@
55 54
56 55 private static Log log = LogFactory.getLog(UserRegistrationActions.class);
57 56
58   - protected UserRegistrationService userRegistrationService;
59   -
60 57 protected UserRegistrationInfo userinfo = new UserRegistrationInfo();
61 58
62 59 protected DocumentRegistrationInfo docinfo = new DocumentRegistrationInfo();
@@ -83,7 +80,10 @@
83 80 protected transient DocumentsListsManager documentsListsManager;
84 81
85 82 @In(create = true)
86   - protected ContentViewActions contentViewActions;
  83 + protected transient ContentViewActions contentViewActions;
  84 +
  85 + @In(create = true)
  86 + protected transient UserRegistrationService userRegistrationService;
87 87
88 88 public UserRegistrationInfo getUserinfo() {
89 89 return userinfo;
@@ -99,19 +99,19 @@ public UserRegistrationActions getData() {
99 99 }
100 100
101 101 public String getDocType() throws ClientException {
102   - return getUserRegistrationService().getConfiguration().getRequestDocType();
  102 + return userRegistrationService.getConfiguration().getRequestDocType();
103 103 }
104 104
105 105 public String getValidationBaseUrl() throws ClientException {
106 106 return BaseURL.getBaseURL()
107   - + getUserRegistrationService().getConfiguration().getValidationRelUrl();
  107 + + userRegistrationService.getConfiguration().getValidationRelUrl();
108 108 }
109 109
110 110 public void acceptRegistrationRequest(DocumentModel request)
111 111 throws UserRegistrationException, ClientException {
112 112 Map<String, Serializable> additionalInfo = new HashMap<String, Serializable>();
113 113 additionalInfo.put("validationBaseURL", getValidationBaseUrl());
114   - getUserRegistrationService().acceptRegistrationRequest(request.getId(),
  114 + userRegistrationService.acceptRegistrationRequest(request.getId(),
115 115 additionalInfo);
116 116 // EventManager.raiseEventsOnDocumentChange(request);
117 117 Events.instance().raiseEvent(REQUESTS_DOCUMENT_LIST_CHANGED);
@@ -121,7 +121,7 @@ public void rejectRegistrationRequest(DocumentModel request)
121 121 throws UserRegistrationException, ClientException {
122 122 Map<String, Serializable> additionalInfo = new HashMap<String, Serializable>();
123 123 additionalInfo.put("validationBaseURL", getValidationBaseUrl());
124   - getUserRegistrationService().rejectRegistrationRequest(request.getId(),
  124 + userRegistrationService.rejectRegistrationRequest(request.getId(),
125 125 additionalInfo);
126 126 // EventManager.raiseEventsOnDocumentChange(request);
127 127 Events.instance().raiseEvent(REQUESTS_DOCUMENT_LIST_CHANGED);
@@ -143,8 +143,7 @@ public boolean getCanDelete() {
143 143
144 144 public DocumentModel getConfigurationDocument() throws ClientException {
145 145 if (currentConfiguration == null) {
146   - currentConfiguration = getUserRegistrationService().getConfigurationDocument(
147   - documentManager);
  146 + currentConfiguration = userRegistrationService.getConfigurationDocument(documentManager);
148 147 }
149 148 return currentConfiguration;
150 149 }
@@ -200,7 +199,7 @@ protected boolean isDocumentRevivable(DocumentModel doc) {
200 199 public void reviveUserRegistration() {
201 200 if (!documentsListsManager.isWorkingListEmpty(REQUEST_DOCUMENT_LIST)) {
202 201 try {
203   - getUserRegistrationService().reviveRegistrationRequests(
  202 + userRegistrationService.reviveRegistrationRequests(
204 203 documentManager,
205 204 documentsListsManager.getWorkingList(REQUEST_DOCUMENT_LIST));
206 205 Events.instance().raiseEvent(REQUESTS_DOCUMENT_LIST_CHANGED);
@@ -222,7 +221,7 @@ public void reviveUserRegistration() {
222 221 public void deleteUserRegistration() {
223 222 if (!documentsListsManager.isWorkingListEmpty(REQUEST_DOCUMENT_LIST)) {
224 223 try {
225   - getUserRegistrationService().deleteRegistrationRequests(
  224 + userRegistrationService.deleteRegistrationRequests(
226 225 documentManager,
227 226 documentsListsManager.getWorkingList(REQUEST_DOCUMENT_LIST));
228 227 Events.instance().raiseEvent(REQUESTS_DOCUMENT_LIST_CHANGED);
@@ -245,7 +244,7 @@ public void deleteUserRegistration() {
245 244 protected void doSubmitUserRegistration() {
246 245 try {
247 246 userinfo.setPassword(RandomStringUtils.randomAlphanumeric(6));
248   - getUserRegistrationService().submitRegistrationRequest(userinfo,
  247 + userRegistrationService.submitRegistrationRequest(userinfo,
249 248 docinfo, getAdditionalsParameters(), EMAIL, false);
250 249
251 250 facesMessages.add(
@@ -267,19 +266,6 @@ protected void doSubmitUserRegistration() {
267 266 return new HashMap<String, Serializable>();
268 267 }
269 268
270   - protected UserRegistrationService getUserRegistrationService()
271   - throws ClientException {
272   - if (userRegistrationService == null) {
273   - try {
274   - userRegistrationService = Framework.getService(UserRegistrationService.class);
275   - } catch (Exception e) {
276   - throw new ClientException(
277   - "Failed to get UserRegistrationService", e);
278   - }
279   - }
280   - return userRegistrationService;
281   - }
282   -
283 269 @Observer({ EventNames.DOCUMENT_CHANGED })
284 270 public void resetPojos() {
285 271 userinfo = new UserRegistrationInfo();
2  nuxeo-platform-user-registration-web/src/main/resources/OSGI-INF/user-registration-actions-contrib.xml
@@ -38,7 +38,7 @@
38 38 <filter-id>mutable_document</filter-id>
39 39 <filter id="displayUserRegistrationListingLocal">
40 40 <rule grant="true">
41   - <condition>#{userRegistrationActions.registrationRules.displayLocalRegistration}</condition>
  41 + <condition>#{userRegistrationService.registrationRules.displayLocalRegistration}</condition>
42 42 </rule>
43 43 </filter>
44 44 </action>

0 comments on commit f5f2fc7

Please sign in to comment.
Something went wrong with that request. Please try again.